TianoCore EDK2 master
Loading...
Searching...
No Matches
Tcg2Protocol.h
Go to the documentation of this file.
1
10#ifndef __TCG2_PROTOCOL_H__
11#define __TCG2_PROTOCOL_H__
12
15
16#define EFI_TCG2_PROTOCOL_GUID \
17 {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}
18
20
21typedef struct tdEFI_TCG2_VERSION {
22 UINT8 Major;
23 UINT8 Minor;
25
26typedef UINT32 EFI_TCG2_EVENT_LOG_BITMAP;
27typedef UINT32 EFI_TCG2_EVENT_LOG_FORMAT;
28typedef UINT32 EFI_TCG2_EVENT_ALGORITHM_BITMAP;
29
30#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x00000001
31#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x00000002
32
34 //
35 // Allocated size of the structure
36 //
37 UINT8 Size;
38 //
39 // Version of the EFI_TCG2_BOOT_SERVICE_CAPABILITY structure itself.
40 // For this version of the protocol, the Major version shall be set to 1
41 // and the Minor version shall be set to 1.
42 //
43 EFI_TCG2_VERSION StructureVersion;
44 //
45 // Version of the EFI TCG2 protocol.
46 // For this version of the protocol, the Major version shall be set to 1
47 // and the Minor version shall be set to 1.
48 //
49 EFI_TCG2_VERSION ProtocolVersion;
50 //
51 // Supported hash algorithms (this bitmap is determined by the supported PCR
52 // banks in the TPM and the hashing algorithms supported by the firmware)
53 //
54 EFI_TCG2_EVENT_ALGORITHM_BITMAP HashAlgorithmBitmap;
55 //
56 // Bitmap of supported event log formats
57 //
58 EFI_TCG2_EVENT_LOG_BITMAP SupportedEventLogs;
59 //
60 // False = TPM not present
61 //
62 BOOLEAN TPMPresentFlag;
63 //
64 // Max size (in bytes) of a command that can be sent to the TPM
65 //
66 UINT16 MaxCommandSize;
67 //
68 // Max size (in bytes) of a response that can be provided by the TPM
69 //
70 UINT16 MaxResponseSize;
71 //
72 // 4-byte Vendor ID
73 // (see TCG Vendor ID registry, Section "TPM Capabilities Vendor ID")
74 //
75 UINT32 ManufacturerID;
76 //
77 // Maximum number of PCR banks (hashing algorithms) supported.
78 // No granularity is provided to support a specific set of algorithms.
79 // Minimum value is 1.
80 //
81 UINT32 NumberOfPCRBanks;
82 //
83 // A bitmap of currently active PCR banks (hashing algorithms).
84 // This is a subset of the supported hashing algorithms reported in HashAlgorithmBitMap.
85 // NumberOfPcrBanks defines the number of bits that are set.
86 //
87 EFI_TCG2_EVENT_ALGORITHM_BITMAP ActivePcrBanks;
89
90#define EFI_TCG2_BOOT_HASH_ALG_SHA1 0x00000001
91#define EFI_TCG2_BOOT_HASH_ALG_SHA256 0x00000002
92#define EFI_TCG2_BOOT_HASH_ALG_SHA384 0x00000004
93#define EFI_TCG2_BOOT_HASH_ALG_SHA512 0x00000008
94#define EFI_TCG2_BOOT_HASH_ALG_SM3_256 0x00000010
95
96//
97// This bit is shall be set when an event shall be extended but not logged.
98//
99#define EFI_TCG2_EXTEND_ONLY 0x0000000000000001
100//
101// This bit shall be set when the intent is to measure a PE/COFF image.
102//
103#define PE_COFF_IMAGE 0x0000000000000010
104
105#define MAX_PCR_INDEX 23
106
107#pragma pack(1)
108
109#define EFI_TCG2_EVENT_HEADER_VERSION 1
110
111typedef struct {
112 //
113 // Size of the event header itself (sizeof(EFI_TCG2_EVENT_HEADER)).
114 //
115 UINT32 HeaderSize;
116 //
117 // Header version. For this version of this specification, the value shall be 1.
118 //
119 UINT16 HeaderVersion;
120 //
121 // Index of the PCR that shall be extended (0 - 23).
122 //
123 TCG_PCRINDEX PCRIndex;
124 //
125 // Type of the event that shall be extended (and optionally logged).
126 //
127 TCG_EVENTTYPE EventType;
129
130typedef struct tdEFI_TCG2_EVENT {
131 //
132 // Total size of the event including the Size component, the header and the Event data.
133 //
134 UINT32 Size;
136 UINT8 Event[1];
138
139#pragma pack()
140
160typedef
163 IN EFI_TCG2_PROTOCOL *This,
164 IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
165 );
166
184typedef
186(EFIAPI *EFI_TCG2_GET_EVENT_LOG)(
187 IN EFI_TCG2_PROTOCOL *This,
188 IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
189 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
190 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry,
191 OUT BOOLEAN *EventLogTruncated
192 );
193
213typedef
216 IN EFI_TCG2_PROTOCOL *This,
217 IN UINT64 Flags,
218 IN EFI_PHYSICAL_ADDRESS DataToHash,
219 IN UINT64 DataToHashLen,
220 IN EFI_TCG2_EVENT *EfiTcgEvent
221 );
222
237typedef
240 IN EFI_TCG2_PROTOCOL *This,
241 IN UINT32 InputParameterBlockSize,
242 IN UINT8 *InputParameterBlock,
243 IN UINT32 OutputParameterBlockSize,
244 IN UINT8 *OutputParameterBlock
245 );
246
256typedef
259 IN EFI_TCG2_PROTOCOL *This,
260 OUT UINT32 *ActivePcrBanks
261 );
262
272typedef
275 IN EFI_TCG2_PROTOCOL *This,
276 IN UINT32 ActivePcrBanks
277 );
278
289typedef
292 IN EFI_TCG2_PROTOCOL *This,
293 OUT UINT32 *OperationPresent,
294 OUT UINT32 *Response
295 );
296
298 EFI_TCG2_GET_CAPABILITY GetCapability;
299 EFI_TCG2_GET_EVENT_LOG GetEventLog;
300 EFI_TCG2_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;
301 EFI_TCG2_SUBMIT_COMMAND SubmitCommand;
302 EFI_TCG2_GET_ACTIVE_PCR_BANKS GetActivePcrBanks;
303 EFI_TCG2_SET_ACTIVE_PCR_BANKS SetActivePcrBanks;
304 EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS GetResultOfSetActivePcrBanks;
305};
306
307extern EFI_GUID gEfiTcg2ProtocolGuid;
308
309//
310// Log entries after Get Event Log service
311//
312
313#define EFI_TCG2_FINAL_EVENTS_TABLE_GUID \
314 {0x1e2ed096, 0x30e2, 0x4254, { 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25 }}
315
316extern EFI_GUID gEfiTcg2FinalEventsTableGuid;
317
319 //
320 // The version of this structure.
321 //
322 UINT64 Version;
323 //
324 // Number of events recorded after invocation of GetEventLog API
325 //
326 UINT64 NumberOfEvents;
327 //
328 // List of events of type TCG_PCR_EVENT2.
329 //
330 // TCG_PCR_EVENT2 Event[1];
332
333#define EFI_TCG2_FINAL_EVENTS_TABLE_VERSION 1
334
335#endif
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS(EFIAPI * EFI_TCG2_GET_EVENT_LOG)(IN EFI_TCG2_PROTOCOL *This, IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat, OUT EFI_PHYSICAL_ADDRESS *EventLogLocation, OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry, OUT BOOLEAN *EventLogTruncated)
Definition: Tcg2Protocol.h:186
EFI_STATUS(EFIAPI * EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS)(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *OperationPresent, OUT UINT32 *Response)
Definition: Tcg2Protocol.h:291
EFI_STATUS(EFIAPI * EFI_TCG2_GET_CAPABILITY)(IN EFI_TCG2_PROTOCOL *This, IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability)
Definition: Tcg2Protocol.h:162
EFI_STATUS(EFIAPI * EFI_TCG2_SET_ACTIVE_PCR_BANKS)(IN EFI_TCG2_PROTOCOL *This, IN UINT32 ActivePcrBanks)
Definition: Tcg2Protocol.h:274
EFI_STATUS(EFIAPI * EFI_TCG2_SUBMIT_COMMAND)(IN EFI_TCG2_PROTOCOL *This, IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN UINT32 OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
Definition: Tcg2Protocol.h:239
EFI_STATUS(EFIAPI * EFI_TCG2_HASH_LOG_EXTEND_EVENT)(IN EFI_TCG2_PROTOCOL *This, IN UINT64 Flags, IN EFI_PHYSICAL_ADDRESS DataToHash, IN UINT64 DataToHashLen, IN EFI_TCG2_EVENT *EfiTcgEvent)
Definition: Tcg2Protocol.h:215
EFI_STATUS(EFIAPI * EFI_TCG2_GET_ACTIVE_PCR_BANKS)(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *ActivePcrBanks)
Definition: Tcg2Protocol.h:258
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
Definition: Base.h:213