iPXE
UefiTcgPlatform.h
Go to the documentation of this file.
1 /** @file
2  TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final
3 
4  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
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 __UEFI_TCG_PLATFORM_H__
16 #define __UEFI_TCG_PLATFORM_H__
17 
18 FILE_LICENCE ( BSD3 );
19 
22 #include <ipxe/efi/Uefi.h>
23 
24 //
25 // Standard event types
26 //
27 #define EV_POST_CODE ((TCG_EVENTTYPE) 0x00000001)
28 #define EV_NO_ACTION ((TCG_EVENTTYPE) 0x00000003)
29 #define EV_SEPARATOR ((TCG_EVENTTYPE) 0x00000004)
30 #define EV_S_CRTM_CONTENTS ((TCG_EVENTTYPE) 0x00000007)
31 #define EV_S_CRTM_VERSION ((TCG_EVENTTYPE) 0x00000008)
32 #define EV_CPU_MICROCODE ((TCG_EVENTTYPE) 0x00000009)
33 #define EV_TABLE_OF_DEVICES ((TCG_EVENTTYPE) 0x0000000B)
34 
35 //
36 // EFI specific event types
37 //
38 #define EV_EFI_EVENT_BASE ((TCG_EVENTTYPE) 0x80000000)
39 #define EV_EFI_VARIABLE_DRIVER_CONFIG (EV_EFI_EVENT_BASE + 1)
40 #define EV_EFI_VARIABLE_BOOT (EV_EFI_EVENT_BASE + 2)
41 #define EV_EFI_BOOT_SERVICES_APPLICATION (EV_EFI_EVENT_BASE + 3)
42 #define EV_EFI_BOOT_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 4)
43 #define EV_EFI_RUNTIME_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 5)
44 #define EV_EFI_GPT_EVENT (EV_EFI_EVENT_BASE + 6)
45 #define EV_EFI_ACTION (EV_EFI_EVENT_BASE + 7)
46 #define EV_EFI_PLATFORM_FIRMWARE_BLOB (EV_EFI_EVENT_BASE + 8)
47 #define EV_EFI_HANDOFF_TABLES (EV_EFI_EVENT_BASE + 9)
48 #define EV_EFI_VARIABLE_AUTHORITY (EV_EFI_EVENT_BASE + 0xE0)
49 
50 #define EFI_CALLING_EFI_APPLICATION \
51  "Calling EFI Application from Boot Option"
52 #define EFI_RETURNING_FROM_EFI_APPLICATOIN \
53  "Returning from EFI Application from Boot Option"
54 #define EFI_EXIT_BOOT_SERVICES_INVOCATION \
55  "Exit Boot Services Invocation"
56 #define EFI_EXIT_BOOT_SERVICES_FAILED \
57  "Exit Boot Services Returned with Failure"
58 #define EFI_EXIT_BOOT_SERVICES_SUCCEEDED \
59  "Exit Boot Services Returned with Success"
60 
61 
62 #define EV_POSTCODE_INFO_POST_CODE "POST CODE"
63 #define POST_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_POST_CODE) - 1)
64 
65 #define EV_POSTCODE_INFO_SMM_CODE "SMM CODE"
66 #define SMM_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_SMM_CODE) - 1)
67 
68 #define EV_POSTCODE_INFO_ACPI_DATA "ACPI DATA"
69 #define ACPI_DATA_LEN (sizeof(EV_POSTCODE_INFO_ACPI_DATA) - 1)
70 
71 #define EV_POSTCODE_INFO_BIS_CODE "BIS CODE"
72 #define BIS_CODE_LEN (sizeof(EV_POSTCODE_INFO_BIS_CODE) - 1)
73 
74 #define EV_POSTCODE_INFO_UEFI_PI "UEFI PI"
75 #define UEFI_PI_LEN (sizeof(EV_POSTCODE_INFO_UEFI_PI) - 1)
76 
77 #define EV_POSTCODE_INFO_OPROM "Embedded Option ROM"
78 #define OPROM_LEN (sizeof(EV_POSTCODE_INFO_OPROM) - 1)
79 
80 #define FIRMWARE_DEBUGGER_EVENT_STRING "UEFI Debug Mode"
81 #define FIRMWARE_DEBUGGER_EVENT_STRING_LEN (sizeof(FIRMWARE_DEBUGGER_EVENT_STRING) - 1)
82 
83 //
84 // Set structure alignment to 1-byte
85 //
86 #pragma pack (1)
87 
91 ///
92 /// Event Log Entry Structure Definition
93 ///
94 typedef struct tdTCG_PCR_EVENT {
95  TCG_PCRINDEX PCRIndex; ///< PCRIndex event extended to
96  TCG_EVENTTYPE EventType; ///< TCG EFI event type
97  TCG_DIGEST Digest; ///< Value extended into PCRIndex
98  UINT32 EventSize; ///< Size of the event data
99  UINT8 Event[1]; ///< The event data
100 } TCG_PCR_EVENT;
101 
102 #define TSS_EVENT_DATA_MAX_SIZE 256
103 
104 ///
105 /// TCG_PCR_EVENT_HDR
106 ///
107 typedef struct tdTCG_PCR_EVENT_HDR {
113 
114 ///
115 /// EFI_PLATFORM_FIRMWARE_BLOB
116 ///
117 /// BlobLength should be of type UINTN but we use UINT64 here
118 /// because PEI is 32-bit while DXE is 64-bit on x64 platforms
119 ///
124 
125 ///
126 /// EFI_IMAGE_LOAD_EVENT
127 ///
128 /// This structure is used in EV_EFI_BOOT_SERVICES_APPLICATION,
129 /// EV_EFI_BOOT_SERVICES_DRIVER and EV_EFI_RUNTIME_SERVICES_DRIVER
130 ///
131 typedef struct tdEFI_IMAGE_LOAD_EVENT {
138 
139 ///
140 /// EFI_HANDOFF_TABLE_POINTERS
141 ///
142 /// This structure is used in EV_EFI_HANDOFF_TABLES event to facilitate
143 /// the measurement of given configuration tables.
144 ///
149 
150 ///
151 /// EFI_VARIABLE_DATA
152 ///
153 /// This structure serves as the header for measuring variables. The name of the
154 /// variable (in Unicode format) should immediately follow, then the variable
155 /// data.
156 /// This is defined in TCG EFI Platform Spec for TPM1.1 or 1.2 V1.22
157 ///
158 typedef struct tdEFI_VARIABLE_DATA {
163  INT8 VariableData[1]; ///< Driver or platform-specific data
165 
166 ///
167 /// UEFI_VARIABLE_DATA
168 ///
169 /// This structure serves as the header for measuring variables. The name of the
170 /// variable (in Unicode format) should immediately follow, then the variable
171 /// data.
172 /// This is defined in TCG PC Client Firmware Profile Spec 00.21
173 ///
174 typedef struct tdUEFI_VARIABLE_DATA {
179  INT8 VariableData[1]; ///< Driver or platform-specific data
181 
182 //
183 // For TrEE1.0 compatibility
184 //
185 typedef struct {
187  UINT64 UnicodeNameLength; // The TCG Definition used UINTN
188  UINT64 VariableDataLength; // The TCG Definition used UINTN
189  CHAR16 UnicodeName[1];
190  INT8 VariableData[1];
192 
193 typedef struct tdEFI_GPT_DATA {
197 } EFI_GPT_DATA;
198 
199 //
200 // Crypto Agile Log Entry Format
201 //
202 typedef struct tdTCG_PCR_EVENT2 {
209 
210 //
211 // TCG PCR Event2 Header
212 // Follow TCG EFI Protocol Spec 5.2 Crypto Agile Log Entry Format
213 //
214 typedef struct tdTCG_PCR_EVENT2_HDR{
220 
221 //
222 // Log Header Entry Data
223 //
224 typedef struct {
225  //
226  // TCG defined hashing algorithm ID.
227  //
229  //
230  // The size of the digest for the respective hashing algorithm.
231  //
234 
235 #define TCG_EfiSpecIDEventStruct_SIGNATURE_02 "Spec ID Event02"
236 #define TCG_EfiSpecIDEventStruct_SIGNATURE_03 "Spec ID Event03"
237 
238 #define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM12 1
239 #define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM12 2
240 #define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM12 2
241 
242 #define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM2 2
243 #define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM2 0
244 #define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2 0
245 
246 typedef struct {
248  //
249  // The value for the Platform Class.
250  // The enumeration is defined in the TCG ACPI Specification Client Common Header.
251  //
253  //
254  // The TCG EFI Platform Specification minor version number this BIOS supports.
255  // Any BIOS supporting version (1.22) MUST set this value to 02h.
256  // Any BIOS supporting version (2.0) SHALL set this value to 0x00.
257  //
259  //
260  // The TCG EFI Platform Specification major version number this BIOS supports.
261  // Any BIOS supporting version (1.22) MUST set this value to 01h.
262  // Any BIOS supporting version (2.0) SHALL set this value to 0x02.
263  //
265  //
266  // The TCG EFI Platform Specification errata for this specification this BIOS supports.
267  // Any BIOS supporting version and errata (1.22) MUST set this value to 02h.
268  // Any BIOS supporting version and errata (2.0) SHALL set this value to 0x00.
269  //
271  //
272  // Specifies the size of the UINTN fields used in various data structures used in this specification.
273  // 0x01 indicates UINT32 and 0x02 indicates UINT64.
274  //
276  //
277  // This field is added in "Spec ID Event03".
278  // The number of hashing algorithms used in this event log (except the first event).
279  // All events in this event log use all hashing algorithms defined here.
280  //
281 //UINT32 numberOfAlgorithms;
282  //
283  // This field is added in "Spec ID Event03".
284  // An array of size numberOfAlgorithms of value pairs.
285  //
286 //TCG_EfiSpecIdEventAlgorithmSize digestSize[numberOfAlgorithms];
287  //
288  // Size in bytes of the VendorInfo field.
289  // Maximum value SHALL be FFh bytes.
290  //
291 //UINT8 vendorInfoSize;
292  //
293  // Provided for use by the BIOS implementer.
294  // The value might be used, for example, to provide more detailed information about the specific BIOS such as BIOS revision numbers, etc.
295  // The values within this field are not standardized and are implementer-specific.
296  // Platform-specific or -unique information SHALL NOT be provided in this field.
297  //
298 //UINT8 vendorInfo[vendorInfoSize];
300 
301 
302 
303 #define TCG_EfiStartupLocalityEvent_SIGNATURE "StartupLocality"
304 
305 
306 //
307 // PC Client PTP spec Table 8 Relationship between Locality and Locality Attribute
308 //
309 #define LOCALITY_0_INDICATOR 0x01
310 #define LOCALITY_1_INDICATOR 0x02
311 #define LOCALITY_2_INDICATOR 0x03
312 #define LOCALITY_3_INDICATOR 0x04
313 #define LOCALITY_4_INDICATOR 0x05
314 
315 
316 //
317 // Startup Locality Event
318 //
321  //
322  // The Locality Indicator which sent the TPM2_Startup command
323  //
326 
327 
328 //
329 // Restore original structure alignment
330 //
331 #pragma pack ()
332 
333 #endif
334 
335 
EFI_CONFIGURATION_TABLE TableEntry[1]
Event Log Entry Structure Definition.
EFI_PHYSICAL_ADDRESS ImageLocationInMemory
128 bit buffer containing a unique identifier value.
Definition: Base.h:263
INT8 VariableData[1]
Driver or platform-specific data.
UEFI_VARIABLE_DATA.
struct tdTCG_PCR_EVENT2 TCG_PCR_EVENT2
EFI_IMAGE_LOAD_EVENT.
GPT Partition Entry.
Definition: UefiGpt.h:90
unsigned int UINT32
Definition: ProcessorBind.h:56
EFI_PHYSICAL_ADDRESS BlobBase
unsigned short CHAR16
Definition: ProcessorBind.h:59
EFI_PLATFORM_FIRMWARE_BLOB.
This protocol can be used on any device handle to obtain generic path/location information concerning...
Definition: DevicePath.h:51
EFI_PARTITION_TABLE_HEADER EfiPartitionHeader
unsigned char UINT8
Definition: ProcessorBind.h:62
UINT64 EFI_PHYSICAL_ADDRESS
64-bit physical memory address.
Definition: UefiBaseType.h:56
struct tdEFI_IMAGE_LOAD_EVENT EFI_IMAGE_LOAD_EVENT
EFI_IMAGE_LOAD_EVENT.
struct tdEFI_PLATFORM_FIRMWARE_BLOB EFI_PLATFORM_FIRMWARE_BLOB
EFI_PLATFORM_FIRMWARE_BLOB.
GPT Partition Table Header.
Definition: UefiGpt.h:35
struct tdEFI_HANDOFF_TABLE_POINTERS EFI_HANDOFF_TABLE_POINTERS
EFI_HANDOFF_TABLE_POINTERS.
UINT32 EventSize
Size of the event data.
u8 signature
Definition: CIB_PRM.h:35
TCG_EVENTTYPE EventType
TPM_PCRINDEX TCG_PCRINDEX
TCG_EVENTTYPE EventType
TCG_PCRINDEX PCRIndex
PCRIndex event extended to.
TCG_DIGEST Digest
Value extended into PCRIndex.
TCG_EVENTTYPE EventType
TCG EFI event type.
EFI_DEVICE_PATH_PROTOCOL DevicePath[1]
TPM_DIGEST TCG_DIGEST
struct tdEFI_GPT_DATA EFI_GPT_DATA
unsigned short UINT16
Definition: ProcessorBind.h:58
struct tdUEFI_VARIABLE_DATA UEFI_VARIABLE_DATA
UEFI_VARIABLE_DATA.
TCG_PCRINDEX PCRIndex
struct tdTCG_EfiStartupLocalityEvent TCG_EfiStartupLocalityEvent
EFI_VARIABLE_DATA.
TPML_DIGEST_VALUES Digest
TPM2.0 Specification data structures (Trusted Platform Module Library Specification,...
EFI_PARTITION_ENTRY Partitions[1]
Root include file for Mde Package UEFI, UEFI_APPLICATION type modules.
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
unsigned long long UINT64
Definition: ProcessorBind.h:54
TPML_DIGEST_VALUES Digests
Part 2, section 5.4: TPM_DIGEST.
Definition: Tpm12.h:449
TCG_PCR_EVENT_HDR.
TPM Specification data structures (TCG TPM Specification Version 1.2 Revision 103) See http://trusted...
UINT32 TCG_EVENTTYPE
EFI_HANDOFF_TABLE_POINTERS.
struct tdTCG_PCR_EVENT2_HDR TCG_PCR_EVENT2_HDR
struct tdEFI_VARIABLE_DATA EFI_VARIABLE_DATA
EFI_VARIABLE_DATA.
INT8 VariableData[1]
Driver or platform-specific data.
struct tdTCG_PCR_EVENT_HDR TCG_PCR_EVENT_HDR
TCG_PCR_EVENT_HDR.
Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the EFI System Tabl...
Definition: UefiSpec.h:1935
UINT32 TPM_PCRINDEX
Index to a PCR register.
Definition: Tpm12.h:142
UINT8 Event[1]
The event data.
signed char INT8
Definition: ProcessorBind.h:64
struct tdTCG_PCR_EVENT TCG_PCR_EVENT
Event Log Entry Structure Definition.
FILE_LICENCE(BSD3)
TCG_EVENTTYPE EventType