1 | /** @file
|
---|
2 | Unified Hash API Defines
|
---|
3 |
|
---|
4 | This API when called will calculate the Hash using the
|
---|
5 | hashing algorithm specified by PcdHashApiLibPolicy.
|
---|
6 |
|
---|
7 | Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
---|
8 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
9 |
|
---|
10 | **/
|
---|
11 |
|
---|
12 | #ifndef __HASH_API_LIB_H_
|
---|
13 | #define __HASH_API_LIB_H_
|
---|
14 |
|
---|
15 | typedef VOID *HASH_API_CONTEXT;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | Retrieves the size, in bytes, of the context buffer required for hash operations.
|
---|
19 |
|
---|
20 | @return The size, in bytes, of the context buffer required for hash operations.
|
---|
21 | **/
|
---|
22 | UINTN
|
---|
23 | EFIAPI
|
---|
24 | HashApiGetContextSize (
|
---|
25 | VOID
|
---|
26 | );
|
---|
27 |
|
---|
28 | /**
|
---|
29 | Init hash sequence.
|
---|
30 |
|
---|
31 | @param[out] HashContext Hash context.
|
---|
32 |
|
---|
33 | @retval TRUE Hash start and HashHandle returned.
|
---|
34 | @retval FALSE Hash Init unsuccessful.
|
---|
35 | **/
|
---|
36 | BOOLEAN
|
---|
37 | EFIAPI
|
---|
38 | HashApiInit (
|
---|
39 | OUT HASH_API_CONTEXT HashContext
|
---|
40 | );
|
---|
41 |
|
---|
42 | /**
|
---|
43 | Makes a copy of an existing hash context.
|
---|
44 |
|
---|
45 | @param[in] HashContext Hash context.
|
---|
46 | @param[out] NewHashContext New copy of hash context.
|
---|
47 |
|
---|
48 | @retval TRUE Hash context copy succeeded.
|
---|
49 | @retval FALSE Hash context copy failed.
|
---|
50 | **/
|
---|
51 | BOOLEAN
|
---|
52 | EFIAPI
|
---|
53 | HashApiDuplicate (
|
---|
54 | IN HASH_API_CONTEXT HashContext,
|
---|
55 | OUT HASH_API_CONTEXT NewHashContext
|
---|
56 | );
|
---|
57 |
|
---|
58 | /**
|
---|
59 | Update hash data.
|
---|
60 |
|
---|
61 | @param[in] HashContext Hash context.
|
---|
62 | @param[in] DataToHash Data to be hashed.
|
---|
63 | @param[in] DataToHashLen Data size.
|
---|
64 |
|
---|
65 | @retval TRUE Hash updated.
|
---|
66 | @retval FALSE Hash updated unsuccessful.
|
---|
67 | **/
|
---|
68 | BOOLEAN
|
---|
69 | EFIAPI
|
---|
70 | HashApiUpdate (
|
---|
71 | IN HASH_API_CONTEXT HashContext,
|
---|
72 | IN VOID *DataToHash,
|
---|
73 | IN UINTN DataToHashLen
|
---|
74 | );
|
---|
75 |
|
---|
76 | /**
|
---|
77 | Hash complete.
|
---|
78 |
|
---|
79 | @param[in] HashContext Hash context.
|
---|
80 | @param[out] Digest Hash Digest.
|
---|
81 |
|
---|
82 | @retval TRUE Hash complete and Digest is returned.
|
---|
83 | @retval FALSE Hash complete unsuccessful.
|
---|
84 | **/
|
---|
85 | BOOLEAN
|
---|
86 | EFIAPI
|
---|
87 | HashApiFinal (
|
---|
88 | IN HASH_API_CONTEXT HashContext,
|
---|
89 | OUT UINT8 *Digest
|
---|
90 | );
|
---|
91 |
|
---|
92 | /**
|
---|
93 | Computes hash message digest of a input data buffer.
|
---|
94 |
|
---|
95 | @param[in] DataToHash Data to be hashed.
|
---|
96 | @param[in] DataToHashLen Data size.
|
---|
97 | @param[out] Digest Hash Digest.
|
---|
98 |
|
---|
99 | @retval TRUE Hash digest computation succeeded.
|
---|
100 | @retval FALSE Hash digest computation failed.
|
---|
101 | **/
|
---|
102 | BOOLEAN
|
---|
103 | EFIAPI
|
---|
104 | HashApiHashAll (
|
---|
105 | IN CONST VOID *DataToHash,
|
---|
106 | IN UINTN DataToHashLen,
|
---|
107 | OUT UINT8 *Digest
|
---|
108 | );
|
---|
109 |
|
---|
110 | #endif
|
---|