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

Go to the source code of this file.

Data Structures

struct  HASH_INTERFACE_HOB
 

Macros

#define HASH_LIB_PEI_ROUTER_GUID    { 0x84681c08, 0x6873, 0x46f3, { 0x8b, 0xb7, 0xab, 0x66, 0x18, 0x95, 0xa1, 0xb3 } }
 

Functions

HASH_INTERFACE_HOBInternalGetHashInterfaceHob (EFI_GUID *Identifier)
 
HASH_INTERFACE_HOBInternalCreateHashInterfaceHob (EFI_GUID *Identifier)
 
VOID CheckSupportedHashMaskMismatch (IN HASH_INTERFACE_HOB *HashInterfaceHobCurrent)
 
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)
 
EFI_STATUS EFIAPI HashLibBaseCryptoRouterPeiConstructor (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
 

Variables

EFI_GUID mHashLibPeiRouterGuid = HASH_LIB_PEI_ROUTER_GUID
 

Detailed Description

This library is BaseCrypto router. It will redirect hash request to each individual hash handler registered, such as SHA1, SHA256. Platform can use PcdTpm2HashMask to mask some hash engines.

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

Definition in file HashLibBaseCryptoRouterPei.c.

Macro Definition Documentation

◆ HASH_LIB_PEI_ROUTER_GUID

#define HASH_LIB_PEI_ROUTER_GUID    { 0x84681c08, 0x6873, 0x46f3, { 0x8b, 0xb7, 0xab, 0x66, 0x18, 0x95, 0xa1, 0xb3 } }

Definition at line 24 of file HashLibBaseCryptoRouterPei.c.

Function Documentation

◆ CheckSupportedHashMaskMismatch()

VOID CheckSupportedHashMaskMismatch ( IN HASH_INTERFACE_HOB HashInterfaceHobCurrent)

Check mismatch of supported HashMask between modules that may link different HashInstanceLib instances.

Parameters
HashInterfaceHobCurrentPointer to hash interface hob for CURRENT module.

Definition at line 102 of file HashLibBaseCryptoRouterPei.c.

◆ 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 286 of file HashLibBaseCryptoRouterPei.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 227 of file HashLibBaseCryptoRouterPei.c.

◆ HashLibBaseCryptoRouterPeiConstructor()

EFI_STATUS EFIAPI HashLibBaseCryptoRouterPeiConstructor ( IN EFI_PEI_FILE_HANDLE  FileHandle,
IN CONST EFI_PEI_SERVICES **  PeiServices 
)

The constructor function of HashLibBaseCryptoRouterPei.

Parameters
FileHandleThe handle of FFS header the loaded driver.
PeiServicesThe pointer to the PEI services.
Return values
EFI_SUCCESSThe constructor executes successfully.
EFI_OUT_OF_RESOURCESThere is no enough resource for the constructor.

Definition at line 395 of file HashLibBaseCryptoRouterPei.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 134 of file HashLibBaseCryptoRouterPei.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 180 of file HashLibBaseCryptoRouterPei.c.

◆ InternalCreateHashInterfaceHob()

HASH_INTERFACE_HOB * InternalCreateHashInterfaceHob ( EFI_GUID Identifier)

This function creates hash interface hob.

Parameters
IdentifierIdentifier to create hash interface hob.
Return values
hashinterface hob.

Definition at line 83 of file HashLibBaseCryptoRouterPei.c.

◆ InternalGetHashInterfaceHob()

HASH_INTERFACE_HOB * InternalGetHashInterfaceHob ( EFI_GUID Identifier)

This function gets hash interface hob.

Parameters
IdentifierIdentifier to get hash interface hob.
Return values
hashinterface hob.

Definition at line 51 of file HashLibBaseCryptoRouterPei.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 326 of file HashLibBaseCryptoRouterPei.c.

Variable Documentation

◆ mHashLibPeiRouterGuid

EFI_GUID mHashLibPeiRouterGuid = HASH_LIB_PEI_ROUTER_GUID

Definition at line 27 of file HashLibBaseCryptoRouterPei.c.