TianoCore EDK2 master
Loading...
Searching...
No Matches
HashLibTdx.c File Reference
#include <PiPei.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/HashLib.h>
#include <Library/TdxLib.h>
#include <Protocol/CcMeasurement.h>

Go to the source code of this file.

Functions

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

EFI_GUID mSha384Guid = HASH_ALGORITHM_SHA384_GUID
 
HASH_INTERFACE mHashInterface
 
UINTN mHashInterfaceCount = 0
 

Detailed Description

This library is HashLib for Tdx.

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

Definition in file HashLibTdx.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 RTMR.

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 150 of file HashLibTdx.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 98 of file HashLibTdx.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 39 of file HashLibTdx.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 69 of file HashLibTdx.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 185 of file HashLibTdx.c.

Variable Documentation

◆ mHashInterface

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

Definition at line 23 of file HashLibTdx.c.

◆ mHashInterfaceCount

UINTN mHashInterfaceCount = 0

Definition at line 27 of file HashLibTdx.c.

◆ mSha384Guid

EFI_GUID mSha384Guid = HASH_ALGORITHM_SHA384_GUID

Definition at line 18 of file HashLibTdx.c.