26 return TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_TYPE_PCI;
29 if (
CompareGuid (&SpdmDeviceContext->DeviceId.DeviceType, &gEdkiiDeviceIdentifierTypeUsbGuid)) {
30 return TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_TYPE_USB;
33 return TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_TYPE_NULL;
53 if (
CompareGuid (&SpdmDeviceContext->DeviceId.DeviceType, &gEdkiiDeviceIdentifierTypeUsbGuid)) {
73 IN OUT VOID *DeviceContext,
82 if (DeviceContextSize !=
sizeof (*PciContext)) {
83 return EFI_BUFFER_TOO_SMALL;
86 PciIo = SpdmDeviceContext->DeviceIo;
87 Status = PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint8, 0,
sizeof (PciData), &PciData);
90 PciContext = DeviceContext;
91 PciContext->Version = TCG_DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT_VERSION;
92 PciContext->Length =
sizeof (*PciContext);
93 PciContext->VendorId = PciData.Hdr.VendorId;
94 PciContext->DeviceId = PciData.Hdr.DeviceId;
95 PciContext->RevisionID = PciData.Hdr.RevisionID;
96 PciContext->ClassCode[0] = PciData.Hdr.ClassCode[0];
97 PciContext->ClassCode[1] = PciData.Hdr.ClassCode[1];
98 PciContext->ClassCode[2] = PciData.Hdr.ClassCode[2];
99 if ((PciData.Hdr.HeaderType & HEADER_LAYOUT_CODE) == HEADER_TYPE_DEVICE) {
100 PciContext->SubsystemVendorID = PciData.Device.SubsystemVendorID;
101 PciContext->SubsystemID = PciData.Device.SubsystemID;
103 PciContext->SubsystemVendorID = 0;
104 PciContext->SubsystemID = 0;
124 IN OUT VOID *DeviceContext,
132 if (
CompareGuid (&SpdmDeviceContext->DeviceId.DeviceType, &gEdkiiDeviceIdentifierTypeUsbGuid)) {
133 return EFI_UNSUPPORTED;
136 return EFI_UNSUPPORTED;
155 for (Index = 0; Index < Size; Index++) {
156 DEBUG ((DEBUG_INFO,
"%02x ", (
UINTN)Data[Index]));
180 IN UINT32 MeasurementRecordLength,
181 IN UINT8 *MeasurementRecord,
182 IN UINT8 *RequesterNonce,
183 IN UINT8 *ResponderNonce,
196 UINTN DeviceContextSize;
202 UINTN DevicePathSize;
203 UINT32 MeasurementHashAlgo;
206 SPDM_DATA_PARAMETER Parameter;
208 SpdmContext = SpdmDeviceContext->SpdmContext;
211 ZeroMem (&Parameter,
sizeof (Parameter));
212 Parameter.location = SpdmDataLocationConnection;
213 DataSize =
sizeof (MeasurementHashAlgo);
214 Status = SpdmGetData (SpdmContext, SpdmDataMeasurementHashAlgo, &Parameter, &MeasurementHashAlgo, &DataSize);
217 if (MeasurementRecord !=
NULL) {
218 SpdmMeasurementBlockCommonHeader = (VOID *)MeasurementRecord;
219 SpdmMeasurementBlockDmtfHeader = (VOID *)(SpdmMeasurementBlockCommonHeader + 1);
220 Digest = (SpdmMeasurementBlockDmtfHeader + 1);
223 DEBUG ((DEBUG_INFO,
"SpdmMeasurementBlockCommonHeader\n"));
224 DEBUG ((DEBUG_INFO,
" Index - 0x%02x\n", SpdmMeasurementBlockCommonHeader->Index));
225 DEBUG ((DEBUG_INFO,
" MeasurementSpecification - 0x%02x\n", SpdmMeasurementBlockCommonHeader->MeasurementSpecification));
226 DEBUG ((DEBUG_INFO,
" MeasurementSize - 0x%04x\n", SpdmMeasurementBlockCommonHeader->MeasurementSize));
227 DEBUG ((DEBUG_INFO,
"SpdmMeasurementBlockDmtfHeader\n"));
228 DEBUG ((DEBUG_INFO,
" DMTFSpecMeasurementValueType - 0x%02x\n", SpdmMeasurementBlockDmtfHeader->DMTFSpecMeasurementValueType));
229 DEBUG ((DEBUG_INFO,
" DMTFSpecMeasurementValueSize - 0x%04x\n", SpdmMeasurementBlockDmtfHeader->DMTFSpecMeasurementValueSize));
230 DEBUG ((DEBUG_INFO,
"Measurement - "));
232 DEBUG ((DEBUG_INFO,
"\n"));
234 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_MEASUREMENT_AUTH_FAILURE;
235 return EFI_SECURITY_VIOLATION;
238 if ((SpdmMeasurementBlockCommonHeader->MeasurementSpecification & SPDM_MEASUREMENT_SPECIFICATION_DMTF) == 0) {
239 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_MEASUREMENT_AUTH_FAILURE;
240 return EFI_SECURITY_VIOLATION;
244 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_MEASUREMENT_AUTH_FAILURE;
245 return EFI_SECURITY_VIOLATION;
248 if (SpdmMeasurementBlockDmtfHeader->DMTFSpecMeasurementValueSize != SpdmMeasurementBlockCommonHeader->MeasurementSize - sizeof (
SPDM_MEASUREMENT_BLOCK_DMTF_HEADER)) {
249 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_MEASUREMENT_AUTH_FAILURE;
250 return EFI_SECURITY_VIOLATION;
256 switch (SpdmMeasurementBlockDmtfHeader->DMTFSpecMeasurementValueType & 0x7F) {
258 case SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_MUTABLE_FIRMWARE:
259 case SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_VERSION:
260 case SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_SECURE_VERSION_NUMBER:
261 if (SpdmDeviceContext->IsEmbeddedDevice) {
267 EventType = EV_EFI_SPDM_FIRMWARE_BLOB;
269 case SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_HARDWARE_CONFIGURATION:
270 case SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_FIRMWARE_CONFIGURATION:
271 case SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_DEVICE_MODE:
272 if (SpdmDeviceContext->IsEmbeddedDevice) {
278 EventType = EV_EFI_SPDM_FIRMWARE_CONFIG;
280 case SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_MEASUREMENT_MANIFEST:
286 if (SpdmDeviceContext->IsEmbeddedDevice) {
292 EventType = EV_EFI_SPDM_FIRMWARE_BLOB;
299 case TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_SUCCESS:
301 sizeof (UINT64) + DevicePathSize +
303 MeasurementRecordLength +
306 if (EventLog ==
NULL) {
307 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_UEFI_OUT_OF_RESOURCE;
308 return EFI_OUT_OF_RESOURCES;
311 EventLogPtr = EventLog;
313 EventData2 = (VOID *)EventLogPtr;
314 CopyMem (EventData2->Signature, TCG_DEVICE_SECURITY_EVENT_DATA_SIGNATURE_2, sizeof (EventData2->Signature));
315 EventData2->Version = TCG_DEVICE_SECURITY_EVENT_DATA_VERSION_2;
316 EventData2->AuthState = AuthState;
317 EventData2->Reserved = 0;
318 EventData2->Length = (UINT32)EventLogSize;
321 EventData2->SubHeaderType = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_SUB_HEADER_TYPE_SPDM_MEASUREMENT_BLOCK;
323 EventData2->SubHeaderUID = SpdmDeviceContext->DeviceUID;
325 EventLogPtr = (VOID *)(EventData2 + 1);
327 *(UINT64 *)EventLogPtr = (UINT64)DevicePathSize;
328 EventLogPtr +=
sizeof (UINT64);
329 CopyMem (EventLogPtr, SpdmDeviceContext->DevicePath, DevicePathSize);
330 EventLogPtr += DevicePathSize;
332 TcgSpdmMeasurementBlock = (VOID *)EventLogPtr;
333 TcgSpdmMeasurementBlock->SpdmVersion = SpdmDeviceContext->SpdmVersion;
334 TcgSpdmMeasurementBlock->SpdmMeasurementBlockCount = 1;
335 TcgSpdmMeasurementBlock->Reserved = 0;
336 TcgSpdmMeasurementBlock->SpdmMeasurementHashAlgo = MeasurementHashAlgo;
339 if ((MeasurementRecord !=
NULL) && (MeasurementRecordLength != 0)) {
340 CopyMem (EventLogPtr, MeasurementRecord, MeasurementRecordLength);
341 EventLogPtr += MeasurementRecordLength;
344 if (DeviceContextSize != 0) {
345 DeviceContext = (VOID *)EventLogPtr;
348 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_DEVICE_ERROR;
349 Status = EFI_DEVICE_ERROR;
362 if (EFI_ERROR (Status)) {
363 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_TCG_EXTEND_TPM_PCR;
366 DEBUG ((DEBUG_INFO,
"TpmMeasureAndLogData (Measurement) - %r\n", Status));
368 case TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_FAIL_INVALID:
370 sizeof (UINT64) + DevicePathSize +
373 if (EventLog ==
NULL) {
374 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_UEFI_OUT_OF_RESOURCE;
375 return EFI_OUT_OF_RESOURCES;
378 EventLogPtr = EventLog;
380 EventData2 = (VOID *)EventLogPtr;
381 CopyMem (EventData2->Signature, TCG_DEVICE_SECURITY_EVENT_DATA_SIGNATURE_2, sizeof (EventData2->Signature));
382 EventData2->Version = TCG_DEVICE_SECURITY_EVENT_DATA_VERSION_2;
383 EventData2->AuthState = AuthState;
384 EventData2->Reserved = 0;
385 EventData2->Length = (UINT32)EventLogSize;
388 EventData2->SubHeaderType = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_SUB_HEADER_TYPE_SPDM_MEASUREMENT_BLOCK;
389 EventData2->SubHeaderLength = 0;
390 EventData2->SubHeaderUID = SpdmDeviceContext->DeviceUID;
392 EventLogPtr = (VOID *)(EventData2 + 1);
394 *(UINT64 *)EventLogPtr = (UINT64)DevicePathSize;
395 EventLogPtr +=
sizeof (UINT64);
396 CopyMem (EventLogPtr, SpdmDeviceContext->DevicePath, DevicePathSize);
397 EventLogPtr += DevicePathSize;
399 if (DeviceContextSize != 0) {
400 DeviceContext = (VOID *)EventLogPtr;
403 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_DEVICE_ERROR;
404 Status = EFI_DEVICE_ERROR;
417 if (EFI_ERROR (Status)) {
418 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_TCG_EXTEND_TPM_PCR;
421 DEBUG ((DEBUG_INFO,
"TpmMeasureAndLogData (Measurement) - %r\n", Status));
424 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_UEFI_UNSUPPORTED;
425 return EFI_UNSUPPORTED;
428 if (RequesterNonce !=
NULL) {
431 CopyMem (DynamicEventLogSpdmGetMeasurementsEvent.Header.Signature, TCG_NV_EXTEND_INDEX_FOR_DYNAMIC_SIGNATURE, sizeof (TCG_NV_EXTEND_INDEX_FOR_DYNAMIC_SIGNATURE));
432 DynamicEventLogSpdmGetMeasurementsEvent.Header.Version = TCG_NV_INDEX_DYNAMIC_EVENT_LOG_STRUCT_VERSION;
433 ZeroMem (DynamicEventLogSpdmGetMeasurementsEvent.Header.Reserved, sizeof (DynamicEventLogSpdmGetMeasurementsEvent.Header.Reserved));
434 DynamicEventLogSpdmGetMeasurementsEvent.Header.Uid = SpdmDeviceContext->DeviceUID;
435 DynamicEventLogSpdmGetMeasurementsEvent.DescriptionSize =
sizeof (TCG_SPDM_GET_MEASUREMENTS_DESCRIPTION);
436 CopyMem (DynamicEventLogSpdmGetMeasurementsEvent.Description, TCG_SPDM_GET_MEASUREMENTS_DESCRIPTION, sizeof (TCG_SPDM_GET_MEASUREMENTS_DESCRIPTION));
437 DynamicEventLogSpdmGetMeasurementsEvent.DataSize = SPDM_NONCE_SIZE;
438 CopyMem (DynamicEventLogSpdmGetMeasurementsEvent.Data, RequesterNonce, SPDM_NONCE_SIZE);
441 TCG_NV_EXTEND_INDEX_FOR_DYNAMIC,
443 &DynamicEventLogSpdmGetMeasurementsEvent,
444 sizeof (DynamicEventLogSpdmGetMeasurementsEvent),
445 &DynamicEventLogSpdmGetMeasurementsEvent,
446 sizeof (DynamicEventLogSpdmGetMeasurementsEvent)
448 if (EFI_ERROR (Status)) {
449 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_TCG_EXTEND_TPM_PCR;
452 DEBUG ((DEBUG_INFO,
"TpmMeasureAndLogData (Dynamic) - %r\n", Status));
455 if (ResponderNonce !=
NULL) {
458 CopyMem (DynamicEventLogSpdmMeasurementsEvent.Header.Signature, TCG_NV_EXTEND_INDEX_FOR_DYNAMIC_SIGNATURE, sizeof (TCG_NV_EXTEND_INDEX_FOR_DYNAMIC_SIGNATURE));
459 DynamicEventLogSpdmMeasurementsEvent.Header.Version = TCG_NV_INDEX_DYNAMIC_EVENT_LOG_STRUCT_VERSION;
460 ZeroMem (DynamicEventLogSpdmMeasurementsEvent.Header.Reserved, sizeof (DynamicEventLogSpdmMeasurementsEvent.Header.Reserved));
461 DynamicEventLogSpdmMeasurementsEvent.Header.Uid = SpdmDeviceContext->DeviceUID;
462 DynamicEventLogSpdmMeasurementsEvent.DescriptionSize =
sizeof (TCG_SPDM_MEASUREMENTS_DESCRIPTION);
463 CopyMem (DynamicEventLogSpdmMeasurementsEvent.Description, TCG_SPDM_MEASUREMENTS_DESCRIPTION, sizeof (TCG_SPDM_MEASUREMENTS_DESCRIPTION));
464 DynamicEventLogSpdmMeasurementsEvent.DataSize = SPDM_NONCE_SIZE;
465 CopyMem (DynamicEventLogSpdmMeasurementsEvent.Data, ResponderNonce, SPDM_NONCE_SIZE);
468 TCG_NV_EXTEND_INDEX_FOR_DYNAMIC,
470 &DynamicEventLogSpdmMeasurementsEvent,
471 sizeof (DynamicEventLogSpdmMeasurementsEvent),
472 &DynamicEventLogSpdmMeasurementsEvent,
473 sizeof (DynamicEventLogSpdmMeasurementsEvent)
475 if (EFI_ERROR (Status)) {
476 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_TCG_EXTEND_TPM_PCR;
479 DEBUG ((DEBUG_INFO,
"TpmMeasureAndLogData (Dynamic) - %r\n", Status));
483 if (EventLog !=
NULL) {
511 SPDM_RETURN SpdmReturn;
513 UINT32 CapabilityFlags;
515 SPDM_DATA_PARAMETER Parameter;
516 UINT8 NumberOfBlocks;
517 UINT32 MeasurementRecordLength;
518 UINT8 MeasurementRecord[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE];
520 UINT8 RequesterNonce[SPDM_NONCE_SIZE];
521 UINT8 ResponderNonce[SPDM_NONCE_SIZE];
522 UINT8 RequestAttribute;
523 UINT32 MeasurementsBlockSize;
526 UINT8 ReceivedNumberOfBlock;
528 UINT8 ContentChanged;
529 UINT8 ContentChangedCount;
531 SpdmContext = SpdmDeviceContext->SpdmContext;
533 ZeroMem (&Parameter,
sizeof (Parameter));
534 Parameter.location = SpdmDataLocationConnection;
535 DataSize =
sizeof (CapabilityFlags);
536 SpdmGetData (SpdmContext, SpdmDataCapabilityFlags, &Parameter, &CapabilityFlags, &DataSize);
538 if ((CapabilityFlags & SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP_SIG) == 0) {
539 AuthState = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_FAIL_NO_SIG;
541 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_DEVICE_NO_CAPABILITIES;
545 return EFI_UNSUPPORTED;
549 RequestAttribute = 0;
552 MeasurementRecordLength =
sizeof (MeasurementRecord);
553 ZeroMem (RequesterNonce,
sizeof (RequesterNonce));
554 ZeroMem (ResponderNonce,
sizeof (ResponderNonce));
559 SpdmReturn = SpdmGetMeasurementEx (
567 &MeasurementRecordLength,
575 if (LIBSPDM_STATUS_IS_SUCCESS (SpdmReturn)) {
576 DEBUG ((DEBUG_INFO,
"NumberOfBlocks %d\n", NumberOfBlocks));
578 MeasurementBlock = (VOID *)MeasurementRecord;
579 for (Index = 0; Index < NumberOfBlocks; Index++) {
580 MeasurementsBlockSize =
583 ->MeasurementBlockDmtfHeader
584 .DMTFSpecMeasurementValueSize;
586 AuthState = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_SUCCESS;
588 if (Index == NumberOfBlocks - 1) {
589 Status =
ExtendMeasurement (SpdmDeviceContext, AuthState, MeasurementsBlockSize, (UINT8 *)MeasurementBlock, RequesterNonce, ResponderNonce, SecurityState);
591 Status =
ExtendMeasurement (SpdmDeviceContext, AuthState, MeasurementsBlockSize, (UINT8 *)MeasurementBlock,
NULL,
NULL, SecurityState);
594 MeasurementBlock = (VOID *)((
size_t)MeasurementBlock + MeasurementsBlockSize);
599 }
else if (SpdmReturn == LIBSPDM_STATUS_VERIF_FAIL) {
600 AuthState = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_FAIL_INVALID;
601 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_MEASUREMENT_AUTH_FAILURE;
605 ContentChangedCount = 0;
607 RequestAttribute = 0;
608 ContentChanged = SPDM_MEASUREMENTS_RESPONSE_CONTENT_NO_CHANGE_DETECTED;
609 ReceivedNumberOfBlock = 0;
614 SpdmReturn = SpdmGetMeasurement (
625 if (LIBSPDM_STATUS_IS_ERROR (SpdmReturn)) {
626 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_DEVICE_ERROR;
627 return EFI_DEVICE_ERROR;
630 DEBUG ((DEBUG_INFO,
"NumberOfBlocks - 0x%x\n", NumberOfBlocks));
632 ReceivedNumberOfBlock = 0;
633 for (Index = 1; Index <= 0xFE; Index++) {
634 if (ReceivedNumberOfBlock == NumberOfBlocks) {
638 DEBUG ((DEBUG_INFO,
"Index - 0x%x\n", Index));
643 if (ReceivedNumberOfBlock == NumberOfBlocks - 1) {
647 MeasurementRecordLength =
sizeof (MeasurementRecord);
648 ZeroMem (RequesterNonce,
sizeof (RequesterNonce));
649 ZeroMem (ResponderNonce,
sizeof (ResponderNonce));
650 SpdmReturn = SpdmGetMeasurementEx (
658 &MeasurementRecordLength,
666 if (LIBSPDM_STATUS_IS_ERROR (SpdmReturn)) {
667 if (SpdmReturn == LIBSPDM_STATUS_VERIF_FAIL) {
668 AuthState = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_FAIL_INVALID;
669 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_DEVICE_ERROR;
677 if ((ReceivedNumberOfBlock == NumberOfBlocks - 1) &&
678 (ContentChanged == SPDM_MEASUREMENTS_RESPONSE_CONTENT_CHANGE_DETECTED))
680 if (ContentChangedCount == 0) {
681 ContentChangedCount++;
682 goto ContentChangedFlag;
684 AuthState = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_FAIL_INVALID;
685 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_DEVICE_ERROR;
691 DEBUG ((DEBUG_INFO,
"ExtendMeasurement...\n"));
692 AuthState = TCG_DEVICE_SECURITY_EVENT_DATA_DEVICE_AUTH_STATE_SUCCESS;
694 if (ReceivedNumberOfBlock == NumberOfBlocks - 1) {
695 Status =
ExtendMeasurement (SpdmDeviceContext, AuthState, MeasurementRecordLength, MeasurementRecord, RequesterNonce, ResponderNonce, SecurityState);
697 Status =
ExtendMeasurement (SpdmDeviceContext, AuthState, MeasurementRecordLength, MeasurementRecord,
NULL, ResponderNonce, SecurityState);
704 ReceivedNumberOfBlock += 1;
707 if (ReceivedNumberOfBlock != NumberOfBlocks) {
708 SecurityState->MeasurementState = EDKII_DEVICE_SECURITY_STATE_ERROR_MEASUREMENT_AUTH_FAILURE;
709 return EFI_DEVICE_ERROR;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_GUID gEdkiiDeviceIdentifierTypePciGuid
#define EDKII_DEVICE_SECURITY_STATE_SUCCESS
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
#define SPDM_MEASUREMENT_BLOCK_MEASUREMENT_TYPE_IMMUTABLE_ROM
#define SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_TOTAL_NUMBER_OF_MEASUREMENTS
#define SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_ALL_MEASUREMENTS
#define SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE
EFI_STATUS ExtendCertificate(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN UINT8 AuthState, IN UINTN CertChainSize, IN UINT8 *CertChain, IN VOID *TrustAnchor, IN UINTN TrustAnchorSize, IN UINT8 SlotId, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
VOID EFIAPI InternalDumpData(CONST UINT8 *Data, UINTN Size)
EFI_STATUS EFIAPI CreateDeviceMeasurementContext(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN OUT VOID *DeviceContext, IN UINTN DeviceContextSize)
EFI_STATUS ExtendMeasurement(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN UINT8 AuthState, IN UINT32 MeasurementRecordLength, IN UINT8 *MeasurementRecord, IN UINT8 *RequesterNonce, IN UINT8 *ResponderNonce, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
EFI_STATUS EFIAPI DoDeviceMeasurement(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN UINT8 SlotId, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
EFI_STATUS CreatePciDeviceMeasurementContext(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN OUT VOID *DeviceContext, IN UINTN DeviceContextSize)
UINT32 EFIAPI GetSpdmDeviceType(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext)
UINTN EFIAPI GetDeviceMeasurementContextSize(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext)
EFI_STATUS EFIAPI TpmMeasureAndLogData(IN UINT32 PcrIndex, IN UINT32 EventType, IN VOID *EventLog, IN UINT32 LogLen, IN VOID *HashData, IN UINT64 HashDataLen)
VOID EFIAPI Exit(IN EFI_STATUS Status)
EFI_PCI_IO_PROTOCOL_CONFIG Read