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