Defines | |
#define | PERF_ID_TCG2_PEI 0x3080 |
Functions | |
EFI_STATUS EFIAPI | FirmwareVolmeInfoPpiNotifyCallback (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi) |
EFI_STATUS EFIAPI | EndofPeiSignalNotifyCallBack (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi) |
EFI_STATUS | Tpm2GetDigestFromDigestList (IN TPMI_ALG_HASH HashAlg, IN TPML_DIGEST_VALUES *DigestList, IN VOID *Digest) |
BOOLEAN | IsZeroBuffer (IN VOID *Buffer, IN UINTN BufferSize) |
UINT32 | GetDigestListSize (IN TPML_DIGEST_VALUES *DigestList) |
BOOLEAN | IsHashAlgSupportedInPcrBank (IN TPMI_ALG_HASH HashAlg) |
VOID * | CopyDigestListToBuffer (IN OUT VOID *Buffer, IN TPML_DIGEST_VALUES *DigestList) |
VOID | SetTpm2HashMask (VOID) |
EFI_STATUS | LogHashEvent (IN TPML_DIGEST_VALUES *DigestList, IN OUT TCG_PCR_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData) |
EFI_STATUS | HashLogExtendEvent (IN UINT64 Flags, IN UINT8 *HashData, IN UINTN HashDataLen, IN TCG_PCR_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData) |
EFI_STATUS | MeasureCRTMVersion (VOID) |
EFI_STATUS | MeasureFvImage (IN EFI_PHYSICAL_ADDRESS FvBase, IN UINT64 FvLength) |
EFI_STATUS | MeasureMainBios (VOID) |
EFI_STATUS | PeimEntryMP (IN EFI_PEI_SERVICES **PeiServices) |
EFI_STATUS EFIAPI | PeimEntryMA (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices) |
Variables | |
TCG2_EVENT_INFO_STRUCT | mTcg2EventInfo [] |
BOOLEAN | mImageInMemory = FALSE |
EFI_PEI_FILE_HANDLE | mFileHandle |
EFI_PEI_PPI_DESCRIPTOR | mTpmInitializedPpiList |
EFI_PEI_PPI_DESCRIPTOR | mTpmInitializationDonePpiList |
EFI_PLATFORM_FIRMWARE_BLOB * | mMeasuredBaseFvInfo |
UINT32 | mMeasuredBaseFvIndex = 0 |
EFI_PLATFORM_FIRMWARE_BLOB * | mMeasuredChildFvInfo |
UINT32 | mMeasuredChildFvIndex = 0 |
EFI_PEI_NOTIFY_DESCRIPTOR | mNotifyList [] |
EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI * | mMeasurementExcludedFvPpi |
Copyright (c) 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define PERF_ID_TCG2_PEI 0x3080 |
Referenced by MeasureMainBios().
VOID* CopyDigestListToBuffer | ( | IN OUT VOID * | Buffer, | |
IN TPML_DIGEST_VALUES * | DigestList | |||
) |
Copy TPML_DIGEST_VALUES into a buffer
[in,out] | Buffer | Buffer to hold TPML_DIGEST_VALUES. |
[in] | DigestList | TPML_DIGEST_VALUES to be copied. |
References GetHashSizeFromAlgo(), IsHashAlgSupportedInPcrBank(), and UINTN().
EFI_STATUS EFIAPI EndofPeiSignalNotifyCallBack | ( | IN EFI_PEI_SERVICES ** | PeiServices, | |
IN EFI_PEI_NOTIFY_DESCRIPTOR * | NotifyDescriptor, | |||
IN VOID * | Ppi | |||
) |
Record all measured Firmware Volum 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. |
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. |
References gMeasuredFvHobGuid, MEASURED_HOB_DATA::MeasuredFvBuf, mMeasuredBaseFvIndex, mMeasuredBaseFvInfo, mMeasuredChildFvIndex, mMeasuredChildFvInfo, MEASURED_HOB_DATA::Num, and UINTN().
EFI_STATUS EFIAPI FirmwareVolmeInfoPpiNotifyCallback | ( | IN EFI_PEI_SERVICES ** | PeiServices, | |
IN EFI_PEI_NOTIFY_DESCRIPTOR * | NotifyDescriptor, | |||
IN VOID * | Ppi | |||
) |
Measure and record the Firmware Volum 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. |
References EFI_STATUS(), MeasureFvImage(), mMeasuredChildFvIndex, mMeasuredChildFvInfo, and UINTN().
UINT32 GetDigestListSize | ( | IN TPML_DIGEST_VALUES * | DigestList | ) |
Get TPML_DIGEST_VALUES data size.
[in] | DigestList | TPML_DIGEST_VALUES data. |
References GetHashSizeFromAlgo(), and UINTN().
EFI_STATUS HashLogExtendEvent | ( | 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] | 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. |
References EFI_STATUS(), gTpmErrorHobGuid, HashAndExtend(), and LogHashEvent().
Referenced by MeasureCRTMVersion(), and MeasureFvImage().
BOOLEAN IsHashAlgSupportedInPcrBank | ( | IN TPMI_ALG_HASH | HashAlg | ) |
Return if hash alg is supported in TPM PCR bank.
HashAlg | Hash algorithm to be checked. |
TRUE | Hash algorithm is supported. | |
FALSE | Hash algorithm is not supported. |
References TRUE.
BOOLEAN IsZeroBuffer | ( | IN VOID * | Buffer, | |
IN UINTN | BufferSize | |||
) |
EFI_STATUS LogHashEvent | ( | IN TPML_DIGEST_VALUES * | DigestList, | |
IN OUT TCG_PCR_EVENT_HDR * | NewEventHdr, | |||
IN UINT8 * | NewEventData | |||
) |
Add a new entry to the Event Log.
[in] | DigestList | A list of digest. |
[in,out] | NewEventHdr | Pointer to a TCG_PCR_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. |
References CopyDigestListToBuffer(), EFI_STATUS(), EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2, EFI_TCG2_EVENT_LOG_FORMAT_TCG_2, GetDigestListSize(), gTcgEvent2EntryHobGuid, gTcgEventEntryHobGuid, mTcg2EventInfo, Tpm2GetDigestFromDigestList(), and UINTN().
Referenced by HashLogExtendEvent().
EFI_STATUS MeasureCRTMVersion | ( | VOID | ) |
Measure CRTM version.
EFI_SUCCESS | Operation completed successfully. | |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. | |
EFI_DEVICE_ERROR | The command was unsuccessful. |
References HashLogExtendEvent().
Referenced by PeimEntryMP().
EFI_STATUS 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. |
References EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI::Count, EFI_STATUS(), EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI::Fv, EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_FV::FvBase, HashLogExtendEvent(), mMeasuredBaseFvIndex, mMeasuredBaseFvInfo, and UINTN().
Referenced by FirmwareVolmeInfoPpiNotifyCallback(), and MeasureMainBios().
EFI_STATUS MeasureMainBios | ( | VOID | ) |
Measure main BIOS.
EFI_SUCCESS | Operation completed successfully. | |
EFI_OUT_OF_RESOURCES | No enough memory to log the new event. | |
EFI_DEVICE_ERROR | The command was unsuccessful. |
References EFI_STATUS(), MeasureFvImage(), mFileHandle, PERF_ID_TCG2_PEI, TRUE, and UINTN().
Referenced by PeimEntryMP().
EFI_STATUS EFIAPI PeimEntryMA | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, | |
IN CONST EFI_PEI_SERVICES ** | PeiServices | |||
) |
Entry point of this module.
[in] | FileHandle | Handle of the file being invoked. |
[in] | PeiServices | Describes the list of possible PEI Services. |
References EFI_STATUS(), gEfiTpmDeviceInstanceNoneGuid, gEfiTpmDeviceInstanceTpm12Guid, gTpmErrorHobGuid, mFileHandle, mImageInMemory, mTpmInitializationDonePpiList, mTpmInitializedPpiList, PeimEntryMP(), SetTpm2HashMask(), Tpm2RequestUseTpm(), Tpm2SelfTest(), Tpm2Startup(), and TRUE.
EFI_STATUS 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. |
References EFI_STATUS(), gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, MeasureCRTMVersion(), MeasureMainBios(), mMeasuredBaseFvInfo, mMeasuredChildFvInfo, and mNotifyList.
Referenced by PeimEntryMA().
VOID SetTpm2HashMask | ( | VOID | ) |
Set Tpm2HashMask PCD value accroding to TPM2 PCR bank.
References EFI_STATUS(), IsZeroBuffer(), Tpm2GetCapabilityPcrs(), and UINTN().
Referenced by PeimEntryMA().
EFI_STATUS Tpm2GetDigestFromDigestList | ( | IN TPMI_ALG_HASH | HashAlg, | |
IN TPML_DIGEST_VALUES * | DigestList, | |||
IN VOID * | Digest | |||
) |
This function get digest from digest list.
HashAlg | digest algorithm | |
DigestList | digest list | |
Digest | digest |
EFI_SUCCESS | Sha1Digest is found and returned. | |
EFI_NOT_FOUND | Sha1Digest is not found. |
References GetHashSizeFromAlgo(), and UINTN().
EFI_PEI_FILE_HANDLE mFileHandle |
Referenced by MeasureMainBios(), and PeimEntryMA().
BOOLEAN mImageInMemory = FALSE |
Referenced by PeimEntryMA().
UINT32 mMeasuredBaseFvIndex = 0 |
Referenced by EndofPeiSignalNotifyCallBack(), and MeasureFvImage().
EFI_PLATFORM_FIRMWARE_BLOB* mMeasuredBaseFvInfo |
Referenced by EndofPeiSignalNotifyCallBack(), MeasureFvImage(), and PeimEntryMP().
UINT32 mMeasuredChildFvIndex = 0 |
Referenced by EndofPeiSignalNotifyCallBack(), and FirmwareVolmeInfoPpiNotifyCallback().
EFI_PLATFORM_FIRMWARE_BLOB* mMeasuredChildFvInfo |
Referenced by EndofPeiSignalNotifyCallBack(), FirmwareVolmeInfoPpiNotifyCallback(), and PeimEntryMP().
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList[] |
Initial value:
{ { EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, &gEfiPeiFirmwareVolumeInfoPpiGuid, FirmwareVolmeInfoPpiNotifyCallback }, { EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, &gEfiPeiFirmwareVolumeInfo2PpiGuid, FirmwareVolmeInfoPpiNotifyCallback }, { (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), &gEfiEndOfPeiSignalPpiGuid, EndofPeiSignalNotifyCallBack } }
Referenced by PeimEntryMP().
TCG2_EVENT_INFO_STRUCT mTcg2EventInfo[] |
Initial value:
EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList |
Initial value:
{ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, &gPeiTpmInitializationDonePpiGuid, NULL }
EFI_PEI_PPI_DESCRIPTOR mTpmInitializedPpiList |
Initial value:
{ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, &gPeiTpmInitializedPpiGuid, NULL }
Referenced by PeimEntryMA().