23#define HANDOFF_TABLE_DESC "TdxTable"
25 UINT8 TableDescriptionSize;
26 UINT8 TableDescription[
sizeof (HANDOFF_TABLE_DESC)];
27 UINT64 NumberOfTables;
33#define FV_HANDOFF_TABLE_DESC "Fv(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)"
70 return EFI_INVALID_PARAMETER;
73 #define TDX_DIGEST_VALUE_LEN (sizeof (UINT32) + sizeof (TPMI_ALG_HASH) + SHA384_DIGEST_SIZE)
76 &gCcEventEntryHobGuid,
77 sizeof (TCG_PCRINDEX) +
sizeof (TCG_EVENTTYPE) +
78 TDX_DIGEST_VALUE_LEN +
79 sizeof (UINT32) + EventSize
82 if (EventHobData ==
NULL) {
83 return EFI_OUT_OF_RESOURCES;
86 Ptr = (UINT8 *)EventHobData;
94 CopyMem (Ptr, &RtmrIndex,
sizeof (UINT32));
95 Ptr +=
sizeof (UINT32);
97 CopyMem (Ptr, &EventType,
sizeof (TCG_EVENTTYPE));
98 Ptr +=
sizeof (TCG_EVENTTYPE);
101 TdxDigest->count = 1;
102 TdxDigest->digests[0].hashAlg = TPM_ALG_SHA384;
104 TdxDigest->digests[0].digest.sha384,
108 Ptr += TDX_DIGEST_VALUE_LEN;
110 CopyMem (Ptr, &EventSize,
sizeof (UINT32));
111 Ptr +=
sizeof (UINT32);
113 CopyMem (Ptr, (VOID *)EventData, EventSize);
162 return &FvExtHeader->
FvName;
189 return EFI_UNSUPPORTED;
193 if (WorkArea ==
NULL) {
203 if (WorkArea->TdxWorkArea.SecTdxWorkArea.TdxMeasurementsData.MeasurementsBitmap & TDX_MEASUREMENT_TDHOB_BITMASK) {
204 HashValue = WorkArea->TdxWorkArea.SecTdxWorkArea.TdxMeasurementsData.TdHobHashValue;
205 HandoffTables.TableDescriptionSize =
sizeof (HandoffTables.TableDescription);
206 CopyMem (HandoffTables.TableDescription, HANDOFF_TABLE_DESC, sizeof (HandoffTables.TableDescription));
207 HandoffTables.NumberOfTables = 1;
209 HandoffTables.TableEntry[0].
VendorTable = TdHobList;
213 EV_EFI_HANDOFF_TABLES2,
214 (UINT8 *)(
UINTN)&HandoffTables,
215 sizeof (HandoffTables),
221 if (EFI_ERROR (Status)) {
229 if (WorkArea->TdxWorkArea.SecTdxWorkArea.TdxMeasurementsData.MeasurementsBitmap & TDX_MEASUREMENT_CFVIMG_BITMASK) {
230 HashValue = WorkArea->TdxWorkArea.SecTdxWorkArea.TdxMeasurementsData.CfvImgHashValue;
231 FvBase = (UINT64)
PcdGet32 (PcdOvmfFlashNvStorageVariableBase);
232 FvLength = (UINT64)
PcdGet32 (PcdCfvRawDataSize);
233 FvBlob2.BlobDescriptionSize =
sizeof (FvBlob2.BlobDescription);
234 CopyMem (FvBlob2.BlobDescription, FV_HANDOFF_TABLE_DESC, sizeof (FvBlob2.BlobDescription));
236 if (FvName !=
NULL) {
237 AsciiSPrint ((CHAR8 *)FvBlob2.BlobDescription, sizeof (FvBlob2.BlobDescription),
"Fv(%g)", FvName);
240 FvBlob2.BlobBase = FvBase;
241 FvBlob2.BlobLength = FvLength;
245 EV_EFI_PLATFORM_FIRMWARE_BLOB2,
253 if (EFI_ERROR (Status)) {
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
#define SHA384_DIGEST_SIZE
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
BOOLEAN EFIAPI TdIsEnabled()
#define FixedPcdGet32(TokenName)
#define PcdGet32(TokenName)
VOID * GetFvName(IN EFI_PHYSICAL_ADDRESS FvBase, IN UINT64 FvLength)
EFI_STATUS InternalBuildGuidHobForTdxMeasurement(VOID)
STATIC EFI_STATUS BuildTdxMeasurementGuidHob(UINT32 RtmrIndex, UINT32 EventType, UINT8 *EventData, UINT32 EventSize, UINT8 *HashValue, UINT32 HashSize)
UINT64 EFI_PHYSICAL_ADDRESS