TianoCore EDK2 master
|
#include <PiPei.h>
#include <IndustryStandard/Tpm12.h>
#include <IndustryStandard/UefiTcgPlatform.h>
#include <Ppi/FirmwareVolumeInfo.h>
#include <Ppi/FirmwareVolumeInfo2.h>
#include <Ppi/LockPhysicalPresence.h>
#include <Ppi/TpmInitialized.h>
#include <Ppi/FirmwareVolume.h>
#include <Ppi/EndOfPeiPhase.h>
#include <Ppi/FirmwareVolumeInfoMeasurementExcluded.h>
#include <Ppi/Tcg.h>
#include <Guid/TcgEventHob.h>
#include <Guid/MeasuredFvHob.h>
#include <Guid/TpmInstance.h>
#include <Guid/MigratedFvInfo.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/HobLib.h>
#include <Library/PcdLib.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/Tpm12DeviceLib.h>
#include <Library/Tpm12CommandLib.h>
#include <Library/BaseCryptLib.h>
#include <Library/PerformanceLib.h>
Go to the source code of this file.
Macros | |
#define | FIRMWARE_BLOB_GROWTH_STEP 4 |
Initialize TPM device and measure FVs before handing off control to DXE.
Copyright (c) 2005 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file TcgPei.c.
EFI_STATUS EFIAPI EndofPeiSignalNotifyCallBack | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_NOTIFY_DESCRIPTOR * | NotifyDescriptor, | ||
IN VOID * | Ppi | ||
) |
Record all measured Firmware Volume Information into a Guid Hob
[in] | PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
[in] | NotifyDescriptor | Address of the notification descriptor data structure. |
[in] | Ppi | Address of the PPI that was installed. |
EFI_SUCCESS | The FV Info is measured and recorded to TPM. |
Record all measured Firmware Volume Information into a Guid Hob Guid Hob payload layout is
UINT32 *************************** FIRMWARE_BLOB number EFI_PLATFORM_FIRMWARE_BLOB******** BLOB Array
[in] | PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
[in] | NotifyDescriptor | Address of the notification descriptor data structure. |
[in] | Ppi | Address of the PPI that was installed. |
EFI_SUCCESS | The FV Info is measured and recorded to TPM. |
EFI_STATUS EFIAPI FirmwareVolumeInfoPpiNotifyCallback | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_NOTIFY_DESCRIPTOR * | NotifyDescriptor, | ||
IN VOID * | Ppi | ||
) |
Measure and record the Firmware Volume Information once FvInfoPPI install.
[in] | PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
[in] | NotifyDescriptor | Address of the notification descriptor data structure. |
[in] | Ppi | Address of the PPI that was installed. |
EFI_SUCCESS | The FV Info is measured and recorded to TPM. |
EFI_STATUS EFIAPI HashLogExtendEvent | ( | IN EDKII_TCG_PPI * | This, |
IN UINT64 | Flags, | ||
IN UINT8 * | HashData, | ||
IN UINTN | HashDataLen, | ||
IN TCG_PCR_EVENT_HDR * | NewEventHdr, | ||
IN UINT8 * | NewEventData | ||
) |
Do a hash operation on a data buffer, extend a specific TPM PCR with the hash result, and build a GUIDed HOB recording the event which will be passed to the DXE phase and added into the Event Log.
[in] | This | Indicates the calling context |
[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] | NewEventHdr | Pointer to a TCG_PCR_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. |
Do a hash operation on a data buffer, extend a specific TPM PCR with the hash result, and build a GUIDed HOB recording the event which will be passed to the DXE phase and added into the Event Log.
[in] | This | Indicates the calling context. |
[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] | NewEventHdr | Pointer to a TCG_PCR_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. |
BOOLEAN IsTpmUsable | ( | VOID | ) |
EFI_STATUS EFIAPI MeasureCRTMVersion | ( | IN EFI_PEI_SERVICES ** | PeiServices | ) |
EFI_STATUS EFIAPI MeasureFvImage | ( | IN EFI_PHYSICAL_ADDRESS | FvBase, |
IN UINT64 | FvLength | ||
) |
Measure FV image. Add it into the measured FV list after the FV is measured successfully.
[in] | FvBase | Base address of FV image. |
[in] | FvLength | Length of FV image. |
EFI_SUCCESS | Fv image is measured successfully or it has been already measured. |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. |
EFI_DEVICE_ERROR | The command was unsuccessful. |
EFI_STATUS EFIAPI MeasureMainBios | ( | IN EFI_PEI_SERVICES ** | PeiServices | ) |
EFI_STATUS EFIAPI PeimEntryMA | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
IN CONST EFI_PEI_SERVICES ** | PeiServices | ||
) |
EFI_STATUS EFIAPI PeimEntryMP | ( | IN EFI_PEI_SERVICES ** | PeiServices | ) |
Do measurement after memory is ready.
[in] | PeiServices | Describes the list of possible PEI Services. |
EFI_SUCCESS | Operation completed successfully. |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. |
EFI_DEVICE_ERROR | The command was unsuccessful. |
EFI_STATUS EFIAPI PhysicalPresencePpiNotifyCallback | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_NOTIFY_DESCRIPTOR * | NotifyDescriptor, | ||
IN VOID * | Ppi | ||
) |
Lock physical presence if needed.
[in] | PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation |
[in] | NotifyDescriptor | Address of the notification descriptor data structure. |
[in] | Ppi | Address of the PPI that was installed. |
EFI_SUCCESS | Operation completed successfully. |
Set physicalPresenceLifetimeLock, physicalPresenceHWEnable and physicalPresenceCMDEnable bit by corresponding PCDs. And lock physical presence if needed.
[in] | PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation |
[in] | NotifyDescriptor | Address of the notification descriptor data structure. |
[in] | Ppi | Address of the PPI that was installed. |
EFI_SUCCESS | Operation completed successfully. |
EFI_ABORTED | physicalPresenceCMDEnable is locked. |
EFI_DEVICE_ERROR | The command was unsuccessful. |
EFI_STATUS EFIAPI TpmCommHashAll | ( | IN CONST UINT8 * | Data, |
IN UINTN | DataLen, | ||
OUT TPM_DIGEST * | Digest | ||
) |
Single function calculates SHA1 digest value for all raw data. It combines Sha1Init(), Sha1Update() and Sha1Final().
[in] | Data | Raw data to be digested. |
[in] | DataLen | Size of the raw data. |
[out] | Digest | Pointer to a buffer that stores the final digest. |
EFI_SUCCESS | Always successfully calculate the final digest. |
EDKII_TCG_PPI mEdkiiTcgPpi |
EFI_PLATFORM_FIRMWARE_BLOB* mMeasuredBaseFvInfo |
EFI_PLATFORM_FIRMWARE_BLOB* mMeasuredChildFvInfo |
EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI* mMeasurementExcludedFvPpi |
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList[] |
EFI_PEI_PPI_DESCRIPTOR mTcgPpiList |
EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList |
EFI_PEI_PPI_DESCRIPTOR mTpmInitializedPpiList |