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