VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/CcMeasurement.h

最後變更 在這個檔案是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 10.5 KB
 
1/** @file
2 If CC Guest firmware supports measurement and an event is created,
3 CC Guest firmware is designed to report the event log with the same
4 data structure in TCG-Platform-Firmware-Profile specification with
5 EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 format.
6
7 The CC Guest firmware supports measurement, the CC Guest Firmware is
8 designed to produce EFI_CC_MEASUREMENT_PROTOCOL with new GUID
9 EFI_CC_MEASUREMENT_PROTOCOL_GUID to report event log and provides hash
10 capability.
11
12Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
13SPDX-License-Identifier: BSD-2-Clause-Patent
14
15**/
16
17#ifndef CC_MEASUREMENT_PROTOCOL_H_
18#define CC_MEASUREMENT_PROTOCOL_H_
19
20#include <IndustryStandard/UefiTcgPlatform.h>
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
26typedef struct _EFI_CC_MEASUREMENT_PROTOCOL EFI_CC_MEASUREMENT_PROTOCOL;
27
28typedef struct {
29 UINT8 Major;
30 UINT8 Minor;
31} EFI_CC_VERSION;
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;
43} EFI_CC_TYPE;
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;
92} EFI_CC_EVENT_HEADER;
93
94typedef struct {
95 //
96 // Total size of the event including the Size component, the header and the Event data.
97 //
98 UINT32 Size;
99 EFI_CC_EVENT_HEADER Header;
100 UINT8 Event[1];
101} EFI_CC_EVENT;
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;
135} EFI_CC_BOOT_SERVICE_CAPABILITY;
136
137/**
138 The EFI_CC_MEASUREMENT_PROTOCOL GetCapability function call provides protocol
139 capability information and state information.
140
141 @param[in] This Indicates the calling context
142 @param[in, out] ProtocolCapability The caller allocates memory for a EFI_CC_BOOT_SERVICE_CAPABILITY
143 structure and sets the size field to the size of the structure allocated.
144 The callee fills in the fields with the EFI CC BOOT Service capability
145 information and the current CC information.
146
147 @retval EFI_SUCCESS Operation completed successfully.
148 @retval EFI_DEVICE_ERROR The command was unsuccessful.
149 The ProtocolCapability variable will not be populated.
150 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
151 The ProtocolCapability variable will not be populated.
152 @retval EFI_BUFFER_TOO_SMALL The ProtocolCapability variable is too small to hold the full response.
153 It will be partially populated (required Size field will be set).
154**/
155typedef
156EFI_STATUS
157(EFIAPI *EFI_CC_GET_CAPABILITY)(
158 IN EFI_CC_MEASUREMENT_PROTOCOL *This,
159 IN OUT EFI_CC_BOOT_SERVICE_CAPABILITY *ProtocolCapability
160 );
161
162/**
163 The EFI_CC_MEASUREMENT_PROTOCOL Get Event Log function call allows a caller to
164 retrieve the address of a given event log and its last entry.
165
166 @param[in] This Indicates the calling context
167 @param[in] EventLogFormat The type of the event log for which the information is requested.
168 @param[out] EventLogLocation A pointer to the memory address of the event log.
169 @param[out] EventLogLastEntry If the Event Log contains more than one entry, this is a pointer to the
170 address of the start of the last entry in the event log in memory.
171 @param[out] EventLogTruncated If the Event Log is missing at least one entry because an event would
172 have exceeded the area allocated for events, this value is set to TRUE.
173 Otherwise, the value will be FALSE and the Event Log will be complete.
174
175 @retval EFI_SUCCESS Operation completed successfully.
176 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect
177 (e.g. asking for an event log whose format is not supported).
178**/
179typedef
180EFI_STATUS
181(EFIAPI *EFI_CC_GET_EVENT_LOG)(
182 IN EFI_CC_MEASUREMENT_PROTOCOL *This,
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
189/**
190 The EFI_CC_MEASUREMENT_PROTOCOL HashLogExtendEvent function call provides
191 callers with an opportunity to extend and optionally log events without requiring
192 knowledge of actual CC commands.
193 The extend operation will occur even if this function cannot create an event
194 log entry (e.g. due to the event log being full).
195
196 @param[in] This Indicates the calling context
197 @param[in] Flags Bitmap providing additional information.
198 @param[in] DataToHash Physical address of the start of the data buffer to be hashed.
199 @param[in] DataToHashLen The length in bytes of the buffer referenced by DataToHash.
200 @param[in] EfiCcEvent Pointer to data buffer containing information about the event.
201
202 @retval EFI_SUCCESS Operation completed successfully.
203 @retval EFI_DEVICE_ERROR The command was unsuccessful.
204 @retval EFI_VOLUME_FULL The extend operation occurred, but the event could not be written to one or more event logs.
205 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
206 @retval EFI_UNSUPPORTED The PE/COFF image type is not supported.
207**/
208typedef
209EFI_STATUS
210(EFIAPI *EFI_CC_HASH_LOG_EXTEND_EVENT)(
211 IN EFI_CC_MEASUREMENT_PROTOCOL *This,
212 IN UINT64 Flags,
213 IN EFI_PHYSICAL_ADDRESS DataToHash,
214 IN UINT64 DataToHashLen,
215 IN EFI_CC_EVENT *EfiCcEvent
216 );
217
218/**
219 The EFI_CC_MEASUREMENT_PROTOCOL MapPcrToMrIndex function call provides callers
220 the info on TPM PCR <-> CC MR mapping information.
221
222 @param[in] This Indicates the calling context
223 @param[in] PcrIndex TPM PCR index.
224 @param[out] MrIndex CC MR index.
225
226 @retval EFI_SUCCESS The MrIndex is returned.
227 @retval EFI_INVALID_PARAMETER The MrIndex is NULL.
228 @retval EFI_UNSUPPORTED The PcrIndex is invalid.
229**/
230typedef
231EFI_STATUS
232(EFIAPI *EFI_CC_MAP_PCR_TO_MR_INDEX)(
233 IN EFI_CC_MEASUREMENT_PROTOCOL *This,
234 IN TCG_PCRINDEX PcrIndex,
235 OUT EFI_CC_MR_INDEX *MrIndex
236 );
237
238struct _EFI_CC_MEASUREMENT_PROTOCOL {
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;
272} CC_EVENT_HDR;
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];
295} EFI_CC_FINAL_EVENTS_TABLE;
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 {
308 EFI_ACPI_DESCRIPTION_HEADER Header;
309 EFI_CC_TYPE CcType;
310 UINT16 Rsvd;
311 UINT64 Laml;
312 UINT64 Lasa;
313} EFI_CC_EVENTLOG_ACPI_TABLE;
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
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette