TianoCore EDK2 master
Loading...
Searching...
No Matches
SpdmMeasurement.c File Reference

Go to the source code of this file.

Functions

UINT32 EFIAPI GetSpdmDeviceType (IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext)
 
UINTN EFIAPI GetDeviceMeasurementContextSize (IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext)
 
EFI_STATUS CreatePciDeviceMeasurementContext (IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN OUT VOID *DeviceContext, IN UINTN DeviceContextSize)
 
EFI_STATUS EFIAPI CreateDeviceMeasurementContext (IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN OUT VOID *DeviceContext, IN UINTN DeviceContextSize)
 
VOID EFIAPI InternalDumpData (CONST UINT8 *Data, UINTN Size)
 
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)
 

Detailed Description

EDKII Device Security library for SPDM device. It follows the SPDM Specification.

Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SpdmMeasurement.c.

Function Documentation

◆ CreateDeviceMeasurementContext()

EFI_STATUS EFIAPI CreateDeviceMeasurementContext ( IN SPDM_DEVICE_CONTEXT SpdmDeviceContext,
IN OUT VOID *  DeviceContext,
IN UINTN  DeviceContextSize 
)

This function creates the SPDM device measurement context for TCG SPDM event.

Parameters
[in]SpdmDeviceContextThe SPDM context for the device.
[in,out]DeviceContextThe TCG SPDM device measurement context.
[in]DeviceContextSizeThe size of TCG SPDM device measurement context.
Return values
EFI_SUCCESSThe TCG SPDM device measurement context is returned.
EFI_UNSUPPORTEDThe TCG SPDM device measurement context is unsupported.

Definition at line 122 of file SpdmMeasurement.c.

◆ CreatePciDeviceMeasurementContext()

EFI_STATUS CreatePciDeviceMeasurementContext ( IN SPDM_DEVICE_CONTEXT SpdmDeviceContext,
IN OUT VOID *  DeviceContext,
IN UINTN  DeviceContextSize 
)

This function creates the SPDM PCI device measurement context for TCG SPDM event.

Parameters
[in]SpdmDeviceContextThe SPDM context for the device.
[in,out]DeviceContextThe TCG SPDM PCI device measurement context.
[in]DeviceContextSizeThe size of TCG SPDM PCI device measurement context.
Return values
EFI_SUCCESSThe TCG SPDM PCI device measurement context is returned.

Definition at line 71 of file SpdmMeasurement.c.

◆ DoDeviceMeasurement()

EFI_STATUS EFIAPI DoDeviceMeasurement ( IN SPDM_DEVICE_CONTEXT SpdmDeviceContext,
IN UINT8  SlotId,
OUT EDKII_DEVICE_SECURITY_STATE SecurityState 
)

This function gets SPDM measurement and extend to TPM.

Parameters
[in]SpdmDeviceContextThe SPDM context for the device.
[in]SlotIdThe number of slot id of the certificate.
[out]SecurityStateA poniter to security state of the requester.
Return values
EFI_SUCCESSOperation completed successfully.
EFI_OUT_OF_RESOURCESOut of memory.
EFI_DEVICE_ERRORThe operation was unsuccessful.

Definition at line 504 of file SpdmMeasurement.c.

◆ ExtendMeasurement()

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 
)

This function extend the PCI digest from the DvSec register.

Parameters
[in]SpdmDeviceContextThe SPDM context for the device.
[in]AuthStateThe auth state of the device.
[in]MeasurementRecordLengthThe length of the SPDM measurement record
[in]MeasurementRecordThe SPDM measurement record
[in]RequesterNonceA buffer to hold the requester nonce (32 bytes), if not NULL.
[in]ResponderNonceA buffer to hold the responder nonce (32 bytes), if not NULL.
[out]SecurityStateThe Device Security state associated with the device.
Return values
EFI_SUCCESSOperation completed successfully.
EFI_OUT_OF_RESOURCESOut of memory.
EFI_DEVICE_ERRORThe operation was unsuccessful.

Definition at line 177 of file SpdmMeasurement.c.

◆ GetDeviceMeasurementContextSize()

UINTN EFIAPI GetDeviceMeasurementContextSize ( IN SPDM_DEVICE_CONTEXT SpdmDeviceContext)

This function returns the SPDM device measurement context size for TCG SPDM event.

Parameters
[in]SpdmDeviceContextThe SPDM context for the device.
Returns
TCG SPDM device measurement context size

Definition at line 45 of file SpdmMeasurement.c.

◆ GetSpdmDeviceType()

UINT32 EFIAPI GetSpdmDeviceType ( IN SPDM_DEVICE_CONTEXT SpdmDeviceContext)

This function returns the SPDM device type for TCG SPDM event.

Parameters
[in]SpdmDeviceContextThe SPDM context for the device.
Returns
TCG SPDM device type

Definition at line 21 of file SpdmMeasurement.c.

◆ InternalDumpData()

VOID EFIAPI InternalDumpData ( CONST UINT8 *  Data,
UINTN  Size 
)

This function dumps data.

Parameters
[in]DataA pointer to Data.
[in]SizeThe size of Data.

Definition at line 148 of file SpdmMeasurement.c.