1 /* nvram.h 2 3 Copyright (c) 2016, Nikolaj Schlej. All rights reserved. 4 5 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 NVRAM_H 16 #define NVRAM_H 17 18 #include "basetypes.h" 19 #include "ubytearray.h" 20 #include "ustring.h" 21 22 // Make sure we use right packing rules 23 #pragma pack(push, 1) 24 25 // 26 // NVAR store and entry 27 // 28 29 // CEF5B9A3-476D-497F-9FDC-E98143E0422C 30 const UByteArray NVRAM_NVAR_STORE_FILE_GUID 31 ("\xA3\xB9\xF5\xCE\x6D\x47\x7F\x49\x9F\xDC\xE9\x81\x43\xE0\x42\x2C", 16); 32 33 // 9221315B-30BB-46B5-813E-1B1BF4712BD3 34 const UByteArray NVRAM_NVAR_EXTERNAL_DEFAULTS_FILE_GUID 35 ("\x5B\x31\x21\x92\xBB\x30\xB5\x46\x81\x3E\x1B\x1B\xF4\x71\x2B\xD3", 16); 36 37 // 77D3DC50-D42B-4916-AC80-8F469035D150 38 const UByteArray NVRAM_NVAR_PEI_EXTERNAL_DEFAULTS_FILE_GUID 39 ("\x50\xDC\xD3\x77\x2B\xD4\x16\x49\xAC\x80\x8F\x46\x90\x35\xD1\x50", 16); 40 41 // AF516361-B4C5-436E-A7E3-A149A31B1461 42 const UByteArray NVRAM_NVAR_BB_DEFAULTS_FILE_GUID 43 ("\x61\x63\x51\xAF\xC5\xB4\x6E\x43\xA7\xE3\xA1\x49\xA3\x1B\x14\x61", 16); 44 45 extern UString nvarAttributesToUString(const UINT8 attributes); 46 extern UString nvarExtendedAttributesToUString(const UINT8 attributes); 47 extern UString efiTimeToUString(const EFI_TIME & time); 48 49 typedef struct NVAR_ENTRY_HEADER_ { 50 UINT32 Signature; // NVAR 51 UINT16 Size; // Size of the entry including header 52 UINT32 Next : 24; // Offset to the next entry in a list, or empty if the latest in the list 53 UINT32 Attributes : 8; // Attributes 54 } NVAR_ENTRY_HEADER; 55 56 // NVAR signature 57 #define NVRAM_NVAR_ENTRY_SIGNATURE 0x5241564E 58 59 // Attributes 60 #define NVRAM_NVAR_ENTRY_RUNTIME 0x01 61 #define NVRAM_NVAR_ENTRY_ASCII_NAME 0x02 62 #define NVRAM_NVAR_ENTRY_GUID 0x04 63 #define NVRAM_NVAR_ENTRY_DATA_ONLY 0x08 64 #define NVRAM_NVAR_ENTRY_EXT_HEADER 0x10 65 #define NVRAM_NVAR_ENTRY_HW_ERROR_RECORD 0x20 66 #define NVRAM_NVAR_ENTRY_AUTH_WRITE 0x40 67 #define NVRAM_NVAR_ENTRY_VALID 0x80 68 69 // Extended attributes 70 #define NVRAM_NVAR_ENTRY_EXT_CHECKSUM 0x01 71 #define NVRAM_NVAR_ENTRY_EXT_AUTH_WRITE 0x10 72 #define NVRAM_NVAR_ENTRY_EXT_TIME_BASED 0x20 73 #define NVRAM_NVAR_ENTRY_EXT_UNKNOWN_MASK 0xCE 74 75 // 76 // TianoCore VSS store and variables 77 // 78 79 // FFF12B8D-7696-4C8B-A985-2747075B4F50 80 const UByteArray NVRAM_MAIN_STORE_VOLUME_GUID 81 ("\x8D\x2B\xF1\xFF\x96\x76\x8B\x4C\xA9\x85\x27\x47\x07\x5B\x4F\x50", 16); 82 83 // 00504624-8A59-4EEB-BD0F-6B36E96128E0 84 const UByteArray NVRAM_ADDITIONAL_STORE_VOLUME_GUID 85 ("\x24\x46\x50\x00\x59\x8A\xEB\x4E\xBD\x0F\x6B\x36\xE9\x61\x28\xE0", 16); 86 87 #define NVRAM_VSS_STORE_SIGNATURE 0x53535624 // $VSS 88 #define NVRAM_APPLE_SVS_STORE_SIGNATURE 0x53565324 // $SVS 89 #define NVRAM_APPLE_NSS_STORE_SIGNATURE 0x53534E24 // $NSS 90 #define NVRAM_APPLE_FSYS_STORE_SIGNATURE 0x73797346 // Fsys 91 #define NVRAM_APPLE_GAID_STORE_SIGNATURE 0x64696147 // Gaid 92 #define NVRAM_VSS_VARIABLE_START_ID 0x55AA 93 94 // Variable store header flags 95 #define NVRAM_VSS_VARIABLE_STORE_FORMATTED 0x5a 96 #define NVRAM_VSS_VARIABLE_STORE_HEALTHY 0xfe 97 98 // Variable store status 99 #define NVRAM_VSS_VARIABLE_STORE_STATUS_RAW 0 100 #define NVRAM_VSS_VARIABLE_STORE_STATUS_VALID 1 101 #define NVRAM_VSS_VARIABLE_STORE_STATUS_INVALID 2 102 #define NVRAM_VSS_VARIABLE_STORE_STATUS_UNKNOWN 3 103 104 // Variable store header 105 typedef struct VSS_VARIABLE_STORE_HEADER_ { 106 UINT32 Signature; // $VSS signature 107 UINT32 Size; // Size of variable store, including store header 108 UINT8 Format; // Store format state 109 UINT8 State; // Store health state 110 UINT16 Unknown; // Used in Apple $SVS varstores 111 UINT32 : 32; 112 } VSS_VARIABLE_STORE_HEADER; 113 114 // Normal variable header 115 typedef struct VSS_VARIABLE_HEADER_ { 116 UINT16 StartId; // Variable start marker AA55 117 UINT8 State; // Variable state 118 UINT8 Reserved; 119 UINT32 Attributes; // Variable attributes 120 UINT32 NameSize; // Size of variable name, stored as null-terminated UCS2 string 121 UINT32 DataSize; // Size of variable data without header and name 122 EFI_GUID VendorGuid; // Variable vendor GUID 123 } VSS_VARIABLE_HEADER; 124 125 // Intel variable header 126 typedef struct VSS_INTEL_VARIABLE_HEADER_ { 127 UINT16 StartId; // Variable start marker AA55 128 UINT8 State; // Variable state 129 UINT8 Reserved; 130 UINT32 Attributes; // Variable attributes 131 UINT32 TotalSize; // Size of variable including header 132 EFI_GUID VendorGuid; // Variable vendor GUID 133 } VSS_INTEL_VARIABLE_HEADER; 134 135 // Apple variation of normal variable header, with one new field 136 typedef struct VSS_APPLE_VARIABLE_HEADER_ { 137 UINT16 StartId; // Variable start marker AA55 138 UINT8 State; // Variable state 139 UINT8 Reserved; 140 UINT32 Attributes; // Variable attributes 141 UINT32 NameSize; // Size of variable name, stored as null-terminated UCS2 string 142 UINT32 DataSize; // Size of variable data without header and name 143 EFI_GUID VendorGuid; // Variable vendor GUID 144 UINT32 DataCrc32; // CRC32 of the data 145 } VSS_APPLE_VARIABLE_HEADER; 146 147 // Authenticated variable header, used for SecureBoot vars 148 typedef struct VSS_AUTH_VARIABLE_HEADER_ { 149 UINT16 StartId; // Variable start marker AA55 150 UINT8 State; // Variable state 151 UINT8 Reserved; 152 UINT32 Attributes; // Variable attributes 153 UINT64 MonotonicCounter; // Monotonic counter against replay attack 154 EFI_TIME Timestamp; // Time stamp against replay attack 155 UINT32 PubKeyIndex; // Index in PubKey database 156 UINT32 NameSize; // Size of variable name, stored as null-terminated UCS2 string 157 UINT32 DataSize; // Size of variable data without header and name 158 EFI_GUID VendorGuid; // Variable vendor GUID 159 } VSS_AUTH_VARIABLE_HEADER; 160 161 // VSS variable states 162 #define NVRAM_VSS_VARIABLE_IN_DELETED_TRANSITION 0xfe // Variable is in obsolete transistion 163 #define NVRAM_VSS_VARIABLE_DELETED 0xfd // Variable is obsolete 164 #define NVRAM_VSS_VARIABLE_HEADER_VALID 0x7f // Variable has valid header 165 #define NVRAM_VSS_VARIABLE_ADDED 0x3f // Variable has been completely added 166 #define NVRAM_VSS_INTEL_VARIABLE_VALID 0xfc // Intel special variable valid 167 #define NVRAM_VSS_INTEL_VARIABLE_INVALID 0xf8 // Intel special variable invalid 168 169 // VSS variable attributes 170 #define NVRAM_VSS_VARIABLE_NON_VOLATILE 0x00000001 171 #define NVRAM_VSS_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 172 #define NVRAM_VSS_VARIABLE_RUNTIME_ACCESS 0x00000004 173 #define NVRAM_VSS_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008 174 #define NVRAM_VSS_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010 175 #define NVRAM_VSS_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 176 #define NVRAM_VSS_VARIABLE_APPEND_WRITE 0x00000040 177 #define NVRAM_VSS_VARIABLE_APPLE_DATA_CHECKSUM 0x80000000 178 #define NVRAM_VSS_VARIABLE_UNKNOWN_MASK 0x7FFFFF80 179 180 extern UString vssAttributesToUString(const UINT32 attributes); 181 182 // 183 // VSS2 variables 184 // 185 186 // aaf32c78-947b-439a-a180-2e144ec37792 187 #define NVRAM_VSS2_AUTH_VAR_KEY_DATABASE_GUID_PART1 0xaaf32c78 188 const UByteArray NVRAM_VSS2_AUTH_VAR_KEY_DATABASE_GUID 189 ("\x78\x2C\xF3\xAA\x7B\x94\x9A\x43\xA1\x80\x2E\x14\x4E\xC3\x77\x92"); 190 191 #define NVRAM_VSS2_STORE_GUID_PART1 0xddcf3617 192 const UByteArray NVRAM_VSS2_STORE_GUID 193 ("\x17\x36\xCF\xDD\x75\x32\x64\x41\x98\xB6\xFE\x85\x70\x7F\xFE\x7D"); 194 195 const UByteArray NVRAM_FDC_STORE_GUID 196 ("\x16\x36\xCF\xDD\x75\x32\x64\x41\x98\xB6\xFE\x85\x70\x7F\xFE\x7D"); 197 198 // Variable store header 199 typedef struct VSS2_VARIABLE_STORE_HEADER_ { 200 EFI_GUID Signature; // VSS2 Store Guid 201 UINT32 Size; // Size of variable store, including store header 202 UINT8 Format; // Store format state 203 UINT8 State; // Store health state 204 UINT16 Unknown; 205 UINT32 : 32; 206 } VSS2_VARIABLE_STORE_HEADER; 207 208 // VSS2 entries are 4-bytes aligned in VSS2 stores 209 210 // 211 // _FDC region 212 // 213 214 #define NVRAM_FDC_VOLUME_SIGNATURE 0x4344465F 215 216 typedef struct FDC_VOLUME_HEADER_ { 217 UINT32 Signature; //_FDC signature 218 UINT32 Size; // Size of the whole region 219 //EFI_FIRMWARE_VOLUME_HEADER VolumeHeader; 220 //EFI_FV_BLOCK_MAP_ENTRY FvBlockMap[2]; 221 //VSS_VARIABLE_STORE_HEADER VssHeader; 222 } FDC_VOLUME_HEADER; 223 224 // 225 // FTW block 226 // 227 #define EFI_FAULT_TOLERANT_WORKING_BLOCK_VALID 0x1 228 #define EFI_FAULT_TOLERANT_WORKING_BLOCK_INVALID 0x2 229 230 // 9E58292B-7C68-497D-0ACE6500FD9F1B95 231 const UByteArray EDKII_WORKING_BLOCK_SIGNATURE_GUID 232 ("\x2B\x29\x58\x9E\x68\x7C\x7D\x49\x0A\xCE\x65\x00\xFD\x9F\x1B\x95", 16); 233 234 // 9E58292B-7C68-497D-A0CE6500FD9F1B95 235 const UByteArray VSS2_WORKING_BLOCK_SIGNATURE_GUID 236 ("\x2B\x29\x58\x9E\x68\x7C\x7D\x49\xA0\xCE\x65\x00\xFD\x9F\x1B\x95", 16); 237 238 #define NVRAM_MAIN_STORE_VOLUME_GUID_DATA1 0xFFF12B8D 239 #define EDKII_WORKING_BLOCK_SIGNATURE_GUID_DATA1 0x9E58292B 240 241 typedef struct EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER32_ { 242 EFI_GUID Signature; // NVRAM_MAIN_STORE_VOLUME_GUID 243 UINT32 Crc; // Crc32 of the header with empty Crc and State fields 244 UINT8 State; 245 UINT8 Reserved[3]; 246 UINT32 WriteQueueSize; // Size of the FTW block without the header 247 //UINT8 WriteQueue[WriteQueueSize]; 248 } EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER32; 249 250 typedef struct EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER64_ { 251 EFI_GUID Signature; // NVRAM_MAIN_STORE_VOLUME_GUID or EDKII_WORKING_BLOCK_SIGNATURE_GUID 252 UINT32 Crc; // Crc32 of the header with empty Crc and State fields 253 UINT8 State; 254 UINT8 Reserved[3]; 255 UINT64 WriteQueueSize; // Size of the FTW block without the header 256 //UINT8 WriteQueue[WriteQueueSize]; 257 } EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER64; 258 259 // 260 // Apple Fsys store 261 // 262 263 typedef struct APPLE_FSYS_STORE_HEADER_ { 264 UINT32 Signature; // Fsys or Gaid signature 265 UINT8 Unknown0; // Still unknown 266 UINT32 Unknown1; // Still unknown 267 UINT16 Size; // Size of variable store 268 } APPLE_FSYS_STORE_HEADER; 269 270 // Apple Fsys entry format 271 // UINT8 NameLength; 272 // CHAR8 Name[]; 273 // UINT16 DataLength; 274 // UINT8 Data[] 275 // Store ends with a chunk named "EOF" without data 276 // All free bytes in store are zeroed 277 // Has CRC32 of the whole store without checksum field at the end 278 279 // 280 // EVSA store and entries 281 // 282 283 #define NVRAM_EVSA_STORE_SIGNATURE 0x41535645 284 285 #define NVRAM_EVSA_ENTRY_TYPE_STORE 0xEC 286 #define NVRAM_EVSA_ENTRY_TYPE_GUID1 0xED 287 #define NVRAM_EVSA_ENTRY_TYPE_GUID2 0xE1 288 #define NVRAM_EVSA_ENTRY_TYPE_NAME1 0xEE 289 #define NVRAM_EVSA_ENTRY_TYPE_NAME2 0xE2 290 #define NVRAM_EVSA_ENTRY_TYPE_DATA1 0xEF 291 #define NVRAM_EVSA_ENTRY_TYPE_DATA2 0xE3 292 #define NVRAM_EVSA_ENTRY_TYPE_DATA_INVALID 0x83 293 294 typedef struct EVSA_ENTRY_HEADER_ { 295 UINT8 Type; 296 UINT8 Checksum; 297 UINT16 Size; 298 } EVSA_ENTRY_HEADER; 299 300 typedef struct EVSA_STORE_ENTRY_ { 301 EVSA_ENTRY_HEADER Header; 302 UINT32 Signature; // EVSA signature 303 UINT32 Attributes; 304 UINT32 StoreSize; 305 UINT32 : 32; 306 } EVSA_STORE_ENTRY; 307 308 typedef struct EVSA_GUID_ENTRY_ { 309 EVSA_ENTRY_HEADER Header; 310 UINT16 GuidId; 311 //EFI_GUID Guid; 312 } EVSA_GUID_ENTRY; 313 314 typedef struct EVSA_NAME_ENTRY_ { 315 EVSA_ENTRY_HEADER Header; 316 UINT16 VarId; 317 //CHAR16 Name[]; 318 } EVSA_NAME_ENTRY; 319 320 typedef struct EVSA_DATA_ENTRY_ { 321 EVSA_ENTRY_HEADER Header; 322 UINT16 GuidId; 323 UINT16 VarId; 324 UINT32 Attributes; 325 //UINT8 Data[]; 326 } EVSA_DATA_ENTRY; 327 328 // VSS variable attributes 329 #define NVRAM_EVSA_DATA_NON_VOLATILE 0x00000001 330 #define NVRAM_EVSA_DATA_BOOTSERVICE_ACCESS 0x00000002 331 #define NVRAM_EVSA_DATA_RUNTIME_ACCESS 0x00000004 332 #define NVRAM_EVSA_DATA_HARDWARE_ERROR_RECORD 0x00000008 333 #define NVRAM_EVSA_DATA_AUTHENTICATED_WRITE_ACCESS 0x00000010 334 #define NVRAM_EVSA_DATA_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 335 #define NVRAM_EVSA_DATA_APPEND_WRITE 0x00000040 336 #define NVRAM_EVSA_DATA_EXTENDED_HEADER 0x10000000 337 #define NVRAM_EVSA_DATA_UNKNOWN_MASK 0xEFFFFF80 338 339 typedef struct EVSA_DATA_ENTRY_EXTENDED_ { 340 EVSA_ENTRY_HEADER Header; 341 UINT16 GuidId; 342 UINT16 VarId; 343 UINT32 Attributes; 344 UINT32 DataSize; 345 //UINT8 Data[]; 346 } EVSA_DATA_ENTRY_EXTENDED; 347 348 extern UString evsaAttributesToUString(const UINT32 attributes); 349 350 // 351 // Phoenix SCT Flash Map 352 // 353 354 #define NVRAM_PHOENIX_FLASH_MAP_SIGNATURE_PART1 0x414C465F 355 #define NVRAM_PHOENIX_FLASH_MAP_SIGNATURE_LENGTH 10 356 357 // _FLASH_MAP 358 const UByteArray NVRAM_PHOENIX_FLASH_MAP_SIGNATURE 359 ("\x5F\x46\x4C\x41\x53\x48\x5F\x4D\x41\x50", 10); 360 361 typedef struct PHOENIX_FLASH_MAP_HEADER_ { 362 UINT8 Signature[10]; // _FLASH_MAP signature 363 UINT16 NumEntries; // Number of entries in the map 364 UINT32 : 32; // Reserved field 365 } PHOENIX_FLASH_MAP_HEADER; 366 367 typedef struct PHOENIX_FLASH_MAP_ENTRY_ { 368 EFI_GUID Guid; 369 UINT16 DataType; 370 UINT16 EntryType; 371 UINT64 PhysicalAddress; 372 UINT32 Size; 373 UINT32 Offset; 374 } PHOENIX_FLASH_MAP_ENTRY; 375 376 #define NVRAM_PHOENIX_FLASH_MAP_ENTRY_TYPE_VOLUME 0x0000 377 #define NVRAM_PHOENIX_FLASH_MAP_ENTRY_TYPE_DATA_BLOCK 0x0001 378 379 extern UString flashMapGuidToUString(const EFI_GUID & guid); 380 381 // B091E7D2-05A0-4198-94F0-74B7B8C55459 382 const UByteArray NVRAM_PHOENIX_FLASH_MAP_VOLUME_HEADER 383 ("\xD2\xE7\x91\xB0\xA0\x05\x98\x41\x94\xF0\x74\xB7\xB8\xC5\x54\x59", 16); 384 385 // FD3F690E-B4B0-4D68-89DB-19A1A3318F90 386 const UByteArray NVRAM_PHOENIX_FLASH_MAP_MICROCODES_GUID 387 ("\x0E\x69\x3F\xFD\xB0\xB4\x68\x4D\x89\xDB\x19\xA1\xA3\x31\x8F\x90", 16); 388 389 // 46310243-7B03-4132-BE44-2243FACA7CDD 390 const UByteArray NVRAM_PHOENIX_FLASH_MAP_CMDB_GUID 391 ("\x43\x02\x31\x46\x03\x7B\x32\x41\xBE\x44\x22\x43\xFA\xCA\x7C\xDD", 16); 392 393 // 1B2C4952-D778-4B64-BDA1-15A36F5FA545 394 const UByteArray NVRAM_PHOENIX_FLASH_MAP_PUBKEY1_GUID 395 ("\x52\x49\x2C\x1B\x78\xD7\x64\x4B\xBD\xA1\x15\xA3\x6F\x5F\xA5\x45", 16); 396 397 // 127C1C4E-9135-46E3-B006-F9808B0559A5 398 const UByteArray NVRAM_PHOENIX_FLASH_MAP_MARKER1_GUID 399 ("\x4E\x1C\x7C\x12\x35\x91\xE3\x46\xB0\x06\xF9\x80\x8B\x05\x59\xA5", 16); 400 401 // 7CE75114-8272-45AF-B536-761BD38852CE 402 const UByteArray NVRAM_PHOENIX_FLASH_MAP_PUBKEY2_GUID 403 ("\x14\x51\xE7\x7C\x72\x82\xAF\x45\xB5\x36\x76\x1B\xD3\x88\x52\xCE", 16); 404 405 // 071A3DBE-CFF4-4B73-83F0-598C13DCFDD5 406 const UByteArray NVRAM_PHOENIX_FLASH_MAP_MARKER2_GUID 407 ("\xBE\x3D\x1A\x07\xF4\xCF\x73\x4B\x83\xF0\x59\x8C\x13\xDC\xFD\xD5", 16); 408 409 // FACFB110-7BFD-4EFB-873E-88B6B23B97EA 410 const UByteArray NVRAM_PHOENIX_FLASH_MAP_EVSA1_GUID 411 ("\x10\xB1\xCF\xFA\xFD\x7B\xFB\x4E\x87\x3E\x88\xB6\xB2\x3B\x97\xEA", 16); 412 413 // E68DC11A-A5F4-4AC3-AA2E-29E298BFF645 414 const UByteArray NVRAM_PHOENIX_FLASH_MAP_EVSA2_GUID 415 ("\x1A\xC1\x8D\xE6\xF4\xA5\xC3\x4A\xAA\x2E\x29\xE2\x98\xBF\xF6\x45", 16); 416 417 // 4B3828AE-0ACE-45B6-8CDB-DAFC28BBF8C5 418 const UByteArray NVRAM_PHOENIX_FLASH_MAP_EVSA3_GUID 419 ("\xAE\x28\x38\x4B\xCE\x0A\xB6\x45\x8C\xDB\xDA\xFC\x28\xBB\xF8\xC5", 16); 420 421 // C22E6B8A-8159-49A3-B353-E84B79DF19C0 422 const UByteArray NVRAM_PHOENIX_FLASH_MAP_EVSA4_GUID 423 ("\x8A\x6B\x2E\xC2\x59\x81\xA3\x49\xB3\x53\xE8\x4B\x79\xDF\x19\xC0", 16); 424 425 // B6B5FAB9-75C4-4AAE-8314-7FFFA7156EAA 426 const UByteArray NVRAM_PHOENIX_FLASH_MAP_EVSA5_GUID 427 ("\xB9\xFA\xB5\xB6\xC4\x75\xAE\x4A\x83\x14\x7F\xFF\xA7\x15\x6E\xAA", 16); 428 429 // 919B9699-8DD0-4376-AA0B-0E54CCA47D8F 430 const UByteArray NVRAM_PHOENIX_FLASH_MAP_EVSA6_GUID 431 ("\x99\x96\x9B\x91\xD0\x8D\x76\x43\xAA\x0B\x0E\x54\xCC\xA4\x7D\x8F", 16); 432 433 // 58A90A52-929F-44F8-AC35-A7E1AB18AC91 434 const UByteArray NVRAM_PHOENIX_FLASH_MAP_EVSA7_GUID 435 ("\x52\x0A\xA9\x58\x9F\x92\xF8\x44\xAC\x35\xA7\xE1\xAB\x18\xAC\x91", 16); 436 437 // 8CB71915-531F-4AF5-82BF-A09140817BAA 438 const UByteArray NVRAM_PHOENIX_FLASH_MAP_SELF_GUID 439 ("\x15\x19\xB7\x8C\x1F\x53\xF5\x4A\x82\xBF\xA0\x91\x40\x81\x7B\xAA", 16); 440 441 // 442 // SLIC pubkey and marker 443 // 444 445 typedef struct OEM_ACTIVATION_PUBKEY_ { 446 UINT32 Type; // 0 447 UINT32 Size; // 0x9C 448 UINT8 KeyType; 449 UINT8 Version; 450 UINT16 Reserved; 451 UINT32 Algorithm; 452 UINT32 Magic; // RSA1 signature 453 UINT32 BitLength; 454 UINT32 Exponent; 455 UINT8 Modulus[128]; 456 } OEM_ACTIVATION_PUBKEY; 457 458 #define OEM_ACTIVATION_PUBKEY_TYPE 0x00000000 459 #define OEM_ACTIVATION_PUBKEY_MAGIC 0x31415352 // RSA1 460 461 typedef struct OEM_ACTIVATION_MARKER_ { 462 UINT32 Type; // 1 463 UINT32 Size; // 0xB6 464 UINT32 Version; 465 UINT8 OemId[6]; 466 UINT8 OemTableId[8]; 467 UINT64 WindowsFlag; // WINDOWS signature 468 UINT32 SlicVersion; 469 UINT8 Reserved[16]; 470 UINT8 Signature[128]; 471 } OEM_ACTIVATION_MARKER; 472 473 #define OEM_ACTIVATION_MARKER_TYPE 0x00000001 474 #define OEM_ACTIVATION_MARKER_WINDOWS_FLAG_PART1 0x444E4957 475 #define OEM_ACTIVATION_MARKER_WINDOWS_FLAG 0x2053574F444E4957UL 476 #define OEM_ACTIVATION_MARKER_RESERVED_BYTE 0x00 477 478 // 479 // Phoenix CMDB, no londer used, requires no parsing 480 // 481 482 typedef struct PHOENIX_CMDB_HEADER_ { 483 UINT32 Signature; // CMDB signature 484 UINT32 HeaderSize; // Size of this header 485 UINT32 TotalSize; // Total size of header and chunks, without strings 486 // UINT8 StartChunk[3]; 487 // UINT8 StringChunk[5][x]; 488 // C_STR Strings[2*x + 1]; 489 } PHOENIX_CMDB_HEADER; 490 491 #define NVRAM_PHOENIX_CMDB_HEADER_SIGNATURE 0x42444D43 492 #define NVRAM_PHOENIX_CMDB_SIZE 0x100; 493 494 // Restore previous packing rules 495 #pragma pack(pop) 496 497 #endif // NVRAM_H 498