51 IN UINT64 HashDataLen,
65 if (EFI_ERROR (Status)) {
69 TcgEventHdr.PCRIndex = PcrIndex;
70 TcgEventHdr.EventType = EventType;
71 TcgEventHdr.EventSize = LogLen;
73 Status = TcgPpi->HashLogExtendEvent (
102 IN CHAR8 *Description OPTIONAL,
104 IN UINT64 FirmwareBlobLength,
105 IN UINT32 CfgRegionOffset,
106 IN UINT32 CfgRegionSize
113 VOID *FvEventLog, *UpdEventLog;
114 UINT32 FvEventLogSize, UpdEventLogSize;
116 HASH_HANDLE HashHandle;
123 if (((Description !=
NULL) || (FvName !=
NULL)) &&
124 (
PcdGet32 (PcdTcgPfpMeasurementRevision) >= TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_105))
126 if (Description !=
NULL) {
127 AsciiSPrint ((CHAR8 *)FvBlob2.BlobDescription, sizeof (FvBlob2.BlobDescription),
"%a", Description);
128 AsciiSPrint ((CHAR8 *)UpdBlob2.BlobDescription, sizeof (UpdBlob2.BlobDescription),
"%aUDP", Description);
130 AsciiSPrint ((CHAR8 *)FvBlob2.BlobDescription, sizeof (FvBlob2.BlobDescription),
"Fv(%g)", FvName);
131 AsciiSPrint ((CHAR8 *)UpdBlob2.BlobDescription, sizeof (UpdBlob2.BlobDescription),
"(%g)UDP", FvName);
134 FvBlob2.BlobDescriptionSize =
sizeof (FvBlob2.BlobDescription);
135 FvBlob2.BlobBase = FirmwareBlobBase;
136 FvBlob2.BlobLength = FirmwareBlobLength;
137 FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB2;
138 FvEventLog = &FvBlob2;
139 FvEventLogSize =
sizeof (FvBlob2);
141 UpdBlob2.BlobDescriptionSize =
sizeof (UpdBlob2.BlobDescription);
142 UpdBlob2.BlobBase = CfgRegionOffset;
143 UpdBlob2.BlobLength = CfgRegionSize;
144 UpdEventLog = &UpdBlob2;
145 UpdEventLogSize =
sizeof (UpdBlob2);
147 FvBlob.BlobBase = FirmwareBlobBase;
148 FvBlob.BlobLength = FirmwareBlobLength;
149 FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB;
150 FvEventLog = &FvBlob;
151 FvEventLogSize =
sizeof (FvBlob);
153 UpdBlob.BlobBase = CfgRegionOffset;
154 UpdBlob.BlobLength = CfgRegionSize;
155 UpdEventLog = &UpdBlob;
156 UpdEventLogSize =
sizeof (UpdBlob);
161 if (EFI_ERROR (Status)) {
162 DEBUG ((DEBUG_ERROR,
"HashStart failed - %r\n", Status));
167 HashBase = (UINT8 *)(
UINTN)FirmwareBlobBase;
168 HashSize = (
UINTN)CfgRegionOffset;
169 Status =
HashUpdate (HashHandle, HashBase, HashSize);
170 if (EFI_ERROR (Status)) {
171 DEBUG ((DEBUG_ERROR,
"HashUpdate failed - %r\n", Status));
176 HashBase = (UINT8 *)(
UINTN)FirmwareBlobBase + CfgRegionOffset + CfgRegionSize;
177 HashSize = (
UINTN)(FirmwareBlobLength - CfgRegionOffset - CfgRegionSize);
178 Status =
HashUpdate (HashHandle, HashBase, HashSize);
179 if (EFI_ERROR (Status)) {
180 DEBUG ((DEBUG_ERROR,
"HashUpdate failed - %r\n", Status));
186 if (EFI_ERROR (Status)) {
187 DEBUG ((DEBUG_ERROR,
"HashCompleteAndExtend failed - %r\n", Status));
196 (UINT8 *)&DigestList,
197 (
UINTN)
sizeof (DigestList),
198 EDKII_TCG_PRE_HASH_LOG_ONLY
200 if (EFI_ERROR (Status)) {
201 DEBUG ((DEBUG_ERROR,
"TpmMeasureAndLogDataWithFlags failed - %r\n", Status));
207 EV_PLATFORM_CONFIG_FLAGS,
210 (UINT8 *)(
UINTN)FirmwareBlobBase + CfgRegionOffset,
234 IN CHAR8 *Description OPTIONAL,
236 IN UINT64 FirmwareBlobLength
239 UINT32 FspMeasureMask;
242 FspMeasureMask =
PcdGet32 (PcdFspMeasurementConfig);
243 if ((FspMeasureMask & FSP_MEASURE_FSPUPD) != 0) {
245 if (FspHeaderPtr !=
NULL) {
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
STATIC EFI_STATUS EFIAPI MeasureFspFirmwareBlobWithCfg(IN CHAR8 *Description OPTIONAL, IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase, IN UINT64 FirmwareBlobLength, IN UINT32 CfgRegionOffset, IN UINT32 CfgRegionSize)
EFI_STATUS EFIAPI TpmMeasureAndLogDataWithFlags(IN UINT32 PcrIndex, IN UINT32 EventType, IN VOID *EventLog, IN UINT32 LogLen, IN VOID *HashData, IN UINT64 HashDataLen, IN UINT64 Flags)
EFI_STATUS EFIAPI MeasureFspFirmwareBlob(IN UINT32 PcrIndex, IN CHAR8 *Description OPTIONAL, IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase, IN UINT64 FirmwareBlobLength)
FSP_INFO_HEADER *EFIAPI FspFindFspHeader(IN EFI_PHYSICAL_ADDRESS FlashFvFspBase)
EFI_STATUS EFIAPI HashStart(OUT HASH_HANDLE *HashHandle)
EFI_STATUS EFIAPI HashUpdate(IN HASH_HANDLE HashHandle, IN VOID *DataToHash, IN UINTN DataToHashLen)
EFI_STATUS EFIAPI HashCompleteAndExtend(IN HASH_HANDLE HashHandle, IN TPMI_DH_PCR PcrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT TPML_DIGEST_VALUES *DigestList)
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
#define DEBUG(Expression)
#define PcdGet32(TokenName)
VOID * TpmMeasurementGetFvName(IN EFI_PHYSICAL_ADDRESS FvBase, IN UINT64 FvLength)
EFI_STATUS EFIAPI MeasureFirmwareBlob(IN UINT32 PcrIndex, IN CHAR8 *Description OPTIONAL, IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase, IN UINT64 FirmwareBlobLength)
EFI_STATUS EFIAPI TpmMeasureAndLogData(IN UINT32 PcrIndex, IN UINT32 EventType, IN VOID *EventLog, IN UINT32 LogLen, IN VOID *HashData, IN UINT64 HashDataLen)
UINT64 EFI_PHYSICAL_ADDRESS