]>
Commit | Line | Data |
---|---|---|
959ccb23 | 1 | /** @file\r |
00edb218 | 2 | This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.\r |
959ccb23 | 3 | \r |
3ed785e9 | 4 | Copyright (c) 2006 - 2008, Intel Corporation \r |
00edb218 A |
5 | All rights reserved. This program and the accompanying materials \r |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
959ccb23 | 9 | \r |
00edb218 A |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
959ccb23 | 12 | \r |
959ccb23 | 13 | **/\r |
14 | \r | |
15 | #ifndef __UEFI_MULTIPHASE_H__\r | |
16 | #define __UEFI_MULTIPHASE_H__\r | |
17 | \r | |
0b3cac32 | 18 | #include <ProcessorBind.h>\r |
19 | \r | |
8b13229b | 20 | ///\r |
21 | /// Enumeration of memory types introduced in UEFI.\r | |
22 | /// \r | |
959ccb23 | 23 | typedef enum {\r |
1bf79370 LG |
24 | ///\r |
25 | /// Not used.\r | |
26 | ///\r | |
00edb218 | 27 | EfiReservedMemoryType,\r |
1bf79370 LG |
28 | ///\r |
29 | /// The code portions of a loaded application. \r | |
30 | /// (Note that UEFI OS loaders are UEFI applications.)\r | |
31 | ///\r | |
00edb218 | 32 | EfiLoaderCode,\r |
1bf79370 LG |
33 | ///\r |
34 | /// The data portions of a loaded application and the default data allocation\r | |
35 | /// type used by an application to allocate pool memory.\r | |
36 | ///\r | |
00edb218 | 37 | EfiLoaderData,\r |
1bf79370 LG |
38 | ///\r |
39 | /// The code portions of a loaded Boot Services Driver\r | |
40 | ///\r | |
00edb218 | 41 | EfiBootServicesCode,\r |
1bf79370 LG |
42 | ///\r |
43 | /// The data portions of a loaded Boot Serves Driver, and the default data\r | |
44 | /// allocation type used by a Boot Services Driver to allocate pool memory.\r | |
45 | ///\r | |
00edb218 | 46 | EfiBootServicesData,\r |
1bf79370 LG |
47 | ///\r |
48 | /// The code portions of a loaded Runtime Services Driver.\r | |
49 | ///\r | |
00edb218 | 50 | EfiRuntimeServicesCode,\r |
1bf79370 LG |
51 | ///\r |
52 | /// The data portions of a loaded Runtime Services Driver and the default\r | |
53 | /// data allocation type used by a Runtime Services Driver to allocate pool memory.\r | |
54 | ///\r | |
00edb218 | 55 | EfiRuntimeServicesData,\r |
1bf79370 LG |
56 | ///\r |
57 | /// Free (unallocated) memory.\r | |
58 | ///\r | |
00edb218 | 59 | EfiConventionalMemory,\r |
1bf79370 LG |
60 | ///\r |
61 | /// Memory in which errors have been detected.\r | |
62 | ///\r | |
00edb218 | 63 | EfiUnusableMemory,\r |
1bf79370 LG |
64 | ///\r |
65 | /// Memory that holds the ACPI tables.\r | |
66 | ///\r | |
00edb218 | 67 | EfiACPIReclaimMemory,\r |
1bf79370 LG |
68 | ///\r |
69 | /// Address space reserved for use by the firmware.\r | |
70 | ///\r | |
00edb218 | 71 | EfiACPIMemoryNVS,\r |
1bf79370 LG |
72 | ///\r |
73 | /// Used by system firmware to request that a memory-mapped IO region\r | |
74 | /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services.\r | |
75 | ///\r | |
00edb218 | 76 | EfiMemoryMappedIO,\r |
1bf79370 LG |
77 | ///\r |
78 | /// System memory-mapped IO region that is used to translate memory\r | |
79 | /// cycles to IO cycles by the processor.\r | |
80 | ///\r | |
00edb218 | 81 | EfiMemoryMappedIOPortSpace,\r |
1bf79370 LG |
82 | ///\r |
83 | /// Address space reserved by the firmware for code that is part of the processor.\r | |
84 | ///\r | |
00edb218 A |
85 | EfiPalCode,\r |
86 | EfiMaxMemoryType\r | |
959ccb23 | 87 | } EFI_MEMORY_TYPE;\r |
88 | \r | |
8b13229b | 89 | ///\r |
90 | /// Data structure that precedes all of the standard EFI table types.\r | |
91 | /// \r | |
959ccb23 | 92 | typedef struct {\r |
1bf79370 LG |
93 | ///\r |
94 | /// A 64-bit signature that identifies the type of table that follows.\r | |
95 | /// Unique signatures have been generated for the EFI System Table,\r | |
96 | /// the EFI Boot Services Table, and the EFI Runtime Services Table.\r | |
97 | ///\r | |
00edb218 | 98 | UINT64 Signature;\r |
1bf79370 LG |
99 | ///\r |
100 | /// The revision of the EFI Specification to which this table\r | |
101 | /// conforms. The upper 16 bits of this field contain the major\r | |
102 | /// revision value, and the lower 16 bits contain the minor revision\r | |
103 | /// value. The minor revision values are limited to the range of 00..99.\r | |
104 | ///\r | |
00edb218 | 105 | UINT32 Revision;\r |
1bf79370 LG |
106 | ///\r |
107 | /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.\r | |
108 | ///\r | |
00edb218 | 109 | UINT32 HeaderSize;\r |
1bf79370 LG |
110 | ///\r |
111 | /// The 32-bit CRC for the entire table. This value is computed by\r | |
112 | /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.\r | |
113 | ///\r | |
00edb218 | 114 | UINT32 CRC32;\r |
1bf79370 LG |
115 | ///\r |
116 | /// Reserved field that must be set to 0.\r | |
117 | ///\r | |
00edb218 | 118 | UINT32 Reserved;\r |
959ccb23 | 119 | } EFI_TABLE_HEADER;\r |
120 | \r | |
8b13229b | 121 | ///\r |
122 | /// Attributes of variable.\r | |
123 | /// \r | |
00edb218 A |
124 | #define EFI_VARIABLE_NON_VOLATILE 0x00000001\r |
125 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002\r | |
126 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004\r | |
127 | #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008\r | |
959ccb23 | 128 | \r |
8b13229b | 129 | ///\r |
130 | /// This attribute is identified by the mnemonic 'HR' \r | |
131 | /// elsewhere in this specification.\r | |
132 | /// \r | |
00edb218 | 133 | #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010\r |
959ccb23 | 134 | \r |
959ccb23 | 135 | //\r |
136 | // _WIN_CERTIFICATE.wCertificateType\r | |
137 | // \r | |
00edb218 A |
138 | #define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0\r |
139 | #define WIN_CERT_TYPE_EFI_GUID 0x0EF1\r | |
959ccb23 | 140 | \r |
3ed785e9 | 141 | ///\r |
142 | /// The WIN_CERTIFICATE structure is part of the PE/COFF specification.\r | |
143 | ///\r | |
959ccb23 | 144 | typedef struct _WIN_CERTIFICATE {\r |
3ed785e9 | 145 | ///\r |
146 | /// The length of the entire certificate, \r | |
147 | /// including the length of the header, in bytes. \r | |
148 | ///\r | |
00edb218 | 149 | UINT32 dwLength;\r |
3ed785e9 | 150 | ///\r |
151 | /// The revision level of the WIN_CERTIFICATE \r | |
152 | /// structure. The current revision level is 0x0200. \r | |
153 | ///\r | |
00edb218 | 154 | UINT16 wRevision;\r |
3ed785e9 | 155 | ///\r |
156 | /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI \r | |
157 | /// certificate types. The UEFI specification reserves the range of \r | |
158 | /// certificate type values from 0x0EF0 to 0x0EFF. \r | |
159 | ///\r | |
00edb218 | 160 | UINT16 wCertificateType;\r |
3ed785e9 | 161 | ///\r |
162 | /// The following is the actual certificate. The format of \r | |
163 | /// the certificate depends on wCertificateType.\r | |
164 | ///\r | |
165 | /// UINT8 bCertificate[ANYSIZE_ARRAY];\r | |
166 | ///\r | |
959ccb23 | 167 | } WIN_CERTIFICATE;\r |
168 | \r | |
fb5148a0 | 169 | ///\r |
170 | /// WIN_CERTIFICATE_UEFI_GUID.CertType\r | |
171 | /// \r | |
959ccb23 | 172 | #define EFI_CERT_TYPE_RSA2048_SHA256_GUID \\r |
00edb218 | 173 | {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }\r |
959ccb23 | 174 | \r |
1bf79370 LG |
175 | ///\r |
176 | /// WIN_CERTIFICATE_UEFI_GUID.CertData\r | |
177 | /// \r | |
959ccb23 | 178 | typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {\r |
00edb218 A |
179 | UINT32 HashType;\r |
180 | UINT8 PublicKey[256];\r | |
181 | UINT8 Signature[256];\r | |
959ccb23 | 182 | } EFI_CERT_BLOCK_RSA_2048_SHA256;\r |
183 | \r | |
184 | \r | |
3ed785e9 | 185 | ///\r |
186 | /// Certificate which encapsulates a GUID-specific digital signature\r | |
187 | ///\r | |
959ccb23 | 188 | typedef struct _WIN_CERTIFICATE_UEFI_GUID {\r |
3ed785e9 | 189 | ///\r |
190 | /// This is the standard WIN_CERTIFICATE header, where\r | |
191 | /// wCertificateType is set to WIN_CERT_TYPE_UEFI_GUID. \r | |
192 | /// \r | |
00edb218 | 193 | WIN_CERTIFICATE Hdr;\r |
3ed785e9 | 194 | ///\r |
195 | /// This is the unique id which determines the \r | |
196 | /// format of the CertData. In this case, the \r | |
197 | /// value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.\r | |
198 | ///\r | |
00edb218 | 199 | EFI_GUID CertType;\r |
3ed785e9 | 200 | /// \r |
201 | /// The following is the certificate data. The format of\r | |
202 | /// the data is determined by the CertType. In this case the value is \r | |
203 | /// EFI_CERT_BLOCK_RSA_2048_SHA256. \r | |
204 | ///\r | |
205 | /// UINT8 CertData[ANYSIZE_ARRAY];\r | |
206 | ///\r | |
959ccb23 | 207 | } WIN_CERTIFICATE_UEFI_GUID;\r |
208 | \r | |
209 | \r | |
3ed785e9 | 210 | /// \r |
211 | /// Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital signature.\r | |
212 | /// \r | |
213 | /// The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from\r | |
214 | /// WIN_CERTIFICATE and encapsulate the information needed to \r | |
215 | /// implement the RSASSA-PKCS1-v1_5 digital signature algorithm as \r | |
216 | /// specified in RFC2437. \r | |
217 | /// \r | |
218 | typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 { \r | |
219 | ///\r | |
220 | /// This is the standard WIN_CERTIFICATE header, where \r | |
221 | /// wCertificateType is set to WIN_CERT_TYPE_UEFI_PKCS1_15. \r | |
222 | ///\r | |
00edb218 | 223 | WIN_CERTIFICATE Hdr;\r |
3ed785e9 | 224 | ///\r |
225 | /// This is the hashing algorithm which was performed on the\r | |
226 | /// UEFI executable when creating the digital signature. \r | |
227 | ///\r | |
00edb218 | 228 | EFI_GUID HashAlgorithm;\r |
3ed785e9 | 229 | ///\r |
230 | /// The following is the actual digital signature. The \r | |
231 | /// size of the signature is the same size as the key \r | |
232 | /// (1024-bit key is 128 bytes) and can be determined by \r | |
233 | /// subtracting the length of the other parts of this header\r | |
234 | /// from the total length of the certificate as found in \r | |
235 | /// Hdr.dwLength. \r | |
236 | ///\r | |
237 | /// UINT8 Signature[ANYSIZE_ARRAY];\r | |
238 | ///\r | |
959ccb23 | 239 | } WIN_CERTIFICATE_EFI_PKCS1_15;\r |
240 | \r | |
241 | \r | |
959ccb23 | 242 | \r |
3ed785e9 | 243 | /// \r |
244 | /// AuthInfo is a WIN_CERTIFICATE using the wCertificateType\r | |
245 | /// WIN_CERTIFICATE_UEFI_GUID and the CertType\r | |
246 | /// EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies\r | |
247 | /// authenticated access, then the Data buffer should begin with an\r | |
248 | /// authentication descriptor prior to the data payload and DataSize\r | |
249 | /// should reflect the the data.and descriptor size. The caller\r | |
250 | /// shall digest the Monotonic Count value and the associated data\r | |
251 | /// for the variable update using the SHA-256 1-way hash algorithm.\r | |
252 | /// The ensuing the 32-byte digest will be signed using the private\r | |
253 | /// key associated w/ the public/private 2048-bit RSA key-pair. The\r | |
254 | /// WIN_CERTIFICATE shall be used to describe the signature of the\r | |
255 | /// Variable data *Data. In addition, the signature will also\r | |
256 | /// include the MonotonicCount value to guard against replay attacks\r | |
257 | /// \r | |
959ccb23 | 258 | typedef struct {\r |
3ed785e9 | 259 | ///\r |
260 | /// Included in the signature of \r | |
261 | /// AuthInfo.Used to ensure freshness/no\r | |
262 | /// replay. Incremented during each \r | |
263 | /// "Write" access. \r | |
264 | /// \r | |
00edb218 | 265 | UINT64 MonotonicCount;\r |
3ed785e9 | 266 | ///\r |
267 | /// Provides the authorization for the variable \r | |
268 | /// access. It is a signature across the \r | |
269 | /// variable data and the Monotonic Count \r | |
270 | /// value. Caller uses Private key that is \r | |
271 | /// associated with a public key that has been \r | |
272 | /// provisioned via the key exchange. \r | |
273 | ///\r | |
00edb218 | 274 | WIN_CERTIFICATE_UEFI_GUID AuthInfo;\r |
959ccb23 | 275 | } EFI_VARIABLE_AUTHENTICATION;\r |
276 | \r | |
277 | #endif\r | |
278 | \r |