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

Go to the source code of this file.

Functions

VOID CheckSupportedHashMaskMismatch (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 Tpm2ExtendNvIndex (TPMI_RH_NV_INDEX NvIndex, UINT16 DataSize, BYTE *Data)
 
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 HashLibBaseCryptoRouterDxeConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

HASH_INTERFACE mHashInterface [HASH_COUNT]
 
UINTN mHashInterfaceCount = 0
 
UINT32 mSupportedHashMaskLast = 0
 
UINT32 mSupportedHashMaskCurrent = 0
 

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 - 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file HashLibBaseCryptoRouterDxe.c.

Function Documentation

◆ CheckSupportedHashMaskMismatch()

VOID CheckSupportedHashMaskMismatch ( VOID  )

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

Definition at line 39 of file HashLibBaseCryptoRouterDxe.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 265 of file HashLibBaseCryptoRouterDxe.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 188 of file HashLibBaseCryptoRouterDxe.c.

◆ HashLibBaseCryptoRouterDxeConstructor()

EFI_STATUS EFIAPI HashLibBaseCryptoRouterDxeConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The constructor function of HashLibBaseCryptoRouterDxe.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe constructor executed correctly.

Definition at line 358 of file HashLibBaseCryptoRouterDxe.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 HashLibBaseCryptoRouterDxe.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 104 of file HashLibBaseCryptoRouterDxe.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 299 of file HashLibBaseCryptoRouterDxe.c.

◆ Tpm2ExtendNvIndex()

EFI_STATUS EFIAPI Tpm2ExtendNvIndex ( TPMI_RH_NV_INDEX  NvIndex,
UINT16  DataSize,
BYTE *  Data 
)

Extend to TPM NvIndex.

Parameters
[in]NvIndexThe NV Index of the area to extend.
[in]DataSizeThe data size to extend.
[in]DataThe data to extend.
Return values
EFI_SUCCESSOperation completed successfully.
EFI_DEVICE_ERRORThe command was unsuccessful.
EFI_NOT_FOUNDThe command was returned successfully, but NvIndex is not found.

Definition at line 145 of file HashLibBaseCryptoRouterDxe.c.

Variable Documentation

◆ mHashInterface

HASH_INTERFACE mHashInterface[HASH_COUNT]
Initial value:
= {
{
{ 0 }, NULL, NULL, NULL
}
}
#define NULL
Definition: Base.h:319

Definition at line 23 of file HashLibBaseCryptoRouterDxe.c.

◆ mHashInterfaceCount

UINTN mHashInterfaceCount = 0

Definition at line 28 of file HashLibBaseCryptoRouterDxe.c.

◆ mSupportedHashMaskCurrent

UINT32 mSupportedHashMaskCurrent = 0

Definition at line 31 of file HashLibBaseCryptoRouterDxe.c.

◆ mSupportedHashMaskLast

UINT32 mSupportedHashMaskLast = 0

Definition at line 30 of file HashLibBaseCryptoRouterDxe.c.