]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Include/Guid/AuthenticatedVariableFormat.h
Update header file to match UEFI231B mantis 771, 850, 853 and 857.
[mirror_edk2.git] / SecurityPkg / Include / Guid / AuthenticatedVariableFormat.h
CommitLineData
0c18794e 1/** @file\r
2 The variable data structures are related to EDKII-specific \r
3 implementation of UEFI authenticated variables.\r
4 AuthenticatedVariableFormat.h defines variable data headers \r
5 and variable storage region headers.\r
6\r
ecc722ad 7Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
0c18794e 8This program and the accompanying materials \r
9are licensed and made available under the terms and conditions of the BSD License \r
10which accompanies this distribution. The full text of the license may be found at \r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef __AUTHENTICATED_VARIABLE_FORMAT_H__\r
19#define __AUTHENTICATED_VARIABLE_FORMAT_H__\r
20\r
21#define EFI_AUTHENTICATED_VARIABLE_GUID \\r
22 { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 } }\r
23\r
beda2356 24#define EFI_SECURE_BOOT_ENABLE_DISABLE \\r
25 { 0xf0a30bc7, 0xaf08, 0x4556, { 0x99, 0xc4, 0x0, 0x10, 0x9, 0xc9, 0x3a, 0x44 } }\r
26\r
27\r
0c18794e 28extern EFI_GUID gEfiAuthenticatedVariableGuid;\r
beda2356 29extern EFI_GUID gEfiSecureBootEnableDisableGuid;\r
30\r
31///\r
32/// "SecureBootEnable" variable for the Secure boot feature enable/disable.\r
33///\r
34#define EFI_SECURE_BOOT_ENABLE_NAME L"SecureBootEnable"\r
35#define SECURE_BOOT_ENABLE 1\r
36#define SECURE_BOOT_DISABLE 0\r
0c18794e 37\r
ecc722ad 38extern EFI_GUID gEfiCustomModeEnableGuid;\r
39\r
40///\r
41/// "CustomMode" variable for two Secure Boot modes feature: "Custom" and "Standard".\r
42/// Standard Secure Boot mode is the default mode as UEFI Spec's description.\r
43/// Custom Secure Boot mode allows for more flexibility as specified in the following:\r
44/// Can enroll or delete PK without existing PK's private key.\r
45/// Can enroll or delete KEK without existing PK's private key.\r
46/// Can enroll or delete signature from DB/DBX without KEK's private key.\r
47///\r
48#define EFI_CUSTOM_MODE_NAME L"CustomMode"\r
49#define CUSTOM_SECURE_BOOT_MODE 1\r
50#define STANDARD_SECURE_BOOT_MODE 0\r
51\r
ed47ae02 52///\r
53/// "certdb" variable stores the signer's certificates for non PK/KEK/DB/DBX\r
54/// variables with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.\r
55/// \r
56///\r
57#define EFI_CERT_DB_NAME L"certdb"\r
58\r
59extern EFI_GUID gEfiCertDbGuid;\r
60\r
0c18794e 61///\r
62/// Alignment of variable name and data, according to the architecture:\r
63/// * For IA-32 and Intel(R) 64 architectures: 1.\r
64/// * For IA-64 architecture: 8.\r
65///\r
66#if defined (MDE_CPU_IPF)\r
67#define ALIGNMENT 8\r
68#else\r
69#define ALIGNMENT 1\r
70#endif\r
71\r
72//\r
73// GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement.\r
74//\r
75#if (ALIGNMENT == 1)\r
76#define GET_PAD_SIZE(a) (0)\r
77#else\r
78#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
79#endif\r
80\r
81///\r
82/// Alignment of Variable Data Header in Variable Store region.\r
83///\r
84#define HEADER_ALIGNMENT 4\r
85#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
86\r
87///\r
88/// Status of Variable Store Region.\r
89///\r
90typedef enum {\r
91 EfiRaw,\r
92 EfiValid,\r
93 EfiInvalid,\r
94 EfiUnknown\r
95} VARIABLE_STORE_STATUS;\r
96\r
97#pragma pack(1)\r
98\r
99#define VARIABLE_STORE_SIGNATURE EFI_AUTHENTICATED_VARIABLE_GUID\r
100\r
101///\r
102/// Variable Store Header Format and State.\r
103///\r
104#define VARIABLE_STORE_FORMATTED 0x5a\r
105#define VARIABLE_STORE_HEALTHY 0xfe\r
106\r
107///\r
108/// Variable Store region header.\r
109///\r
110typedef struct {\r
111 ///\r
112 /// Variable store region signature.\r
113 ///\r
114 EFI_GUID Signature;\r
115 ///\r
116 /// Size of entire variable store, \r
117 /// including size of variable store header but not including the size of FvHeader.\r
118 ///\r
119 UINT32 Size;\r
120 ///\r
121 /// Variable region format state.\r
122 ///\r
123 UINT8 Format;\r
124 ///\r
125 /// Variable region healthy state.\r
126 ///\r
127 UINT8 State;\r
128 UINT16 Reserved;\r
129 UINT32 Reserved1;\r
130} VARIABLE_STORE_HEADER;\r
131\r
132///\r
133/// Variable data start flag.\r
134///\r
135#define VARIABLE_DATA 0x55AA\r
136\r
137///\r
138/// Variable State flags.\r
139///\r
140#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition.\r
141#define VAR_DELETED 0xfd ///< Variable is obsolete.\r
142#define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid.\r
143#define VAR_ADDED 0x3f ///< Variable has been completely added.\r
144\r
145///\r
146/// Single Variable Data Header Structure.\r
147///\r
148typedef struct {\r
149 ///\r
150 /// Variable Data Start Flag.\r
151 ///\r
152 UINT16 StartId;\r
153 ///\r
154 /// Variable State defined above.\r
155 ///\r
156 UINT8 State;\r
157 UINT8 Reserved;\r
158 ///\r
159 /// Attributes of variable defined in UEFI specification.\r
160 ///\r
161 UINT32 Attributes;\r
162 ///\r
163 /// Associated monotonic count value against replay attack.\r
164 ///\r
165 UINT64 MonotonicCount;\r
166 ///\r
167 /// Associated TimeStamp value against replay attack. \r
168 ///\r
169 EFI_TIME TimeStamp;\r
170 ///\r
171 /// Index of associated public key in database.\r
172 ///\r
173 UINT32 PubKeyIndex;\r
174 ///\r
175 /// Size of variable null-terminated Unicode string name.\r
176 ///\r
177 UINT32 NameSize;\r
178 ///\r
179 /// Size of the variable data without this header.\r
180 ///\r
181 UINT32 DataSize;\r
182 ///\r
183 /// A unique identifier for the vendor that produces and consumes this varaible.\r
184 ///\r
185 EFI_GUID VendorGuid;\r
186} VARIABLE_HEADER;\r
187\r
188#pragma pack()\r
189\r
190typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY;\r
191\r
192///\r
193/// This structure contains the variable list that is put in EFI system table.\r
194/// The variable driver collects all variables that were used at boot service time and produces this list.\r
195/// This is an optional feature to dump all used variables in shell environment. \r
196///\r
197struct _VARIABLE_INFO_ENTRY {\r
198 VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry.\r
199 EFI_GUID VendorGuid; ///< Guid of Variable.\r
200 CHAR16 *Name; ///< Name of Variable. \r
201 UINT32 Attributes; ///< Attributes of variable defined in UEFI spec.\r
202 UINT32 ReadCount; ///< Number of times to read this variable.\r
203 UINT32 WriteCount; ///< Number of times to write this variable.\r
204 UINT32 DeleteCount; ///< Number of times to delete this variable.\r
205 UINT32 CacheCount; ///< Number of times that cache hits this variable.\r
206 BOOLEAN Volatile; ///< TRUE if volatile, FALSE if non-volatile.\r
207};\r
208\r
209#endif // __AUTHENTICATED_VARIABLE_FORMAT_H__\r