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