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