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

Go to the source code of this file.

Data Structures

struct  TPM2_HASH_MASK
 

Functions

TPM_ALG_ID Tpm2GetAlgoFromHashMask (VOID)
 
EFI_STATUS EFIAPI HashStart (OUT HASH_HANDLE *HashHandle)
 
EFI_STATUS EFIAPI HashUpdate (IN HASH_HANDLE HashHandle, IN VOID *DataToHash, IN UINTN DataToHashLen)
 
EFI_STATUS EFIAPI HashCompleteAndExtend (IN HASH_HANDLE HashHandle, IN TPMI_DH_PCR PcrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT TPML_DIGEST_VALUES *DigestList)
 
EFI_STATUS EFIAPI HashAndExtend (IN TPMI_DH_PCR PcrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT TPML_DIGEST_VALUES *DigestList)
 
EFI_STATUS EFIAPI RegisterHashInterfaceLib (IN HASH_INTERFACE *HashInterface)
 

Variables

TPM2_HASH_MASK mTpm2HashMask []
 

Detailed Description

This library uses TPM2 device to calculation hash.

Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file HashLibTpm2.c.

Function Documentation

◆ HashAndExtend()

EFI_STATUS EFIAPI HashAndExtend ( IN TPMI_DH_PCR  PcrIndex,
IN VOID *  DataToHash,
IN UINTN  DataToHashLen,
OUT TPML_DIGEST_VALUES DigestList 
)

Hash data and extend to PCR.

Parameters
PcrIndexPCR to be extended.
DataToHashData to be hashed.
DataToHashLenData size.
DigestListDigest list.
Return values
EFI_SUCCESSHash data and DigestList is returned.

Definition at line 225 of file HashLibTpm2.c.

◆ HashCompleteAndExtend()

EFI_STATUS EFIAPI HashCompleteAndExtend ( IN HASH_HANDLE  HashHandle,
IN TPMI_DH_PCR  PcrIndex,
IN VOID *  DataToHash,
IN UINTN  DataToHashLen,
OUT TPML_DIGEST_VALUES DigestList 
)

Hash sequence complete and extend to PCR.

Parameters
HashHandleHash handle.
PcrIndexPCR to be extended.
DataToHashData to be hashed.
DataToHashLenData size.
DigestListDigest list.
Return values
EFI_SUCCESSHash sequence complete and DigestList is returned.

Definition at line 142 of file HashLibTpm2.c.

◆ HashStart()

EFI_STATUS EFIAPI HashStart ( OUT HASH_HANDLE *  HashHandle)

Start hash sequence.

Parameters
HashHandleHash handle.
Return values
EFI_SUCCESSHash sequence start and HandleHandle returned.
EFI_OUT_OF_RESOURCESNo enough resource to start hash.

Definition at line 64 of file HashLibTpm2.c.

◆ HashUpdate()

EFI_STATUS EFIAPI HashUpdate ( IN HASH_HANDLE  HashHandle,
IN VOID *  DataToHash,
IN UINTN  DataToHashLen 
)

Update hash sequence data.

Parameters
HashHandleHash handle.
DataToHashData to be hashed.
DataToHashLenData size.
Return values
EFI_SUCCESSHash sequence updated.

Definition at line 93 of file HashLibTpm2.c.

◆ RegisterHashInterfaceLib()

EFI_STATUS EFIAPI RegisterHashInterfaceLib ( IN HASH_INTERFACE HashInterface)

This service register Hash.

Parameters
HashInterfaceHash interface
Return values
EFI_SUCCESSThis hash interface is registered successfully.
EFI_UNSUPPORTEDSystem does not support register this interface.
EFI_ALREADY_STARTEDSystem already register this interface.

Definition at line 337 of file HashLibTpm2.c.

◆ Tpm2GetAlgoFromHashMask()

TPM_ALG_ID Tpm2GetAlgoFromHashMask ( VOID  )

The function get algorithm from hash mask info.

Returns
Hash algorithm

Definition at line 37 of file HashLibTpm2.c.

Variable Documentation

◆ mTpm2HashMask

TPM2_HASH_MASK mTpm2HashMask[]
Initial value:
= {
{ TPM_ALG_SHA1, HASH_ALG_SHA1 },
{ TPM_ALG_SHA256, HASH_ALG_SHA256 },
{ TPM_ALG_SHA384, HASH_ALG_SHA384 },
{ TPM_ALG_SHA512, HASH_ALG_SHA512 },
}

Definition at line 24 of file HashLibTpm2.c.