Julian Hall | 29620bf | 2022-06-09 10:26:37 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef COMMON_EFI_CERTIFICATE_H |
| 8 | #define COMMON_EFI_CERTIFICATE_H |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | #include "efi_types.h" |
| 12 | |
| 13 | /* Certificate types (wCertificateType) */ |
| 14 | #define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002 |
| 15 | #define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0 |
| 16 | #define WIN_CERT_TYPE_EFI_GUID 0x0EF1 |
| 17 | |
| 18 | /* Current WIN_CERTIFICATE version */ |
| 19 | #define WIN_CERT_CURRENT_VERSION 0x0200 |
| 20 | |
| 21 | /** |
| 22 | * The Authenticode WIN_CERTIFICATE structure |
| 23 | */ |
| 24 | typedef struct { |
| 25 | |
| 26 | /* Length of certificate plus header in bytes */ |
| 27 | uint32_t dwLength; |
| 28 | |
| 29 | /* The revision of this structure */ |
| 30 | uint16_t wRevision; |
| 31 | |
| 32 | /* Certificate type */ |
| 33 | uint16_t wCertificateType; |
| 34 | |
| 35 | /* Certificate bytes follow this structure */ |
| 36 | |
| 37 | } WIN_CERTIFICATE; |
| 38 | |
| 39 | /** |
| 40 | * Extends WIN_CERTIFICATE for a GUID defined certificate type |
| 41 | * (wCertificateType in WIN_CERTIFICATE set to WIN_CERT_TYPE_EFI_GUID). |
| 42 | */ |
| 43 | typedef struct { |
| 44 | |
| 45 | WIN_CERTIFICATE Hdr; |
| 46 | EFI_GUID CertType; |
| 47 | uint8_t CertData[1]; |
| 48 | |
| 49 | } WIN_CERTIFICATE_UEFI_GUID; |
| 50 | |
| 51 | |
| 52 | #endif /* COMMON_EFI_CERTIFICATE_H */ |