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