TianoCore EDK2 master
Loading...
Searching...
No Matches
CcMeasurement.h
Go to the documentation of this file.
1
17#ifndef CC_MEASUREMENT_PROTOCOL_H_
18#define CC_MEASUREMENT_PROTOCOL_H_
19
21
22#define EFI_CC_MEASUREMENT_PROTOCOL_GUID \
23 { 0x96751a3d, 0x72f4, 0x41a6, { 0xa7, 0x94, 0xed, 0x5d, 0x0e, 0x67, 0xae, 0x6b }}
24extern EFI_GUID gEfiCcMeasurementProtocolGuid;
25
27
28typedef struct {
29 UINT8 Major;
30 UINT8 Minor;
32
33//
34// EFI_CC Type/SubType definition
35//
36#define EFI_CC_TYPE_NONE 0
37#define EFI_CC_TYPE_SEV 1
38#define EFI_CC_TYPE_TDX 2
39
40typedef struct {
41 UINT8 Type;
42 UINT8 SubType;
44
45typedef UINT32 EFI_CC_EVENT_LOG_BITMAP;
46typedef UINT32 EFI_CC_EVENT_LOG_FORMAT;
47typedef UINT32 EFI_CC_EVENT_ALGORITHM_BITMAP;
48typedef UINT32 EFI_CC_MR_INDEX;
49
50//
51// Intel TDX measure register index
52//
53#define TDX_MR_INDEX_MRTD 0
54#define TDX_MR_INDEX_RTMR0 1
55#define TDX_MR_INDEX_RTMR1 2
56#define TDX_MR_INDEX_RTMR2 3
57#define TDX_MR_INDEX_RTMR3 4
58
59#define EFI_CC_EVENT_LOG_FORMAT_TCG_2 0x00000002
60#define EFI_CC_BOOT_HASH_ALG_SHA384 0x00000004
61
62//
63// This bit is shall be set when an event shall be extended but not logged.
64//
65#define EFI_CC_FLAG_EXTEND_ONLY 0x0000000000000001
66//
67// This bit shall be set when the intent is to measure a PE/COFF image.
68//
69#define EFI_CC_FLAG_PE_COFF_IMAGE 0x0000000000000010
70
71#pragma pack (1)
72
73#define EFI_CC_EVENT_HEADER_VERSION 1
74
75typedef struct {
76 //
77 // Size of the event header itself (sizeof(EFI_CC_EVENT_HEADER)).
78 //
79 UINT32 HeaderSize;
80 //
81 // Header version. For this version of this specification, the value shall be 1.
82 //
83 UINT16 HeaderVersion;
84 //
85 // Index of the MR (measurement register) that shall be extended.
86 //
87 EFI_CC_MR_INDEX MrIndex;
88 //
89 // Type of the event that shall be extended (and optionally logged).
90 //
91 UINT32 EventType;
93
94typedef struct {
95 //
96 // Total size of the event including the Size component, the header and the Event data.
97 //
98 UINT32 Size;
100 UINT8 Event[1];
102
103#pragma pack()
104
105typedef struct {
106 //
107 // Allocated size of the structure
108 //
109 UINT8 Size;
110 //
111 // Version of the EFI_CC_BOOT_SERVICE_CAPABILITY structure itself.
112 // For this version of the protocol, the Major version shall be set to 1
113 // and the Minor version shall be set to 0.
114 //
115 EFI_CC_VERSION StructureVersion;
116 //
117 // Version of the EFI CC Measurement protocol.
118 // For this version of the protocol, the Major version shall be set to 1
119 // and the Minor version shall be set to 0.
120 //
121 EFI_CC_VERSION ProtocolVersion;
122 //
123 // Supported hash algorithms
124 //
125 EFI_CC_EVENT_ALGORITHM_BITMAP HashAlgorithmBitmap;
126 //
127 // Bitmap of supported event log formats
128 //
129 EFI_CC_EVENT_LOG_BITMAP SupportedEventLogs;
130
131 //
132 // Indicates the CC type
133 //
134 EFI_CC_TYPE CcType;
136
155typedef
157(EFIAPI *EFI_CC_GET_CAPABILITY)(
159 IN OUT EFI_CC_BOOT_SERVICE_CAPABILITY *ProtocolCapability
160 );
161
179typedef
181(EFIAPI *EFI_CC_GET_EVENT_LOG)(
183 IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat,
184 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
185 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry,
186 OUT BOOLEAN *EventLogTruncated
187 );
188
208typedef
212 IN UINT64 Flags,
213 IN EFI_PHYSICAL_ADDRESS DataToHash,
214 IN UINT64 DataToHashLen,
215 IN EFI_CC_EVENT *EfiCcEvent
216 );
217
230typedef
234 IN TCG_PCRINDEX PcrIndex,
235 OUT EFI_CC_MR_INDEX *MrIndex
236 );
237
239 EFI_CC_GET_CAPABILITY GetCapability;
240 EFI_CC_GET_EVENT_LOG GetEventLog;
241 EFI_CC_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;
242 EFI_CC_MAP_PCR_TO_MR_INDEX MapPcrToMrIndex;
243};
244
245//
246// CC event log
247//
248
249#pragma pack(1)
250
251//
252// Crypto Agile Log Entry Format.
253// It is similar with TCG_PCR_EVENT2 except the field of MrIndex and PCRIndex.
254//
255typedef struct {
256 EFI_CC_MR_INDEX MrIndex;
257 UINT32 EventType;
258 TPML_DIGEST_VALUES Digests;
259 UINT32 EventSize;
260 UINT8 Event[1];
261} CC_EVENT;
262
263//
264// EFI CC Event Header
265// It is similar with TCG_PCR_EVENT2_HDR except the field of MrIndex and PCRIndex
266//
267typedef struct {
268 EFI_CC_MR_INDEX MrIndex;
269 UINT32 EventType;
270 TPML_DIGEST_VALUES Digests;
271 UINT32 EventSize;
273
274#pragma pack()
275
276//
277// Log entries after Get Event Log service
278//
279
280#define EFI_CC_FINAL_EVENTS_TABLE_VERSION 1
281
282typedef struct {
283 //
284 // The version of this structure. It shall be set to 1.
285 //
286 UINT64 Version;
287 //
288 // Number of events recorded after invocation of GetEventLog API
289 //
290 UINT64 NumberOfEvents;
291 //
292 // List of events of type CC_EVENT.
293 //
294 // CC_EVENT Event[1];
296
297#define EFI_CC_FINAL_EVENTS_TABLE_GUID \
298 {0xdd4a4648, 0x2de7, 0x4665, {0x96, 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46}}
299
300extern EFI_GUID gEfiCcFinalEventsTableGuid;
301
302//
303// Define the CC Measure EventLog ACPI Table
304//
305#pragma pack(1)
306
307typedef struct {
309 EFI_CC_TYPE CcType;
310 UINT16 Rsvd;
311 UINT64 Laml;
312 UINT64 Lasa;
314
315#pragma pack()
316
317//
318// Define the signature and revision of CC Measurement EventLog ACPI Table
319//
320#define EFI_CC_EVENTLOG_ACPI_TABLE_SIGNATURE SIGNATURE_32('C', 'C', 'E', 'L')
321#define EFI_CC_EVENTLOG_ACPI_TABLE_REVISION 1
322
323#endif
EFI_STATUS(EFIAPI * EFI_CC_GET_CAPABILITY)(IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN OUT EFI_CC_BOOT_SERVICE_CAPABILITY *ProtocolCapability)
EFI_STATUS(EFIAPI * EFI_CC_GET_EVENT_LOG)(IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat, OUT EFI_PHYSICAL_ADDRESS *EventLogLocation, OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry, OUT BOOLEAN *EventLogTruncated)
EFI_STATUS(EFIAPI * EFI_CC_MAP_PCR_TO_MR_INDEX)(IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN TCG_PCRINDEX PcrIndex, OUT EFI_CC_MR_INDEX *MrIndex)
EFI_STATUS(EFIAPI * EFI_CC_HASH_LOG_EXTEND_EVENT)(IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN UINT64 Flags, IN EFI_PHYSICAL_ADDRESS DataToHash, IN UINT64 DataToHashLen, IN EFI_CC_EVENT *EfiCcEvent)
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
Definition: Base.h:213