]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Guid/WinCertificate.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Guid / WinCertificate.h
CommitLineData
bd86cb02 1/** @file\r
fbb393ab 2 GUID for UEFI WIN_CERTIFICATE structure.\r
bd86cb02 3\r
73a324f8 4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
9344f092 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
bd86cb02
LG
6\r
7 @par Revision Reference:\r
8 GUID defined in UEFI 2.0 spec.\r
9**/\r
10\r
11#ifndef __EFI_WIN_CERTIFICATE_H__\r
12#define __EFI_WIN_CERTIFICATE_H__\r
13\r
14//\r
15// _WIN_CERTIFICATE.wCertificateType\r
fbb393ab 16//\r
2f88bd3a
MK
17#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002\r
18#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0\r
19#define WIN_CERT_TYPE_EFI_GUID 0x0EF1\r
bd86cb02
LG
20\r
21///\r
22/// The WIN_CERTIFICATE structure is part of the PE/COFF specification.\r
23///\r
24typedef struct {\r
25 ///\r
fbb393ab
LL
26 /// The length of the entire certificate,\r
27 /// including the length of the header, in bytes.\r
bd86cb02 28 ///\r
2f88bd3a 29 UINT32 dwLength;\r
bd86cb02 30 ///\r
fbb393ab
LL
31 /// The revision level of the WIN_CERTIFICATE\r
32 /// structure. The current revision level is 0x0200.\r
bd86cb02 33 ///\r
2f88bd3a 34 UINT16 wRevision;\r
bd86cb02 35 ///\r
fbb393ab
LL
36 /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI\r
37 /// certificate types. The UEFI specification reserves the range of\r
38 /// certificate type values from 0x0EF0 to 0x0EFF.\r
bd86cb02 39 ///\r
2f88bd3a 40 UINT16 wCertificateType;\r
bd86cb02 41 ///\r
fbb393ab 42 /// The following is the actual certificate. The format of\r
bd86cb02
LG
43 /// the certificate depends on wCertificateType.\r
44 ///\r
45 /// UINT8 bCertificate[ANYSIZE_ARRAY];\r
46 ///\r
47} WIN_CERTIFICATE;\r
48\r
49///\r
50/// WIN_CERTIFICATE_UEFI_GUID.CertType\r
fbb393ab 51///\r
bd86cb02
LG
52#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \\r
53 {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }\r
54\r
55///\r
56/// WIN_CERTIFICATE_UEFI_GUID.CertData\r
fbb393ab 57///\r
bd86cb02 58typedef struct {\r
2f88bd3a
MK
59 EFI_GUID HashType;\r
60 UINT8 PublicKey[256];\r
61 UINT8 Signature[256];\r
bd86cb02
LG
62} EFI_CERT_BLOCK_RSA_2048_SHA256;\r
63\r
bd86cb02
LG
64///\r
65/// Certificate which encapsulates a GUID-specific digital signature\r
66///\r
67typedef struct {\r
68 ///\r
69 /// This is the standard WIN_CERTIFICATE header, where\r
fbb393ab
LL
70 /// wCertificateType is set to WIN_CERT_TYPE_EFI_GUID.\r
71 ///\r
2f88bd3a 72 WIN_CERTIFICATE Hdr;\r
bd86cb02 73 ///\r
fbb393ab 74 /// This is the unique id which determines the\r
bd86cb02
LG
75 /// format of the CertData. .\r
76 ///\r
2f88bd3a 77 EFI_GUID CertType;\r
fbb393ab 78 ///\r
bd86cb02 79 /// The following is the certificate data. The format of\r
fbb393ab 80 /// the data is determined by the CertType.\r
bd86cb02
LG
81 /// If CertType is EFI_CERT_TYPE_RSA2048_SHA256_GUID,\r
82 /// the CertData will be EFI_CERT_BLOCK_RSA_2048_SHA256 structure.\r
83 ///\r
2f88bd3a 84 UINT8 CertData[1];\r
bd86cb02
LG
85} WIN_CERTIFICATE_UEFI_GUID;\r
86\r
fbb393ab 87///\r
bd86cb02 88/// Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital signature.\r
fbb393ab 89///\r
bd86cb02 90/// The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from\r
fbb393ab
LL
91/// WIN_CERTIFICATE and encapsulate the information needed to\r
92/// implement the RSASSA-PKCS1-v1_5 digital signature algorithm as\r
93/// specified in RFC2437.\r
94///\r
95typedef struct {\r
bd86cb02 96 ///\r
fbb393ab
LL
97 /// This is the standard WIN_CERTIFICATE header, where\r
98 /// wCertificateType is set to WIN_CERT_TYPE_UEFI_PKCS1_15.\r
bd86cb02 99 ///\r
2f88bd3a 100 WIN_CERTIFICATE Hdr;\r
bd86cb02
LG
101 ///\r
102 /// This is the hashing algorithm which was performed on the\r
fbb393ab 103 /// UEFI executable when creating the digital signature.\r
bd86cb02 104 ///\r
2f88bd3a 105 EFI_GUID HashAlgorithm;\r
bd86cb02 106 ///\r
fbb393ab
LL
107 /// The following is the actual digital signature. The\r
108 /// size of the signature is the same size as the key\r
109 /// (1024-bit key is 128 bytes) and can be determined by\r
bd86cb02 110 /// subtracting the length of the other parts of this header\r
fbb393ab
LL
111 /// from the total length of the certificate as found in\r
112 /// Hdr.dwLength.\r
bd86cb02
LG
113 ///\r
114 /// UINT8 Signature[];\r
115 ///\r
116} WIN_CERTIFICATE_EFI_PKCS1_15;\r
117\r
2f88bd3a 118extern EFI_GUID gEfiCertTypeRsa2048Sha256Guid;\r
bd86cb02
LG
119\r
120#endif\r