TianoCore EDK2 master
Loading...
Searching...
No Matches
BaseHashApiLib.c File Reference
#include <Base.h>
#include <IndustryStandard/Tpm20.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseCryptLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/HashApiLib.h>

Go to the source code of this file.

Functions

UINTN EFIAPI HashApiGetContextSize (VOID)
 
BOOLEAN EFIAPI HashApiInit (OUT HASH_API_CONTEXT HashContext)
 
BOOLEAN EFIAPI HashApiDuplicate (IN HASH_API_CONTEXT HashContext, OUT HASH_API_CONTEXT NewHashContext)
 
BOOLEAN EFIAPI HashApiUpdate (IN HASH_API_CONTEXT HashContext, IN VOID *DataToHash, IN UINTN DataToHashLen)
 
BOOLEAN EFIAPI HashApiFinal (IN HASH_API_CONTEXT HashContext, OUT UINT8 *Digest)
 
BOOLEAN EFIAPI HashApiHashAll (IN CONST VOID *DataToHash, IN UINTN DataToHashLen, OUT UINT8 *Digest)
 

Detailed Description

Unified Hash API Implementation

This file implements the Unified Hash API.

This API, when called, will calculate the Hash using the hashing algorithm specified by PcdHashApiLibPolicy.

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

Definition in file BaseHashApiLib.c.

Function Documentation

◆ HashApiDuplicate()

BOOLEAN EFIAPI HashApiDuplicate ( IN HASH_API_CONTEXT  HashContext,
OUT HASH_API_CONTEXT  NewHashContext 
)

Makes a copy of an existing hash context.

Parameters
[in]HashContextHash context.
[out]NewHashContextNew copy of hash context.
Return values
TRUEHash context copy succeeded.
FALSEHash context copy failed.

Definition at line 120 of file BaseHashApiLib.c.

◆ HashApiFinal()

BOOLEAN EFIAPI HashApiFinal ( IN HASH_API_CONTEXT  HashContext,
OUT UINT8 *  Digest 
)

Hash complete.

Parameters
[in]HashContextHash context.
[out]DigestHash Digest.
Return values
TRUEHash complete and Digest is returned.
FALSEHash complete unsuccessful.

Definition at line 214 of file BaseHashApiLib.c.

◆ HashApiGetContextSize()

UINTN EFIAPI HashApiGetContextSize ( VOID  )

Retrieves the size, in bytes, of the context buffer required for hash operations.

Returns
The size, in bytes, of the context buffer required for hash operations.

Definition at line 31 of file BaseHashApiLib.c.

◆ HashApiHashAll()

BOOLEAN EFIAPI HashApiHashAll ( IN CONST VOID *  DataToHash,
IN UINTN  DataToHashLen,
OUT UINT8 *  Digest 
)

Computes hash message digest of a input data buffer.

Parameters
[in]DataToHashData to be hashed.
[in]DataToHashLenData size.
[out]DigestHash Digest.
Return values
TRUEHash digest computation succeeded.
FALSEHash digest computation failed.

Definition at line 261 of file BaseHashApiLib.c.

◆ HashApiInit()

BOOLEAN EFIAPI HashApiInit ( OUT HASH_API_CONTEXT  HashContext)

Init hash sequence.

Parameters
[out]HashContextHash context.
Return values
TRUEHash start and HashHandle returned.
FALSEHash Init unsuccessful.

Definition at line 75 of file BaseHashApiLib.c.

◆ HashApiUpdate()

BOOLEAN EFIAPI HashApiUpdate ( IN HASH_API_CONTEXT  HashContext,
IN VOID *  DataToHash,
IN UINTN  DataToHashLen 
)

Update hash data.

Parameters
[in]HashContextHash context.
[in]DataToHashData to be hashed.
[in]DataToHashLenData size.
Return values
TRUEHash updated.
FALSEHash updated unsuccessful.

Definition at line 167 of file BaseHashApiLib.c.