2 This library is used by other modules to measure data to TPM.
4 Copyright (c) 2020, Intel Corporation. All rights reserved. <BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/BaseMemoryLib.h>
12 #include <Library/PeiServicesLib.h>
13 #include <Library/PeiServicesTablePointerLib.h>
14 #include <Library/DebugLib.h>
15 #include <Library/HobLib.h>
16 #include <Library/TpmMeasurementLib.h>
19 #include <IndustryStandard/UefiTcgPlatform.h>
22 Tpm measure and log data, and extend the measurement result into a specific PCR.
24 @param[in] PcrIndex PCR Index.
25 @param[in] EventType Event type.
26 @param[in] EventLog Measurement event log.
27 @param[in] LogLen Event log length in bytes.
28 @param[in] HashData The start of the data buffer to be hashed, extended.
29 @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData
31 @retval EFI_SUCCESS Operation completed successfully.
32 @retval EFI_UNSUPPORTED TPM device not available.
33 @retval EFI_OUT_OF_RESOURCES Out of memory.
34 @retval EFI_DEVICE_ERROR The operation was unsuccessful.
38 TpmMeasureAndLogData (
48 EDKII_TCG_PPI
*TcgPpi
;
49 TCG_PCR_EVENT_HDR TcgEventHdr
;
51 Status
= PeiServicesLocatePpi (
57 if (EFI_ERROR (Status
)) {
61 TcgEventHdr
.PCRIndex
= PcrIndex
;
62 TcgEventHdr
.EventType
= EventType
;
63 TcgEventHdr
.EventSize
= LogLen
;
65 Status
= TcgPpi
->HashLogExtendEvent (