]>
Commit | Line | Data |
---|---|---|
b1567b2e MX |
1 | /** @file\r |
2 | SHA-256 Digest Wrapper Null Implementation.\r | |
3 | \r | |
4 | Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | **/\r | |
8 | \r | |
9 | #include "InternalCryptLib.h"\r | |
10 | \r | |
11 | /**\r | |
12 | Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.\r | |
13 | \r | |
14 | @return The size, in bytes, of the context buffer required for SHA-256 hash operations.\r | |
15 | \r | |
16 | **/\r | |
17 | UINTN\r | |
18 | EFIAPI\r | |
19 | Sha256GetContextSize (\r | |
20 | VOID\r | |
21 | )\r | |
22 | {\r | |
23 | ASSERT (FALSE);\r | |
24 | return 0;\r | |
25 | }\r | |
26 | \r | |
27 | /**\r | |
28 | Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for\r | |
29 | subsequent use.\r | |
30 | \r | |
31 | If Sha256Context is NULL, then return FALSE.\r | |
32 | \r | |
33 | @param[out] Sha256Context Pointer to SHA-256 context being initialized.\r | |
34 | \r | |
35 | @retval TRUE SHA-256 context initialization succeeded.\r | |
36 | @retval FALSE SHA-256 context initialization failed.\r | |
37 | \r | |
38 | **/\r | |
39 | BOOLEAN\r | |
40 | EFIAPI\r | |
41 | Sha256Init (\r | |
42 | OUT VOID *Sha256Context\r | |
43 | )\r | |
44 | {\r | |
45 | ASSERT (FALSE);\r | |
46 | return FALSE;\r | |
47 | }\r | |
48 | \r | |
49 | /**\r | |
50 | Makes a copy of an existing SHA-256 context.\r | |
51 | \r | |
52 | If Sha256Context is NULL, then return FALSE.\r | |
53 | If NewSha256Context is NULL, then return FALSE.\r | |
54 | \r | |
55 | @param[in] Sha256Context Pointer to SHA-256 context being copied.\r | |
56 | @param[out] NewSha256Context Pointer to new SHA-256 context.\r | |
57 | \r | |
58 | @retval TRUE SHA-256 context copy succeeded.\r | |
59 | @retval FALSE SHA-256 context copy failed.\r | |
60 | \r | |
61 | **/\r | |
62 | BOOLEAN\r | |
63 | EFIAPI\r | |
64 | Sha256Duplicate (\r | |
65 | IN CONST VOID *Sha256Context,\r | |
66 | OUT VOID *NewSha256Context\r | |
67 | )\r | |
68 | {\r | |
69 | ASSERT (FALSE);\r | |
70 | return FALSE;\r | |
71 | }\r | |
72 | \r | |
73 | /**\r | |
74 | Digests the input data and updates SHA-256 context.\r | |
75 | \r | |
76 | This function performs SHA-256 digest on a data buffer of the specified size.\r | |
77 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
78 | SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized\r | |
79 | by Sha256Final(). Behavior with invalid context is undefined.\r | |
80 | \r | |
81 | If Sha256Context is NULL, then return FALSE.\r | |
82 | \r | |
83 | @param[in, out] Sha256Context Pointer to the SHA-256 context.\r | |
84 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
85 | @param[in] DataSize Size of Data buffer in bytes.\r | |
86 | \r | |
87 | @retval TRUE SHA-256 data digest succeeded.\r | |
88 | @retval FALSE SHA-256 data digest failed.\r | |
89 | \r | |
90 | **/\r | |
91 | BOOLEAN\r | |
92 | EFIAPI\r | |
93 | Sha256Update (\r | |
94 | IN OUT VOID *Sha256Context,\r | |
95 | IN CONST VOID *Data,\r | |
96 | IN UINTN DataSize\r | |
97 | )\r | |
98 | {\r | |
99 | ASSERT (FALSE);\r | |
100 | return FALSE;\r | |
101 | }\r | |
102 | \r | |
103 | /**\r | |
104 | Completes computation of the SHA-256 digest value.\r | |
105 | \r | |
106 | This function completes SHA-256 hash computation and retrieves the digest value into\r | |
107 | the specified memory. After this function has been called, the SHA-256 context cannot\r | |
108 | be used again.\r | |
109 | SHA-256 context should be already correctly initialized by Sha256Init(), and should not be\r | |
110 | finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.\r | |
111 | \r | |
112 | If Sha256Context is NULL, then return FALSE.\r | |
113 | If HashValue is NULL, then return FALSE.\r | |
114 | \r | |
115 | @param[in, out] Sha256Context Pointer to the SHA-256 context.\r | |
116 | @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest\r | |
117 | value (32 bytes).\r | |
118 | \r | |
119 | @retval TRUE SHA-256 digest computation succeeded.\r | |
120 | @retval FALSE SHA-256 digest computation failed.\r | |
121 | \r | |
122 | **/\r | |
123 | BOOLEAN\r | |
124 | EFIAPI\r | |
125 | Sha256Final (\r | |
126 | IN OUT VOID *Sha256Context,\r | |
127 | OUT UINT8 *HashValue\r | |
128 | )\r | |
129 | {\r | |
130 | ASSERT (FALSE);\r | |
131 | return FALSE;\r | |
132 | }\r | |
133 | \r | |
134 | /**\r | |
135 | Computes the SHA-256 message digest of a input data buffer.\r | |
136 | \r | |
137 | This function performs the SHA-256 message digest of a given data buffer, and places\r | |
138 | the digest value into the specified memory.\r | |
139 | \r | |
140 | If this interface is not supported, then return FALSE.\r | |
141 | \r | |
142 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
143 | @param[in] DataSize Size of Data buffer in bytes.\r | |
144 | @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest\r | |
145 | value (32 bytes).\r | |
146 | \r | |
147 | @retval TRUE SHA-256 digest computation succeeded.\r | |
148 | @retval FALSE SHA-256 digest computation failed.\r | |
149 | @retval FALSE This interface is not supported.\r | |
150 | \r | |
151 | **/\r | |
152 | BOOLEAN\r | |
153 | EFIAPI\r | |
154 | Sha256HashAll (\r | |
155 | IN CONST VOID *Data,\r | |
156 | IN UINTN DataSize,\r | |
157 | OUT UINT8 *HashValue\r | |
158 | )\r | |
159 | {\r | |
160 | ASSERT (FALSE);\r | |
161 | return FALSE;\r | |
162 | }\r |