]>
Commit | Line | Data |
---|---|---|
30fdf114 LG |
1 | /** @file\r |
2 | This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation All rights reserved.\r | |
5 | \r | |
6 | This program and the accompanying materials are licensed and made available\r | |
7 | under the terms and conditions of the BSD License which accompanies this\r | |
8 | distribution. The full text of the license may be found at:\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | File Name: UefiMultiPhase.h\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #ifndef __UEFI_MULTIPHASE_H__\r | |
19 | #define __UEFI_MULTIPHASE_H__\r | |
20 | \r | |
21 | //\r | |
22 | // Enumeration of memory types introduced in UEFI.\r | |
23 | // \r | |
24 | typedef enum {\r | |
25 | EfiReservedMemoryType,\r | |
26 | EfiLoaderCode,\r | |
27 | EfiLoaderData,\r | |
28 | EfiBootServicesCode,\r | |
29 | EfiBootServicesData,\r | |
30 | EfiRuntimeServicesCode,\r | |
31 | EfiRuntimeServicesData,\r | |
32 | EfiConventionalMemory,\r | |
33 | EfiUnusableMemory,\r | |
34 | EfiACPIReclaimMemory,\r | |
35 | EfiACPIMemoryNVS,\r | |
36 | EfiMemoryMappedIO,\r | |
37 | EfiMemoryMappedIOPortSpace,\r | |
38 | EfiPalCode,\r | |
39 | EfiMaxMemoryType\r | |
40 | } EFI_MEMORY_TYPE;\r | |
41 | \r | |
42 | \r | |
43 | //\r | |
44 | // Data structure that precedes all of the standard EFI table types.\r | |
45 | // \r | |
46 | typedef struct {\r | |
47 | UINT64 Signature;\r | |
48 | UINT32 Revision;\r | |
49 | UINT32 HeaderSize;\r | |
50 | UINT32 CRC32;\r | |
51 | UINT32 Reserved;\r | |
52 | } EFI_TABLE_HEADER;\r | |
53 | \r | |
54 | //\r | |
55 | // Attributes of variable.\r | |
56 | // \r | |
57 | #define EFI_VARIABLE_NON_VOLATILE 0x00000001\r | |
58 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002\r | |
59 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004\r | |
60 | #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008\r | |
61 | \r | |
62 | //\r | |
63 | // This attribute is identified by the mnemonic 'HR' \r | |
64 | // elsewhere in this specification.\r | |
65 | // \r | |
66 | #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010\r | |
67 | \r | |
68 | \r | |
69 | \r | |
70 | //\r | |
71 | // _WIN_CERTIFICATE.wCertificateType\r | |
72 | // \r | |
73 | #define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0\r | |
74 | #define WIN_CERT_TYPE_EFI_GUID 0x0EF1\r | |
75 | \r | |
76 | /**\r | |
77 | \r | |
78 | The WIN_CERTIFICATE structure is part of the PE/COFF\r | |
79 | specification and has the following definition:\r | |
80 | \r | |
81 | @param dwLength The length of the entire certificate,\r | |
82 | including the length of the header, in\r | |
83 | bytes.\r | |
84 | \r | |
85 | @param wRevision The revision level of the WIN_CERTIFICATE\r | |
86 | structure. The current revision level is\r | |
87 | 0x0200.\r | |
88 | \r | |
89 | @param wCertificateType The certificate type. See\r | |
90 | WIN_CERT_TYPE_xxx for the UEFI\r | |
91 | certificate types. The UEFI\r | |
92 | specification reserves the range of\r | |
93 | certificate type values from 0x0EF0\r | |
94 | to 0x0EFF.\r | |
95 | \r | |
96 | @param bCertificate The actual certificate. The format of\r | |
97 | the certificate depends on\r | |
98 | wCertificateType. The format of the UEFI\r | |
99 | certificates is defined below.\r | |
100 | \r | |
101 | \r | |
102 | **/\r | |
103 | typedef struct _WIN_CERTIFICATE {\r | |
104 | UINT32 dwLength;\r | |
105 | UINT16 wRevision;\r | |
106 | UINT16 wCertificateType;\r | |
107 | //UINT8 bCertificate[ANYSIZE_ARRAY];\r | |
108 | } WIN_CERTIFICATE;\r | |
109 | \r | |
110 | //\r | |
111 | // WIN_CERTIFICATE_UEFI_GUID.CertType\r | |
112 | // \r | |
113 | #define EFI_CERT_TYPE_RSA2048_SHA256_GUID \\r | |
114 | {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }\r | |
115 | \r | |
116 | //\r | |
117 | // WIN_CERTIFICATE_UEFI_GUID.CertData\r | |
118 | // \r | |
119 | typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {\r | |
120 | UINT32 HashType;\r | |
121 | UINT8 PublicKey[256];\r | |
122 | UINT8 Signature[256];\r | |
123 | } EFI_CERT_BLOCK_RSA_2048_SHA256;\r | |
124 | \r | |
125 | \r | |
126 | /**\r | |
127 | \r | |
128 | @param Hdr This is the standard WIN_CERTIFICATE header, where\r | |
129 | wCertificateType is set to\r | |
130 | WIN_CERT_TYPE_UEFI_GUID.\r | |
131 | \r | |
132 | @param CertType This is the unique id which determines the\r | |
133 | format of the CertData. In this case, the\r | |
134 | value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.\r | |
135 | \r | |
136 | @param CertData This is the certificate data. The format of\r | |
137 | the data is determined by the CertType. In\r | |
138 | this case the value is\r | |
139 | EFI_CERT_BLOCK_RSA_2048_SHA256.\r | |
140 | \r | |
141 | @param Information The WIN_CERTIFICATE_UEFI_GUID certificate\r | |
142 | type allows new types of certificates to\r | |
143 | be developed for driver authentication\r | |
144 | without requiring a new certificate type.\r | |
145 | The CertType defines the format of the\r | |
146 | CertData, which length is defined by the\r | |
147 | size of the certificate less the fixed\r | |
148 | size of the WIN_CERTIFICATE_UEFI_GUID\r | |
149 | structure.\r | |
150 | \r | |
151 | **/\r | |
152 | typedef struct _WIN_CERTIFICATE_UEFI_GUID {\r | |
153 | WIN_CERTIFICATE Hdr;\r | |
154 | EFI_GUID CertType;\r | |
155 | // UINT8 CertData[ANYSIZE_ARRAY];\r | |
156 | } WIN_CERTIFICATE_UEFI_GUID;\r | |
157 | \r | |
158 | \r | |
159 | /**\r | |
160 | \r | |
161 | Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital\r | |
162 | signature.\r | |
163 | \r | |
164 | The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from\r | |
165 | WIN_CERTIFICATE and encapsulate the information needed to \r | |
166 | implement the RSASSA-PKCS1-v1_5 digital signature algorithm as \r | |
167 | specified in RFC2437. \r | |
168 | \r | |
169 | @param Hdr This is the standard WIN_CERTIFICATE header, where\r | |
170 | wCertificateType is set to\r | |
171 | WIN_CERT_TYPE_UEFI_PKCS1_15.\r | |
172 | \r | |
173 | @param HashAlgorithm This is the hashing algorithm which was\r | |
174 | performed on the UEFI executable when\r | |
175 | creating the digital signature. It is\r | |
176 | one of the enumerated values pre-defined\r | |
177 | in Section 26.4.1. See\r | |
178 | EFI_HASH_ALGORITHM_x.\r | |
179 | \r | |
180 | @param Signature This is the actual digital signature. The\r | |
181 | size of the signature is the same size as\r | |
182 | the key (1024-bit key is 128 bytes) and can\r | |
183 | be determined by subtracting the length of\r | |
184 | the other parts of this header from the\r | |
185 | total length of the certificate as found in\r | |
186 | Hdr.dwLength.\r | |
187 | \r | |
188 | **/\r | |
189 | typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {\r | |
190 | WIN_CERTIFICATE Hdr;\r | |
191 | EFI_GUID HashAlgorithm;\r | |
192 | // UINT8 Signature[ANYSIZE_ARRAY];\r | |
193 | } WIN_CERTIFICATE_EFI_PKCS1_15;\r | |
194 | \r | |
195 | \r | |
196 | /**\r | |
197 | \r | |
198 | AuthInfo is a WIN_CERTIFICATE using the wCertificateType\r | |
199 | WIN_CERTIFICATE_UEFI_GUID and the CertType\r | |
200 | EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies\r | |
201 | authenticated access, then the Data buffer should begin with an\r | |
202 | authentication descriptor prior to the data payload and DataSize\r | |
203 | should reflect the the data.and descriptor size. The caller\r | |
204 | shall digest the Monotonic Count value and the associated data\r | |
205 | for the variable update using the SHA-256 1-way hash algorithm.\r | |
206 | The ensuing the 32-byte digest will be signed using the private\r | |
207 | key associated w/ the public/private 2048-bit RSA key-pair. The\r | |
208 | WIN_CERTIFICATE shall be used to describe the signature of the\r | |
209 | Variable data *Data. In addition, the signature will also\r | |
210 | include the MonotonicCount value to guard against replay attacks\r | |
211 | \r | |
212 | @param MonotonicCount Included in the signature of\r | |
213 | AuthInfo.Used to ensure freshness/no\r | |
214 | replay. Incremented during each\r | |
215 | "Write" access.\r | |
216 | \r | |
217 | @param AuthInfo Provides the authorization for the variable\r | |
218 | access. It is a signature across the\r | |
219 | variable data and the Monotonic Count\r | |
220 | value. Caller uses Private key that is\r | |
221 | associated with a public key that has been\r | |
222 | provisioned via the key exchange.\r | |
223 | \r | |
224 | **/\r | |
225 | typedef struct {\r | |
226 | UINT64 MonotonicCount;\r | |
227 | WIN_CERTIFICATE_UEFI_GUID AuthInfo;\r | |
228 | } EFI_VARIABLE_AUTHENTICATION;\r | |
229 | \r | |
230 | #endif\r | |
231 | \r |