2 Unified Hash API Defines
4 This API when called will calculate the Hash using the
5 hashing algorithm specified by PcdHashApiLibPolicy.
7 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #ifndef __BASEHASHAPILIB_H_
13 #define __BASEHASHAPILIB_H_
15 typedef VOID
*HASH_API_CONTEXT
;
20 #define HASH_API_ALGO_INVALID 0x00000000
21 #define HASH_API_ALGO_MD4 0x00000001
22 #define HASH_API_ALGO_MD5 0x00000002
23 #define HASH_API_ALGO_SHA1 0x00000003
24 #define HASH_API_ALGO_SHA256 0x00000004
25 #define HASH_API_ALGO_SHA384 0x00000005
26 #define HASH_API_ALGO_SHA512 0x00000006
27 #define HASH_API_ALGO_SM3_256 0x00000007
30 Retrieves the size, in bytes, of the context buffer required for hash operations.
32 @return The size, in bytes, of the context buffer required for hash operations.
36 HashApiGetContextSize (
43 @param[out] HashContext Hash context.
45 @retval TRUE Hash start and HashHandle returned.
46 @retval FALSE Hash Init unsuccessful.
51 OUT HASH_API_CONTEXT HashContext
55 Makes a copy of an existing hash context.
57 @param[in] HashContext Hash context.
58 @param[out] NewHashContext New copy of hash context.
60 @retval TRUE Hash context copy succeeded.
61 @retval FALSE Hash context copy failed.
66 IN HASH_API_CONTEXT HashContext
,
67 OUT HASH_API_CONTEXT NewHashContext
73 @param[in] HashContext Hash context.
74 @param[in] DataToHash Data to be hashed.
75 @param[in] DataToHashLen Data size.
77 @retval TRUE Hash updated.
78 @retval FALSE Hash updated unsuccessful.
83 IN HASH_API_CONTEXT HashContext
,
85 IN UINTN DataToHashLen
91 @param[in] HashContext Hash context.
92 @param[out] Digest Hash Digest.
94 @retval TRUE Hash complete and Digest is returned.
95 @retval FALSE Hash complete unsuccessful.
100 IN HASH_API_CONTEXT HashContext
,
105 Computes hash message digest of a input data buffer.
107 @param[in] DataToHash Data to be hashed.
108 @param[in] DataToHashLen Data size.
109 @param[out] Digest Hash Digest.
111 @retval TRUE Hash digest computation succeeded.
112 @retval FALSE Hash digest computation failed.
117 IN CONST VOID
*DataToHash
,
118 IN UINTN DataToHashLen
,