| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
/* Matches EFI API definition of the same structure for userspace */ |
| 7 |
typedef struct { |
| 8 |
uint32_t Data1; |
| 9 |
uint16_t Data2; |
| 10 |
uint16_t Data3; |
| 11 |
uint8_t Data4[8]; |
| 12 |
} EFI_GUID; |
| 13 |
|
| 14 |
#if !SD_BOOT |
| 15 |
# include <stdbool.h> |
| 16 |
# include <string.h> |
| 17 |
static inline bool efi_guid_equal(const EFI_GUID *a, const EFI_GUID *b) { |
| 18 |
return memcmp(a, b, sizeof(EFI_GUID)) == 0; |
| 19 |
} |
| 20 |
#endif |
| 21 |
|
| 22 |
typedef struct { |
| 23 |
EFI_GUID SignatureOwner; |
| 24 |
uint8_t SignatureData[]; |
| 25 |
} EFI_SIGNATURE_DATA; |
| 26 |
|
| 27 |
typedef struct { |
| 28 |
EFI_GUID SignatureType; |
| 29 |
uint32_t SignatureListSize; |
| 30 |
uint32_t SignatureHeaderSize; |
| 31 |
uint32_t SignatureSize; |
| 32 |
EFI_SIGNATURE_DATA Signatures[]; |
| 33 |
} EFI_SIGNATURE_LIST; |
| 34 |
|
| 35 |
typedef struct { |
| 36 |
uint32_t dwLength; |
| 37 |
uint16_t wRevision; |
| 38 |
uint16_t wCertificateType; |
| 39 |
} WIN_CERTIFICATE_HEADER; |
| 40 |
|
| 41 |
typedef struct { |
| 42 |
WIN_CERTIFICATE_HEADER Hdr; |
| 43 |
EFI_GUID CertType; |
| 44 |
uint8_t CertData[]; |
| 45 |
} WIN_CERTIFICATE_UEFI_GUID; |
| 46 |
|
| 47 |
typedef struct { |
| 48 |
uint16_t Year; |
| 49 |
uint8_t Month; |
| 50 |
uint8_t Day; |
| 51 |
uint8_t Hour; |
| 52 |
uint8_t Minute; |
| 53 |
uint8_t Second; |
| 54 |
uint8_t Pad1; |
| 55 |
uint32_t Nanosecond; |
| 56 |
int16_t TimeZone; |
| 57 |
uint8_t Daylight; |
| 58 |
uint8_t Pad2; |
| 59 |
} EFI_TIME; |
| 60 |
|
| 61 |
typedef struct { |
| 62 |
EFI_TIME TimeStamp; |
| 63 |
WIN_CERTIFICATE_UEFI_GUID AuthInfo; |
| 64 |
} EFI_VARIABLE_AUTHENTICATION_2; |
| 65 |
|
| 66 |
#define GUID_DEF(d1, d2, d3, d4_1, d4_2, d4_3, d4_4, d4_5, d4_6, d4_7, d4_8) \ |
| 67 |
{ d1, d2, d3, { d4_1, d4_2, d4_3, d4_4, d4_5, d4_6, d4_7, d4_8 } } |
| 68 |
|
| 69 |
/* Creates a EFI_GUID pointer suitable for EFI APIs. Use of const allows the compiler to merge multiple |
| 70 |
* uses (although, currently compilers do that regardless). Most EFI APIs declare their EFI_GUID input |
| 71 |
* as non-const, but almost all of them are in fact const. */ |
| 72 |
#define MAKE_GUID_PTR(name) ((EFI_GUID *) &(const EFI_GUID) name##_GUID) |
| 73 |
|
| 74 |
#define EFI_GLOBAL_VARIABLE \ |
| 75 |
GUID_DEF(0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c) |
| 76 |
#define EFI_IMAGE_SECURITY_DATABASE_GUID \ |
| 77 |
GUID_DEF(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f) |
| 78 |
|
| 79 |
#define EFI_CERT_X509_GUID \ |
| 80 |
GUID_DEF(0xa5c059a1, 0x94e4, 0x4aa7, 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72) |
| 81 |
#define EFI_CERT_TYPE_PKCS7_GUID \ |
| 82 |
GUID_DEF(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7) |
| 83 |
|
| 84 |
#define SHIM_LOCK_GUID \ |
| 85 |
GUID_DEF(0x605dab50, 0xe046, 0x4300 ,0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23) |