48#define PERF_ID_CC_TCG2_DXE 0x3130
50#define CC_EVENT_LOG_AREA_COUNT_MAX 1
51#define CC_MR_INDEX_0_MRTD 0
52#define CC_MR_INDEX_1_RTMR0 1
53#define CC_MR_INDEX_2_RTMR1 2
54#define CC_MR_INDEX_3_RTMR2 3
55#define CC_MR_INDEX_INVALID 4
64 EFI_CC_EVENT_LOG_FORMAT LogFormat;
68 EFI_CC_EVENT_LOG_FORMAT EventLogFormat;
73 BOOLEAN EventLogStarted;
74 BOOLEAN EventLogTruncated;
75 UINTN Next800155EventOffset;
81 BOOLEAN GetEventLogCalled[CC_EVENT_LOG_AREA_COUNT_MAX];
87 TPMI_ALG_HASH HashAlgo;
95 { &gCcEventEntryHobGuid, EFI_CC_EVENT_LOG_FORMAT_TCG_2 },
103 EFI_CC_BOOT_HASH_ALG_SHA384,
104 EFI_CC_EVENT_LOG_FORMAT_TCG_2,
109UINTN mBootAttempts = 0;
110CHAR16 mBootVarName[] = L
"BootOrder";
122 EFI_CC_EVENTLOG_ACPI_TABLE_SIGNATURE,
123 sizeof (mTdxEventlogAcpiTemplate),
124 EFI_CC_EVENTLOG_ACPI_TABLE_REVISION,
130 { EFI_CC_TYPE_TDX, 0 },
153 IN TPMI_ALG_HASH HashAlgo
158 for (Index = 0; Index <
sizeof (mHashInfo)/
sizeof (mHashInfo[0]); Index++) {
159 if (mHashInfo[Index].HashAlgo == HashAlgo) {
160 return mHashInfo[Index].HashSize;
176 IN TPMI_ALG_HASH HashAlgo
181 for (Index = 0; Index <
ARRAY_SIZE (mHashInfo); Index++) {
182 if (mHashInfo[Index].HashAlgo == HashAlgo) {
183 return mHashInfo[Index].HashMask;
204 IN UINT32 HashAlgorithmMask
209 UINT32 DigestListCount;
210 UINT32 *DigestListCountPtr;
212 DigestListCountPtr = (UINT32 *)Buffer;
214 Buffer = (UINT8 *)Buffer +
sizeof (DigestList->count);
215 for (Index = 0; Index < DigestList->count; Index++) {
216 if ((DigestList->digests[Index].hashAlg & HashAlgorithmMask) == 0) {
217 DEBUG ((DEBUG_ERROR,
"WARNING: TD Event log has HashAlg unsupported (0x%x)\n", DigestList->digests[Index].hashAlg));
221 CopyMem (Buffer, &DigestList->digests[Index].hashAlg, sizeof (DigestList->digests[Index].hashAlg));
222 Buffer = (UINT8 *)Buffer +
sizeof (DigestList->digests[Index].hashAlg);
224 CopyMem (Buffer, &DigestList->digests[Index].digest, DigestSize);
225 Buffer = (UINT8 *)Buffer + DigestSize;
263#define COLUME_SIZE (16 * 2)
281 for (Index = 0; Index < Size; Index++) {
282 DEBUG ((DEBUG_INFO, Index == COLUME_SIZE/2 ?
" | %02x" :
" %02x", (
UINTN)Data[Index]));
304 Count = Size / COLUME_SIZE;
305 Left = Size % COLUME_SIZE;
306 for (Index = 0; Index < Count; Index++) {
307 DEBUG ((DEBUG_INFO,
"%04x: ", Index * COLUME_SIZE));
309 DEBUG ((DEBUG_INFO,
"\n"));
313 DEBUG ((DEBUG_INFO,
"%04x: ", Index * COLUME_SIZE));
315 DEBUG ((DEBUG_INFO,
"\n"));
335 UINT32 DigestListCount;
336 TPMI_ALG_HASH HashAlgId;
339 DigestBuffer = (UINT8 *)NoActionEvent->Digests.digests;
342 NoActionEvent->MrIndex = 0;
343 NoActionEvent->EventType = EV_NO_ACTION;
348 ZeroMem (&NoActionEvent->Digests, sizeof (NoActionEvent->Digests));
350 if ((mTdxDxeData.BsCap.HashAlgorithmBitmap & EFI_CC_BOOT_HASH_ALG_SHA384) != 0) {
351 HashAlgId = TPM_ALG_SHA384;
352 CopyMem (DigestBuffer, &HashAlgId,
sizeof (TPMI_ALG_HASH));
360 WriteUnaligned32 ((UINT32 *)&NoActionEvent->Digests.count, DigestListCount);
388 UINTN EnabledProcessorNum;
393 Status =
gBS->LocateProtocol (&gEfiMpServiceProtocolGuid,
NULL, (VOID **)&MpProtocol);
394 if (EFI_ERROR (Status)) {
398 return EFI_UNSUPPORTED;
401 Status = MpProtocol->GetNumberOfProcessors (
406 if (EFI_ERROR (Status)) {
410 Status =
gBS->AllocatePool (
413 (VOID **)&ProcessorLocBuf
415 if (EFI_ERROR (Status)) {
422 for (Index = 0; Index < ProcessorNum; Index++) {
423 Status = MpProtocol->GetProcessorInfo (
428 if (EFI_ERROR (Status)) {
437 &ProcessorLocBuf[Index],
443 *LocationBuf = ProcessorLocBuf;
475 DEBUG ((DEBUG_VERBOSE,
"TdGetCapability\n"));
477 if ((This ==
NULL) || (ProtocolCapability ==
NULL)) {
478 return EFI_INVALID_PARAMETER;
501 DEBUG ((DEBUG_INFO,
" Event:\n"));
502 DEBUG ((DEBUG_INFO,
" MrIndex - %d\n", EventHdr->PCRIndex));
503 DEBUG ((DEBUG_INFO,
" EventType - 0x%08x\n", EventHdr->EventType));
504 DEBUG ((DEBUG_INFO,
" Digest - "));
505 for (Index = 0; Index <
sizeof (
TCG_DIGEST); Index++) {
506 DEBUG ((DEBUG_INFO,
"%02x ", EventHdr->Digest.digest[Index]));
509 DEBUG ((DEBUG_INFO,
"\n"));
510 DEBUG ((DEBUG_INFO,
" EventSize - 0x%08x\n", EventHdr->EventSize));
526 UINT8 *VendorInfoSize;
528 UINT32 NumberOfAlgorithms;
530 DEBUG ((DEBUG_INFO,
" TCG_EfiSpecIDEventStruct:\n"));
531 DEBUG ((DEBUG_INFO,
" signature - '"));
532 for (Index = 0; Index <
sizeof (TcgEfiSpecIdEventStruct->signature); Index++) {
533 DEBUG ((DEBUG_INFO,
"%c", TcgEfiSpecIdEventStruct->signature[Index]));
536 DEBUG ((DEBUG_INFO,
"'\n"));
537 DEBUG ((DEBUG_INFO,
" platformClass - 0x%08x\n", TcgEfiSpecIdEventStruct->platformClass));
538 DEBUG ((DEBUG_INFO,
" specVersion - %d.%d%d\n", TcgEfiSpecIdEventStruct->specVersionMajor, TcgEfiSpecIdEventStruct->specVersionMinor, TcgEfiSpecIdEventStruct->specErrata));
539 DEBUG ((DEBUG_INFO,
" uintnSize - 0x%02x\n", TcgEfiSpecIdEventStruct->uintnSize));
541 CopyMem (&NumberOfAlgorithms, TcgEfiSpecIdEventStruct + 1,
sizeof (NumberOfAlgorithms));
542 DEBUG ((DEBUG_INFO,
" NumberOfAlgorithms - 0x%08x\n", NumberOfAlgorithms));
545 for (Index = 0; Index < NumberOfAlgorithms; Index++) {
546 DEBUG ((DEBUG_INFO,
" digest(%d)\n", Index));
547 DEBUG ((DEBUG_INFO,
" algorithmId - 0x%04x\n", DigestSize[Index].algorithmId));
548 DEBUG ((DEBUG_INFO,
" digestSize - 0x%04x\n", DigestSize[Index].digestSize));
551 VendorInfoSize = (UINT8 *)&DigestSize[NumberOfAlgorithms];
552 DEBUG ((DEBUG_INFO,
" VendorInfoSize - 0x%02x\n", *VendorInfoSize));
553 VendorInfo = VendorInfoSize + 1;
554 DEBUG ((DEBUG_INFO,
" VendorInfo - "));
555 for (Index = 0; Index < *VendorInfoSize; Index++) {
556 DEBUG ((DEBUG_INFO,
"%02x ", VendorInfo[Index]));
559 DEBUG ((DEBUG_INFO,
"\n"));
573 UINT8 *VendorInfoSize;
574 UINT32 NumberOfAlgorithms;
576 CopyMem (&NumberOfAlgorithms, TcgEfiSpecIdEventStruct + 1,
sizeof (NumberOfAlgorithms));
579 VendorInfoSize = (UINT8 *)&DigestSize[NumberOfAlgorithms];
595 TPMI_ALG_HASH HashAlgo;
601 DEBUG ((DEBUG_INFO,
"Cc Event:\n"));
602 DEBUG ((DEBUG_INFO,
" MrIndex - %d\n", CcEvent->MrIndex));
603 DEBUG ((DEBUG_INFO,
" EventType - 0x%08x\n", CcEvent->EventType));
604 DEBUG ((DEBUG_INFO,
" DigestCount: 0x%08x\n", CcEvent->Digests.count));
606 DigestCount = CcEvent->Digests.count;
607 HashAlgo = CcEvent->Digests.digests[0].hashAlg;
608 DigestBuffer = (UINT8 *)&CcEvent->Digests.digests[0].digest;
609 for (DigestIndex = 0; DigestIndex < DigestCount; DigestIndex++) {
610 DEBUG ((DEBUG_INFO,
" HashAlgo : 0x%04x\n", HashAlgo));
611 DEBUG ((DEBUG_INFO,
" Digest(%d): \n", DigestIndex));
617 CopyMem (&HashAlgo, DigestBuffer + DigestSize,
sizeof (TPMI_ALG_HASH));
618 DigestBuffer = DigestBuffer + DigestSize +
sizeof (TPMI_ALG_HASH);
621 DigestBuffer = DigestBuffer -
sizeof (TPMI_ALG_HASH);
623 CopyMem (&EventSize, DigestBuffer,
sizeof (CcEvent->EventSize));
624 DEBUG ((DEBUG_INFO,
" EventSize - 0x%08x\n", EventSize));
625 EventBuffer = DigestBuffer +
sizeof (CcEvent->EventSize);
627 DEBUG ((DEBUG_INFO,
"\n"));
644 TPMI_ALG_HASH HashAlgo;
650 DigestCount = CcEvent->Digests.count;
651 HashAlgo = CcEvent->Digests.digests[0].hashAlg;
652 DigestBuffer = (UINT8 *)&CcEvent->Digests.digests[0].digest;
653 for (DigestIndex = 0; DigestIndex < DigestCount; DigestIndex++) {
658 CopyMem (&HashAlgo, DigestBuffer + DigestSize,
sizeof (TPMI_ALG_HASH));
659 DigestBuffer = DigestBuffer + DigestSize +
sizeof (TPMI_ALG_HASH);
662 DigestBuffer = DigestBuffer -
sizeof (TPMI_ALG_HASH);
664 CopyMem (&EventSize, DigestBuffer,
sizeof (CcEvent->EventSize));
665 EventBuffer = DigestBuffer +
sizeof (CcEvent->EventSize);
667 return (
UINTN)EventBuffer + EventSize - (
UINTN)CcEvent;
682 IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat,
691 UINTN NumberOfEvents;
693 DEBUG ((DEBUG_INFO,
"EventLogFormat: (0x%x)\n", EventLogFormat));
694 ASSERT (EventLogFormat == EFI_CC_EVENT_LOG_FORMAT_TCG_2);
711 while ((
UINTN)CcEvent <= EventLogLastEntry) {
716 if (FinalEventsTable ==
NULL) {
717 DEBUG ((DEBUG_INFO,
"FinalEventsTable: NOT FOUND\n"));
719 DEBUG ((DEBUG_INFO,
"FinalEventsTable: (0x%x)\n", FinalEventsTable));
720 DEBUG ((DEBUG_INFO,
" Version: (0x%x)\n", FinalEventsTable->Version));
721 DEBUG ((DEBUG_INFO,
" NumberOfEvents: (0x%x)\n", FinalEventsTable->NumberOfEvents));
724 for (NumberOfEvents = 0; NumberOfEvents < FinalEventsTable->NumberOfEvents; NumberOfEvents++) {
754 IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat,
757 OUT BOOLEAN *EventLogTruncated
762 DEBUG ((DEBUG_INFO,
"TdGetEventLog ... (0x%x)\n", EventLogFormat));
763 ASSERT (EventLogFormat == EFI_CC_EVENT_LOG_FORMAT_TCG_2);
765 if (EventLogLocation !=
NULL) {
766 *EventLogLocation = mTdxDxeData.EventLogAreaStruct[Index].Lasa;
767 DEBUG ((DEBUG_INFO,
"TdGetEventLog (EventLogLocation - %x)\n", *EventLogLocation));
770 if (EventLogLastEntry !=
NULL) {
771 if (!mTdxDxeData.EventLogAreaStruct[Index].EventLogStarted) {
777 DEBUG ((DEBUG_INFO,
"TdGetEventLog (EventLogLastEntry - %x)\n", *EventLogLastEntry));
780 if (EventLogTruncated !=
NULL) {
781 *EventLogTruncated = mTdxDxeData.EventLogAreaStruct[Index].EventLogTruncated;
782 DEBUG ((DEBUG_INFO,
"TdGetEventLog (EventLogTruncated - %x)\n", *EventLogTruncated));
788 if ((EventLogLocation !=
NULL) && (EventLogLastEntry !=
NULL)) {
789 DumpCcEventLog (EventLogFormat, *EventLogLocation, *EventLogLastEntry, mTdxDxeData.FinalEventsTable[Index]);
796 mTdxDxeData.GetEventLogCalled[Index] =
TRUE;
815 IN VOID *NewEventHdr,
816 IN UINT32 NewEventHdrSize,
817 IN UINT8 *NewEventData,
818 IN UINT32 NewEventSize
825 TCG_Sp800_155_PlatformId_Event2_SIGNATURE,
826 sizeof (TCG_Sp800_155_PlatformId_Event2_SIGNATURE) - 1
830 TCG_Sp800_155_PlatformId_Event3_SIGNATURE,
831 sizeof (TCG_Sp800_155_PlatformId_Event3_SIGNATURE) - 1
856 IN VOID *NewEventHdr,
857 IN UINT32 NewEventHdrSize,
858 IN UINT8 *NewEventData,
859 IN UINT32 NewEventSize
863 BOOLEAN Record800155Event;
867 DEBUG ((DEBUG_VERBOSE,
"Td: Try to log event. Index = %d, EventType = 0x%x\n", CcEventHdr->MrIndex, CcEventHdr->EventType));
869 if (NewEventSize >
MAX_ADDRESS - NewEventHdrSize) {
870 return EFI_OUT_OF_RESOURCES;
873 NewLogSize = NewEventHdrSize + NewEventSize;
875 if (NewLogSize >
MAX_ADDRESS - EventLogAreaStruct->EventLogSize) {
876 return EFI_OUT_OF_RESOURCES;
879 if (NewLogSize + EventLogAreaStruct->EventLogSize > EventLogAreaStruct->Laml) {
880 DEBUG ((DEBUG_INFO,
" Laml - 0x%x\n", EventLogAreaStruct->Laml));
881 DEBUG ((DEBUG_INFO,
" NewLogSize - 0x%x\n", NewLogSize));
882 DEBUG ((DEBUG_INFO,
" LogSize - 0x%x\n", EventLogAreaStruct->EventLogSize));
883 DEBUG ((DEBUG_INFO,
"TcgCommLogEvent - %r\n", EFI_OUT_OF_RESOURCES));
884 return EFI_OUT_OF_RESOURCES;
892 Record800155Event =
Is800155Event (NewEventHdr, NewEventHdrSize, NewEventData, NewEventSize);
893 if (Record800155Event) {
894 DEBUG ((DEBUG_INFO,
"It is 800155Event.\n"));
896 if (EventLogAreaStruct->Next800155EventOffset != 0) {
898 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset + NewLogSize,
899 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset,
900 EventLogAreaStruct->EventLogSize - EventLogAreaStruct->Next800155EventOffset
904 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset,
909 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset + NewEventHdrSize,
914 EventLogAreaStruct->Next800155EventOffset += NewLogSize;
915 EventLogAreaStruct->LastEvent += NewLogSize;
916 EventLogAreaStruct->EventLogSize += NewLogSize;
922 EventLogAreaStruct->LastEvent = (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->EventLogSize;
923 EventLogAreaStruct->EventLogSize += NewLogSize;
925 CopyMem (EventLogAreaStruct->LastEvent, NewEventHdr, NewEventHdrSize);
927 EventLogAreaStruct->LastEvent + NewEventHdrSize,
963 return CC_MR_INDEX_INVALID;
968 MrIndex = CC_MR_INDEX_0_MRTD;
969 }
else if ((PCRIndex == 1) || (PCRIndex == 7)) {
970 MrIndex = CC_MR_INDEX_1_RTMR0;
971 }
else if ((PCRIndex >= 2) && (PCRIndex <= 6)) {
972 MrIndex = CC_MR_INDEX_2_RTMR1;
973 }
else if ((PCRIndex >= 8) && (PCRIndex <= 15)) {
974 MrIndex = CC_MR_INDEX_3_RTMR2;
988 if (MrIndex ==
NULL) {
989 return EFI_INVALID_PARAMETER;
994 return *MrIndex == CC_MR_INDEX_INVALID ? EFI_INVALID_PARAMETER :
EFI_SUCCESS;
1012 IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat,
1013 IN VOID *NewEventHdr,
1014 IN UINT32 NewEventHdrSize,
1015 IN UINT8 *NewEventData,
1016 IN UINT32 NewEventSize
1023 if (EventLogFormat != EFI_CC_EVENT_LOG_FORMAT_TCG_2) {
1025 return EFI_INVALID_PARAMETER;
1033 EventLogAreaStruct = &mTdxDxeData.EventLogAreaStruct[Index];
1035 if (EventLogAreaStruct->EventLogTruncated) {
1036 return EFI_VOLUME_FULL;
1047 if (Status == EFI_OUT_OF_RESOURCES) {
1048 EventLogAreaStruct->EventLogTruncated =
TRUE;
1049 return EFI_VOLUME_FULL;
1051 EventLogAreaStruct->EventLogStarted =
TRUE;
1057 if (mTdxDxeData.GetEventLogCalled[Index]) {
1058 if (mTdxDxeData.FinalEventsTable[Index] ==
NULL) {
1065 EventLogAreaStruct = &mTdxDxeData.FinalEventLogAreaStruct[Index];
1067 if (EventLogAreaStruct->EventLogTruncated) {
1068 return EFI_VOLUME_FULL;
1078 if (Status == EFI_OUT_OF_RESOURCES) {
1079 EventLogAreaStruct->EventLogTruncated =
TRUE;
1080 return EFI_VOLUME_FULL;
1082 EventLogAreaStruct->EventLogStarted =
TRUE;
1086 (mTdxDxeData.FinalEventsTable[Index])->NumberOfEvents++;
1087 DEBUG ((DEBUG_INFO,
"FinalEventsTable->NumberOfEvents - 0x%x\n", (mTdxDxeData.FinalEventsTable[Index])->NumberOfEvents));
1088 DEBUG ((DEBUG_INFO,
" Size - 0x%x\n", (
UINTN)EventLogAreaStruct->EventLogSize));
1104 IN VOID *DigestListBin
1111 TPMI_ALG_HASH HashAlg;
1114 TotalSize =
sizeof (Count);
1115 DigestListBin = (UINT8 *)DigestListBin +
sizeof (Count);
1116 for (Index = 0; Index < Count; Index++) {
1118 TotalSize +=
sizeof (HashAlg);
1119 DigestListBin = (UINT8 *)DigestListBin +
sizeof (HashAlg);
1122 TotalSize += DigestSize;
1123 DigestListBin = (UINT8 *)DigestListBin + DigestSize;
1141 IN OUT VOID *Buffer,
1142 IN VOID *DigestListBin,
1143 IN UINT32 HashAlgorithmMask,
1144 OUT UINT32 *HashAlgorithmMaskCopied
1150 TPMI_ALG_HASH HashAlg;
1151 UINT32 DigestListCount;
1152 UINT32 *DigestListCountPtr;
1154 DigestListCountPtr = (UINT32 *)Buffer;
1155 DigestListCount = 0;
1156 *HashAlgorithmMaskCopied = 0;
1159 Buffer = (UINT8 *)Buffer +
sizeof (Count);
1160 DigestListBin = (UINT8 *)DigestListBin +
sizeof (Count);
1161 for (Index = 0; Index < Count; Index++) {
1163 DigestListBin = (UINT8 *)DigestListBin +
sizeof (HashAlg);
1166 if ((HashAlg & HashAlgorithmMask) != 0) {
1167 CopyMem (Buffer, &HashAlg,
sizeof (HashAlg));
1168 Buffer = (UINT8 *)Buffer +
sizeof (HashAlg);
1169 CopyMem (Buffer, DigestListBin, DigestSize);
1170 Buffer = (UINT8 *)Buffer + DigestSize;
1174 DEBUG ((DEBUG_ERROR,
"WARNING: CopyDigestListBinToBuffer Event log has HashAlg unsupported by PCR bank (0x%x)\n", HashAlg));
1177 DigestListBin = (UINT8 *)DigestListBin + DigestSize;
1203 IN UINT8 *NewEventData
1210 UINT8 *DigestBuffer;
1211 UINT32 *EventSizePtr;
1212 EFI_CC_EVENT_LOG_FORMAT LogFormat;
1215 LogFormat = EFI_CC_EVENT_LOG_FORMAT_TCG_2;
1217 ZeroMem (&CcEvent,
sizeof (CcEvent));
1218 CcEvent.MrIndex = NewEventHdr->MrIndex;
1219 CcEvent.EventType = NewEventHdr->EventType;
1220 DigestBuffer = (UINT8 *)&CcEvent.Digests;
1222 CopyMem (EventSizePtr, &NewEventHdr->EventSize, sizeof (NewEventHdr->EventSize));
1227 OldTpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
1231 sizeof (CcEvent.MrIndex) + sizeof (CcEvent.EventType) +
GetDigestListBinSize (DigestBuffer) +
sizeof (CcEvent.EventSize),
1233 NewEventHdr->EventSize
1239 gBS->RestoreTPL (OldTpl);
1264 IN UINT64 HashDataLen,
1266 IN UINT8 *NewEventData
1273 if (NewEventHdr->EventType == EV_NO_ACTION) {
1279 if ((Flags & EFI_CC_FLAG_EXTEND_ONLY) == 0) {
1295 NewEventHdr->MrIndex - 1,
1300 if (!EFI_ERROR (Status)) {
1301 if ((Flags & EFI_CC_FLAG_EXTEND_ONLY) == 0) {
1334 IN UINT64 DataToHashLen,
1342 DEBUG ((DEBUG_VERBOSE,
"TdHashLogExtendEvent ...\n"));
1344 if ((This ==
NULL) || (CcEvent ==
NULL)) {
1345 return EFI_INVALID_PARAMETER;
1351 if ((CcEvent->Header.EventType != EV_NO_ACTION) && (DataToHash == 0)) {
1352 return EFI_INVALID_PARAMETER;
1355 if (CcEvent->Size < CcEvent->Header.HeaderSize + sizeof (UINT32)) {
1356 return EFI_INVALID_PARAMETER;
1359 if (CcEvent->Header.MrIndex == CC_MR_INDEX_0_MRTD) {
1360 DEBUG ((DEBUG_ERROR,
"%a: MRTD cannot be extended in TDVF.\n", __func__));
1361 return EFI_INVALID_PARAMETER;
1364 if (CcEvent->Header.MrIndex >= CC_MR_INDEX_INVALID) {
1365 DEBUG ((DEBUG_ERROR,
"%a: MrIndex is invalid. (%d)\n", __func__, CcEvent->Header.MrIndex));
1366 return EFI_INVALID_PARAMETER;
1369 NewEventHdr.MrIndex = CcEvent->Header.MrIndex;
1370 NewEventHdr.EventType = CcEvent->Header.EventType;
1371 NewEventHdr.EventSize = CcEvent->Size -
sizeof (UINT32) - CcEvent->Header.HeaderSize;
1372 if ((Flags & EFI_CC_FLAG_PE_COFF_IMAGE) != 0) {
1382 NewEventHdr.MrIndex - 1,
1384 (
UINTN)DataToHashLen,
1387 if (!EFI_ERROR (Status)) {
1388 if ((Flags & EFI_CC_FLAG_EXTEND_ONLY) == 0) {
1395 (UINT8 *)(
UINTN)DataToHash,
1402 DEBUG ((DEBUG_VERBOSE,
"TdHashLogExtendEvent - %r\n", Status));
1413#define TD_HASH_COUNT 1
1414#define TEMP_BUF_LEN (sizeof(TCG_EfiSpecIDEventStruct) + sizeof(UINT32) \
1415 + (TD_HASH_COUNT * sizeof(TCG_EfiSpecIdEventAlgorithmSize)) + sizeof(UINT8))
1433 UINT8 TempBuf[TEMP_BUF_LEN];
1437 UINT8 *VendorInfoSize;
1438 UINT32 NumberOfAlgorithms;
1439 EFI_CC_EVENT_LOG_FORMAT LogFormat;
1444 DEBUG ((DEBUG_INFO,
"SetupCcEventLog\n"));
1447 LogFormat = EFI_CC_EVENT_LOG_FORMAT_TCG_2;
1452 mTdxDxeData.EventLogAreaStruct[Index].EventLogFormat = LogFormat;
1455 Status =
gBS->AllocatePages (
1461 if (EFI_ERROR (Status)) {
1465 mTdxDxeData.EventLogAreaStruct[Index].Lasa = Lasa;
1466 mTdxDxeData.EventLogAreaStruct[Index].Laml =
PcdGet32 (PcdTcgLogAreaMinLen);
1467 mTdxDxeData.EventLogAreaStruct[Index].Next800155EventOffset = 0;
1473 PcdSet32S (PcdCcEventlogAcpiTableLaml, (UINT32)mTdxDxeData.EventLogAreaStruct[Index].Laml);
1474 PcdSet64S (PcdCcEventlogAcpiTableLasa, mTdxDxeData.EventLogAreaStruct[Index].Lasa);
1490 CopyMem (TcgEfiSpecIdEventStruct->signature, TCG_EfiSpecIDEventStruct_SIGNATURE_03, sizeof (TcgEfiSpecIdEventStruct->signature));
1492 TcgEfiSpecIdEventStruct->platformClass =
PcdGet8 (PcdTpmPlatformClass);
1494 TcgEfiSpecIdEventStruct->specVersionMajor = TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM2;
1495 TcgEfiSpecIdEventStruct->specVersionMinor = TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM2;
1496 TcgEfiSpecIdEventStruct->specErrata = TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2;
1497 TcgEfiSpecIdEventStruct->uintnSize =
sizeof (
UINTN)/
sizeof (UINT32);
1498 NumberOfAlgorithms = 0;
1500 +
sizeof (*TcgEfiSpecIdEventStruct)
1501 +
sizeof (NumberOfAlgorithms));
1503 TempDigestSize = DigestSize;
1504 TempDigestSize += NumberOfAlgorithms;
1505 TempDigestSize->algorithmId = TPM_ALG_SHA384;
1507 NumberOfAlgorithms++;
1509 CopyMem (TcgEfiSpecIdEventStruct + 1, &NumberOfAlgorithms,
sizeof (NumberOfAlgorithms));
1510 TempDigestSize = DigestSize;
1511 TempDigestSize += NumberOfAlgorithms;
1512 VendorInfoSize = (UINT8 *)TempDigestSize;
1513 *VendorInfoSize = 0;
1515 SpecIdEvent.PCRIndex = 1;
1516 SpecIdEvent.EventType = EV_NO_ACTION;
1517 ZeroMem (&SpecIdEvent.Digest, sizeof (SpecIdEvent.Digest));
1529 sizeof (SpecIdEvent),
1530 (UINT8 *)TcgEfiSpecIdEventStruct,
1531 SpecIdEvent.EventSize
1537 mTdxDxeData.EventLogAreaStruct[Index].Next800155EventOffset = mTdxDxeData.EventLogAreaStruct[Index].EventLogSize;
1543 while (GuidHob.Guid !=
NULL) {
1549 sizeof (NoActionEvent.MrIndex) + sizeof (NoActionEvent.EventType) +
GetDigestListBinSize (&NoActionEvent.Digests) + sizeof (NoActionEvent.EventSize),
1550 GET_GUID_HOB_DATA (GuidHob.Guid),
1551 GET_GUID_HOB_DATA_SIZE (GuidHob.Guid)
1554 GuidHob.Guid = GET_NEXT_HOB (GuidHob);
1555 GuidHob.Guid =
GetNextGuidHob (&gTcg800155PlatformIdEventHobGuid, GuidHob.Guid);
1561 Status =
gBS->AllocatePages (
1567 if (EFI_ERROR (Status)) {
1576 mTdxDxeData.FinalEventsTable[Index] = (VOID *)(
UINTN)Lasa;
1577 (mTdxDxeData.FinalEventsTable[Index])->Version = EFI_TCG2_FINAL_EVENTS_TABLE_VERSION;
1578 (mTdxDxeData.FinalEventsTable[Index])->NumberOfEvents = 0;
1580 mTdxDxeData.FinalEventLogAreaStruct[Index].EventLogFormat = LogFormat;
1583 mTdxDxeData.FinalEventLogAreaStruct[Index].EventLogSize = 0;
1584 mTdxDxeData.FinalEventLogAreaStruct[Index].LastEvent = (VOID *)(
UINTN)mTdxDxeData.FinalEventLogAreaStruct[Index].Lasa;
1585 mTdxDxeData.FinalEventLogAreaStruct[Index].EventLogStarted =
FALSE;
1586 mTdxDxeData.FinalEventLogAreaStruct[Index].EventLogTruncated =
FALSE;
1587 mTdxDxeData.FinalEventLogAreaStruct[Index].Next800155EventOffset = 0;
1592 Status =
gBS->InstallConfigurationTable (&gEfiCcFinalEventsTableGuid, (VOID *)mTdxDxeData.FinalEventsTable[Index]);
1593 if (EFI_ERROR (Status)) {
1618 CcEvent.MrIndex = MrIndex;
1619 CcEvent.EventType = EV_EFI_ACTION;
1648 ProcessorLocBuf =
NULL;
1651 if (
PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) {
1658 if (!EFI_ERROR (Status)) {
1660 CcEvent.EventType = EV_TABLE_OF_DEVICES;
1661 CcEvent.EventSize =
sizeof (HandoffTables);
1663 HandoffTables.NumberOfTables = 1;
1664 HandoffTables.TableEntry[0].
VendorGuid = gEfiMpServiceProtocolGuid;
1665 HandoffTables.TableEntry[0].
VendorTable = ProcessorLocBuf;
1669 (UINT8 *)(
UINTN)ProcessorLocBuf,
1672 (UINT8 *)&HandoffTables
1699 DEBUG ((DEBUG_INFO,
"MeasureSeparatorEvent to Rtmr - %d\n", MrIndex));
1702 CcEvent.MrIndex = MrIndex;
1703 CcEvent.EventType = EV_SEPARATOR;
1704 CcEvent.EventSize = (UINT32)
sizeof (EventData);
1708 (UINT8 *)&EventData,
1733 IN TCG_EVENTTYPE EventType,
1742 UINTN VarNameLength;
1745 DEBUG ((DEBUG_INFO,
"TdTcg2Dxe: MeasureVariable (Rtmr - %x, EventType - %x, ", (
UINTN)MrIndex, (
UINTN)EventType));
1746 DEBUG ((DEBUG_INFO,
"VariableName - %s, VendorGuid - %g)\n", VarName, VendorGuid));
1748 VarNameLength =
StrLen (VarName);
1749 CcEvent.MrIndex = MrIndex;
1750 CcEvent.EventType = EventType;
1752 CcEvent.EventSize = (UINT32)(
sizeof (*VarLog) + VarNameLength *
sizeof (*VarName) + VarSize
1753 -
sizeof (VarLog->UnicodeName) -
sizeof (VarLog->
VariableData));
1756 if (VarLog ==
NULL) {
1757 return EFI_OUT_OF_RESOURCES;
1760 VarLog->VariableName = *VendorGuid;
1761 VarLog->UnicodeNameLength = VarNameLength;
1762 VarLog->VariableDataLength = VarSize;
1764 VarLog->UnicodeName,
1766 VarNameLength * sizeof (*VarName)
1768 if ((VarSize != 0) && (VarData !=
NULL)) {
1770 (CHAR16 *)VarLog->UnicodeName + VarNameLength,
1776 if (EventType == EV_EFI_VARIABLE_DRIVER_CONFIG) {
1788 ASSERT (VarData !=
NULL);
1820 IN TCG_EVENTTYPE EventType,
1829 Status =
GetVariable2 (VarName, VendorGuid, VarData, VarSize);
1830 if (EventType == EV_EFI_VARIABLE_DRIVER_CONFIG) {
1831 if (EFI_ERROR (Status)) {
1842 if (EFI_ERROR (Status)) {
1843 return EFI_NOT_FOUND;
1882 EV_EFI_VARIABLE_BOOT,
1913 EV_EFI_VARIABLE_DRIVER_CONFIG,
1945 &gEfiGlobalVariableGuid,
1949 if ((Status == EFI_NOT_FOUND) || (BootOrder ==
NULL)) {
1953 if (EFI_ERROR (Status)) {
1961 BootCount /=
sizeof (*BootOrder);
1962 for (Index = 0; Index < BootCount; Index++) {
1963 UnicodeSPrint (mBootVarName,
sizeof (mBootVarName), L
"Boot%04x", BootOrder[Index]);
1966 &gEfiGlobalVariableGuid,
1970 if (!EFI_ERROR (Status)) {
1999 Status = EFI_NOT_FOUND;
2000 for (Index = 0; Index <
sizeof (mVariableType)/
sizeof (mVariableType[0]); Index++) {
2002 mVariableType[Index].VariableName,
2003 mVariableType[Index].VendorGuid,
2007 if (!EFI_ERROR (Status)) {
2018 if (!EFI_ERROR (Status)) {
2021 EV_EFI_VARIABLE_DRIVER_CONFIG,
2023 &gEfiImageSecurityDatabaseGuid,
2051 CcEvent.EventType = EV_EFI_ACTION;
2052 CcEvent.EventSize =
sizeof (FIRMWARE_DEBUGGER_EVENT_STRING) - 1;
2055 (UINT8 *)FIRMWARE_DEBUGGER_EVENT_STRING,
2056 sizeof (FIRMWARE_DEBUGGER_EVENT_STRING) - 1,
2058 (UINT8 *)FIRMWARE_DEBUGGER_EVENT_STRING
2090 Status =
gBS->LocateProtocol (&gEfiVariableWriteArchProtocolGuid,
NULL, (VOID **)&Protocol);
2091 if (EFI_ERROR (Status)) {
2095 if (
PcdGetBool (PcdFirmwareDebuggerInitialized)) {
2097 DEBUG ((DEBUG_INFO,
"MeasureLaunchOfFirmwareDebugger - %r\n", Status));
2101 DEBUG ((DEBUG_INFO,
"MeasureAllSecureVariables - %r\n", Status));
2110 DEBUG ((DEBUG_INFO,
"MeasureSeparatorEvent - %r\n", Status));
2132 PERF_START_EX (mImageHandle,
"EventRec",
"TdTcg2Dxe", 0, PERF_ID_CC_TCG2_DXE);
2133 if (mBootAttempts == 0) {
2138 if (EFI_ERROR (Status)) {
2139 DEBUG ((DEBUG_ERROR,
"HOBs not Measured. Error!\n"));
2146 if (EFI_ERROR (Status)) {
2147 DEBUG ((DEBUG_ERROR,
"Boot Variables not Measured. Error!\n"));
2155 EFI_CALLING_EFI_APPLICATION
2157 if (EFI_ERROR (Status)) {
2158 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_CALLING_EFI_APPLICATION));
2172 if (EFI_ERROR (Status)) {
2173 DEBUG ((DEBUG_ERROR,
"Separator Event not Measured to RTMR[1]. Error!\n"));
2193 EFI_RETURNING_FROM_EFI_APPLICATION
2195 if (EFI_ERROR (Status)) {
2196 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_RETURNING_FROM_EFI_APPLICATION));
2205 EFI_CALLING_EFI_APPLICATION
2207 if (EFI_ERROR (Status)) {
2208 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_CALLING_EFI_APPLICATION));
2212 DEBUG ((DEBUG_INFO,
"TdTcg2Dxe Measure Data when ReadyToBoot\n"));
2217 PERF_END_EX (mImageHandle,
"EventRec",
"Tcg2Dxe", 0, PERF_ID_CC_TCG2_DXE + 1);
2243 EFI_EXIT_BOOT_SERVICES_INVOCATION
2245 if (EFI_ERROR (Status)) {
2246 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_INVOCATION));
2254 EFI_EXIT_BOOT_SERVICES_SUCCEEDED
2256 if (EFI_ERROR (Status)) {
2257 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_SUCCEEDED));
2284 EFI_EXIT_BOOT_SERVICES_FAILED
2286 if (EFI_ERROR (Status)) {
2287 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_FAILED));
2299 VOID *DigestListBin;
2300 UINT32 DigestListBinSize;
2303 EFI_CC_EVENT_LOG_FORMAT LogFormat;
2305 DEBUG ((DEBUG_INFO,
"Sync Cc event from SEC\n"));
2308 LogFormat = EFI_CC_EVENT_LOG_FORMAT_TCG_2;
2311 while (!EFI_ERROR (Status) && GuidHob.Guid !=
NULL) {
2312 CcEvent =
AllocateCopyPool (GET_GUID_HOB_DATA_SIZE (GuidHob.Guid), GET_GUID_HOB_DATA (GuidHob.Guid));
2313 if (CcEvent ==
NULL) {
2314 return EFI_OUT_OF_RESOURCES;
2317 GuidHob.Guid = GET_NEXT_HOB (GuidHob);
2318 GuidHob.Guid =
GetNextGuidHob (&gCcEventEntryHobGuid, GuidHob.Guid);
2320 DigestListBin = (UINT8 *)CcEvent +
sizeof (UINT32) +
sizeof (TCG_EVENTTYPE);
2326 EventSize = *(UINT32 *)((UINT8 *)DigestListBin + DigestListBinSize);
2327 Event = (UINT8 *)DigestListBin + DigestListBinSize +
sizeof (UINT32);
2335 sizeof (UINT32) +
sizeof (TCG_EVENTTYPE) + DigestListBinSize +
sizeof (UINT32),
2364 Status =
gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid,
NULL, (VOID **)&AcpiTable);
2365 if (EFI_ERROR (Status)) {
2366 DEBUG ((DEBUG_ERROR,
"TD: AcpiTableProtocol is not installed. %r\n", Status));
2370 mTdxEventlogAcpiTemplate.Laml = (UINT64)
PcdGet32 (PcdCcEventlogAcpiTableLaml);
2371 mTdxEventlogAcpiTemplate.Lasa =
PcdGet64 (PcdCcEventlogAcpiTableLasa);
2372 CopyMem (mTdxEventlogAcpiTemplate.Header.OemId,
PcdGetPtr (PcdAcpiDefaultOemId),
sizeof (mTdxEventlogAcpiTemplate.Header.OemId));
2373 mTdxEventlogAcpiTemplate.Header.OemTableId =
PcdGet64 (PcdAcpiDefaultOemTableId);
2374 mTdxEventlogAcpiTemplate.Header.OemRevision =
PcdGet32 (PcdAcpiDefaultOemRevision);
2375 mTdxEventlogAcpiTemplate.Header.CreatorId =
PcdGet32 (PcdAcpiDefaultCreatorId);
2376 mTdxEventlogAcpiTemplate.Header.CreatorRevision =
PcdGet32 (PcdAcpiDefaultCreatorRevision);
2380 Status = AcpiTable->InstallAcpiTable (
2382 &mTdxEventlogAcpiTemplate,
2383 mTdxEventlogAcpiTemplate.Header.Length,
2388 DEBUG ((DEBUG_INFO,
"TDVF Eventlog ACPI Table is installed.\n"));
2406 Status =
gBS->InstallMultipleProtocolInterfaces (
2408 &gEfiCcMeasurementProtocolGuid,
2412 DEBUG ((DEBUG_INFO,
"CcProtocol: Install %r\n", Status));
2437 return EFI_UNSUPPORTED;
2440 mImageHandle = ImageHandle;
2448 mTdxDxeData.BsCap.ProtocolVersion.Major = 1;
2449 mTdxDxeData.BsCap.ProtocolVersion.Minor = 0;
2450 mTdxDxeData.BsCap.StructureVersion.Major = 1;
2451 mTdxDxeData.BsCap.StructureVersion.Minor = 0;
2457 mTdxDxeData.BsCap.HashAlgorithmBitmap = HASH_ALG_SHA384;
2460 mTdxDxeData.BsCap.SupportedEventLogs = EFI_CC_EVENT_LOG_FORMAT_TCG_2;
2468 if (!EFI_ERROR (Status)) {
2469 Status = SyncCcEvent ();
2483 Status =
gBS->CreateEventEx (
2488 &gEfiEventExitBootServicesGuid,
2495 Status =
gBS->CreateEventEx (
2500 &gEventExitBootServicesFailedGuid,
2515 DEBUG ((DEBUG_INFO,
"InstallCcMeasurementProtocol - %r\n", Status));
2525 DEBUG ((DEBUG_ERROR,
"%a: CcMeasurement protocol failed to be installed - %r\n", __func__, Status));
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
VOID *EFIAPI GetNextGuidHob(IN CONST EFI_GUID *Guid, IN CONST VOID *HobStart)
#define SHA384_DIGEST_SIZE
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
UINT16 EFIAPI ReadUnaligned16(IN CONST UINT16 *Buffer)
VOID EFIAPI CpuDeadLoop(VOID)
UINT32 EFIAPI WriteUnaligned32(OUT UINT32 *Buffer, IN UINT32 Value)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
UINT32 EFIAPI ReadUnaligned32(IN CONST UINT32 *Buffer)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define EFI_KEY_EXCHANGE_KEY_NAME
#define EFI_PLATFORM_KEY_NAME
#define EFI_SECURE_BOOT_MODE_NAME
EFI_STATUS EFIAPI HashAndExtend(IN TPMI_DH_PCR PcrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT TPML_DIGEST_VALUES *DigestList)
#define EFI_IMAGE_SECURITY_DATABASE2
#define EFI_IMAGE_SECURITY_DATABASE1
#define EFI_IMAGE_SECURITY_DATABASE
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define ARRAY_SIZE(Array)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
BOOLEAN EFIAPI TdIsEnabled()
#define PcdGet64(TokenName)
#define PcdGet8(TokenName)
#define PcdGet32(TokenName)
#define PcdGetBool(TokenName)
#define PcdSet64S(TokenName, Value)
#define PcdSet32S(TokenName, Value)
#define PcdGetPtr(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID EFIAPI OnExitBootServicesFailed(IN EFI_EVENT Event, IN VOID *Context)
VOID InternalDumpData(IN UINT8 *Data, IN UINTN Size)
UINTN GetTcgEfiSpecIdEventStructSize(IN TCG_EfiSpecIDEventStruct *TcgEfiSpecIdEventStruct)
VOID * CopyDigestListBinToBuffer(IN OUT VOID *Buffer, IN VOID *DigestListBin, IN UINT32 HashAlgorithmMask, OUT UINT32 *HashAlgorithmMaskCopied)
EFI_STATUS MeasureLaunchOfFirmwareDebugger(VOID)
EFI_STATUS EFIAPI TdGetEventLog(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 MeasureAllSecureVariables(VOID)
VOID InternalDumpHex(IN UINT8 *Data, IN UINTN Size)
EFI_STATUS TcgCommLogEvent(IN OUT CC_EVENT_LOG_AREA_STRUCT *EventLogAreaStruct, IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize)
VOID DumpTcgEfiSpecIdEventStruct(IN TCG_EfiSpecIDEventStruct *TcgEfiSpecIdEventStruct)
BOOLEAN Is800155Event(IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize)
EFI_STATUS TdxDxeLogHashEvent(IN TPML_DIGEST_VALUES *DigestList, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
EFI_STATUS GetProcessorsCpuLocation(OUT EFI_CPU_PHYSICAL_LOCATION **LocationBuf, OUT UINTN *Num)
VOID DumpCcEvent(IN CC_EVENT *CcEvent)
VOID EFIAPI MeasureSecureBootPolicy(IN EFI_EVENT Event, IN VOID *Context)
UINT32 GetDigestListBinSize(IN VOID *DigestListBin)
EFI_STATUS MeasureVariable(IN UINT32 MrIndex, IN TCG_EVENTTYPE EventType, IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, IN VOID *VarData, IN UINTN VarSize)
EFI_STATUS EFIAPI TdHashLogExtendEvent(IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN UINT64 Flags, IN EFI_PHYSICAL_ADDRESS DataToHash, IN UINT64 DataToHashLen, IN EFI_CC_EVENT *CcEvent)
VOID EFIAPI OnReadyToBoot(IN EFI_EVENT Event, IN VOID *Context)
VOID InitNoActionEvent(IN OUT CC_EVENT_HDR *NoActionEvent, IN UINT32 EventSize)
EFI_STATUS MeasurePeImageAndExtend(IN UINT32 RtmrIndex, IN EFI_PHYSICAL_ADDRESS ImageAddress, IN UINTN ImageSize, OUT TPML_DIGEST_VALUES *DigestList)
VOID EFIAPI OnExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
VOID DumpPcrEvent(IN TCG_PCR_EVENT_HDR *EventHdr)
EFI_STATUS ReadAndMeasureBootVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
EFI_STATUS MeasureSeparatorEvent(IN UINT32 MrIndex)
VOID EFIAPI InstallAcpiTable(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS InstallCcMeasurementProtocol(VOID)
VOID DumpCcEventLog(IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat, IN EFI_PHYSICAL_ADDRESS EventLogLocation, IN EFI_PHYSICAL_ADDRESS EventLogLastEntry, IN EFI_CC_FINAL_EVENTS_TABLE *FinalEventsTable)
EFI_STATUS TdxDxeLogEvent(IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat, IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize)
EFI_STATUS TdMeasureAction(IN UINT32 MrIndex, IN CHAR8 *String)
EFI_STATUS TdxDxeHashLogExtendEvent(IN UINT64 Flags, IN UINT8 *HashData, IN UINT64 HashDataLen, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
EFI_STATUS MeasureHandoffTables(VOID)
EFI_STATUS ReadAndMeasureSecureVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
EFI_STATUS ReadAndMeasureVariable(IN UINT32 MrIndex, IN TCG_EVENTTYPE EventType, IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
EFI_STATUS MeasureAllBootVariables(VOID)
UINT32 EFIAPI MapPcrToMrIndex(IN UINT32 PCRIndex)
EFI_STATUS EFIAPI TdGetCapability(IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN OUT EFI_CC_BOOT_SERVICE_CAPABILITY *ProtocolCapability)
EFI_STATUS EFIAPI DriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
UINT32 GetHashMaskFromAlgo(IN TPMI_ALG_HASH HashAlgo)
VOID * CopyDigestListToBuffer(IN OUT VOID *Buffer, IN TPML_DIGEST_VALUES *DigestList, IN UINT32 HashAlgorithmMask)
UINTN GetCcEventSize(IN CC_EVENT *CcEvent)
EFI_STATUS SetupCcEventLog(VOID)
UINT16 GetHashSizeFromAlgo(IN TPMI_ALG_HASH HashAlgo)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
EFI_STATUS EFIAPI EfiCreateEventReadyToBootEx(IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *ReadyToBootEvent)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
EFI_CPU_PHYSICAL_LOCATION Location
INT8 VariableData[1]
Driver or platform-specific data.