1 /** @file
2   SHA-384 and SHA-512 Digest Wrapper Implementations which does not provide real capabilities.
3 
4 Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #include "InternalCryptLib.h"
16 
17 /**
18   Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
19 
20   Return zero to indicate this interface is not supported.
21 
22   @retval  0   This interface is not supported.
23 
24 **/
25 UINTN
26 EFIAPI
Sha384GetContextSize(VOID)27 Sha384GetContextSize (
28   VOID
29   )
30 {
31   ASSERT (FALSE);
32   return 0;
33 }
34 
35 /**
36   Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for
37   subsequent use.
38 
39   Return FALSE to indicate this interface is not supported.
40 
41   @param[out]  Sha384Context  Pointer to SHA-384 context being initialized.
42 
43   @retval FALSE  This interface is not supported.
44 
45 **/
46 BOOLEAN
47 EFIAPI
Sha384Init(OUT VOID * Sha384Context)48 Sha384Init (
49   OUT  VOID  *Sha384Context
50   )
51 {
52   ASSERT (FALSE);
53   return FALSE;
54 }
55 
56 /**
57   Makes a copy of an existing SHA-384 context.
58 
59   Return FALSE to indicate this interface is not supported.
60 
61   @param[in]  Sha384Context     Pointer to SHA-384 context being copied.
62   @param[out] NewSha384Context  Pointer to new SHA-384 context.
63 
64   @retval FALSE  This interface is not supported.
65 
66 **/
67 BOOLEAN
68 EFIAPI
Sha384Duplicate(IN CONST VOID * Sha384Context,OUT VOID * NewSha384Context)69 Sha384Duplicate (
70   IN   CONST VOID  *Sha384Context,
71   OUT  VOID        *NewSha384Context
72   )
73 {
74   ASSERT (FALSE);
75   return FALSE;
76 }
77 
78 /**
79   Digests the input data and updates SHA-384 context.
80 
81   Return FALSE to indicate this interface is not supported.
82 
83   @param[in, out]  Sha384Context  Pointer to the SHA-384 context.
84   @param[in]       Data           Pointer to the buffer containing the data to be hashed.
85   @param[in]       DataSize       Size of Data buffer in bytes.
86 
87   @retval FALSE  This interface is not supported.
88 
89 **/
90 BOOLEAN
91 EFIAPI
Sha384Update(IN OUT VOID * Sha384Context,IN CONST VOID * Data,IN UINTN DataSize)92 Sha384Update (
93   IN OUT  VOID        *Sha384Context,
94   IN      CONST VOID  *Data,
95   IN      UINTN       DataSize
96   )
97 {
98   ASSERT (FALSE);
99   return FALSE;
100 }
101 
102 /**
103   Completes computation of the SHA-384 digest value.
104 
105   Return FALSE to indicate this interface is not supported.
106 
107   @param[in, out]  Sha384Context  Pointer to the SHA-384 context.
108   @param[out]      HashValue      Pointer to a buffer that receives the SHA-384 digest
109                                   value (48 bytes).
110 
111   @retval FALSE  This interface is not supported.
112 
113 **/
114 BOOLEAN
115 EFIAPI
Sha384Final(IN OUT VOID * Sha384Context,OUT UINT8 * HashValue)116 Sha384Final (
117   IN OUT  VOID   *Sha384Context,
118   OUT     UINT8  *HashValue
119   )
120 {
121   ASSERT (FALSE);
122   return FALSE;
123 }
124 
125 /**
126   Computes the SHA-384 message digest of a input data buffer.
127 
128   Return FALSE to indicate this interface is not supported.
129 
130   @param[in]   Data        Pointer to the buffer containing the data to be hashed.
131   @param[in]   DataSize    Size of Data buffer in bytes.
132   @param[out]  HashValue   Pointer to a buffer that receives the SHA-384 digest
133                            value (48 bytes).
134 
135   @retval FALSE  This interface is not supported.
136 
137 **/
138 BOOLEAN
139 EFIAPI
Sha384HashAll(IN CONST VOID * Data,IN UINTN DataSize,OUT UINT8 * HashValue)140 Sha384HashAll (
141   IN   CONST VOID  *Data,
142   IN   UINTN       DataSize,
143   OUT  UINT8       *HashValue
144   )
145 {
146   ASSERT (FALSE);
147   return FALSE;
148 }
149 
150 /**
151   Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.
152 
153   Return zero to indicate this interface is not supported.
154 
155   @retval  0   This interface is not supported.
156 
157 **/
158 UINTN
159 EFIAPI
Sha512GetContextSize(VOID)160 Sha512GetContextSize (
161   VOID
162   )
163 {
164   ASSERT (FALSE);
165   return 0;
166 }
167 
168 /**
169   Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for
170   subsequent use.
171 
172   Return FALSE to indicate this interface is not supported.
173 
174   @param[out]  Sha512Context  Pointer to SHA-512 context being initialized.
175 
176   @retval FALSE  This interface is not supported.
177 
178 **/
179 BOOLEAN
180 EFIAPI
Sha512Init(OUT VOID * Sha512Context)181 Sha512Init (
182   OUT  VOID  *Sha512Context
183   )
184 {
185   ASSERT (FALSE);
186   return FALSE;
187 }
188 
189 /**
190   Makes a copy of an existing SHA-512 context.
191 
192   Return FALSE to indicate this interface is not supported.
193 
194   @param[in]  Sha512Context     Pointer to SHA-512 context being copied.
195   @param[out] NewSha512Context  Pointer to new SHA-512 context.
196 
197   @retval FALSE  This interface is not supported.
198 
199 **/
200 BOOLEAN
201 EFIAPI
Sha512Duplicate(IN CONST VOID * Sha512Context,OUT VOID * NewSha512Context)202 Sha512Duplicate (
203   IN   CONST VOID  *Sha512Context,
204   OUT  VOID        *NewSha512Context
205   )
206 {
207   ASSERT (FALSE);
208   return FALSE;
209 }
210 
211 /**
212   Digests the input data and updates SHA-512 context.
213 
214   Return FALSE to indicate this interface is not supported.
215 
216   @param[in, out]  Sha512Context  Pointer to the SHA-512 context.
217   @param[in]       Data           Pointer to the buffer containing the data to be hashed.
218   @param[in]       DataSize       Size of Data buffer in bytes.
219 
220   @retval FALSE  This interface is not supported.
221 
222 **/
223 BOOLEAN
224 EFIAPI
Sha512Update(IN OUT VOID * Sha512Context,IN CONST VOID * Data,IN UINTN DataSize)225 Sha512Update (
226   IN OUT  VOID        *Sha512Context,
227   IN      CONST VOID  *Data,
228   IN      UINTN       DataSize
229   )
230 {
231   ASSERT (FALSE);
232   return FALSE;
233 }
234 
235 /**
236   Completes computation of the SHA-512 digest value.
237 
238   Return FALSE to indicate this interface is not supported.
239 
240   @param[in, out]  Sha512Context  Pointer to the SHA-512 context.
241   @param[out]      HashValue      Pointer to a buffer that receives the SHA-512 digest
242                                   value (64 bytes).
243 
244   @retval FALSE  This interface is not supported.
245 
246 **/
247 BOOLEAN
248 EFIAPI
Sha512Final(IN OUT VOID * Sha512Context,OUT UINT8 * HashValue)249 Sha512Final (
250   IN OUT  VOID   *Sha512Context,
251   OUT     UINT8  *HashValue
252   )
253 {
254   ASSERT (FALSE);
255   return FALSE;
256 }
257 
258 /**
259   Computes the SHA-512 message digest of a input data buffer.
260 
261   Return FALSE to indicate this interface is not supported.
262 
263   @param[in]   Data        Pointer to the buffer containing the data to be hashed.
264   @param[in]   DataSize    Size of Data buffer in bytes.
265   @param[out]  HashValue   Pointer to a buffer that receives the SHA-512 digest
266                            value (64 bytes).
267 
268   @retval FALSE  This interface is not supported.
269 
270 **/
271 BOOLEAN
272 EFIAPI
Sha512HashAll(IN CONST VOID * Data,IN UINTN DataSize,OUT UINT8 * HashValue)273 Sha512HashAll (
274   IN   CONST VOID  *Data,
275   IN   UINTN       DataSize,
276   OUT  UINT8       *HashValue
277   )
278 {
279   ASSERT (FALSE);
280   return FALSE;
281 }
282