| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "efi.h" |
| 5 |
|
| 6 |
#define FWHEADERMAGIC (UINT32_C(0xfeeddead)) |
| 7 |
|
| 8 |
/* The structure of the efifw UKI blob is the following: |
| 9 |
* --------------------------------------------------------- |
| 10 |
* EfiFw header|fwid|payload| reserved for future attributes |
| 11 |
* --------------------------------------------------------- |
| 12 |
* The base header defines the length of full header, fwid and payload. |
| 13 |
* The fwid is a NUL terminated string. |
| 14 |
* The payload contains the actual efi firmware. */ |
| 15 |
typedef struct EfiFwHeader { |
| 16 |
uint32_t magic; /* magic number that defines Efifw */ |
| 17 |
uint32_t header_len; /* total length of header including all attributes */ |
| 18 |
uint32_t fwid_len; /* length including the NUL terminator */ |
| 19 |
uint32_t payload_len; /* actual length of the efi firmware binary image */ |
| 20 |
|
| 21 |
/* The header might be extended in the future to add additional |
| 22 |
* parameters. header_len will increase to indicate presence of these |
| 23 |
* additional attributes. |
| 24 |
*/ |
| 25 |
|
| 26 |
/* next comes payload which is fwid and efi firmware binary blob */ |
| 27 |
uint8_t payload[] _alignas_(uint64_t); |
| 28 |
} EfiFwHeader; |
| 29 |
|
| 30 |
EFI_STATUS efi_firmware_match_by_fwid(const void *blob, size_t blob_len, const char *fwid); |