TianoCore EDK2 master
|
#include <PiDxe.h>
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/PeImage.h>
#include <IndustryStandard/TcpaAcpi.h>
#include <Guid/GlobalVariable.h>
#include <Guid/HobList.h>
#include <Guid/EventGroup.h>
#include <Guid/EventExitBootServiceFailed.h>
#include <Guid/ImageAuthentication.h>
#include <Guid/TpmInstance.h>
#include <Protocol/DevicePath.h>
#include <Protocol/MpService.h>
#include <Protocol/VariableWrite.h>
#include <Protocol/Tcg2Protocol.h>
#include <Protocol/TrEEProtocol.h>
#include <Protocol/AcpiTable.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/HobLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiLib.h>
#include <Library/HashLib.h>
#include <Library/PerformanceLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/TpmMeasurementLib.h>
#include <Protocol/CcMeasurement.h>
#include <Guid/CcEventHob.h>
#include <Library/TdxLib.h>
Go to the source code of this file.
Data Structures | |
struct | VARIABLE_TYPE |
struct | CC_EVENT_INFO_STRUCT |
struct | CC_EVENT_LOG_AREA_STRUCT |
struct | _TDX_DXE_DATA |
struct | TDX_HASH_INFO |
Macros | |
#define | PERF_ID_CC_TCG2_DXE 0x3130 |
#define | CC_EVENT_LOG_AREA_COUNT_MAX 1 |
#define | CC_MR_INDEX_0_MRTD 0 |
#define | CC_MR_INDEX_1_RTMR0 1 |
#define | CC_MR_INDEX_2_RTMR1 2 |
#define | CC_MR_INDEX_3_RTMR2 3 |
#define | CC_MR_INDEX_INVALID 4 |
#define | COLUME_SIZE (16 * 2) |
#define | TD_HASH_COUNT 1 |
#define | TEMP_BUF_LEN |
Typedefs | |
typedef struct _TDX_DXE_DATA | TDX_DXE_DATA |
Functions | |
UINT16 | GetHashSizeFromAlgo (IN TPMI_ALG_HASH HashAlgo) |
UINT32 | GetHashMaskFromAlgo (IN TPMI_ALG_HASH HashAlgo) |
VOID * | CopyDigestListToBuffer (IN OUT VOID *Buffer, IN TPML_DIGEST_VALUES *DigestList, IN UINT32 HashAlgorithmMask) |
EFI_STATUS | MeasurePeImageAndExtend (IN UINT32 RtmrIndex, IN EFI_PHYSICAL_ADDRESS ImageAddress, IN UINTN ImageSize, OUT TPML_DIGEST_VALUES *DigestList) |
VOID | InternalDumpData (IN UINT8 *Data, IN UINTN Size) |
VOID | InternalDumpHex (IN UINT8 *Data, IN UINTN Size) |
VOID | InitNoActionEvent (IN OUT CC_EVENT_HDR *NoActionEvent, IN UINT32 EventSize) |
EFI_STATUS | GetProcessorsCpuLocation (OUT EFI_CPU_PHYSICAL_LOCATION **LocationBuf, OUT UINTN *Num) |
EFI_STATUS EFIAPI | TdGetCapability (IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN OUT EFI_CC_BOOT_SERVICE_CAPABILITY *ProtocolCapability) |
VOID | DumpPcrEvent (IN TCG_PCR_EVENT_HDR *EventHdr) |
VOID | DumpTcgEfiSpecIdEventStruct (IN TCG_EfiSpecIDEventStruct *TcgEfiSpecIdEventStruct) |
UINTN | GetTcgEfiSpecIdEventStructSize (IN TCG_EfiSpecIDEventStruct *TcgEfiSpecIdEventStruct) |
VOID | DumpCcEvent (IN CC_EVENT *CcEvent) |
UINTN | GetCcEventSize (IN CC_EVENT *CcEvent) |
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 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) |
BOOLEAN | Is800155Event (IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize) |
EFI_STATUS | TcgCommLogEvent (IN OUT CC_EVENT_LOG_AREA_STRUCT *EventLogAreaStruct, IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize) |
UINT32 EFIAPI | MapPcrToMrIndex (IN UINT32 PCRIndex) |
EFI_STATUS EFIAPI | TdMapPcrToMrIndex (IN EFI_CC_MEASUREMENT_PROTOCOL *This, IN UINT32 PCRIndex, OUT UINT32 *MrIndex) |
EFI_STATUS | TdxDxeLogEvent (IN EFI_CC_EVENT_LOG_FORMAT EventLogFormat, IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize) |
UINT32 | GetDigestListBinSize (IN VOID *DigestListBin) |
VOID * | CopyDigestListBinToBuffer (IN OUT VOID *Buffer, IN VOID *DigestListBin, IN UINT32 HashAlgorithmMask, OUT UINT32 *HashAlgorithmMaskCopied) |
EFI_STATUS | TdxDxeLogHashEvent (IN TPML_DIGEST_VALUES *DigestList, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData) |
EFI_STATUS | TdxDxeHashLogExtendEvent (IN UINT64 Flags, IN UINT8 *HashData, IN UINT64 HashDataLen, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData) |
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) |
EFI_STATUS | SetupCcEventLog (VOID) |
EFI_STATUS | TdMeasureAction (IN UINT32 MrIndex, IN CHAR8 *String) |
EFI_STATUS | MeasureHandoffTables (VOID) |
EFI_STATUS | MeasureSeparatorEvent (IN UINT32 MrIndex) |
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 | ReadAndMeasureVariable (IN UINT32 MrIndex, IN TCG_EVENTTYPE EventType, IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData) |
EFI_STATUS | ReadAndMeasureBootVariable (IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData) |
EFI_STATUS | ReadAndMeasureSecureVariable (IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData) |
EFI_STATUS | MeasureAllBootVariables (VOID) |
EFI_STATUS | MeasureAllSecureVariables (VOID) |
EFI_STATUS | MeasureLaunchOfFirmwareDebugger (VOID) |
VOID EFIAPI | MeasureSecureBootPolicy (IN EFI_EVENT Event, IN VOID *Context) |
VOID EFIAPI | OnReadyToBoot (IN EFI_EVENT Event, IN VOID *Context) |
VOID EFIAPI | OnExitBootServices (IN EFI_EVENT Event, IN VOID *Context) |
VOID EFIAPI | OnExitBootServicesFailed (IN EFI_EVENT Event, IN VOID *Context) |
EFI_STATUS | SyncCcEvent (VOID) |
VOID EFIAPI | InstallAcpiTable (IN EFI_EVENT Event, IN VOID *Context) |
EFI_STATUS | InstallCcMeasurementProtocol (VOID) |
EFI_STATUS EFIAPI | DriverEntry (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
Variables | |
CC_EVENT_INFO_STRUCT | mCcEventInfo [] |
TDX_DXE_DATA | mTdxDxeData |
UINTN | mBootAttempts = 0 |
CHAR16 | mBootVarName [] = L"BootOrder" |
VARIABLE_TYPE | mVariableType [] |
EFI_CC_EVENTLOG_ACPI_TABLE | mTdxEventlogAcpiTemplate |
TDX_HASH_INFO | mHashInfo [] |
EFI_HANDLE | mImageHandle |
EFI_CC_MEASUREMENT_PROTOCOL | mTdProtocol |
This module implements EFI TD Protocol.
Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file TdTcg2Dxe.c.
#define CC_EVENT_LOG_AREA_COUNT_MAX 1 |
Definition at line 50 of file TdTcg2Dxe.c.
#define CC_MR_INDEX_0_MRTD 0 |
Definition at line 51 of file TdTcg2Dxe.c.
#define CC_MR_INDEX_1_RTMR0 1 |
Definition at line 52 of file TdTcg2Dxe.c.
#define CC_MR_INDEX_2_RTMR1 2 |
Definition at line 53 of file TdTcg2Dxe.c.
#define CC_MR_INDEX_3_RTMR2 3 |
Definition at line 54 of file TdTcg2Dxe.c.
#define CC_MR_INDEX_INVALID 4 |
Definition at line 55 of file TdTcg2Dxe.c.
#define COLUME_SIZE (16 * 2) |
Definition at line 263 of file TdTcg2Dxe.c.
#define PERF_ID_CC_TCG2_DXE 0x3130 |
Definition at line 48 of file TdTcg2Dxe.c.
#define TD_HASH_COUNT 1 |
Definition at line 1413 of file TdTcg2Dxe.c.
#define TEMP_BUF_LEN |
Definition at line 1414 of file TdTcg2Dxe.c.
VOID * CopyDigestListBinToBuffer | ( | IN OUT VOID * | Buffer, |
IN VOID * | DigestListBin, | ||
IN UINT32 | HashAlgorithmMask, | ||
OUT UINT32 * | HashAlgorithmMaskCopied | ||
) |
Copy TPML_DIGEST_VALUES compact binary into a buffer
[in,out] | Buffer | Buffer to hold copied TPML_DIGEST_VALUES compact binary. |
[in] | DigestListBin | TPML_DIGEST_VALUES compact binary buffer. |
[in] | HashAlgorithmMask | HASH bits corresponding to the desired digests to copy. |
[out] | HashAlgorithmMaskCopied | Pointer to HASH bits corresponding to the digests copied. |
Definition at line 1140 of file TdTcg2Dxe.c.
VOID * CopyDigestListToBuffer | ( | IN OUT VOID * | Buffer, |
IN TPML_DIGEST_VALUES * | DigestList, | ||
IN UINT32 | HashAlgorithmMask | ||
) |
Copy TPML_DIGEST_VALUES into a buffer
[in,out] | Buffer | Buffer to hold copied TPML_DIGEST_VALUES compact binary. |
[in] | DigestList | TPML_DIGEST_VALUES to be copied. |
[in] | HashAlgorithmMask | HASH bits corresponding to the desired digests to copy. |
Definition at line 201 of file TdTcg2Dxe.c.
EFI_STATUS EFIAPI DriverEntry | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The driver's entry point. It publishes EFI Tcg2 Protocol.
[in] | ImageHandle | The firmware allocated handle for the EFI image. |
[in] | SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The entry point is executed successfully. |
other | Some error occurs when executing this entry point. |
Definition at line 2427 of file TdTcg2Dxe.c.
This function dump TD Event (including the Digests).
[in] | CcEvent | TD Event structure. |
Definition at line 589 of file TdTcg2Dxe.c.
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 | ||
) |
This function dump CC event log. TDVF only supports EFI_CC_EVENT_LOG_FORMAT_TCG_2
[in] | EventLogFormat | The type of the event log for which the information is requested. |
[in] | EventLogLocation | A pointer to the memory address of the event log. |
[in] | EventLogLastEntry | If the Event Log contains more than one entry, this is a pointer to the address of the start of the last entry in the event log in memory. |
[in] | FinalEventsTable | A pointer to the memory address of the final event table. |
Definition at line 681 of file TdTcg2Dxe.c.
VOID DumpPcrEvent | ( | IN TCG_PCR_EVENT_HDR * | EventHdr | ) |
This function dump PCR event. TD Event log reuse the TCG PCR Event spec. The first event in the event log is the SHA1 log format. There is only ONE TCG_PCR_EVENT in TD Event log.
[in] | EventHdr | TCG PCR event structure. |
Definition at line 495 of file TdTcg2Dxe.c.
VOID DumpTcgEfiSpecIdEventStruct | ( | IN TCG_EfiSpecIDEventStruct * | TcgEfiSpecIdEventStruct | ) |
This function dump TCG_EfiSpecIDEventStruct.
[in] | TcgEfiSpecIdEventStruct | A pointer to TCG_EfiSpecIDEventStruct. |
Definition at line 520 of file TdTcg2Dxe.c.
This function returns size of Td Table event.
[in] | CcEvent | Td Table event structure. |
Definition at line 638 of file TdTcg2Dxe.c.
UINT32 GetDigestListBinSize | ( | IN VOID * | DigestListBin | ) |
Get TPML_DIGEST_VALUES compact binary buffer size.
[in] | DigestListBin | TPML_DIGEST_VALUES compact binary buffer. |
Definition at line 1103 of file TdTcg2Dxe.c.
UINT32 GetHashMaskFromAlgo | ( | IN TPMI_ALG_HASH | HashAlgo | ) |
Get hash mask based on Algo
[in] | HashAlgo | Hash Algorithm Id. |
Definition at line 175 of file TdTcg2Dxe.c.
UINT16 GetHashSizeFromAlgo | ( | IN TPMI_ALG_HASH | HashAlgo | ) |
Get hash size based on Algo
[in] | HashAlgo | Hash Algorithm Id. |
Definition at line 152 of file TdTcg2Dxe.c.
EFI_STATUS GetProcessorsCpuLocation | ( | OUT EFI_CPU_PHYSICAL_LOCATION ** | LocationBuf, |
OUT UINTN * | Num | ||
) |
Get All processors EFI_CPU_LOCATION in system. LocationBuf is allocated inside the function Caller is responsible to free LocationBuf.
[out] | LocationBuf | Returns Processor Location Buffer. |
[out] | Num | Returns processor number. |
EFI_SUCCESS | Operation completed successfully. |
EFI_UNSUPPORTED | MpService protocol not found. |
Definition at line 380 of file TdTcg2Dxe.c.
UINTN GetTcgEfiSpecIdEventStructSize | ( | IN TCG_EfiSpecIDEventStruct * | TcgEfiSpecIdEventStruct | ) |
This function get size of TCG_EfiSpecIDEventStruct.
[in] | TcgEfiSpecIdEventStruct | A pointer to TCG_EfiSpecIDEventStruct. |
Definition at line 568 of file TdTcg2Dxe.c.
VOID InitNoActionEvent | ( | IN OUT CC_EVENT_HDR * | NoActionEvent, |
IN UINT32 | EventSize | ||
) |
This function initialize TD_EVENT_HDR for EV_NO_ACTION Event Type other than EFI Specification ID event. The behavior is defined by TCG PC Client PFP Spec. Section 9.3.4 EV_NO_ACTION Event Types
[in,out] | NoActionEvent | Event Header of EV_NO_ACTION Event |
[in] | EventSize | Event Size of the EV_NO_ACTION Event |
Definition at line 330 of file TdTcg2Dxe.c.
Install TDVF ACPI Table when ACPI Table Protocol is available.
[in] | Event | Event whose notification function is being invoked |
[in] | Context | Pointer to the notification function's context |
Definition at line 2355 of file TdTcg2Dxe.c.
EFI_STATUS InstallCcMeasurementProtocol | ( | VOID | ) |
The function install TdTcg2 protocol.
EFI_SUCCESS | TdTcg2 protocol is installed. |
other | Some error occurs. |
Definition at line 2398 of file TdTcg2Dxe.c.
This function dump raw data.
Data | raw data |
Size | raw data size |
Definition at line 274 of file TdTcg2Dxe.c.
This function dump raw data with colume format.
Data | raw data |
Size | raw data size |
Definition at line 295 of file TdTcg2Dxe.c.
BOOLEAN Is800155Event | ( | IN VOID * | NewEventHdr, |
IN UINT32 | NewEventHdrSize, | ||
IN UINT8 * | NewEventData, | ||
IN UINT32 | NewEventSize | ||
) |
Return if this is a Tcg800155PlatformIdEvent.
[in] | NewEventHdr | Pointer to a TCG_PCR_EVENT_HDR/TCG_PCR_EVENT_EX data structure. |
[in] | NewEventHdrSize | New event header size. |
[in] | NewEventData | Pointer to the new event data. |
[in] | NewEventSize | New event data size. |
TRUE | This is a Tcg800155PlatformIdEvent. |
FALSE | This is NOT a Tcg800155PlatformIdEvent. |
Definition at line 814 of file TdTcg2Dxe.c.
UINT32 EFIAPI MapPcrToMrIndex | ( | IN UINT32 | PCRIndex | ) |
According to UEFI Spec 2.10 Section 38.4.1: The following table shows the TPM PCR index mapping and CC event log measurement register index interpretation for Intel TDX, where MRTD means Trust Domain Measurement Register and RTMR means Runtime Measurement Register
0 | 0 | MRTD 1, 7 | 1 | RTMR[0] 2~6 | 2 | RTMR[1] 8~15 | 3 | RTMR[2]
[in] | PCRIndex | Index of the TPM PCR |
UINT32 | Index of the CC Event Log Measurement Register Index |
CC_MR_INDEX_INVALID | Invalid MR Index |
Definition at line 955 of file TdTcg2Dxe.c.
EFI_STATUS MeasureAllBootVariables | ( | VOID | ) |
Measure and log all EFI boot variables, and extend the measurement result into a specific PCR.
The EFI boot variables are BootOrder and Boot#### variables.
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1932 of file TdTcg2Dxe.c.
EFI_STATUS MeasureAllSecureVariables | ( | VOID | ) |
Measure and log all EFI Secure variables, and extend the measurement result into a specific PCR.
The EFI boot variables are BootOrder and Boot#### variables.
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1990 of file TdTcg2Dxe.c.
EFI_STATUS MeasureHandoffTables | ( | VOID | ) |
Measure and log EFI handoff tables, and extend the measurement result into PCR[1].
EFI_SUCCESS | Operation completed successfully. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1638 of file TdTcg2Dxe.c.
EFI_STATUS MeasureLaunchOfFirmwareDebugger | ( | VOID | ) |
Measure and log launch of FirmwareDebugger, and extend the measurement result into a specific PCR.
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 2044 of file TdTcg2Dxe.c.
EFI_STATUS MeasurePeImageAndExtend | ( | IN UINT32 | PCRIndex, |
IN EFI_PHYSICAL_ADDRESS | ImageAddress, | ||
IN UINTN | ImageSize, | ||
OUT TPML_DIGEST_VALUES * | DigestList | ||
) |
Measure PE image into TPM log based on the authenticode image hashing in PE/COFF Specification 8.0 Appendix A.
Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will validate its data structure within this image buffer before use.
Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
[in] | RtmrIndex | RTMR index |
[in] | ImageAddress | Start address of image buffer. |
[in] | ImageSize | Image size |
[out] | DigestList | Digest list of this image. |
EFI_SUCCESS | Successfully measure image. |
EFI_OUT_OF_RESOURCES | No enough resource to measure image. |
other | error value |
Measure PE image into TPM log based on the authenticode image hashing in PE/COFF Specification 8.0 Appendix A.
Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will validate its data structure within this image buffer before use.
Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
[in] | RtmrIndex | Rtmr index |
[in] | ImageAddress | Start address of image buffer. |
[in] | ImageSize | Image size |
[out] | DigestList | Digest list of this image. |
EFI_SUCCESS | Successfully measure image. |
EFI_OUT_OF_RESOURCES | No enough resource to measure image. |
other | error value |
Measure PE image into TPM log based on the authenticode image hashing in PE/COFF Specification 8.0 Appendix A.
Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will validate its data structure within this image buffer before use.
Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
[in] | PCRIndex | TPM PCR index |
[in] | ImageAddress | Start address of image buffer. |
[in] | ImageSize | Image size |
[out] | DigestList | Digest list of this image. |
EFI_SUCCESS | Successfully measure image. |
EFI_OUT_OF_RESOURCES | No enough resource to measure image. |
other | error value |
Definition at line 95 of file MeasureBootPeCoff.c.
Measure and log all Secure Boot Policy, and extend the measurement result into a specific PCR.
Platform firmware adhering to the policy must therefore measure the following values into PCR[7]: (in order listed)
NOTE: Because of the above, UEFI variables PK, KEK, EFI_IMAGE_SECURITY_DATABASE, EFI_IMAGE_SECURITY_DATABASE1 and SecureBoot SHALL NOT be measured into PCR[3].
[in] | Event | Event whose notification function is being invoked |
[in] | Context | Pointer to the notification function's context |
Definition at line 2082 of file TdTcg2Dxe.c.
EFI_STATUS MeasureSeparatorEvent | ( | IN UINT32 | MrIndex | ) |
Measure and log Separator event, and extend the measurement result into a specific PCR.
[in] | PCRIndex | PCR index. |
EFI_SUCCESS | Operation completed successfully. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1692 of file TdTcg2Dxe.c.
EFI_STATUS MeasureVariable | ( | IN UINT32 | MrIndex, |
IN TCG_EVENTTYPE | EventType, | ||
IN CHAR16 * | VarName, | ||
IN EFI_GUID * | VendorGuid, | ||
IN VOID * | VarData, | ||
IN UINTN | VarSize | ||
) |
Measure and log an EFI variable, and extend the measurement result into a specific RTMR.
[in] | MrIndex | RTMR Index. |
[in] | EventType | Event type. |
[in] | VarName | A Null-terminated string that is the name of the vendor's variable. |
[in] | VendorGuid | A unique identifier for the vendor. |
[in] | VarData | The content of the variable data. |
[in] | VarSize | The size of the variable data. |
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1731 of file TdTcg2Dxe.c.
Exit Boot Services Event notification handler.
Measure invocation and success of ExitBootServices.
[in] | Event | Event whose notification function is being invoked |
[in] | Context | Pointer to the notification function's context |
Definition at line 2231 of file TdTcg2Dxe.c.
Exit Boot Services Failed Event notification handler.
Measure Failure of ExitBootServices.
[in] | Event | Event whose notification function is being invoked |
[in] | Context | Pointer to the notification function's context |
Definition at line 2272 of file TdTcg2Dxe.c.
Ready to Boot Event notification handler.
Sequence of OS boot events is measured in this event notification handler.
[in] | Event | Event whose notification function is being invoked |
[in] | Context | Pointer to the notification function's context |
Definition at line 2125 of file TdTcg2Dxe.c.
EFI_STATUS ReadAndMeasureBootVariable | ( | IN CHAR16 * | VarName, |
IN EFI_GUID * | VendorGuid, | ||
OUT UINTN * | VarSize, | ||
OUT VOID ** | VarData | ||
) |
Read then Measure and log an EFI boot variable, and extend the measurement result into PCR[1]. according to TCG PC Client PFP spec 0021 Section 2.4.4.2
[in] | VarName | A Null-terminated string that is the name of the vendor's variable. |
[in] | VendorGuid | A unique identifier for the vendor. |
[out] | VarSize | The size of the variable data. |
[out] | VarData | Pointer to the content of the variable. |
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1873 of file TdTcg2Dxe.c.
EFI_STATUS ReadAndMeasureSecureVariable | ( | IN CHAR16 * | VarName, |
IN EFI_GUID * | VendorGuid, | ||
OUT UINTN * | VarSize, | ||
OUT VOID ** | VarData | ||
) |
Read then Measure and log an EFI Secure variable, and extend the measurement result into PCR[7].
[in] | VarName | A Null-terminated string that is the name of the vendor's variable. |
[in] | VendorGuid | A unique identifier for the vendor. |
[out] | VarSize | The size of the variable data. |
[out] | VarData | Pointer to the content of the variable. |
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1904 of file TdTcg2Dxe.c.
EFI_STATUS ReadAndMeasureVariable | ( | IN UINT32 | MrIndex, |
IN TCG_EVENTTYPE | EventType, | ||
IN CHAR16 * | VarName, | ||
IN EFI_GUID * | VendorGuid, | ||
OUT UINTN * | VarSize, | ||
OUT VOID ** | VarData | ||
) |
Read then Measure and log an EFI variable, and extend the measurement result into a specific RTMR.
[in] | MrIndex | RTMR Index. |
[in] | EventType | Event type. |
[in] | VarName | A Null-terminated string that is the name of the vendor's variable. |
[in] | VendorGuid | A unique identifier for the vendor. |
[out] | VarSize | The size of the variable data. |
[out] | VarData | Pointer to the content of the variable. |
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1818 of file TdTcg2Dxe.c.
EFI_STATUS SetupCcEventLog | ( | VOID | ) |
Initialize the TD Event Log and log events passed from the PEI phase.
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | Out of memory. |
Definition at line 1425 of file TdTcg2Dxe.c.
EFI_STATUS SyncCcEvent | ( | VOID | ) |
Definition at line 2292 of file TdTcg2Dxe.c.
EFI_STATUS TcgCommLogEvent | ( | IN OUT CC_EVENT_LOG_AREA_STRUCT * | EventLogAreaStruct, |
IN VOID * | NewEventHdr, | ||
IN UINT32 | NewEventHdrSize, | ||
IN UINT8 * | NewEventData, | ||
IN UINT32 | NewEventSize | ||
) |
Add a new entry to the Event Log.
[in,out] | EventLogAreaStruct | The event log area data structure |
[in] | NewEventHdr | Pointer to a TCG_PCR_EVENT_HDR/TCG_PCR_EVENT_EX data structure. |
[in] | NewEventHdrSize | New event header size. |
[in] | NewEventData | Pointer to the new event data. |
[in] | NewEventSize | New event data size. |
EFI_SUCCESS | The new event log entry was added. |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. |
Definition at line 854 of file TdTcg2Dxe.c.
EFI_STATUS EFIAPI TdGetCapability | ( | IN EFI_CC_MEASUREMENT_PROTOCOL * | This, |
IN OUT EFI_CC_BOOT_SERVICE_CAPABILITY * | ProtocolCapability | ||
) |
The EFI_CC_MEASUREMENT_PROTOCOL GetCapability function call provides protocol capability information and state information.
[in] | This | Indicates the calling context |
[in,out] | ProtocolCapability | The caller allocates memory for a EFI_CC_BOOT_SERVICE_CAPABILITY structure and sets the size field to the size of the structure allocated. The callee fills in the fields with the EFI protocol capability information and the current EFI TCG2 state information up to the number of fields which fit within the size of the structure passed in. |
EFI_SUCCESS | Operation completed successfully. |
EFI_DEVICE_ERROR | The command was unsuccessful. The ProtocolCapability variable will not be populated. |
EFI_INVALID_PARAMETER | One or more of the parameters are incorrect. The ProtocolCapability variable will not be populated. |
EFI_BUFFER_TOO_SMALL | The ProtocolCapability variable is too small to hold the full response. It will be partially populated (required Size field will be set). |
Definition at line 470 of file TdTcg2Dxe.c.
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 | ||
) |
The EFI_CC_MEASUREMENT_PROTOCOL Get Event Log function call allows a caller to retrieve the address of a given event log and its last entry.
[in] | This | Indicates the calling context |
[in] | EventLogFormat | The type of the event log for which the information is requested. |
[out] | EventLogLocation | A pointer to the memory address of the event log. |
[out] | EventLogLastEntry | If the Event Log contains more than one entry, this is a pointer to the address of the start of the last entry in the event log in memory. |
[out] | EventLogTruncated | If the Event Log is missing at least one entry because an event would have exceeded the area allocated for events, this value is set to TRUE. Otherwise, the value will be FALSE and the Event Log will be complete. |
EFI_SUCCESS | Operation completed successfully. |
EFI_INVALID_PARAMETER | One or more of the parameters are incorrect (e.g. asking for an event log whose format is not supported). |
Definition at line 752 of file TdTcg2Dxe.c.
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 | ||
) |
The EFI_CC_MEASUREMENT_PROTOCOL HashLogExtendEvent function call provides callers with an opportunity to extend and optionally log events without requiring knowledge of actual TPM commands. The extend operation will occur even if this function cannot create an event log entry (e.g. due to the event log being full).
[in] | This | Indicates the calling context |
[in] | Flags | Bitmap providing additional information. |
[in] | DataToHash | Physical address of the start of the data buffer to be hashed. |
[in] | DataToHashLen | The length in bytes of the buffer referenced by DataToHash. |
[in] | Event | Pointer to data buffer containing information about the event. |
EFI_SUCCESS | Operation completed successfully. |
EFI_DEVICE_ERROR | The command was unsuccessful. |
EFI_VOLUME_FULL | The extend operation occurred, but the event could not be written to one or more event logs. |
EFI_INVALID_PARAMETER | One or more of the parameters are incorrect. |
EFI_UNSUPPORTED | The PE/COFF image type is not supported. |
Definition at line 1330 of file TdTcg2Dxe.c.
EFI_STATUS EFIAPI TdMapPcrToMrIndex | ( | IN EFI_CC_MEASUREMENT_PROTOCOL * | This, |
IN UINT32 | PCRIndex, | ||
OUT UINT32 * | MrIndex | ||
) |
Definition at line 982 of file TdTcg2Dxe.c.
EFI_STATUS TdMeasureAction | ( | IN UINT32 | MrIndex, |
IN CHAR8 * | String | ||
) |
Measure and log an action string, and extend the measurement result into RTMR.
[in] | MrIndex | MrIndex to extend |
[in] | String | A specific string that indicates an Action event. |
EFI_SUCCESS | Operation completed successfully. |
EFI_DEVICE_ERROR | The operation was unsuccessful. |
Definition at line 1611 of file TdTcg2Dxe.c.
EFI_STATUS TdxDxeHashLogExtendEvent | ( | IN UINT64 | Flags, |
IN UINT8 * | HashData, | ||
IN UINT64 | HashDataLen, | ||
IN OUT CC_EVENT_HDR * | NewEventHdr, | ||
IN UINT8 * | NewEventData | ||
) |
Do a hash operation on a data buffer, extend a specific RTMR with the hash result, and add an entry to the Event Log.
[in] | Flags | Bitmap providing additional information. |
[in] | HashData | Physical address of the start of the data buffer to be hashed, extended, and logged. |
[in] | HashDataLen | The length, in bytes, of the buffer referenced by HashData |
[in,out] | NewEventHdr | Pointer to a TD_EVENT_HDR data structure. |
[in] | NewEventData | Pointer to the new event data. |
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. |
EFI_DEVICE_ERROR | The command was unsuccessful. |
Definition at line 1261 of file TdTcg2Dxe.c.
EFI_STATUS TdxDxeLogEvent | ( | IN EFI_CC_EVENT_LOG_FORMAT | EventLogFormat, |
IN VOID * | NewEventHdr, | ||
IN UINT32 | NewEventHdrSize, | ||
IN UINT8 * | NewEventData, | ||
IN UINT32 | NewEventSize | ||
) |
Add a new entry to the Event Log.
[in] | EventLogFormat | The type of the event log for which the information is requested. |
[in] | NewEventHdr | Pointer to a TCG_PCR_EVENT_HDR/TCG_PCR_EVENT_EX data structure. |
[in] | NewEventHdrSize | New event header size. |
[in] | NewEventData | Pointer to the new event data. |
[in] | NewEventSize | New event data size. |
EFI_SUCCESS | The new event log entry was added. |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. |
Definition at line 1011 of file TdTcg2Dxe.c.
EFI_STATUS TdxDxeLogHashEvent | ( | IN TPML_DIGEST_VALUES * | DigestList, |
IN OUT CC_EVENT_HDR * | NewEventHdr, | ||
IN UINT8 * | NewEventData | ||
) |
Add a new entry to the Event Log. The call chain is like below: TdxDxeLogHashEvent -> TdxDxeLogEvent -> TcgCommonLogEvent
Before this function is called, the event information (including the digest) is ready.
[in] | DigestList | A list of digest. |
[in,out] | NewEventHdr | Pointer to a TD_EVENT_HDR data structure. |
[in] | NewEventData | Pointer to the new event data. |
EFI_SUCCESS | The new event log entry was added. |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. |
Definition at line 1200 of file TdTcg2Dxe.c.
UINTN mBootAttempts = 0 |
Definition at line 109 of file TdTcg2Dxe.c.
CHAR16 mBootVarName[] = L"BootOrder" |
Definition at line 110 of file TdTcg2Dxe.c.
CC_EVENT_INFO_STRUCT mCcEventInfo[] |
Definition at line 94 of file TdTcg2Dxe.c.
TDX_HASH_INFO mHashInfo[] |
Definition at line 140 of file TdTcg2Dxe.c.
EFI_HANDLE mImageHandle |
Definition at line 234 of file TdTcg2Dxe.c.
EFI_CC_MEASUREMENT_PROTOCOL mTdProtocol |
Definition at line 1406 of file TdTcg2Dxe.c.
TDX_DXE_DATA mTdxDxeData |
Definition at line 98 of file TdTcg2Dxe.c.
EFI_CC_EVENTLOG_ACPI_TABLE mTdxEventlogAcpiTemplate |
Definition at line 120 of file TdTcg2Dxe.c.
VARIABLE_TYPE mVariableType[] |
Definition at line 112 of file TdTcg2Dxe.c.