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

Go to the source code of this file.

Data Structures

struct  TPM2_PCR_EXTEND_COMMAND
 
struct  TPM2_PCR_EXTEND_RESPONSE
 
struct  TPM2_PCR_EVENT_COMMAND
 
struct  TPM2_PCR_EVENT_RESPONSE
 
struct  TPM2_PCR_READ_COMMAND
 
struct  TPM2_PCR_READ_RESPONSE
 
struct  TPM2_PCR_ALLOCATE_COMMAND
 
struct  TPM2_PCR_ALLOCATE_RESPONSE
 

Functions

EFI_STATUS EFIAPI Tpm2PcrExtend (IN TPMI_DH_PCR PcrHandle, IN TPML_DIGEST_VALUES *Digests)
 
EFI_STATUS EFIAPI Tpm2PcrEvent (IN TPMI_DH_PCR PcrHandle, IN TPM2B_EVENT *EventData, OUT TPML_DIGEST_VALUES *Digests)
 
EFI_STATUS EFIAPI Tpm2PcrRead (IN TPML_PCR_SELECTION *PcrSelectionIn, OUT UINT32 *PcrUpdateCounter, OUT TPML_PCR_SELECTION *PcrSelectionOut, OUT TPML_DIGEST *PcrValues)
 
EFI_STATUS EFIAPI Tpm2PcrAllocate (IN TPMI_RH_PLATFORM AuthHandle, IN TPMS_AUTH_COMMAND *AuthSession, IN TPML_PCR_SELECTION *PcrAllocation, OUT TPMI_YES_NO *AllocationSuccess, OUT UINT32 *MaxPCR, OUT UINT32 *SizeNeeded, OUT UINT32 *SizeAvailable)
 
EFI_STATUS EFIAPI Tpm2PcrAllocateBanks (IN TPM2B_AUTH *PlatformAuth OPTIONAL, IN UINT32 SupportedPCRBanks, IN UINT32 PCRBanks)
 
EFI_STATUS EFIAPI Tpm2PcrReadForActiveBank (IN TPMI_DH_PCR PcrHandle, OUT TPML_DIGEST *HashList)
 

Detailed Description

Implement TPM2 Integrity related command.

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

Definition in file Tpm2Integrity.c.

Function Documentation

◆ Tpm2PcrAllocate()

EFI_STATUS EFIAPI Tpm2PcrAllocate ( IN TPMI_RH_PLATFORM  AuthHandle,
IN TPMS_AUTH_COMMAND AuthSession,
IN TPML_PCR_SELECTION PcrAllocation,
OUT TPMI_YES_NO *  AllocationSuccess,
OUT UINT32 *  MaxPCR,
OUT UINT32 *  SizeNeeded,
OUT UINT32 *  SizeAvailable 
)

This command is used to set the desired PCR allocation of PCR and algorithms.

Parameters
[in]AuthHandleTPM_RH_PLATFORM+{PP}
[in]AuthSessionAuth Session context
[in]PcrAllocationThe requested allocation
[out]AllocationSuccessYES if the allocation succeeded
[out]MaxPCRmaximum number of PCR that may be in a bank
[out]SizeNeedednumber of octets required to satisfy the request
[out]SizeAvailableNumber of octets available. Computed before the allocation
Return values
EFI_SUCCESSOperation completed successfully.
EFI_DEVICE_ERRORThe command was unsuccessful.

Definition at line 475 of file Tpm2Integrity.c.

◆ Tpm2PcrAllocateBanks()

EFI_STATUS EFIAPI Tpm2PcrAllocateBanks ( IN TPM2B_AUTH *PlatformAuth  OPTIONAL,
IN UINT32  SupportedPCRBanks,
IN UINT32  PCRBanks 
)

Alloc PCR data.

Parameters
[in]PlatformAuthplatform auth value. NULL means no platform auth change.
[in]SupportedPCRBanksSupported PCR banks
[in]PCRBanksPCR banks
Return values
EFI_SUCCESSOperation completed successfully.

Definition at line 598 of file Tpm2Integrity.c.

◆ Tpm2PcrEvent()

EFI_STATUS EFIAPI Tpm2PcrEvent ( IN TPMI_DH_PCR  PcrHandle,
IN TPM2B_EVENT EventData,
OUT TPML_DIGEST_VALUES Digests 
)

This command is used to cause an update to the indicated PCR. The data in eventData is hashed using the hash algorithm associated with each bank in which the indicated PCR has been allocated. After the data is hashed, the digests list is returned. If the pcrHandle references an implemented PCR and not TPM_ALG_NULL, digests list is processed as in TPM2_PCR_Extend(). A TPM shall support an Event.size of zero through 1,024 inclusive.

Parameters
[in]PcrHandleHandle of the PCR
[in]EventDataEvent data in sized buffer
[out]DigestsList of digest
Return values
EFI_SUCCESSOperation completed successfully.
EFI_DEVICE_ERRORUnexpected device behavior.

Definition at line 223 of file Tpm2Integrity.c.

◆ Tpm2PcrExtend()

EFI_STATUS EFIAPI Tpm2PcrExtend ( IN TPMI_DH_PCR  PcrHandle,
IN TPML_DIGEST_VALUES Digests 
)

This command is used to cause an update to the indicated PCR. The digests parameter contains one or more tagged digest value identified by an algorithm ID. For each digest, the PCR associated with pcrHandle is Extended into the bank identified by the tag (hashAlg).

Parameters
[in]PcrHandleHandle of the PCR
[in]DigestsList of tagged digest values to be extended
Return values
EFI_SUCCESSOperation completed successfully.
EFI_DEVICE_ERRORUnexpected device behavior.

Definition at line 92 of file Tpm2Integrity.c.

◆ Tpm2PcrRead()

EFI_STATUS EFIAPI Tpm2PcrRead ( IN TPML_PCR_SELECTION PcrSelectionIn,
OUT UINT32 *  PcrUpdateCounter,
OUT TPML_PCR_SELECTION PcrSelectionOut,
OUT TPML_DIGEST PcrValues 
)

This command returns the values of all PCR specified in pcrSelect.

Parameters
[in]PcrSelectionInThe selection of PCR to read.
[out]PcrUpdateCounterThe current value of the PCR update counter.
[out]PcrSelectionOutThe PCR in the returned list.
[out]PcrValuesThe contents of the PCR indicated in pcrSelect.
Return values
EFI_SUCCESSOperation completed successfully.
EFI_DEVICE_ERRORThe command was unsuccessful.

Definition at line 337 of file Tpm2Integrity.c.

◆ Tpm2PcrReadForActiveBank()

EFI_STATUS EFIAPI Tpm2PcrReadForActiveBank ( IN TPMI_DH_PCR  PcrHandle,
OUT TPML_DIGEST HashList 
)

This function will query the TPM to determine which hashing algorithms and get the digests of all active and supported PCR banks of a specific PCR register.

Parameters
[in]PcrHandleThe index of the PCR register to be read.
[out]HashListList of digests from PCR register being read.
Return values
EFI_SUCCESSThe Pcr was read successfully.
EFI_DEVICE_ERRORThe command was unsuccessful.

Definition at line 743 of file Tpm2Integrity.c.