1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use guid::Guid;
use zerocopy::AsBytes;
use zerocopy::FromBytes;
use zerocopy::FromZeroes;
/// UEFI spec 32.2.4
///
/// This structure is the certificate header.
/// There may be zero or more certificates.
#[derive(Debug, FromBytes, FromZeroes, AsBytes)]
#[repr(C)]
pub struct WIN_CERTIFICATE {
/// The length of the entire certificate, including the length of the header,
/// in bytes
pub length: u32,
/// The revision level of the WIN_CERTIFICATE structure.
/// The current revision level is 0x0200
pub revision: u16,
/// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI certificate
/// types. The UEFI specification reserves the range of certificate type
/// values from 0x0EF0 to 0x0EFF.
pub certificate_type: u16,
// The actual certificate. The format of the certificate depends on
// certificate_type.
//
// UINT8 bCertificate[ANYSIZE_ARRAY];
}
/// UEFI spec 32.2.4 - WIN_CERTIFICATE_UEFI_GUID
#[derive(Debug, FromBytes, FromZeroes, AsBytes)]
#[repr(C)]
pub struct WIN_CERTIFICATE_UEFI_GUID {
/// certificate_type is set to WIN_CERT_TYPE_EFI_GUID.
pub header: WIN_CERTIFICATE,
/// This is the unique id which determines the format of the CertData.
pub cert_type: Guid,
// This is the certificate data. The format of the data is determined by the
// CertType.
//
// UINT8 CertData[ANYSIZE_ARRAY];
}
/// UEFI spec 32.2.4 - WIN_CERTIFICATE_UEFI_GUID
pub const EFI_CERT_TYPE_PKCS7_GUID: Guid =
Guid::from_static_str("4aafd29d-68df-49ee-8aa9-347d375665a7");
// UEFI spec 32.2.4 - WIN_CERTIFICATE
// pub const WIN_CERT_TYPE_PKCS_SIGNED_DATA: u16 = 0x0002;
// pub const WIN_CERT_TYPE_EFI_PKCS115: u16 = 0x0EF0;//
pub const WIN_CERT_TYPE_EFI_GUID: u16 = 0x0EF1;