TianoCore EDK2 master
Loading...
Searching...
No Matches
UefiTcgPlatform.h
Go to the documentation of this file.
1
10#ifndef __UEFI_TCG_PLATFORM_H__
11#define __UEFI_TCG_PLATFORM_H__
12
15#include <Uefi.h>
16
17//
18// Standard event types
19//
20#define EV_PREBOOT_CERT ((TCG_EVENTTYPE) 0x00000000)
21#define EV_POST_CODE ((TCG_EVENTTYPE) 0x00000001)
22#define EV_NO_ACTION ((TCG_EVENTTYPE) 0x00000003)
23#define EV_SEPARATOR ((TCG_EVENTTYPE) 0x00000004)
24#define EV_ACTION ((TCG_EVENTTYPE) 0x00000005)
25#define EV_EVENT_TAG ((TCG_EVENTTYPE) 0x00000006)
26#define EV_S_CRTM_CONTENTS ((TCG_EVENTTYPE) 0x00000007)
27#define EV_S_CRTM_VERSION ((TCG_EVENTTYPE) 0x00000008)
28#define EV_CPU_MICROCODE ((TCG_EVENTTYPE) 0x00000009)
29#define EV_PLATFORM_CONFIG_FLAGS ((TCG_EVENTTYPE) 0x0000000A)
30#define EV_TABLE_OF_DEVICES ((TCG_EVENTTYPE) 0x0000000B)
31#define EV_COMPACT_HASH ((TCG_EVENTTYPE) 0x0000000C)
32#define EV_NONHOST_CODE ((TCG_EVENTTYPE) 0x0000000F)
33#define EV_NONHOST_CONFIG ((TCG_EVENTTYPE) 0x00000010)
34#define EV_NONHOST_INFO ((TCG_EVENTTYPE) 0x00000011)
35#define EV_OMIT_BOOT_DEVICE_EVENTS ((TCG_EVENTTYPE) 0x00000012)
36
37//
38// EFI specific event types
39//
40#define EV_EFI_EVENT_BASE ((TCG_EVENTTYPE) 0x80000000)
41#define EV_EFI_VARIABLE_DRIVER_CONFIG (EV_EFI_EVENT_BASE + 1)
42#define EV_EFI_VARIABLE_BOOT (EV_EFI_EVENT_BASE + 2)
43#define EV_EFI_BOOT_SERVICES_APPLICATION (EV_EFI_EVENT_BASE + 3)
44#define EV_EFI_BOOT_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 4)
45#define EV_EFI_RUNTIME_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 5)
46#define EV_EFI_GPT_EVENT (EV_EFI_EVENT_BASE + 6)
47#define EV_EFI_ACTION (EV_EFI_EVENT_BASE + 7)
48#define EV_EFI_PLATFORM_FIRMWARE_BLOB (EV_EFI_EVENT_BASE + 8)
49#define EV_EFI_HANDOFF_TABLES (EV_EFI_EVENT_BASE + 9)
50#define EV_EFI_PLATFORM_FIRMWARE_BLOB2 (EV_EFI_EVENT_BASE + 0xA)
51#define EV_EFI_HANDOFF_TABLES2 (EV_EFI_EVENT_BASE + 0xB)
52#define EV_EFI_HCRTM_EVENT (EV_EFI_EVENT_BASE + 0x10)
53#define EV_EFI_VARIABLE_AUTHORITY (EV_EFI_EVENT_BASE + 0xE0)
54#define EV_EFI_SPDM_FIRMWARE_BLOB (EV_EFI_EVENT_BASE + 0xE1)
55#define EV_EFI_SPDM_FIRMWARE_CONFIG (EV_EFI_EVENT_BASE + 0xE2)
56
57#define EFI_CALLING_EFI_APPLICATION \
58 "Calling EFI Application from Boot Option"
59#define EFI_RETURNING_FROM_EFI_APPLICATION \
60 "Returning from EFI Application from Boot Option"
61#define EFI_EXIT_BOOT_SERVICES_INVOCATION \
62 "Exit Boot Services Invocation"
63#define EFI_EXIT_BOOT_SERVICES_FAILED \
64 "Exit Boot Services Returned with Failure"
65#define EFI_EXIT_BOOT_SERVICES_SUCCEEDED \
66 "Exit Boot Services Returned with Success"
67
68#define EV_POSTCODE_INFO_POST_CODE "POST CODE"
69#define POST_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_POST_CODE) - 1)
70
71#define EV_POSTCODE_INFO_SMM_CODE "SMM CODE"
72#define SMM_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_SMM_CODE) - 1)
73
74#define EV_POSTCODE_INFO_ACPI_DATA "ACPI DATA"
75#define ACPI_DATA_LEN (sizeof(EV_POSTCODE_INFO_ACPI_DATA) - 1)
76
77#define EV_POSTCODE_INFO_BIS_CODE "BIS CODE"
78#define BIS_CODE_LEN (sizeof(EV_POSTCODE_INFO_BIS_CODE) - 1)
79
80#define EV_POSTCODE_INFO_UEFI_PI "UEFI PI"
81#define UEFI_PI_LEN (sizeof(EV_POSTCODE_INFO_UEFI_PI) - 1)
82
83#define EV_POSTCODE_INFO_OPROM "Embedded Option ROM"
84#define OPROM_LEN (sizeof(EV_POSTCODE_INFO_OPROM) - 1)
85
86#define EV_POSTCODE_INFO_EMBEDDED_UEFI_DRIVER "Embedded UEFI Driver"
87#define EMBEDDED_UEFI_DRIVER_LEN (sizeof(EV_POSTCODE_INFO_EMBEDDED_UEFI_DRIVER) - 1)
88
89#define FIRMWARE_DEBUGGER_EVENT_STRING "UEFI Debug Mode"
90#define FIRMWARE_DEBUGGER_EVENT_STRING_LEN (sizeof(FIRMWARE_DEBUGGER_EVENT_STRING) - 1)
91
92//
93// Set structure alignment to 1-byte
94//
95#pragma pack (1)
96
97typedef UINT32 TCG_EVENTTYPE;
98typedef TPM_PCRINDEX TCG_PCRINDEX;
103typedef struct tdTCG_PCR_EVENT {
104 TCG_PCRINDEX PCRIndex;
105 TCG_EVENTTYPE EventType;
107 UINT32 EventSize;
108 UINT8 Event[1];
110
111#define TSS_EVENT_DATA_MAX_SIZE 256
112
116typedef struct tdTCG_PCR_EVENT_HDR {
117 TCG_PCRINDEX PCRIndex;
118 TCG_EVENTTYPE EventType;
119 TCG_DIGEST Digest;
120 UINT32 EventSize;
122
130 EFI_PHYSICAL_ADDRESS BlobBase;
131 UINT64 BlobLength;
133
141 EFI_PHYSICAL_ADDRESS BlobBase;
142 UINT64 BlobLength;
144
152 UINT8 BlobDescriptionSize;
153 // UINT8 BlobDescription[BlobDescriptionSize];
154 // EFI_PHYSICAL_ADDRESS BlobBase;
155 // UINT64 BlobLength;
157
165 EFI_PHYSICAL_ADDRESS ImageLocationInMemory;
166 UINTN ImageLengthInMemory;
167 UINTN ImageLinkTimeAddress;
168 UINTN LengthOfDevicePath;
169 EFI_DEVICE_PATH_PROTOCOL DevicePath[1];
171
179 EFI_PHYSICAL_ADDRESS ImageLocationInMemory;
180 UINT64 ImageLengthInMemory;
181 UINT64 ImageLinkTimeAddress;
182 UINT64 LengthOfDevicePath;
183 EFI_DEVICE_PATH_PROTOCOL DevicePath[1];
185
193 UINTN NumberOfTables;
194 EFI_CONFIGURATION_TABLE TableEntry[1];
196
204 UINT64 NumberOfTables;
205 EFI_CONFIGURATION_TABLE TableEntry[1];
207
215 UINT8 TableDescriptionSize;
216 // UINT8 TableDescription[TableDescriptionSize];
217 // UINT64 NumberOfTables;
218 // EFI_CONFIGURATION_TABLE TableEntry[1];
220
229typedef struct tdEFI_VARIABLE_DATA {
230 EFI_GUID VariableName;
231 UINTN UnicodeNameLength;
232 UINTN VariableDataLength;
233 CHAR16 UnicodeName[1];
234 INT8 VariableData[1];
236
245typedef struct tdUEFI_VARIABLE_DATA {
246 EFI_GUID VariableName;
247 UINT64 UnicodeNameLength;
248 UINT64 VariableDataLength;
249 CHAR16 UnicodeName[1];
250 INT8 VariableData[1];
252
253//
254// For TrEE1.0 compatibility
255//
256typedef struct {
257 EFI_GUID VariableName;
258 UINT64 UnicodeNameLength; // The TCG Definition used UINTN
259 UINT64 VariableDataLength; // The TCG Definition used UINTN
260 CHAR16 UnicodeName[1];
261 INT8 VariableData[1];
263
264typedef struct tdEFI_GPT_DATA {
265 EFI_PARTITION_TABLE_HEADER EfiPartitionHeader;
266 UINTN NumberOfPartitions;
267 EFI_PARTITION_ENTRY Partitions[1];
269
270typedef struct tdUEFI_GPT_DATA {
271 EFI_PARTITION_TABLE_HEADER EfiPartitionHeader;
272 UINT64 NumberOfPartitions;
273 EFI_PARTITION_ENTRY Partitions[1];
275
276#define TCG_DEVICE_SECURITY_EVENT_DATA_SIGNATURE "SPDM Device Sec"
277#define TCG_DEVICE_SECURITY_EVENT_DATA_VERSION 1
278
279#define TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_TYPE_NULL 0
280#define TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_TYPE_PCI 1
281#define TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_TYPE_USB 2
282
288typedef struct {
289 UINT8 Signature[16];
290 UINT16 Version;
291 UINT16 Length;
292 UINT32 SpdmHashAlgo;
293 UINT32 DeviceType;
294 // SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock;
296
297#define TCG_DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT_VERSION 0
298
304typedef struct {
305 UINT16 Version;
306 UINT16 Length;
307 UINT16 VendorId;
308 UINT16 DeviceId;
309 UINT8 RevisionID;
310 UINT8 ClassCode[3];
311 UINT16 SubsystemVendorID;
312 UINT16 SubsystemID;
314
315#define TCG_DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT_VERSION 0
316
322typedef struct {
323 UINT16 Version;
324 UINT16 Length;
325 // UINT8 DeviceDescriptor[DescLen];
326 // UINT8 BodDescriptor[DescLen];
327 // UINT8 ConfigurationDescriptor[DescLen][NumOfConfiguration];
329
330//
331// Crypto Agile Log Entry Format
332//
333typedef struct tdTCG_PCR_EVENT2 {
334 TCG_PCRINDEX PCRIndex;
335 TCG_EVENTTYPE EventType;
336 TPML_DIGEST_VALUES Digest;
337 UINT32 EventSize;
338 UINT8 Event[1];
340
341//
342// TCG PCR Event2 Header
343// Follow TCG EFI Protocol Spec 5.2 Crypto Agile Log Entry Format
344//
345typedef struct tdTCG_PCR_EVENT2_HDR {
346 TCG_PCRINDEX PCRIndex;
347 TCG_EVENTTYPE EventType;
348 TPML_DIGEST_VALUES Digests;
349 UINT32 EventSize;
351
352//
353// Log Header Entry Data
354//
355typedef struct {
356 //
357 // TCG defined hashing algorithm ID.
358 //
359 UINT16 algorithmId;
360 //
361 // The size of the digest for the respective hashing algorithm.
362 //
363 UINT16 digestSize;
365
366#define TCG_EfiSpecIDEventStruct_SIGNATURE_02 "Spec ID Event02"
367#define TCG_EfiSpecIDEventStruct_SIGNATURE_03 "Spec ID Event03"
368
369#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM12 1
370#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM12 2
371#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM12 2
372
373#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM2 2
374#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM2 0
375#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2 0
376#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_105 105
377
378typedef struct {
379 UINT8 signature[16];
380 //
381 // The value for the Platform Class.
382 // The enumeration is defined in the TCG ACPI Specification Client Common Header.
383 //
384 UINT32 platformClass;
385 //
386 // The TCG EFI Platform Specification minor version number this BIOS supports.
387 // Any BIOS supporting version (1.22) MUST set this value to 02h.
388 // Any BIOS supporting version (2.0) SHALL set this value to 0x00.
389 //
390 UINT8 specVersionMinor;
391 //
392 // The TCG EFI Platform Specification major version number this BIOS supports.
393 // Any BIOS supporting version (1.22) MUST set this value to 01h.
394 // Any BIOS supporting version (2.0) SHALL set this value to 0x02.
395 //
396 UINT8 specVersionMajor;
397 //
398 // The TCG EFI Platform Specification errata for this specification this BIOS supports.
399 // Any BIOS supporting version and errata (1.22) MUST set this value to 02h.
400 // Any BIOS supporting version and errata (2.0) SHALL set this value to 0x00.
401 //
402 UINT8 specErrata;
403 //
404 // Specifies the size of the UINTN fields used in various data structures used in this specification.
405 // 0x01 indicates UINT32 and 0x02 indicates UINT64.
406 //
407 UINT8 uintnSize;
408 //
409 // This field is added in "Spec ID Event03".
410 // The number of hashing algorithms used in this event log (except the first event).
411 // All events in this event log use all hashing algorithms defined here.
412 //
413 // UINT32 numberOfAlgorithms;
414 //
415 // This field is added in "Spec ID Event03".
416 // An array of size numberOfAlgorithms of value pairs.
417 //
418 // TCG_EfiSpecIdEventAlgorithmSize digestSize[numberOfAlgorithms];
419 //
420 // Size in bytes of the VendorInfo field.
421 // Maximum value SHALL be FFh bytes.
422 //
423 // UINT8 vendorInfoSize;
424 //
425 // Provided for use by the BIOS implementer.
426 // The value might be used, for example, to provide more detailed information about the specific BIOS such as BIOS revision numbers, etc.
427 // The values within this field are not standardized and are implementer-specific.
428 // Platform-specific or -unique information SHALL NOT be provided in this field.
429 //
430 // UINT8 vendorInfo[vendorInfoSize];
432
434 UINT32 taggedEventID;
435 UINT32 taggedEventDataSize;
436 // UINT8 taggedEventData[taggedEventDataSize];
438
439#define TCG_Sp800_155_PlatformId_Event_SIGNATURE "SP800-155 Event"
440#define TCG_Sp800_155_PlatformId_Event2_SIGNATURE "SP800-155 Event2"
441
443 UINT8 Signature[16];
444 //
445 // Where Vendor ID is an integer defined
446 // at http://www.iana.org/assignments/enterprisenumbers
447 //
448 UINT32 VendorId;
449 //
450 // 16-byte identifier of a given platform's static configuration of code
451 //
452 EFI_GUID ReferenceManifestGuid;
453 //
454 // Below structure is newly added in TCG_Sp800_155_PlatformId_Event2.
455 //
456 // UINT8 PlatformManufacturerStrSize;
457 // UINT8 PlatformManufacturerStr[PlatformManufacturerStrSize];
458 // UINT8 PlatformModelSize;
459 // UINT8 PlatformModel[PlatformModelSize];
460 // UINT8 PlatformVersionSize;
461 // UINT8 PlatformVersion[PlatformVersionSize];
462 // UINT8 PlatformModelSize;
463 // UINT8 PlatformModel[PlatformModelSize];
464 // UINT8 FirmwareManufacturerStrSize;
465 // UINT8 FirmwareManufacturerStr[FirmwareManufacturerStrSize];
466 // UINT32 FirmwareManufacturerId;
467 // UINT8 FirmwareVersion;
468 // UINT8 FirmwareVersion[FirmwareVersionSize]];
470
471#define TCG_EfiStartupLocalityEvent_SIGNATURE "StartupLocality"
472
473//
474// The Locality Indicator which sent the TPM2_Startup command
475//
476#define LOCALITY_0_INDICATOR 0x00
477#define LOCALITY_3_INDICATOR 0x03
478
479//
480// Startup Locality Event
481//
483 UINT8 Signature[16];
484 //
485 // The Locality Indicator which sent the TPM2_Startup command
486 //
487 UINT8 StartupLocality;
489
490//
491// Restore original structure alignment
492//
493#pragma pack ()
494
495#endif
UINT64 UINTN
UINT32 TPM_PCRINDEX
Definition: Tpm12.h:133
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
struct tdUEFI_PLATFORM_FIRMWARE_BLOB UEFI_PLATFORM_FIRMWARE_BLOB
struct tdTCG_PCR_EVENT TCG_PCR_EVENT
struct tdUEFI_IMAGE_LOAD_EVENT UEFI_IMAGE_LOAD_EVENT
struct tdEFI_IMAGE_LOAD_EVENT EFI_IMAGE_LOAD_EVENT
struct tdEFI_VARIABLE_DATA EFI_VARIABLE_DATA
struct tdUEFI_PLATFORM_FIRMWARE_BLOB2 UEFI_PLATFORM_FIRMWARE_BLOB2
struct tdUEFI_VARIABLE_DATA UEFI_VARIABLE_DATA
struct tdEFI_PLATFORM_FIRMWARE_BLOB EFI_PLATFORM_FIRMWARE_BLOB
struct tdUEFI_HANDOFF_TABLE_POINTERS2 UEFI_HANDOFF_TABLE_POINTERS2
struct tdUEFI_HANDOFF_TABLE_POINTERS UEFI_HANDOFF_TABLE_POINTERS
struct tdEFI_HANDOFF_TABLE_POINTERS EFI_HANDOFF_TABLE_POINTERS
struct tdTCG_PCR_EVENT_HDR TCG_PCR_EVENT_HDR
Definition: Base.h:213
INT8 VariableData[1]
Driver or platform-specific data.
UINT8 Event[1]
The event data.
UINT32 EventSize
Size of the event data.
TCG_DIGEST Digest
Value extended into PCRIndex.
TCG_EVENTTYPE EventType
TCG EFI event type.
TCG_PCRINDEX PCRIndex
PCRIndex event extended to.
INT8 VariableData[1]
Driver or platform-specific data.