1 | /** @file
|
---|
2 | Implements the EDK II Crypto Protocol/PPI services using the library services
|
---|
3 | from BaseCryptLib and TlsLib.
|
---|
4 |
|
---|
5 | Copyright (C) Microsoft Corporation. All rights reserved.
|
---|
6 | Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 |
|
---|
9 | **/
|
---|
10 | #include <Base.h>
|
---|
11 | #include <Library/DebugLib.h>
|
---|
12 | #include <Library/BaseCryptLib.h>
|
---|
13 | #include <Library/TlsLib.h>
|
---|
14 | #include <Protocol/Crypto.h>
|
---|
15 | #include <Pcd/PcdCryptoServiceFamilyEnable.h>
|
---|
16 |
|
---|
17 | /**
|
---|
18 | A macro used to retrieve the FixedAtBuild PcdCryptoServiceFamilyEnable with a
|
---|
19 | typecast to its associcted structure type PCD_CRYPTO_SERVICE_FAMILY_ENABLE.
|
---|
20 | **/
|
---|
21 | #define EDKII_CRYPTO_PCD ((const PCD_CRYPTO_SERVICE_FAMILY_ENABLE *)\
|
---|
22 | (FixedPcdGetPtr (PcdCryptoServiceFamilyEnable)))
|
---|
23 |
|
---|
24 | /**
|
---|
25 | A macro used to call a non-void BaseCryptLib function if it is enabled.
|
---|
26 |
|
---|
27 | If a BaseCryptLib function is not enabled, there will be no references to it
|
---|
28 | from this module and will be optimized away reducing the size of this module.
|
---|
29 |
|
---|
30 | @param Enable The name of the enable field in PCD
|
---|
31 | PcdCryptoServiceFamilyEnable for the BaseCryptLib
|
---|
32 | function being called. If the value of this field
|
---|
33 | is non-zero, then the BaseCryptLib function is
|
---|
34 | enabled.
|
---|
35 | @param Function The name of the BaseCryptLib function.
|
---|
36 | @param Args The argument list to pass to Function.
|
---|
37 | @param ErrorReturnValue The value to return if the BaseCryptLib function is
|
---|
38 | not enabled.
|
---|
39 |
|
---|
40 | **/
|
---|
41 | #define CALL_BASECRYPTLIB(Enable, Function, Args, ErrorReturnValue) \
|
---|
42 | EDKII_CRYPTO_PCD->Enable \
|
---|
43 | ? Function Args \
|
---|
44 | : (BaseCryptLibServiceNotEnabled (#Function), ErrorReturnValue)
|
---|
45 |
|
---|
46 | /**
|
---|
47 | A macro used to call a void BaseCryptLib function if it is enabled.
|
---|
48 |
|
---|
49 | If a BaseCryptLib function is not enabled, there will be no references to it
|
---|
50 | from this module and will be optimized away reducing the size of this module.
|
---|
51 |
|
---|
52 | @param Enable The name of the enable field in PCD
|
---|
53 | PcdCryptoServiceFamilyEnable for the BaseCryptLib
|
---|
54 | function being called. If the value of this field
|
---|
55 | is non-zero, then the BaseCryptLib function is
|
---|
56 | enabled.
|
---|
57 | @param Function The name of the BaseCryptLib function.
|
---|
58 | @param Args The argument list to pass to Function.
|
---|
59 |
|
---|
60 | **/
|
---|
61 | #define CALL_VOID_BASECRYPTLIB(Enable, Function, Args) \
|
---|
62 | EDKII_CRYPTO_PCD->Enable \
|
---|
63 | ? Function Args \
|
---|
64 | : BaseCryptLibServiceNotEnabled (#Function)
|
---|
65 |
|
---|
66 | /**
|
---|
67 | Internal worker function that prints a debug message and asserts if a call is
|
---|
68 | made to a BaseCryptLib function that is not enabled in the EDK II Crypto
|
---|
69 | Protocol/PPI.
|
---|
70 |
|
---|
71 | If this debug message and assert are observed, then a module is using
|
---|
72 | BaseCryptLib function that is not enabled in a Crypto driver. The
|
---|
73 | PcdCryptoServiceFamilyEnable should be updated to enable the missing service.
|
---|
74 |
|
---|
75 | @param[in] FunctionName Null-terminated ASCII string that is the name of an
|
---|
76 | EDK II Crypto service.
|
---|
77 |
|
---|
78 | **/
|
---|
79 | static
|
---|
80 | VOID
|
---|
81 | BaseCryptLibServiceNotEnabled (
|
---|
82 | IN CONST CHAR8 *FunctionName
|
---|
83 | )
|
---|
84 | {
|
---|
85 | DEBUG ((DEBUG_ERROR, "[%a] Function %a() is not enabled\n", gEfiCallerBaseName, FunctionName));
|
---|
86 | ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
|
---|
87 | }
|
---|
88 |
|
---|
89 | /**
|
---|
90 | Internal worker function that prints a debug message and asserts if a call is
|
---|
91 | made to a BaseCryptLib function that is deprecated and unsupported any longer.
|
---|
92 |
|
---|
93 | @param[in] FunctionName Null-terminated ASCII string that is the name of an
|
---|
94 | EDK II Crypto service.
|
---|
95 |
|
---|
96 | **/
|
---|
97 | static
|
---|
98 | VOID
|
---|
99 | BaseCryptLibServiceDeprecated (
|
---|
100 | IN CONST CHAR8 *FunctionName
|
---|
101 | )
|
---|
102 | {
|
---|
103 | DEBUG ((DEBUG_ERROR, "[%a] Function %a() is deprecated and unsupported any longer\n", gEfiCallerBaseName, FunctionName));
|
---|
104 | ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
|
---|
105 | }
|
---|
106 |
|
---|
107 | /**
|
---|
108 | Returns the version of the EDK II Crypto Protocol.
|
---|
109 |
|
---|
110 | @return The version of the EDK II Crypto Protocol.
|
---|
111 |
|
---|
112 | **/
|
---|
113 | UINTN
|
---|
114 | EFIAPI
|
---|
115 | CryptoServiceGetCryptoVersion (
|
---|
116 | VOID
|
---|
117 | )
|
---|
118 | {
|
---|
119 | return EDKII_CRYPTO_VERSION;
|
---|
120 | }
|
---|
121 |
|
---|
122 | // =====================================================================================
|
---|
123 | // One-Way Cryptographic Hash Primitives
|
---|
124 | // =====================================================================================
|
---|
125 |
|
---|
126 | /**
|
---|
127 | MD4 is deprecated and unsupported any longer.
|
---|
128 | Keep the function field for binary compability.
|
---|
129 |
|
---|
130 | @retval 0 This interface is not supported.
|
---|
131 |
|
---|
132 | **/
|
---|
133 | UINTN
|
---|
134 | EFIAPI
|
---|
135 | DeprecatedCryptoServiceMd4GetContextSize (
|
---|
136 | VOID
|
---|
137 | )
|
---|
138 | {
|
---|
139 | return BaseCryptLibServiceDeprecated ("Md4GetContextSize"), 0;
|
---|
140 | }
|
---|
141 |
|
---|
142 | /**
|
---|
143 | MD4 is deprecated and unsupported any longer.
|
---|
144 | Keep the function field for binary compability.
|
---|
145 |
|
---|
146 | @param[out] Md4Context Pointer to MD4 context being initialized.
|
---|
147 |
|
---|
148 | @retval FALSE This interface is not supported.
|
---|
149 |
|
---|
150 | **/
|
---|
151 | BOOLEAN
|
---|
152 | EFIAPI
|
---|
153 | DeprecatedCryptoServiceMd4Init (
|
---|
154 | OUT VOID *Md4Context
|
---|
155 | )
|
---|
156 | {
|
---|
157 | return BaseCryptLibServiceDeprecated ("Md4Init"), FALSE;
|
---|
158 | }
|
---|
159 |
|
---|
160 | /**
|
---|
161 | MD4 is deprecated and unsupported any longer.
|
---|
162 | Keep the function field for binary compability.
|
---|
163 |
|
---|
164 | @param[in] Md4Context Pointer to MD4 context being copied.
|
---|
165 | @param[out] NewMd4Context Pointer to new MD4 context.
|
---|
166 |
|
---|
167 | @retval FALSE This interface is not supported.
|
---|
168 |
|
---|
169 | **/
|
---|
170 | BOOLEAN
|
---|
171 | EFIAPI
|
---|
172 | DeprecatedCryptoServiceMd4Duplicate (
|
---|
173 | IN CONST VOID *Md4Context,
|
---|
174 | OUT VOID *NewMd4Context
|
---|
175 | )
|
---|
176 | {
|
---|
177 | return BaseCryptLibServiceDeprecated ("Md4Duplicate"), FALSE;
|
---|
178 | }
|
---|
179 |
|
---|
180 | /**
|
---|
181 | MD4 is deprecated and unsupported any longer.
|
---|
182 | Keep the function field for binary compability.
|
---|
183 |
|
---|
184 | @param[in, out] Md4Context Pointer to the MD4 context.
|
---|
185 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
186 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
187 |
|
---|
188 | @retval FALSE This interface is not supported.
|
---|
189 |
|
---|
190 | **/
|
---|
191 | BOOLEAN
|
---|
192 | EFIAPI
|
---|
193 | DeprecatedCryptoServiceMd4Update (
|
---|
194 | IN OUT VOID *Md4Context,
|
---|
195 | IN CONST VOID *Data,
|
---|
196 | IN UINTN DataSize
|
---|
197 | )
|
---|
198 | {
|
---|
199 | return BaseCryptLibServiceDeprecated ("Md4Update"), FALSE;
|
---|
200 | }
|
---|
201 |
|
---|
202 | /**
|
---|
203 | MD4 is deprecated and unsupported any longer.
|
---|
204 | Keep the function field for binary compability.
|
---|
205 |
|
---|
206 | @param[in, out] Md4Context Pointer to the MD4 context.
|
---|
207 | @param[out] HashValue Pointer to a buffer that receives the MD4 digest
|
---|
208 | value (16 bytes).
|
---|
209 |
|
---|
210 | @retval FALSE This interface is not supported.
|
---|
211 |
|
---|
212 | **/
|
---|
213 | BOOLEAN
|
---|
214 | EFIAPI
|
---|
215 | DeprecatedCryptoServiceMd4Final (
|
---|
216 | IN OUT VOID *Md4Context,
|
---|
217 | OUT UINT8 *HashValue
|
---|
218 | )
|
---|
219 | {
|
---|
220 | return BaseCryptLibServiceDeprecated ("Md4Final"), FALSE;
|
---|
221 | }
|
---|
222 |
|
---|
223 | /**
|
---|
224 | MD4 is deprecated and unsupported any longer.
|
---|
225 | Keep the function field for binary compability.
|
---|
226 |
|
---|
227 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
228 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
229 | @param[out] HashValue Pointer to a buffer that receives the MD4 digest
|
---|
230 | value (16 bytes).
|
---|
231 |
|
---|
232 | @retval FALSE This interface is not supported.
|
---|
233 |
|
---|
234 | **/
|
---|
235 | BOOLEAN
|
---|
236 | EFIAPI
|
---|
237 | DeprecatedCryptoServiceMd4HashAll (
|
---|
238 | IN CONST VOID *Data,
|
---|
239 | IN UINTN DataSize,
|
---|
240 | OUT UINT8 *HashValue
|
---|
241 | )
|
---|
242 | {
|
---|
243 | return BaseCryptLibServiceDeprecated ("Md4HashAll"), FALSE;
|
---|
244 | }
|
---|
245 |
|
---|
246 | #ifndef ENABLE_MD5_DEPRECATED_INTERFACES
|
---|
247 |
|
---|
248 | /**
|
---|
249 | Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
---|
250 |
|
---|
251 | If this interface is not supported, then return zero.
|
---|
252 |
|
---|
253 | @retval 0 This interface is not supported.
|
---|
254 |
|
---|
255 | **/
|
---|
256 | UINTN
|
---|
257 | EFIAPI
|
---|
258 | DeprecatedCryptoServiceMd5GetContextSize (
|
---|
259 | VOID
|
---|
260 | )
|
---|
261 | {
|
---|
262 | return BaseCryptLibServiceDeprecated ("Md5GetContextSize"), 0;
|
---|
263 | }
|
---|
264 |
|
---|
265 | /**
|
---|
266 | Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
|
---|
267 | subsequent use.
|
---|
268 |
|
---|
269 | If Md5Context is NULL, then return FALSE.
|
---|
270 | If this interface is not supported, then return FALSE.
|
---|
271 |
|
---|
272 | @param[out] Md5Context Pointer to MD5 context being initialized.
|
---|
273 |
|
---|
274 | @retval FALSE This interface is not supported.
|
---|
275 |
|
---|
276 | **/
|
---|
277 | BOOLEAN
|
---|
278 | EFIAPI
|
---|
279 | DeprecatedCryptoServiceMd5Init (
|
---|
280 | OUT VOID *Md5Context
|
---|
281 | )
|
---|
282 | {
|
---|
283 | return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE;
|
---|
284 | }
|
---|
285 |
|
---|
286 | /**
|
---|
287 | Makes a copy of an existing MD5 context.
|
---|
288 |
|
---|
289 | If Md5Context is NULL, then return FALSE.
|
---|
290 | If NewMd5Context is NULL, then return FALSE.
|
---|
291 | If this interface is not supported, then return FALSE.
|
---|
292 |
|
---|
293 | @param[in] Md5Context Pointer to MD5 context being copied.
|
---|
294 | @param[out] NewMd5Context Pointer to new MD5 context.
|
---|
295 |
|
---|
296 | @retval FALSE This interface is not supported.
|
---|
297 |
|
---|
298 | **/
|
---|
299 | BOOLEAN
|
---|
300 | EFIAPI
|
---|
301 | DeprecatedCryptoServiceMd5Duplicate (
|
---|
302 | IN CONST VOID *Md5Context,
|
---|
303 | OUT VOID *NewMd5Context
|
---|
304 | )
|
---|
305 | {
|
---|
306 | return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE;
|
---|
307 | }
|
---|
308 |
|
---|
309 | /**
|
---|
310 | Digests the input data and updates MD5 context.
|
---|
311 |
|
---|
312 | This function performs MD5 digest on a data buffer of the specified size.
|
---|
313 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
314 | MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
|
---|
315 | by Md5Final(). Behavior with invalid context is undefined.
|
---|
316 |
|
---|
317 | If Md5Context is NULL, then return FALSE.
|
---|
318 | If this interface is not supported, then return FALSE.
|
---|
319 |
|
---|
320 | @param[in, out] Md5Context Pointer to the MD5 context.
|
---|
321 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
322 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
323 |
|
---|
324 | @retval FALSE This interface is not supported.
|
---|
325 |
|
---|
326 | **/
|
---|
327 | BOOLEAN
|
---|
328 | EFIAPI
|
---|
329 | DeprecatedCryptoServiceMd5Update (
|
---|
330 | IN OUT VOID *Md5Context,
|
---|
331 | IN CONST VOID *Data,
|
---|
332 | IN UINTN DataSize
|
---|
333 | )
|
---|
334 | {
|
---|
335 | return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE;
|
---|
336 | }
|
---|
337 |
|
---|
338 | /**
|
---|
339 | Completes computation of the MD5 digest value.
|
---|
340 |
|
---|
341 | This function completes MD5 hash computation and retrieves the digest value into
|
---|
342 | the specified memory. After this function has been called, the MD5 context cannot
|
---|
343 | be used again.
|
---|
344 | MD5 context should be already correctly initialized by Md5Init(), and should not be
|
---|
345 | finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
|
---|
346 |
|
---|
347 | If Md5Context is NULL, then return FALSE.
|
---|
348 | If HashValue is NULL, then return FALSE.
|
---|
349 | If this interface is not supported, then return FALSE.
|
---|
350 |
|
---|
351 | @param[in, out] Md5Context Pointer to the MD5 context.
|
---|
352 | @param[out] HashValue Pointer to a buffer that receives the MD5 digest
|
---|
353 | value (16 bytes).
|
---|
354 |
|
---|
355 | @retval FALSE This interface is not supported.
|
---|
356 |
|
---|
357 | **/
|
---|
358 | BOOLEAN
|
---|
359 | EFIAPI
|
---|
360 | DeprecatedCryptoServiceMd5Final (
|
---|
361 | IN OUT VOID *Md5Context,
|
---|
362 | OUT UINT8 *HashValue
|
---|
363 | )
|
---|
364 | {
|
---|
365 | return BaseCryptLibServiceDeprecated ("Md5Final"), FALSE;
|
---|
366 | }
|
---|
367 |
|
---|
368 | /**
|
---|
369 | Computes the MD5 message digest of a input data buffer.
|
---|
370 |
|
---|
371 | This function performs the MD5 message digest of a given data buffer, and places
|
---|
372 | the digest value into the specified memory.
|
---|
373 |
|
---|
374 | If this interface is not supported, then return FALSE.
|
---|
375 |
|
---|
376 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
377 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
378 | @param[out] HashValue Pointer to a buffer that receives the MD5 digest
|
---|
379 | value (16 bytes).
|
---|
380 |
|
---|
381 | @retval FALSE This interface is not supported.
|
---|
382 |
|
---|
383 | **/
|
---|
384 | BOOLEAN
|
---|
385 | EFIAPI
|
---|
386 | DeprecatedCryptoServiceMd5HashAll (
|
---|
387 | IN CONST VOID *Data,
|
---|
388 | IN UINTN DataSize,
|
---|
389 | OUT UINT8 *HashValue
|
---|
390 | )
|
---|
391 | {
|
---|
392 | return BaseCryptLibServiceDeprecated ("Md5HashAll"), FALSE;
|
---|
393 | }
|
---|
394 |
|
---|
395 | #else
|
---|
396 |
|
---|
397 | /**
|
---|
398 | Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
---|
399 |
|
---|
400 | If this interface is not supported, then return zero.
|
---|
401 |
|
---|
402 | @return The size, in bytes, of the context buffer required for MD5 hash operations.
|
---|
403 | @retval 0 This interface is not supported.
|
---|
404 |
|
---|
405 | **/
|
---|
406 | UINTN
|
---|
407 | EFIAPI
|
---|
408 | CryptoServiceMd5GetContextSize (
|
---|
409 | VOID
|
---|
410 | )
|
---|
411 | {
|
---|
412 | return CALL_BASECRYPTLIB (Md5.Services.GetContextSize, Md5GetContextSize, (), 0);
|
---|
413 | }
|
---|
414 |
|
---|
415 | /**
|
---|
416 | Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
|
---|
417 | subsequent use.
|
---|
418 |
|
---|
419 | If Md5Context is NULL, then return FALSE.
|
---|
420 | If this interface is not supported, then return FALSE.
|
---|
421 |
|
---|
422 | @param[out] Md5Context Pointer to MD5 context being initialized.
|
---|
423 |
|
---|
424 | @retval TRUE MD5 context initialization succeeded.
|
---|
425 | @retval FALSE MD5 context initialization failed.
|
---|
426 | @retval FALSE This interface is not supported.
|
---|
427 |
|
---|
428 | **/
|
---|
429 | BOOLEAN
|
---|
430 | EFIAPI
|
---|
431 | CryptoServiceMd5Init (
|
---|
432 | OUT VOID *Md5Context
|
---|
433 | )
|
---|
434 | {
|
---|
435 | return CALL_BASECRYPTLIB (Md5.Services.Init, Md5Init, (Md5Context), FALSE);
|
---|
436 | }
|
---|
437 |
|
---|
438 | /**
|
---|
439 | Makes a copy of an existing MD5 context.
|
---|
440 |
|
---|
441 | If Md5Context is NULL, then return FALSE.
|
---|
442 | If NewMd5Context is NULL, then return FALSE.
|
---|
443 | If this interface is not supported, then return FALSE.
|
---|
444 |
|
---|
445 | @param[in] Md5Context Pointer to MD5 context being copied.
|
---|
446 | @param[out] NewMd5Context Pointer to new MD5 context.
|
---|
447 |
|
---|
448 | @retval TRUE MD5 context copy succeeded.
|
---|
449 | @retval FALSE MD5 context copy failed.
|
---|
450 | @retval FALSE This interface is not supported.
|
---|
451 |
|
---|
452 | **/
|
---|
453 | BOOLEAN
|
---|
454 | EFIAPI
|
---|
455 | CryptoServiceMd5Duplicate (
|
---|
456 | IN CONST VOID *Md5Context,
|
---|
457 | OUT VOID *NewMd5Context
|
---|
458 | )
|
---|
459 | {
|
---|
460 | return CALL_BASECRYPTLIB (Md5.Services.Duplicate, Md5Duplicate, (Md5Context, NewMd5Context), FALSE);
|
---|
461 | }
|
---|
462 |
|
---|
463 | /**
|
---|
464 | Digests the input data and updates MD5 context.
|
---|
465 |
|
---|
466 | This function performs MD5 digest on a data buffer of the specified size.
|
---|
467 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
468 | MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
|
---|
469 | by Md5Final(). Behavior with invalid context is undefined.
|
---|
470 |
|
---|
471 | If Md5Context is NULL, then return FALSE.
|
---|
472 | If this interface is not supported, then return FALSE.
|
---|
473 |
|
---|
474 | @param[in, out] Md5Context Pointer to the MD5 context.
|
---|
475 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
476 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
477 |
|
---|
478 | @retval TRUE MD5 data digest succeeded.
|
---|
479 | @retval FALSE MD5 data digest failed.
|
---|
480 | @retval FALSE This interface is not supported.
|
---|
481 |
|
---|
482 | **/
|
---|
483 | BOOLEAN
|
---|
484 | EFIAPI
|
---|
485 | CryptoServiceMd5Update (
|
---|
486 | IN OUT VOID *Md5Context,
|
---|
487 | IN CONST VOID *Data,
|
---|
488 | IN UINTN DataSize
|
---|
489 | )
|
---|
490 | {
|
---|
491 | return CALL_BASECRYPTLIB (Md5.Services.Update, Md5Update, (Md5Context, Data, DataSize), FALSE);
|
---|
492 | }
|
---|
493 |
|
---|
494 | /**
|
---|
495 | Completes computation of the MD5 digest value.
|
---|
496 |
|
---|
497 | This function completes MD5 hash computation and retrieves the digest value into
|
---|
498 | the specified memory. After this function has been called, the MD5 context cannot
|
---|
499 | be used again.
|
---|
500 | MD5 context should be already correctly initialized by Md5Init(), and should not be
|
---|
501 | finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
|
---|
502 |
|
---|
503 | If Md5Context is NULL, then return FALSE.
|
---|
504 | If HashValue is NULL, then return FALSE.
|
---|
505 | If this interface is not supported, then return FALSE.
|
---|
506 |
|
---|
507 | @param[in, out] Md5Context Pointer to the MD5 context.
|
---|
508 | @param[out] HashValue Pointer to a buffer that receives the MD5 digest
|
---|
509 | value (16 bytes).
|
---|
510 |
|
---|
511 | @retval TRUE MD5 digest computation succeeded.
|
---|
512 | @retval FALSE MD5 digest computation failed.
|
---|
513 | @retval FALSE This interface is not supported.
|
---|
514 |
|
---|
515 | **/
|
---|
516 | BOOLEAN
|
---|
517 | EFIAPI
|
---|
518 | CryptoServiceMd5Final (
|
---|
519 | IN OUT VOID *Md5Context,
|
---|
520 | OUT UINT8 *HashValue
|
---|
521 | )
|
---|
522 | {
|
---|
523 | return CALL_BASECRYPTLIB (Md5.Services.Final, Md5Final, (Md5Context, HashValue), FALSE);
|
---|
524 | }
|
---|
525 |
|
---|
526 | /**
|
---|
527 | Computes the MD5 message digest of a input data buffer.
|
---|
528 |
|
---|
529 | This function performs the MD5 message digest of a given data buffer, and places
|
---|
530 | the digest value into the specified memory.
|
---|
531 |
|
---|
532 | If this interface is not supported, then return FALSE.
|
---|
533 |
|
---|
534 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
535 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
536 | @param[out] HashValue Pointer to a buffer that receives the MD5 digest
|
---|
537 | value (16 bytes).
|
---|
538 |
|
---|
539 | @retval TRUE MD5 digest computation succeeded.
|
---|
540 | @retval FALSE MD5 digest computation failed.
|
---|
541 | @retval FALSE This interface is not supported.
|
---|
542 |
|
---|
543 | **/
|
---|
544 | BOOLEAN
|
---|
545 | EFIAPI
|
---|
546 | CryptoServiceMd5HashAll (
|
---|
547 | IN CONST VOID *Data,
|
---|
548 | IN UINTN DataSize,
|
---|
549 | OUT UINT8 *HashValue
|
---|
550 | )
|
---|
551 | {
|
---|
552 | return CALL_BASECRYPTLIB (Md5.Services.HashAll, Md5HashAll, (Data, DataSize, HashValue), FALSE);
|
---|
553 | }
|
---|
554 |
|
---|
555 | #endif
|
---|
556 |
|
---|
557 | #ifdef DISABLE_SHA1_DEPRECATED_INTERFACES
|
---|
558 |
|
---|
559 | /**
|
---|
560 | Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
|
---|
561 |
|
---|
562 | If this interface is not supported, then return zero.
|
---|
563 |
|
---|
564 | @retval 0 This interface is not supported.
|
---|
565 |
|
---|
566 | **/
|
---|
567 | UINTN
|
---|
568 | EFIAPI
|
---|
569 | DeprecatedCryptoServiceSha1GetContextSize (
|
---|
570 | VOID
|
---|
571 | )
|
---|
572 | {
|
---|
573 | return BaseCryptLibServiceDeprecated ("Sha1GetContextSize"), 0;
|
---|
574 | }
|
---|
575 |
|
---|
576 | /**
|
---|
577 | Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
|
---|
578 | subsequent use.
|
---|
579 |
|
---|
580 | If Sha1Context is NULL, then return FALSE.
|
---|
581 | If this interface is not supported, then return FALSE.
|
---|
582 |
|
---|
583 | @param[out] Sha1Context Pointer to SHA-1 context being initialized.
|
---|
584 |
|
---|
585 | @retval TRUE SHA-1 context initialization succeeded.
|
---|
586 | @retval FALSE SHA-1 context initialization failed.
|
---|
587 | @retval FALSE This interface is not supported.
|
---|
588 |
|
---|
589 | **/
|
---|
590 | BOOLEAN
|
---|
591 | EFIAPI
|
---|
592 | DeprecatedCryptoServiceSha1Init (
|
---|
593 | OUT VOID *Sha1Context
|
---|
594 | )
|
---|
595 | {
|
---|
596 | return BaseCryptLibServiceDeprecated ("Sha1Init"), FALSE;
|
---|
597 | }
|
---|
598 |
|
---|
599 | /**
|
---|
600 | Makes a copy of an existing SHA-1 context.
|
---|
601 |
|
---|
602 | If Sha1Context is NULL, then return FALSE.
|
---|
603 | If NewSha1Context is NULL, then return FALSE.
|
---|
604 | If this interface is not supported, then return FALSE.
|
---|
605 |
|
---|
606 | @param[in] Sha1Context Pointer to SHA-1 context being copied.
|
---|
607 | @param[out] NewSha1Context Pointer to new SHA-1 context.
|
---|
608 |
|
---|
609 | @retval FALSE This interface is not supported.
|
---|
610 |
|
---|
611 | **/
|
---|
612 | BOOLEAN
|
---|
613 | EFIAPI
|
---|
614 | DeprecatedCryptoServiceSha1Duplicate (
|
---|
615 | IN CONST VOID *Sha1Context,
|
---|
616 | OUT VOID *NewSha1Context
|
---|
617 | )
|
---|
618 | {
|
---|
619 | return BaseCryptLibServiceDeprecated ("Sha1Duplicate"), FALSE;
|
---|
620 | }
|
---|
621 |
|
---|
622 | /**
|
---|
623 | Digests the input data and updates SHA-1 context.
|
---|
624 |
|
---|
625 | This function performs SHA-1 digest on a data buffer of the specified size.
|
---|
626 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
627 | SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
|
---|
628 | by Sha1Final(). Behavior with invalid context is undefined.
|
---|
629 |
|
---|
630 | If Sha1Context is NULL, then return FALSE.
|
---|
631 | If this interface is not supported, then return FALSE.
|
---|
632 |
|
---|
633 | @param[in, out] Sha1Context Pointer to the SHA-1 context.
|
---|
634 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
635 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
636 |
|
---|
637 | @retval FALSE This interface is not supported.
|
---|
638 |
|
---|
639 | **/
|
---|
640 | BOOLEAN
|
---|
641 | EFIAPI
|
---|
642 | DeprecatedCryptoServiceSha1Update (
|
---|
643 | IN OUT VOID *Sha1Context,
|
---|
644 | IN CONST VOID *Data,
|
---|
645 | IN UINTN DataSize
|
---|
646 | )
|
---|
647 | {
|
---|
648 | return BaseCryptLibServiceDeprecated ("Sha1Update"), FALSE;
|
---|
649 | }
|
---|
650 |
|
---|
651 | /**
|
---|
652 | Completes computation of the SHA-1 digest value.
|
---|
653 |
|
---|
654 | This function completes SHA-1 hash computation and retrieves the digest value into
|
---|
655 | the specified memory. After this function has been called, the SHA-1 context cannot
|
---|
656 | be used again.
|
---|
657 | SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
|
---|
658 | finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
|
---|
659 |
|
---|
660 | If Sha1Context is NULL, then return FALSE.
|
---|
661 | If HashValue is NULL, then return FALSE.
|
---|
662 | If this interface is not supported, then return FALSE.
|
---|
663 |
|
---|
664 | @param[in, out] Sha1Context Pointer to the SHA-1 context.
|
---|
665 | @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
|
---|
666 | value (20 bytes).
|
---|
667 |
|
---|
668 | @retval FALSE This interface is not supported.
|
---|
669 |
|
---|
670 | **/
|
---|
671 | BOOLEAN
|
---|
672 | EFIAPI
|
---|
673 | DeprecatedCryptoServiceSha1Final (
|
---|
674 | IN OUT VOID *Sha1Context,
|
---|
675 | OUT UINT8 *HashValue
|
---|
676 | )
|
---|
677 | {
|
---|
678 | return BaseCryptLibServiceDeprecated ("Sha1Final"), FALSE;
|
---|
679 | }
|
---|
680 |
|
---|
681 | /**
|
---|
682 | Computes the SHA-1 message digest of a input data buffer.
|
---|
683 |
|
---|
684 | This function performs the SHA-1 message digest of a given data buffer, and places
|
---|
685 | the digest value into the specified memory.
|
---|
686 |
|
---|
687 | If this interface is not supported, then return FALSE.
|
---|
688 |
|
---|
689 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
690 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
691 | @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
|
---|
692 | value (20 bytes).
|
---|
693 |
|
---|
694 | @retval FALSE This interface is not supported.
|
---|
695 |
|
---|
696 | **/
|
---|
697 | BOOLEAN
|
---|
698 | EFIAPI
|
---|
699 | DeprecatedCryptoServiceSha1HashAll (
|
---|
700 | IN CONST VOID *Data,
|
---|
701 | IN UINTN DataSize,
|
---|
702 | OUT UINT8 *HashValue
|
---|
703 | )
|
---|
704 | {
|
---|
705 | return BaseCryptLibServiceDeprecated ("Sha1HashAll"), FALSE;
|
---|
706 | }
|
---|
707 |
|
---|
708 | #else
|
---|
709 |
|
---|
710 | /**
|
---|
711 | Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
|
---|
712 |
|
---|
713 | If this interface is not supported, then return zero.
|
---|
714 |
|
---|
715 | @return The size, in bytes, of the context buffer required for SHA-1 hash operations.
|
---|
716 | @retval 0 This interface is not supported.
|
---|
717 |
|
---|
718 | **/
|
---|
719 | UINTN
|
---|
720 | EFIAPI
|
---|
721 | CryptoServiceSha1GetContextSize (
|
---|
722 | VOID
|
---|
723 | )
|
---|
724 | {
|
---|
725 | return CALL_BASECRYPTLIB (Sha1.Services.GetContextSize, Sha1GetContextSize, (), 0);
|
---|
726 | }
|
---|
727 |
|
---|
728 | /**
|
---|
729 | Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
|
---|
730 | subsequent use.
|
---|
731 |
|
---|
732 | If Sha1Context is NULL, then return FALSE.
|
---|
733 | If this interface is not supported, then return FALSE.
|
---|
734 |
|
---|
735 | @param[out] Sha1Context Pointer to SHA-1 context being initialized.
|
---|
736 |
|
---|
737 | @retval TRUE SHA-1 context initialization succeeded.
|
---|
738 | @retval FALSE SHA-1 context initialization failed.
|
---|
739 | @retval FALSE This interface is not supported.
|
---|
740 |
|
---|
741 | **/
|
---|
742 | BOOLEAN
|
---|
743 | EFIAPI
|
---|
744 | CryptoServiceSha1Init (
|
---|
745 | OUT VOID *Sha1Context
|
---|
746 | )
|
---|
747 | {
|
---|
748 | return CALL_BASECRYPTLIB (Sha1.Services.Init, Sha1Init, (Sha1Context), FALSE);
|
---|
749 | }
|
---|
750 |
|
---|
751 | /**
|
---|
752 | Makes a copy of an existing SHA-1 context.
|
---|
753 |
|
---|
754 | If Sha1Context is NULL, then return FALSE.
|
---|
755 | If NewSha1Context is NULL, then return FALSE.
|
---|
756 | If this interface is not supported, then return FALSE.
|
---|
757 |
|
---|
758 | @param[in] Sha1Context Pointer to SHA-1 context being copied.
|
---|
759 | @param[out] NewSha1Context Pointer to new SHA-1 context.
|
---|
760 |
|
---|
761 | @retval TRUE SHA-1 context copy succeeded.
|
---|
762 | @retval FALSE SHA-1 context copy failed.
|
---|
763 | @retval FALSE This interface is not supported.
|
---|
764 |
|
---|
765 | **/
|
---|
766 | BOOLEAN
|
---|
767 | EFIAPI
|
---|
768 | CryptoServiceSha1Duplicate (
|
---|
769 | IN CONST VOID *Sha1Context,
|
---|
770 | OUT VOID *NewSha1Context
|
---|
771 | )
|
---|
772 | {
|
---|
773 | return CALL_BASECRYPTLIB (Sha1.Services.Duplicate, Sha1Duplicate, (Sha1Context, NewSha1Context), FALSE);
|
---|
774 | }
|
---|
775 |
|
---|
776 | /**
|
---|
777 | Digests the input data and updates SHA-1 context.
|
---|
778 |
|
---|
779 | This function performs SHA-1 digest on a data buffer of the specified size.
|
---|
780 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
781 | SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
|
---|
782 | by Sha1Final(). Behavior with invalid context is undefined.
|
---|
783 |
|
---|
784 | If Sha1Context is NULL, then return FALSE.
|
---|
785 | If this interface is not supported, then return FALSE.
|
---|
786 |
|
---|
787 | @param[in, out] Sha1Context Pointer to the SHA-1 context.
|
---|
788 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
789 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
790 |
|
---|
791 | @retval TRUE SHA-1 data digest succeeded.
|
---|
792 | @retval FALSE SHA-1 data digest failed.
|
---|
793 | @retval FALSE This interface is not supported.
|
---|
794 |
|
---|
795 | **/
|
---|
796 | BOOLEAN
|
---|
797 | EFIAPI
|
---|
798 | CryptoServiceSha1Update (
|
---|
799 | IN OUT VOID *Sha1Context,
|
---|
800 | IN CONST VOID *Data,
|
---|
801 | IN UINTN DataSize
|
---|
802 | )
|
---|
803 | {
|
---|
804 | return CALL_BASECRYPTLIB (Sha1.Services.Update, Sha1Update, (Sha1Context, Data, DataSize), FALSE);
|
---|
805 | }
|
---|
806 |
|
---|
807 | /**
|
---|
808 | Completes computation of the SHA-1 digest value.
|
---|
809 |
|
---|
810 | This function completes SHA-1 hash computation and retrieves the digest value into
|
---|
811 | the specified memory. After this function has been called, the SHA-1 context cannot
|
---|
812 | be used again.
|
---|
813 | SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
|
---|
814 | finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
|
---|
815 |
|
---|
816 | If Sha1Context is NULL, then return FALSE.
|
---|
817 | If HashValue is NULL, then return FALSE.
|
---|
818 | If this interface is not supported, then return FALSE.
|
---|
819 |
|
---|
820 | @param[in, out] Sha1Context Pointer to the SHA-1 context.
|
---|
821 | @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
|
---|
822 | value (20 bytes).
|
---|
823 |
|
---|
824 | @retval TRUE SHA-1 digest computation succeeded.
|
---|
825 | @retval FALSE SHA-1 digest computation failed.
|
---|
826 | @retval FALSE This interface is not supported.
|
---|
827 |
|
---|
828 | **/
|
---|
829 | BOOLEAN
|
---|
830 | EFIAPI
|
---|
831 | CryptoServiceSha1Final (
|
---|
832 | IN OUT VOID *Sha1Context,
|
---|
833 | OUT UINT8 *HashValue
|
---|
834 | )
|
---|
835 | {
|
---|
836 | return CALL_BASECRYPTLIB (Sha1.Services.Final, Sha1Final, (Sha1Context, HashValue), FALSE);
|
---|
837 | }
|
---|
838 |
|
---|
839 | /**
|
---|
840 | Computes the SHA-1 message digest of a input data buffer.
|
---|
841 |
|
---|
842 | This function performs the SHA-1 message digest of a given data buffer, and places
|
---|
843 | the digest value into the specified memory.
|
---|
844 |
|
---|
845 | If this interface is not supported, then return FALSE.
|
---|
846 |
|
---|
847 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
848 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
849 | @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
|
---|
850 | value (20 bytes).
|
---|
851 |
|
---|
852 | @retval TRUE SHA-1 digest computation succeeded.
|
---|
853 | @retval FALSE SHA-1 digest computation failed.
|
---|
854 | @retval FALSE This interface is not supported.
|
---|
855 |
|
---|
856 | **/
|
---|
857 | BOOLEAN
|
---|
858 | EFIAPI
|
---|
859 | CryptoServiceSha1HashAll (
|
---|
860 | IN CONST VOID *Data,
|
---|
861 | IN UINTN DataSize,
|
---|
862 | OUT UINT8 *HashValue
|
---|
863 | )
|
---|
864 | {
|
---|
865 | return CALL_BASECRYPTLIB (Sha1.Services.HashAll, Sha1HashAll, (Data, DataSize, HashValue), FALSE);
|
---|
866 | }
|
---|
867 |
|
---|
868 | #endif
|
---|
869 |
|
---|
870 | /**
|
---|
871 | Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
|
---|
872 |
|
---|
873 | @return The size, in bytes, of the context buffer required for SHA-256 hash operations.
|
---|
874 |
|
---|
875 | **/
|
---|
876 | UINTN
|
---|
877 | EFIAPI
|
---|
878 | CryptoServiceSha256GetContextSize (
|
---|
879 | VOID
|
---|
880 | )
|
---|
881 | {
|
---|
882 | return CALL_BASECRYPTLIB (Sha256.Services.GetContextSize, Sha256GetContextSize, (), 0);
|
---|
883 | }
|
---|
884 |
|
---|
885 | /**
|
---|
886 | Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for
|
---|
887 | subsequent use.
|
---|
888 |
|
---|
889 | If Sha256Context is NULL, then return FALSE.
|
---|
890 |
|
---|
891 | @param[out] Sha256Context Pointer to SHA-256 context being initialized.
|
---|
892 |
|
---|
893 | @retval TRUE SHA-256 context initialization succeeded.
|
---|
894 | @retval FALSE SHA-256 context initialization failed.
|
---|
895 |
|
---|
896 | **/
|
---|
897 | BOOLEAN
|
---|
898 | EFIAPI
|
---|
899 | CryptoServiceSha256Init (
|
---|
900 | OUT VOID *Sha256Context
|
---|
901 | )
|
---|
902 | {
|
---|
903 | return CALL_BASECRYPTLIB (Sha256.Services.Init, Sha256Init, (Sha256Context), FALSE);
|
---|
904 | }
|
---|
905 |
|
---|
906 | /**
|
---|
907 | Makes a copy of an existing SHA-256 context.
|
---|
908 |
|
---|
909 | If Sha256Context is NULL, then return FALSE.
|
---|
910 | If NewSha256Context is NULL, then return FALSE.
|
---|
911 | If this interface is not supported, then return FALSE.
|
---|
912 |
|
---|
913 | @param[in] Sha256Context Pointer to SHA-256 context being copied.
|
---|
914 | @param[out] NewSha256Context Pointer to new SHA-256 context.
|
---|
915 |
|
---|
916 | @retval TRUE SHA-256 context copy succeeded.
|
---|
917 | @retval FALSE SHA-256 context copy failed.
|
---|
918 | @retval FALSE This interface is not supported.
|
---|
919 |
|
---|
920 | **/
|
---|
921 | BOOLEAN
|
---|
922 | EFIAPI
|
---|
923 | CryptoServiceSha256Duplicate (
|
---|
924 | IN CONST VOID *Sha256Context,
|
---|
925 | OUT VOID *NewSha256Context
|
---|
926 | )
|
---|
927 | {
|
---|
928 | return CALL_BASECRYPTLIB (Sha256.Services.Duplicate, Sha256Duplicate, (Sha256Context, NewSha256Context), FALSE);
|
---|
929 | }
|
---|
930 |
|
---|
931 | /**
|
---|
932 | Digests the input data and updates SHA-256 context.
|
---|
933 |
|
---|
934 | This function performs SHA-256 digest on a data buffer of the specified size.
|
---|
935 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
936 | SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized
|
---|
937 | by Sha256Final(). Behavior with invalid context is undefined.
|
---|
938 |
|
---|
939 | If Sha256Context is NULL, then return FALSE.
|
---|
940 |
|
---|
941 | @param[in, out] Sha256Context Pointer to the SHA-256 context.
|
---|
942 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
943 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
944 |
|
---|
945 | @retval TRUE SHA-256 data digest succeeded.
|
---|
946 | @retval FALSE SHA-256 data digest failed.
|
---|
947 |
|
---|
948 | **/
|
---|
949 | BOOLEAN
|
---|
950 | EFIAPI
|
---|
951 | CryptoServiceSha256Update (
|
---|
952 | IN OUT VOID *Sha256Context,
|
---|
953 | IN CONST VOID *Data,
|
---|
954 | IN UINTN DataSize
|
---|
955 | )
|
---|
956 | {
|
---|
957 | return CALL_BASECRYPTLIB (Sha256.Services.Update, Sha256Update, (Sha256Context, Data, DataSize), FALSE);
|
---|
958 | }
|
---|
959 |
|
---|
960 | /**
|
---|
961 | Completes computation of the SHA-256 digest value.
|
---|
962 |
|
---|
963 | This function completes SHA-256 hash computation and retrieves the digest value into
|
---|
964 | the specified memory. After this function has been called, the SHA-256 context cannot
|
---|
965 | be used again.
|
---|
966 | SHA-256 context should be already correctly initialized by Sha256Init(), and should not be
|
---|
967 | finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.
|
---|
968 |
|
---|
969 | If Sha256Context is NULL, then return FALSE.
|
---|
970 | If HashValue is NULL, then return FALSE.
|
---|
971 |
|
---|
972 | @param[in, out] Sha256Context Pointer to the SHA-256 context.
|
---|
973 | @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
|
---|
974 | value (32 bytes).
|
---|
975 |
|
---|
976 | @retval TRUE SHA-256 digest computation succeeded.
|
---|
977 | @retval FALSE SHA-256 digest computation failed.
|
---|
978 |
|
---|
979 | **/
|
---|
980 | BOOLEAN
|
---|
981 | EFIAPI
|
---|
982 | CryptoServiceSha256Final (
|
---|
983 | IN OUT VOID *Sha256Context,
|
---|
984 | OUT UINT8 *HashValue
|
---|
985 | )
|
---|
986 | {
|
---|
987 | return CALL_BASECRYPTLIB (Sha256.Services.Final, Sha256Final, (Sha256Context, HashValue), FALSE);
|
---|
988 | }
|
---|
989 |
|
---|
990 | /**
|
---|
991 | Computes the SHA-256 message digest of a input data buffer.
|
---|
992 |
|
---|
993 | This function performs the SHA-256 message digest of a given data buffer, and places
|
---|
994 | the digest value into the specified memory.
|
---|
995 |
|
---|
996 | If this interface is not supported, then return FALSE.
|
---|
997 |
|
---|
998 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
999 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1000 | @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
|
---|
1001 | value (32 bytes).
|
---|
1002 |
|
---|
1003 | @retval TRUE SHA-256 digest computation succeeded.
|
---|
1004 | @retval FALSE SHA-256 digest computation failed.
|
---|
1005 | @retval FALSE This interface is not supported.
|
---|
1006 |
|
---|
1007 | **/
|
---|
1008 | BOOLEAN
|
---|
1009 | EFIAPI
|
---|
1010 | CryptoServiceSha256HashAll (
|
---|
1011 | IN CONST VOID *Data,
|
---|
1012 | IN UINTN DataSize,
|
---|
1013 | OUT UINT8 *HashValue
|
---|
1014 | )
|
---|
1015 | {
|
---|
1016 | return CALL_BASECRYPTLIB (Sha256.Services.HashAll, Sha256HashAll, (Data, DataSize, HashValue), FALSE);
|
---|
1017 | }
|
---|
1018 |
|
---|
1019 | /**
|
---|
1020 | Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
|
---|
1021 |
|
---|
1022 | @return The size, in bytes, of the context buffer required for SHA-384 hash operations.
|
---|
1023 |
|
---|
1024 | **/
|
---|
1025 | UINTN
|
---|
1026 | EFIAPI
|
---|
1027 | CryptoServiceSha384GetContextSize (
|
---|
1028 | VOID
|
---|
1029 | )
|
---|
1030 | {
|
---|
1031 | return CALL_BASECRYPTLIB (Sha384.Services.GetContextSize, Sha384GetContextSize, (), 0);
|
---|
1032 | }
|
---|
1033 |
|
---|
1034 | /**
|
---|
1035 | Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for
|
---|
1036 | subsequent use.
|
---|
1037 |
|
---|
1038 | If Sha384Context is NULL, then return FALSE.
|
---|
1039 |
|
---|
1040 | @param[out] Sha384Context Pointer to SHA-384 context being initialized.
|
---|
1041 |
|
---|
1042 | @retval TRUE SHA-384 context initialization succeeded.
|
---|
1043 | @retval FALSE SHA-384 context initialization failed.
|
---|
1044 |
|
---|
1045 | **/
|
---|
1046 | BOOLEAN
|
---|
1047 | EFIAPI
|
---|
1048 | CryptoServiceSha384Init (
|
---|
1049 | OUT VOID *Sha384Context
|
---|
1050 | )
|
---|
1051 | {
|
---|
1052 | return CALL_BASECRYPTLIB (Sha384.Services.Init, Sha384Init, (Sha384Context), FALSE);
|
---|
1053 | }
|
---|
1054 |
|
---|
1055 | /**
|
---|
1056 | Makes a copy of an existing SHA-384 context.
|
---|
1057 |
|
---|
1058 | If Sha384Context is NULL, then return FALSE.
|
---|
1059 | If NewSha384Context is NULL, then return FALSE.
|
---|
1060 | If this interface is not supported, then return FALSE.
|
---|
1061 |
|
---|
1062 | @param[in] Sha384Context Pointer to SHA-384 context being copied.
|
---|
1063 | @param[out] NewSha384Context Pointer to new SHA-384 context.
|
---|
1064 |
|
---|
1065 | @retval TRUE SHA-384 context copy succeeded.
|
---|
1066 | @retval FALSE SHA-384 context copy failed.
|
---|
1067 | @retval FALSE This interface is not supported.
|
---|
1068 |
|
---|
1069 | **/
|
---|
1070 | BOOLEAN
|
---|
1071 | EFIAPI
|
---|
1072 | CryptoServiceSha384Duplicate (
|
---|
1073 | IN CONST VOID *Sha384Context,
|
---|
1074 | OUT VOID *NewSha384Context
|
---|
1075 | )
|
---|
1076 | {
|
---|
1077 | return CALL_BASECRYPTLIB (Sha384.Services.Duplicate, Sha384Duplicate, (Sha384Context, NewSha384Context), FALSE);
|
---|
1078 | }
|
---|
1079 |
|
---|
1080 | /**
|
---|
1081 | Digests the input data and updates SHA-384 context.
|
---|
1082 |
|
---|
1083 | This function performs SHA-384 digest on a data buffer of the specified size.
|
---|
1084 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
1085 | SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized
|
---|
1086 | by Sha384Final(). Behavior with invalid context is undefined.
|
---|
1087 |
|
---|
1088 | If Sha384Context is NULL, then return FALSE.
|
---|
1089 |
|
---|
1090 | @param[in, out] Sha384Context Pointer to the SHA-384 context.
|
---|
1091 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
1092 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1093 |
|
---|
1094 | @retval TRUE SHA-384 data digest succeeded.
|
---|
1095 | @retval FALSE SHA-384 data digest failed.
|
---|
1096 |
|
---|
1097 | **/
|
---|
1098 | BOOLEAN
|
---|
1099 | EFIAPI
|
---|
1100 | CryptoServiceSha384Update (
|
---|
1101 | IN OUT VOID *Sha384Context,
|
---|
1102 | IN CONST VOID *Data,
|
---|
1103 | IN UINTN DataSize
|
---|
1104 | )
|
---|
1105 | {
|
---|
1106 | return CALL_BASECRYPTLIB (Sha384.Services.Update, Sha384Update, (Sha384Context, Data, DataSize), FALSE);
|
---|
1107 | }
|
---|
1108 |
|
---|
1109 | /**
|
---|
1110 | Completes computation of the SHA-384 digest value.
|
---|
1111 |
|
---|
1112 | This function completes SHA-384 hash computation and retrieves the digest value into
|
---|
1113 | the specified memory. After this function has been called, the SHA-384 context cannot
|
---|
1114 | be used again.
|
---|
1115 | SHA-384 context should be already correctly initialized by Sha384Init(), and should not be
|
---|
1116 | finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.
|
---|
1117 |
|
---|
1118 | If Sha384Context is NULL, then return FALSE.
|
---|
1119 | If HashValue is NULL, then return FALSE.
|
---|
1120 |
|
---|
1121 | @param[in, out] Sha384Context Pointer to the SHA-384 context.
|
---|
1122 | @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
|
---|
1123 | value (48 bytes).
|
---|
1124 |
|
---|
1125 | @retval TRUE SHA-384 digest computation succeeded.
|
---|
1126 | @retval FALSE SHA-384 digest computation failed.
|
---|
1127 |
|
---|
1128 | **/
|
---|
1129 | BOOLEAN
|
---|
1130 | EFIAPI
|
---|
1131 | CryptoServiceSha384Final (
|
---|
1132 | IN OUT VOID *Sha384Context,
|
---|
1133 | OUT UINT8 *HashValue
|
---|
1134 | )
|
---|
1135 | {
|
---|
1136 | return CALL_BASECRYPTLIB (Sha384.Services.Final, Sha384Final, (Sha384Context, HashValue), FALSE);
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | /**
|
---|
1140 | Computes the SHA-384 message digest of a input data buffer.
|
---|
1141 |
|
---|
1142 | This function performs the SHA-384 message digest of a given data buffer, and places
|
---|
1143 | the digest value into the specified memory.
|
---|
1144 |
|
---|
1145 | If this interface is not supported, then return FALSE.
|
---|
1146 |
|
---|
1147 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
1148 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1149 | @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
|
---|
1150 | value (48 bytes).
|
---|
1151 |
|
---|
1152 | @retval TRUE SHA-384 digest computation succeeded.
|
---|
1153 | @retval FALSE SHA-384 digest computation failed.
|
---|
1154 | @retval FALSE This interface is not supported.
|
---|
1155 |
|
---|
1156 | **/
|
---|
1157 | BOOLEAN
|
---|
1158 | EFIAPI
|
---|
1159 | CryptoServiceSha384HashAll (
|
---|
1160 | IN CONST VOID *Data,
|
---|
1161 | IN UINTN DataSize,
|
---|
1162 | OUT UINT8 *HashValue
|
---|
1163 | )
|
---|
1164 | {
|
---|
1165 | return CALL_BASECRYPTLIB (Sha384.Services.HashAll, Sha384HashAll, (Data, DataSize, HashValue), FALSE);
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 | /**
|
---|
1169 | Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.
|
---|
1170 |
|
---|
1171 | @return The size, in bytes, of the context buffer required for SHA-512 hash operations.
|
---|
1172 |
|
---|
1173 | **/
|
---|
1174 | UINTN
|
---|
1175 | EFIAPI
|
---|
1176 | CryptoServiceSha512GetContextSize (
|
---|
1177 | VOID
|
---|
1178 | )
|
---|
1179 | {
|
---|
1180 | return CALL_BASECRYPTLIB (Sha512.Services.GetContextSize, Sha512GetContextSize, (), 0);
|
---|
1181 | }
|
---|
1182 |
|
---|
1183 | /**
|
---|
1184 | Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for
|
---|
1185 | subsequent use.
|
---|
1186 |
|
---|
1187 | If Sha512Context is NULL, then return FALSE.
|
---|
1188 |
|
---|
1189 | @param[out] Sha512Context Pointer to SHA-512 context being initialized.
|
---|
1190 |
|
---|
1191 | @retval TRUE SHA-512 context initialization succeeded.
|
---|
1192 | @retval FALSE SHA-512 context initialization failed.
|
---|
1193 |
|
---|
1194 | **/
|
---|
1195 | BOOLEAN
|
---|
1196 | EFIAPI
|
---|
1197 | CryptoServiceSha512Init (
|
---|
1198 | OUT VOID *Sha512Context
|
---|
1199 | )
|
---|
1200 | {
|
---|
1201 | return CALL_BASECRYPTLIB (Sha512.Services.Init, Sha512Init, (Sha512Context), FALSE);
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | /**
|
---|
1205 | Makes a copy of an existing SHA-512 context.
|
---|
1206 |
|
---|
1207 | If Sha512Context is NULL, then return FALSE.
|
---|
1208 | If NewSha512Context is NULL, then return FALSE.
|
---|
1209 | If this interface is not supported, then return FALSE.
|
---|
1210 |
|
---|
1211 | @param[in] Sha512Context Pointer to SHA-512 context being copied.
|
---|
1212 | @param[out] NewSha512Context Pointer to new SHA-512 context.
|
---|
1213 |
|
---|
1214 | @retval TRUE SHA-512 context copy succeeded.
|
---|
1215 | @retval FALSE SHA-512 context copy failed.
|
---|
1216 | @retval FALSE This interface is not supported.
|
---|
1217 |
|
---|
1218 | **/
|
---|
1219 | BOOLEAN
|
---|
1220 | EFIAPI
|
---|
1221 | CryptoServiceSha512Duplicate (
|
---|
1222 | IN CONST VOID *Sha512Context,
|
---|
1223 | OUT VOID *NewSha512Context
|
---|
1224 | )
|
---|
1225 | {
|
---|
1226 | return CALL_BASECRYPTLIB (Sha512.Services.Duplicate, Sha512Duplicate, (Sha512Context, NewSha512Context), FALSE);
|
---|
1227 | }
|
---|
1228 |
|
---|
1229 | /**
|
---|
1230 | Digests the input data and updates SHA-512 context.
|
---|
1231 |
|
---|
1232 | This function performs SHA-512 digest on a data buffer of the specified size.
|
---|
1233 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
1234 | SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized
|
---|
1235 | by Sha512Final(). Behavior with invalid context is undefined.
|
---|
1236 |
|
---|
1237 | If Sha512Context is NULL, then return FALSE.
|
---|
1238 |
|
---|
1239 | @param[in, out] Sha512Context Pointer to the SHA-512 context.
|
---|
1240 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
1241 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1242 |
|
---|
1243 | @retval TRUE SHA-512 data digest succeeded.
|
---|
1244 | @retval FALSE SHA-512 data digest failed.
|
---|
1245 |
|
---|
1246 | **/
|
---|
1247 | BOOLEAN
|
---|
1248 | EFIAPI
|
---|
1249 | CryptoServiceSha512Update (
|
---|
1250 | IN OUT VOID *Sha512Context,
|
---|
1251 | IN CONST VOID *Data,
|
---|
1252 | IN UINTN DataSize
|
---|
1253 | )
|
---|
1254 | {
|
---|
1255 | return CALL_BASECRYPTLIB (Sha512.Services.Update, Sha512Update, (Sha512Context, Data, DataSize), FALSE);
|
---|
1256 | }
|
---|
1257 |
|
---|
1258 | /**
|
---|
1259 | Completes computation of the SHA-512 digest value.
|
---|
1260 |
|
---|
1261 | This function completes SHA-512 hash computation and retrieves the digest value into
|
---|
1262 | the specified memory. After this function has been called, the SHA-512 context cannot
|
---|
1263 | be used again.
|
---|
1264 | SHA-512 context should be already correctly initialized by Sha512Init(), and should not be
|
---|
1265 | finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.
|
---|
1266 |
|
---|
1267 | If Sha512Context is NULL, then return FALSE.
|
---|
1268 | If HashValue is NULL, then return FALSE.
|
---|
1269 |
|
---|
1270 | @param[in, out] Sha512Context Pointer to the SHA-512 context.
|
---|
1271 | @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
|
---|
1272 | value (64 bytes).
|
---|
1273 |
|
---|
1274 | @retval TRUE SHA-512 digest computation succeeded.
|
---|
1275 | @retval FALSE SHA-512 digest computation failed.
|
---|
1276 |
|
---|
1277 | **/
|
---|
1278 | BOOLEAN
|
---|
1279 | EFIAPI
|
---|
1280 | CryptoServiceSha512Final (
|
---|
1281 | IN OUT VOID *Sha512Context,
|
---|
1282 | OUT UINT8 *HashValue
|
---|
1283 | )
|
---|
1284 | {
|
---|
1285 | return CALL_BASECRYPTLIB (Sha512.Services.Final, Sha512Final, (Sha512Context, HashValue), FALSE);
|
---|
1286 | }
|
---|
1287 |
|
---|
1288 | /**
|
---|
1289 | Computes the SHA-512 message digest of a input data buffer.
|
---|
1290 |
|
---|
1291 | This function performs the SHA-512 message digest of a given data buffer, and places
|
---|
1292 | the digest value into the specified memory.
|
---|
1293 |
|
---|
1294 | If this interface is not supported, then return FALSE.
|
---|
1295 |
|
---|
1296 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
1297 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1298 | @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
|
---|
1299 | value (64 bytes).
|
---|
1300 |
|
---|
1301 | @retval TRUE SHA-512 digest computation succeeded.
|
---|
1302 | @retval FALSE SHA-512 digest computation failed.
|
---|
1303 | @retval FALSE This interface is not supported.
|
---|
1304 |
|
---|
1305 | **/
|
---|
1306 | BOOLEAN
|
---|
1307 | EFIAPI
|
---|
1308 | CryptoServiceSha512HashAll (
|
---|
1309 | IN CONST VOID *Data,
|
---|
1310 | IN UINTN DataSize,
|
---|
1311 | OUT UINT8 *HashValue
|
---|
1312 | )
|
---|
1313 | {
|
---|
1314 | return CALL_BASECRYPTLIB (Sha512.Services.HashAll, Sha512HashAll, (Data, DataSize, HashValue), FALSE);
|
---|
1315 | }
|
---|
1316 |
|
---|
1317 | /**
|
---|
1318 | Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
|
---|
1319 |
|
---|
1320 | @return The size, in bytes, of the context buffer required for SM3 hash operations.
|
---|
1321 |
|
---|
1322 | **/
|
---|
1323 | UINTN
|
---|
1324 | EFIAPI
|
---|
1325 | CryptoServiceSm3GetContextSize (
|
---|
1326 | VOID
|
---|
1327 | )
|
---|
1328 | {
|
---|
1329 | return CALL_BASECRYPTLIB (Sm3.Services.GetContextSize, Sm3GetContextSize, (), 0);
|
---|
1330 | }
|
---|
1331 |
|
---|
1332 | /**
|
---|
1333 | Initializes user-supplied memory pointed by Sm3Context as SM3 hash context for
|
---|
1334 | subsequent use.
|
---|
1335 |
|
---|
1336 | If Sm3Context is NULL, then return FALSE.
|
---|
1337 |
|
---|
1338 | @param[out] Sm3Context Pointer to SM3 context being initialized.
|
---|
1339 |
|
---|
1340 | @retval TRUE SM3 context initialization succeeded.
|
---|
1341 | @retval FALSE SM3 context initialization failed.
|
---|
1342 |
|
---|
1343 | **/
|
---|
1344 | BOOLEAN
|
---|
1345 | EFIAPI
|
---|
1346 | CryptoServiceSm3Init (
|
---|
1347 | OUT VOID *Sm3Context
|
---|
1348 | )
|
---|
1349 | {
|
---|
1350 | return CALL_BASECRYPTLIB (Sm3.Services.Init, Sm3Init, (Sm3Context), FALSE);
|
---|
1351 | }
|
---|
1352 |
|
---|
1353 | /**
|
---|
1354 | Makes a copy of an existing SM3 context.
|
---|
1355 |
|
---|
1356 | If Sm3Context is NULL, then return FALSE.
|
---|
1357 | If NewSm3Context is NULL, then return FALSE.
|
---|
1358 | If this interface is not supported, then return FALSE.
|
---|
1359 |
|
---|
1360 | @param[in] Sm3Context Pointer to SM3 context being copied.
|
---|
1361 | @param[out] NewSm3Context Pointer to new SM3 context.
|
---|
1362 |
|
---|
1363 | @retval TRUE SM3 context copy succeeded.
|
---|
1364 | @retval FALSE SM3 context copy failed.
|
---|
1365 | @retval FALSE This interface is not supported.
|
---|
1366 |
|
---|
1367 | **/
|
---|
1368 | BOOLEAN
|
---|
1369 | EFIAPI
|
---|
1370 | CryptoServiceSm3Duplicate (
|
---|
1371 | IN CONST VOID *Sm3Context,
|
---|
1372 | OUT VOID *NewSm3Context
|
---|
1373 | )
|
---|
1374 | {
|
---|
1375 | return CALL_BASECRYPTLIB (Sm3.Services.Duplicate, Sm3Duplicate, (Sm3Context, NewSm3Context), FALSE);
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | /**
|
---|
1379 | Digests the input data and updates SM3 context.
|
---|
1380 |
|
---|
1381 | This function performs SM3 digest on a data buffer of the specified size.
|
---|
1382 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
1383 | SM3 context should be already correctly initialized by Sm3Init(), and should not be finalized
|
---|
1384 | by Sm3Final(). Behavior with invalid context is undefined.
|
---|
1385 |
|
---|
1386 | If Sm3Context is NULL, then return FALSE.
|
---|
1387 |
|
---|
1388 | @param[in, out] Sm3Context Pointer to the SM3 context.
|
---|
1389 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
1390 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1391 |
|
---|
1392 | @retval TRUE SM3 data digest succeeded.
|
---|
1393 | @retval FALSE SM3 data digest failed.
|
---|
1394 |
|
---|
1395 | **/
|
---|
1396 | BOOLEAN
|
---|
1397 | EFIAPI
|
---|
1398 | CryptoServiceSm3Update (
|
---|
1399 | IN OUT VOID *Sm3Context,
|
---|
1400 | IN CONST VOID *Data,
|
---|
1401 | IN UINTN DataSize
|
---|
1402 | )
|
---|
1403 | {
|
---|
1404 | return CALL_BASECRYPTLIB (Sm3.Services.Update, Sm3Update, (Sm3Context, Data, DataSize), FALSE);
|
---|
1405 | }
|
---|
1406 |
|
---|
1407 | /**
|
---|
1408 | Completes computation of the SM3 digest value.
|
---|
1409 |
|
---|
1410 | This function completes SM3 hash computation and retrieves the digest value into
|
---|
1411 | the specified memory. After this function has been called, the SM3 context cannot
|
---|
1412 | be used again.
|
---|
1413 | SM3 context should be already correctly initialized by Sm3Init(), and should not be
|
---|
1414 | finalized by Sm3Final(). Behavior with invalid SM3 context is undefined.
|
---|
1415 |
|
---|
1416 | If Sm3Context is NULL, then return FALSE.
|
---|
1417 | If HashValue is NULL, then return FALSE.
|
---|
1418 |
|
---|
1419 | @param[in, out] Sm3Context Pointer to the SM3 context.
|
---|
1420 | @param[out] HashValue Pointer to a buffer that receives the SM3 digest
|
---|
1421 | value (32 bytes).
|
---|
1422 |
|
---|
1423 | @retval TRUE SM3 digest computation succeeded.
|
---|
1424 | @retval FALSE SM3 digest computation failed.
|
---|
1425 |
|
---|
1426 | **/
|
---|
1427 | BOOLEAN
|
---|
1428 | EFIAPI
|
---|
1429 | CryptoServiceSm3Final (
|
---|
1430 | IN OUT VOID *Sm3Context,
|
---|
1431 | OUT UINT8 *HashValue
|
---|
1432 | )
|
---|
1433 | {
|
---|
1434 | return CALL_BASECRYPTLIB (Sm3.Services.Final, Sm3Final, (Sm3Context, HashValue), FALSE);
|
---|
1435 | }
|
---|
1436 |
|
---|
1437 | /**
|
---|
1438 | Computes the SM3 message digest of a input data buffer.
|
---|
1439 |
|
---|
1440 | This function performs the SM3 message digest of a given data buffer, and places
|
---|
1441 | the digest value into the specified memory.
|
---|
1442 |
|
---|
1443 | If this interface is not supported, then return FALSE.
|
---|
1444 |
|
---|
1445 | @param[in] Data Pointer to the buffer containing the data to be hashed.
|
---|
1446 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1447 | @param[out] HashValue Pointer to a buffer that receives the SM3 digest
|
---|
1448 | value (32 bytes).
|
---|
1449 |
|
---|
1450 | @retval TRUE SM3 digest computation succeeded.
|
---|
1451 | @retval FALSE SM3 digest computation failed.
|
---|
1452 | @retval FALSE This interface is not supported.
|
---|
1453 |
|
---|
1454 | **/
|
---|
1455 | BOOLEAN
|
---|
1456 | EFIAPI
|
---|
1457 | CryptoServiceSm3HashAll (
|
---|
1458 | IN CONST VOID *Data,
|
---|
1459 | IN UINTN DataSize,
|
---|
1460 | OUT UINT8 *HashValue
|
---|
1461 | )
|
---|
1462 | {
|
---|
1463 | return CALL_BASECRYPTLIB (Sm3.Services.HashAll, Sm3HashAll, (Data, DataSize, HashValue), FALSE);
|
---|
1464 | }
|
---|
1465 |
|
---|
1466 | // =====================================================================================
|
---|
1467 | // MAC (Message Authentication Code) Primitive
|
---|
1468 | // =====================================================================================
|
---|
1469 |
|
---|
1470 | /**
|
---|
1471 | HMAC MD5 is deprecated and unsupported any longer.
|
---|
1472 | Keep the function field for binary compability.
|
---|
1473 |
|
---|
1474 | @retval NULL This interface is not supported.
|
---|
1475 |
|
---|
1476 | **/
|
---|
1477 | VOID *
|
---|
1478 | EFIAPI
|
---|
1479 | DeprecatedCryptoServiceHmacMd5New (
|
---|
1480 | VOID
|
---|
1481 | )
|
---|
1482 | {
|
---|
1483 | return BaseCryptLibServiceDeprecated ("HmacMd5New"), NULL;
|
---|
1484 | }
|
---|
1485 |
|
---|
1486 | /**
|
---|
1487 | HMAC MD5 is deprecated and unsupported any longer.
|
---|
1488 | Keep the function field for binary compability.
|
---|
1489 |
|
---|
1490 | @param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released.
|
---|
1491 |
|
---|
1492 | **/
|
---|
1493 | VOID
|
---|
1494 | EFIAPI
|
---|
1495 | DeprecatedCryptoServiceHmacMd5Free (
|
---|
1496 | IN VOID *HmacMd5Ctx
|
---|
1497 | )
|
---|
1498 | {
|
---|
1499 | BaseCryptLibServiceDeprecated ("HmacMd5Free");
|
---|
1500 | }
|
---|
1501 |
|
---|
1502 | /**
|
---|
1503 | HMAC MD5 is deprecated and unsupported any longer.
|
---|
1504 | Keep the function field for binary compability.
|
---|
1505 |
|
---|
1506 | @param[out] HmacMd5Context Pointer to HMAC-MD5 context.
|
---|
1507 | @param[in] Key Pointer to the user-supplied key.
|
---|
1508 | @param[in] KeySize Key size in bytes.
|
---|
1509 |
|
---|
1510 | @retval FALSE This interface is not supported.
|
---|
1511 |
|
---|
1512 | **/
|
---|
1513 | BOOLEAN
|
---|
1514 | EFIAPI
|
---|
1515 | DeprecatedCryptoServiceHmacMd5SetKey (
|
---|
1516 | OUT VOID *HmacMd5Context,
|
---|
1517 | IN CONST UINT8 *Key,
|
---|
1518 | IN UINTN KeySize
|
---|
1519 | )
|
---|
1520 | {
|
---|
1521 | return BaseCryptLibServiceDeprecated ("HmacMd5SetKey"), FALSE;
|
---|
1522 | }
|
---|
1523 |
|
---|
1524 | /**
|
---|
1525 | HMAC MD5 is deprecated and unsupported any longer.
|
---|
1526 | Keep the function field for binary compability.
|
---|
1527 |
|
---|
1528 | @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied.
|
---|
1529 | @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context.
|
---|
1530 |
|
---|
1531 | @retval FALSE This interface is not supported.
|
---|
1532 |
|
---|
1533 | **/
|
---|
1534 | BOOLEAN
|
---|
1535 | EFIAPI
|
---|
1536 | DeprecatedCryptoServiceHmacMd5Duplicate (
|
---|
1537 | IN CONST VOID *HmacMd5Context,
|
---|
1538 | OUT VOID *NewHmacMd5Context
|
---|
1539 | )
|
---|
1540 | {
|
---|
1541 | return BaseCryptLibServiceDeprecated ("HmacMd5Duplicate"), FALSE;
|
---|
1542 | }
|
---|
1543 |
|
---|
1544 | /**
|
---|
1545 | HMAC MD5 is deprecated and unsupported any longer.
|
---|
1546 | Keep the function field for binary compability.
|
---|
1547 |
|
---|
1548 | @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
|
---|
1549 | @param[in] Data Pointer to the buffer containing the data to be digested.
|
---|
1550 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1551 |
|
---|
1552 | @retval FALSE This interface is not supported.
|
---|
1553 |
|
---|
1554 | **/
|
---|
1555 | BOOLEAN
|
---|
1556 | EFIAPI
|
---|
1557 | DeprecatedCryptoServiceHmacMd5Update (
|
---|
1558 | IN OUT VOID *HmacMd5Context,
|
---|
1559 | IN CONST VOID *Data,
|
---|
1560 | IN UINTN DataSize
|
---|
1561 | )
|
---|
1562 | {
|
---|
1563 | return BaseCryptLibServiceDeprecated ("HmacMd5Update"), FALSE;
|
---|
1564 | }
|
---|
1565 |
|
---|
1566 | /**
|
---|
1567 | HMAC MD5 is deprecated and unsupported any longer.
|
---|
1568 | Keep the function field for binary compability.
|
---|
1569 |
|
---|
1570 | @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
|
---|
1571 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-MD5 digest
|
---|
1572 | value (16 bytes).
|
---|
1573 |
|
---|
1574 | @retval FALSE This interface is not supported.
|
---|
1575 |
|
---|
1576 | **/
|
---|
1577 | BOOLEAN
|
---|
1578 | EFIAPI
|
---|
1579 | DeprecatedCryptoServiceHmacMd5Final (
|
---|
1580 | IN OUT VOID *HmacMd5Context,
|
---|
1581 | OUT UINT8 *HmacValue
|
---|
1582 | )
|
---|
1583 | {
|
---|
1584 | return BaseCryptLibServiceDeprecated ("HmacMd5Final"), FALSE;
|
---|
1585 | }
|
---|
1586 |
|
---|
1587 | /**
|
---|
1588 | HMAC SHA1 is deprecated and unsupported any longer.
|
---|
1589 | Keep the function field for binary compability.
|
---|
1590 |
|
---|
1591 | @return NULL This interface is not supported.
|
---|
1592 |
|
---|
1593 | **/
|
---|
1594 | VOID *
|
---|
1595 | EFIAPI
|
---|
1596 | DeprecatedCryptoServiceHmacSha1New (
|
---|
1597 | VOID
|
---|
1598 | )
|
---|
1599 | {
|
---|
1600 | return BaseCryptLibServiceDeprecated ("HmacSha1New"), NULL;
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 | /**
|
---|
1604 | HMAC SHA1 is deprecated and unsupported any longer.
|
---|
1605 | Keep the function field for binary compability.
|
---|
1606 |
|
---|
1607 | @param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released.
|
---|
1608 |
|
---|
1609 | **/
|
---|
1610 | VOID
|
---|
1611 | EFIAPI
|
---|
1612 | DeprecatedCryptoServiceHmacSha1Free (
|
---|
1613 | IN VOID *HmacSha1Ctx
|
---|
1614 | )
|
---|
1615 | {
|
---|
1616 | BaseCryptLibServiceDeprecated ("HmacSha1Free");
|
---|
1617 | }
|
---|
1618 |
|
---|
1619 | /**
|
---|
1620 | HMAC SHA1 is deprecated and unsupported any longer.
|
---|
1621 | Keep the function field for binary compability.
|
---|
1622 |
|
---|
1623 | @param[out] HmacSha1Context Pointer to HMAC-SHA1 context.
|
---|
1624 | @param[in] Key Pointer to the user-supplied key.
|
---|
1625 | @param[in] KeySize Key size in bytes.
|
---|
1626 |
|
---|
1627 | @retval FALSE This interface is not supported.
|
---|
1628 |
|
---|
1629 | **/
|
---|
1630 | BOOLEAN
|
---|
1631 | EFIAPI
|
---|
1632 | DeprecatedCryptoServiceHmacSha1SetKey (
|
---|
1633 | OUT VOID *HmacSha1Context,
|
---|
1634 | IN CONST UINT8 *Key,
|
---|
1635 | IN UINTN KeySize
|
---|
1636 | )
|
---|
1637 | {
|
---|
1638 | return BaseCryptLibServiceDeprecated ("HmacSha1SetKey"), FALSE;
|
---|
1639 | }
|
---|
1640 |
|
---|
1641 | /**
|
---|
1642 | HMAC SHA1 is deprecated and unsupported any longer.
|
---|
1643 | Keep the function field for binary compability.
|
---|
1644 |
|
---|
1645 | @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied.
|
---|
1646 | @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context.
|
---|
1647 |
|
---|
1648 | @retval FALSE This interface is not supported.
|
---|
1649 |
|
---|
1650 | **/
|
---|
1651 | BOOLEAN
|
---|
1652 | EFIAPI
|
---|
1653 | DeprecatedCryptoServiceHmacSha1Duplicate (
|
---|
1654 | IN CONST VOID *HmacSha1Context,
|
---|
1655 | OUT VOID *NewHmacSha1Context
|
---|
1656 | )
|
---|
1657 | {
|
---|
1658 | return BaseCryptLibServiceDeprecated ("HmacSha1Duplicate"), FALSE;
|
---|
1659 | }
|
---|
1660 |
|
---|
1661 | /**
|
---|
1662 | HMAC SHA1 is deprecated and unsupported any longer.
|
---|
1663 | Keep the function field for binary compability.
|
---|
1664 |
|
---|
1665 | @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
|
---|
1666 | @param[in] Data Pointer to the buffer containing the data to be digested.
|
---|
1667 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1668 |
|
---|
1669 | @retval FALSE This interface is not supported.
|
---|
1670 |
|
---|
1671 | **/
|
---|
1672 | BOOLEAN
|
---|
1673 | EFIAPI
|
---|
1674 | DeprecatedCryptoServiceHmacSha1Update (
|
---|
1675 | IN OUT VOID *HmacSha1Context,
|
---|
1676 | IN CONST VOID *Data,
|
---|
1677 | IN UINTN DataSize
|
---|
1678 | )
|
---|
1679 | {
|
---|
1680 | return BaseCryptLibServiceDeprecated ("HmacSha1Update"), FALSE;
|
---|
1681 | }
|
---|
1682 |
|
---|
1683 | /**
|
---|
1684 | HMAC SHA1 is deprecated and unsupported any longer.
|
---|
1685 | Keep the function field for binary compability.
|
---|
1686 |
|
---|
1687 | @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
|
---|
1688 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest
|
---|
1689 | value (20 bytes).
|
---|
1690 |
|
---|
1691 | @retval FALSE This interface is not supported.
|
---|
1692 |
|
---|
1693 | **/
|
---|
1694 | BOOLEAN
|
---|
1695 | EFIAPI
|
---|
1696 | DeprecatedCryptoServiceHmacSha1Final (
|
---|
1697 | IN OUT VOID *HmacSha1Context,
|
---|
1698 | OUT UINT8 *HmacValue
|
---|
1699 | )
|
---|
1700 | {
|
---|
1701 | return BaseCryptLibServiceDeprecated ("HmacSha1Final"), FALSE;
|
---|
1702 | }
|
---|
1703 |
|
---|
1704 | /**
|
---|
1705 | Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
|
---|
1706 |
|
---|
1707 | @return Pointer to the HMAC_CTX context that has been initialized.
|
---|
1708 | If the allocations fails, HmacSha256New() returns NULL.
|
---|
1709 |
|
---|
1710 | **/
|
---|
1711 | VOID *
|
---|
1712 | EFIAPI
|
---|
1713 | CryptoServiceHmacSha256New (
|
---|
1714 | VOID
|
---|
1715 | )
|
---|
1716 | {
|
---|
1717 | return CALL_BASECRYPTLIB (HmacSha256.Services.New, HmacSha256New, (), NULL);
|
---|
1718 | }
|
---|
1719 |
|
---|
1720 | /**
|
---|
1721 | Release the specified HMAC_CTX context.
|
---|
1722 |
|
---|
1723 | @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released.
|
---|
1724 |
|
---|
1725 | **/
|
---|
1726 | VOID
|
---|
1727 | EFIAPI
|
---|
1728 | CryptoServiceHmacSha256Free (
|
---|
1729 | IN VOID *HmacSha256Ctx
|
---|
1730 | )
|
---|
1731 | {
|
---|
1732 | CALL_VOID_BASECRYPTLIB (HmacSha256.Services.Free, HmacSha256Free, (HmacSha256Ctx));
|
---|
1733 | }
|
---|
1734 |
|
---|
1735 | /**
|
---|
1736 | Set user-supplied key for subsequent use. It must be done before any
|
---|
1737 | calling to HmacSha256Update().
|
---|
1738 |
|
---|
1739 | If HmacSha256Context is NULL, then return FALSE.
|
---|
1740 | If this interface is not supported, then return FALSE.
|
---|
1741 |
|
---|
1742 | @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.
|
---|
1743 | @param[in] Key Pointer to the user-supplied key.
|
---|
1744 | @param[in] KeySize Key size in bytes.
|
---|
1745 |
|
---|
1746 | @retval TRUE The Key is set successfully.
|
---|
1747 | @retval FALSE The Key is set unsuccessfully.
|
---|
1748 | @retval FALSE This interface is not supported.
|
---|
1749 |
|
---|
1750 | **/
|
---|
1751 | BOOLEAN
|
---|
1752 | EFIAPI
|
---|
1753 | CryptoServiceHmacSha256SetKey (
|
---|
1754 | OUT VOID *HmacSha256Context,
|
---|
1755 | IN CONST UINT8 *Key,
|
---|
1756 | IN UINTN KeySize
|
---|
1757 | )
|
---|
1758 | {
|
---|
1759 | return CALL_BASECRYPTLIB (HmacSha256.Services.SetKey, HmacSha256SetKey, (HmacSha256Context, Key, KeySize), FALSE);
|
---|
1760 | }
|
---|
1761 |
|
---|
1762 | /**
|
---|
1763 | Makes a copy of an existing HMAC-SHA256 context.
|
---|
1764 |
|
---|
1765 | If HmacSha256Context is NULL, then return FALSE.
|
---|
1766 | If NewHmacSha256Context is NULL, then return FALSE.
|
---|
1767 | If this interface is not supported, then return FALSE.
|
---|
1768 |
|
---|
1769 | @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied.
|
---|
1770 | @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context.
|
---|
1771 |
|
---|
1772 | @retval TRUE HMAC-SHA256 context copy succeeded.
|
---|
1773 | @retval FALSE HMAC-SHA256 context copy failed.
|
---|
1774 | @retval FALSE This interface is not supported.
|
---|
1775 |
|
---|
1776 | **/
|
---|
1777 | BOOLEAN
|
---|
1778 | EFIAPI
|
---|
1779 | CryptoServiceHmacSha256Duplicate (
|
---|
1780 | IN CONST VOID *HmacSha256Context,
|
---|
1781 | OUT VOID *NewHmacSha256Context
|
---|
1782 | )
|
---|
1783 | {
|
---|
1784 | return CALL_BASECRYPTLIB (HmacSha256.Services.Duplicate, HmacSha256Duplicate, (HmacSha256Context, NewHmacSha256Context), FALSE);
|
---|
1785 | }
|
---|
1786 |
|
---|
1787 | /**
|
---|
1788 | Digests the input data and updates HMAC-SHA256 context.
|
---|
1789 |
|
---|
1790 | This function performs HMAC-SHA256 digest on a data buffer of the specified size.
|
---|
1791 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
1792 | HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
|
---|
1793 | by HmacSha256Final(). Behavior with invalid context is undefined.
|
---|
1794 |
|
---|
1795 | If HmacSha256Context is NULL, then return FALSE.
|
---|
1796 | If this interface is not supported, then return FALSE.
|
---|
1797 |
|
---|
1798 | @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
|
---|
1799 | @param[in] Data Pointer to the buffer containing the data to be digested.
|
---|
1800 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1801 |
|
---|
1802 | @retval TRUE HMAC-SHA256 data digest succeeded.
|
---|
1803 | @retval FALSE HMAC-SHA256 data digest failed.
|
---|
1804 | @retval FALSE This interface is not supported.
|
---|
1805 |
|
---|
1806 | **/
|
---|
1807 | BOOLEAN
|
---|
1808 | EFIAPI
|
---|
1809 | CryptoServiceHmacSha256Update (
|
---|
1810 | IN OUT VOID *HmacSha256Context,
|
---|
1811 | IN CONST VOID *Data,
|
---|
1812 | IN UINTN DataSize
|
---|
1813 | )
|
---|
1814 | {
|
---|
1815 | return CALL_BASECRYPTLIB (HmacSha256.Services.Update, HmacSha256Update, (HmacSha256Context, Data, DataSize), FALSE);
|
---|
1816 | }
|
---|
1817 |
|
---|
1818 | /**
|
---|
1819 | Completes computation of the HMAC-SHA256 digest value.
|
---|
1820 |
|
---|
1821 | This function completes HMAC-SHA256 hash computation and retrieves the digest value into
|
---|
1822 | the specified memory. After this function has been called, the HMAC-SHA256 context cannot
|
---|
1823 | be used again.
|
---|
1824 | HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
|
---|
1825 | by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.
|
---|
1826 |
|
---|
1827 | If HmacSha256Context is NULL, then return FALSE.
|
---|
1828 | If HmacValue is NULL, then return FALSE.
|
---|
1829 | If this interface is not supported, then return FALSE.
|
---|
1830 |
|
---|
1831 | @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
|
---|
1832 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest
|
---|
1833 | value (32 bytes).
|
---|
1834 |
|
---|
1835 | @retval TRUE HMAC-SHA256 digest computation succeeded.
|
---|
1836 | @retval FALSE HMAC-SHA256 digest computation failed.
|
---|
1837 | @retval FALSE This interface is not supported.
|
---|
1838 |
|
---|
1839 | **/
|
---|
1840 | BOOLEAN
|
---|
1841 | EFIAPI
|
---|
1842 | CryptoServiceHmacSha256Final (
|
---|
1843 | IN OUT VOID *HmacSha256Context,
|
---|
1844 | OUT UINT8 *HmacValue
|
---|
1845 | )
|
---|
1846 | {
|
---|
1847 | return CALL_BASECRYPTLIB (HmacSha256.Services.Final, HmacSha256Final, (HmacSha256Context, HmacValue), FALSE);
|
---|
1848 | }
|
---|
1849 |
|
---|
1850 | /**
|
---|
1851 | Computes the HMAC-SHA256 digest of a input data buffer.
|
---|
1852 |
|
---|
1853 | This function performs the HMAC-SHA256 digest of a given data buffer, and places
|
---|
1854 | the digest value into the specified memory.
|
---|
1855 |
|
---|
1856 | If this interface is not supported, then return FALSE.
|
---|
1857 |
|
---|
1858 | @param[in] Data Pointer to the buffer containing the data to be digested.
|
---|
1859 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1860 | @param[in] Key Pointer to the user-supplied key.
|
---|
1861 | @param[in] KeySize Key size in bytes.
|
---|
1862 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest
|
---|
1863 | value (32 bytes).
|
---|
1864 |
|
---|
1865 | @retval TRUE HMAC-SHA256 digest computation succeeded.
|
---|
1866 | @retval FALSE HMAC-SHA256 digest computation failed.
|
---|
1867 | @retval FALSE This interface is not supported.
|
---|
1868 |
|
---|
1869 | **/
|
---|
1870 | BOOLEAN
|
---|
1871 | EFIAPI
|
---|
1872 | CryptoServiceHmacSha256All (
|
---|
1873 | IN CONST VOID *Data,
|
---|
1874 | IN UINTN DataSize,
|
---|
1875 | IN CONST UINT8 *Key,
|
---|
1876 | IN UINTN KeySize,
|
---|
1877 | OUT UINT8 *HmacValue
|
---|
1878 | )
|
---|
1879 | {
|
---|
1880 | return CALL_BASECRYPTLIB (HmacSha256.Services.All, HmacSha256All, (Data, DataSize, Key, KeySize, HmacValue), FALSE);
|
---|
1881 | }
|
---|
1882 |
|
---|
1883 | /**
|
---|
1884 | Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA384 use.
|
---|
1885 |
|
---|
1886 | @return Pointer to the HMAC_CTX context that has been initialized.
|
---|
1887 | If the allocations fails, HmacSha384New() returns NULL.
|
---|
1888 |
|
---|
1889 | **/
|
---|
1890 | VOID *
|
---|
1891 | EFIAPI
|
---|
1892 | CryptoServiceHmacSha384New (
|
---|
1893 | VOID
|
---|
1894 | )
|
---|
1895 | {
|
---|
1896 | return CALL_BASECRYPTLIB (HmacSha384.Services.New, HmacSha384New, (), NULL);
|
---|
1897 | }
|
---|
1898 |
|
---|
1899 | /**
|
---|
1900 | Release the specified HMAC_CTX context.
|
---|
1901 |
|
---|
1902 | @param[in] HmacSha384Ctx Pointer to the HMAC_CTX context to be released.
|
---|
1903 |
|
---|
1904 | **/
|
---|
1905 | VOID
|
---|
1906 | EFIAPI
|
---|
1907 | CryptoServiceHmacSha384Free (
|
---|
1908 | IN VOID *HmacSha384Ctx
|
---|
1909 | )
|
---|
1910 | {
|
---|
1911 | CALL_VOID_BASECRYPTLIB (HmacSha384.Services.Free, HmacSha384Free, (HmacSha384Ctx));
|
---|
1912 | }
|
---|
1913 |
|
---|
1914 | /**
|
---|
1915 | Set user-supplied key for subsequent use. It must be done before any
|
---|
1916 | calling to HmacSha384Update().
|
---|
1917 |
|
---|
1918 | If HmacSha384Context is NULL, then return FALSE.
|
---|
1919 | If this interface is not supported, then return FALSE.
|
---|
1920 |
|
---|
1921 | @param[out] HmacSha384Context Pointer to HMAC-SHA384 context.
|
---|
1922 | @param[in] Key Pointer to the user-supplied key.
|
---|
1923 | @param[in] KeySize Key size in bytes.
|
---|
1924 |
|
---|
1925 | @retval TRUE The Key is set successfully.
|
---|
1926 | @retval FALSE The Key is set unsuccessfully.
|
---|
1927 | @retval FALSE This interface is not supported.
|
---|
1928 |
|
---|
1929 | **/
|
---|
1930 | BOOLEAN
|
---|
1931 | EFIAPI
|
---|
1932 | CryptoServiceHmacSha384SetKey (
|
---|
1933 | OUT VOID *HmacSha384Context,
|
---|
1934 | IN CONST UINT8 *Key,
|
---|
1935 | IN UINTN KeySize
|
---|
1936 | )
|
---|
1937 | {
|
---|
1938 | return CALL_BASECRYPTLIB (HmacSha384.Services.SetKey, HmacSha384SetKey, (HmacSha384Context, Key, KeySize), FALSE);
|
---|
1939 | }
|
---|
1940 |
|
---|
1941 | /**
|
---|
1942 | Makes a copy of an existing HMAC-SHA384 context.
|
---|
1943 |
|
---|
1944 | If HmacSha384Context is NULL, then return FALSE.
|
---|
1945 | If NewHmacSha384Context is NULL, then return FALSE.
|
---|
1946 | If this interface is not supported, then return FALSE.
|
---|
1947 |
|
---|
1948 | @param[in] HmacSha384Context Pointer to HMAC-SHA384 context being copied.
|
---|
1949 | @param[out] NewHmacSha384Context Pointer to new HMAC-SHA384 context.
|
---|
1950 |
|
---|
1951 | @retval TRUE HMAC-SHA384 context copy succeeded.
|
---|
1952 | @retval FALSE HMAC-SHA384 context copy failed.
|
---|
1953 | @retval FALSE This interface is not supported.
|
---|
1954 |
|
---|
1955 | **/
|
---|
1956 | BOOLEAN
|
---|
1957 | EFIAPI
|
---|
1958 | CryptoServiceHmacSha384Duplicate (
|
---|
1959 | IN CONST VOID *HmacSha384Context,
|
---|
1960 | OUT VOID *NewHmacSha384Context
|
---|
1961 | )
|
---|
1962 | {
|
---|
1963 | return CALL_BASECRYPTLIB (HmacSha384.Services.Duplicate, HmacSha256Duplicate, (HmacSha384Context, NewHmacSha384Context), FALSE);
|
---|
1964 | }
|
---|
1965 |
|
---|
1966 | /**
|
---|
1967 | Digests the input data and updates HMAC-SHA384 context.
|
---|
1968 |
|
---|
1969 | This function performs HMAC-SHA384 digest on a data buffer of the specified size.
|
---|
1970 | It can be called multiple times to compute the digest of long or discontinuous data streams.
|
---|
1971 | HMAC-SHA384 context should be initialized by HmacSha384New(), and should not be finalized
|
---|
1972 | by HmacSha384Final(). Behavior with invalid context is undefined.
|
---|
1973 |
|
---|
1974 | If HmacSha384Context is NULL, then return FALSE.
|
---|
1975 | If this interface is not supported, then return FALSE.
|
---|
1976 |
|
---|
1977 | @param[in, out] HmacSha384Context Pointer to the HMAC-SHA384 context.
|
---|
1978 | @param[in] Data Pointer to the buffer containing the data to be digested.
|
---|
1979 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
1980 |
|
---|
1981 | @retval TRUE HMAC-SHA384 data digest succeeded.
|
---|
1982 | @retval FALSE HMAC-SHA384 data digest failed.
|
---|
1983 | @retval FALSE This interface is not supported.
|
---|
1984 |
|
---|
1985 | **/
|
---|
1986 | BOOLEAN
|
---|
1987 | EFIAPI
|
---|
1988 | CryptoServiceHmacSha384Update (
|
---|
1989 | IN OUT VOID *HmacSha384Context,
|
---|
1990 | IN CONST VOID *Data,
|
---|
1991 | IN UINTN DataSize
|
---|
1992 | )
|
---|
1993 | {
|
---|
1994 | return CALL_BASECRYPTLIB (HmacSha384.Services.Update, HmacSha384Update, (HmacSha384Context, Data, DataSize), FALSE);
|
---|
1995 | }
|
---|
1996 |
|
---|
1997 | /**
|
---|
1998 | Completes computation of the HMAC-SHA384 digest value.
|
---|
1999 |
|
---|
2000 | This function completes HMAC-SHA384 hash computation and retrieves the digest value into
|
---|
2001 | the specified memory. After this function has been called, the HMAC-SHA384 context cannot
|
---|
2002 | be used again.
|
---|
2003 | HMAC-SHA384 context should be initialized by HmacSha384New(), and should not be finalized
|
---|
2004 | by HmacSha384Final(). Behavior with invalid HMAC-SHA384 context is undefined.
|
---|
2005 |
|
---|
2006 | If HmacSha384Context is NULL, then return FALSE.
|
---|
2007 | If HmacValue is NULL, then return FALSE.
|
---|
2008 | If this interface is not supported, then return FALSE.
|
---|
2009 |
|
---|
2010 | @param[in, out] HmacSha384Context Pointer to the HMAC-SHA384 context.
|
---|
2011 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA384 digest
|
---|
2012 | value (48 bytes).
|
---|
2013 |
|
---|
2014 | @retval TRUE HMAC-SHA384 digest computation succeeded.
|
---|
2015 | @retval FALSE HMAC-SHA384 digest computation failed.
|
---|
2016 | @retval FALSE This interface is not supported.
|
---|
2017 |
|
---|
2018 | **/
|
---|
2019 | BOOLEAN
|
---|
2020 | EFIAPI
|
---|
2021 | CryptoServiceHmacSha384Final (
|
---|
2022 | IN OUT VOID *HmacSha384Context,
|
---|
2023 | OUT UINT8 *HmacValue
|
---|
2024 | )
|
---|
2025 | {
|
---|
2026 | return CALL_BASECRYPTLIB (HmacSha384.Services.Final, HmacSha384Final, (HmacSha384Context, HmacValue), FALSE);
|
---|
2027 | }
|
---|
2028 |
|
---|
2029 | /**
|
---|
2030 | Computes the HMAC-SHA384 digest of a input data buffer.
|
---|
2031 |
|
---|
2032 | This function performs the HMAC-SHA384 digest of a given data buffer, and places
|
---|
2033 | the digest value into the specified memory.
|
---|
2034 |
|
---|
2035 | If this interface is not supported, then return FALSE.
|
---|
2036 |
|
---|
2037 | @param[in] Data Pointer to the buffer containing the data to be digested.
|
---|
2038 | @param[in] DataSize Size of Data buffer in bytes.
|
---|
2039 | @param[in] Key Pointer to the user-supplied key.
|
---|
2040 | @param[in] KeySize Key size in bytes.
|
---|
2041 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA384 digest
|
---|
2042 | value (48 bytes).
|
---|
2043 |
|
---|
2044 | @retval TRUE HMAC-SHA384 digest computation succeeded.
|
---|
2045 | @retval FALSE HMAC-SHA384 digest computation failed.
|
---|
2046 | @retval FALSE This interface is not supported.
|
---|
2047 |
|
---|
2048 | **/
|
---|
2049 | BOOLEAN
|
---|
2050 | EFIAPI
|
---|
2051 | CryptoServiceHmacSha384All (
|
---|
2052 | IN CONST VOID *Data,
|
---|
2053 | IN UINTN DataSize,
|
---|
2054 | IN CONST UINT8 *Key,
|
---|
2055 | IN UINTN KeySize,
|
---|
2056 | OUT UINT8 *HmacValue
|
---|
2057 | )
|
---|
2058 | {
|
---|
2059 | return CALL_BASECRYPTLIB (HmacSha384.Services.All, HmacSha384All, (Data, DataSize, Key, KeySize, HmacValue), FALSE);
|
---|
2060 | }
|
---|
2061 |
|
---|
2062 | // =====================================================================================
|
---|
2063 | // Symmetric Cryptography Primitive
|
---|
2064 | // =====================================================================================
|
---|
2065 |
|
---|
2066 | /**
|
---|
2067 | TDES is deprecated and unsupported any longer.
|
---|
2068 | Keep the function field for binary compability.
|
---|
2069 |
|
---|
2070 | @retval 0 This interface is not supported.
|
---|
2071 |
|
---|
2072 | **/
|
---|
2073 | UINTN
|
---|
2074 | EFIAPI
|
---|
2075 | DeprecatedCryptoServiceTdesGetContextSize (
|
---|
2076 | VOID
|
---|
2077 | )
|
---|
2078 | {
|
---|
2079 | return BaseCryptLibServiceDeprecated ("TdesGetContextSize"), 0;
|
---|
2080 | }
|
---|
2081 |
|
---|
2082 | /**
|
---|
2083 | TDES is deprecated and unsupported any longer.
|
---|
2084 | Keep the function field for binary compability.
|
---|
2085 |
|
---|
2086 | @param[out] TdesContext Pointer to TDES context being initialized.
|
---|
2087 | @param[in] Key Pointer to the user-supplied TDES key.
|
---|
2088 | @param[in] KeyLength Length of TDES key in bits.
|
---|
2089 |
|
---|
2090 | @retval FALSE This interface is not supported.
|
---|
2091 |
|
---|
2092 | **/
|
---|
2093 | BOOLEAN
|
---|
2094 | EFIAPI
|
---|
2095 | DeprecatedCryptoServiceTdesInit (
|
---|
2096 | OUT VOID *TdesContext,
|
---|
2097 | IN CONST UINT8 *Key,
|
---|
2098 | IN UINTN KeyLength
|
---|
2099 | )
|
---|
2100 | {
|
---|
2101 | return BaseCryptLibServiceDeprecated ("TdesInit"), FALSE;
|
---|
2102 | }
|
---|
2103 |
|
---|
2104 | /**
|
---|
2105 | TDES is deprecated and unsupported any longer.
|
---|
2106 | Keep the function field for binary compability.
|
---|
2107 |
|
---|
2108 | @param[in] TdesContext Pointer to the TDES context.
|
---|
2109 | @param[in] Input Pointer to the buffer containing the data to be encrypted.
|
---|
2110 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2111 | @param[out] Output Pointer to a buffer that receives the TDES encryption output.
|
---|
2112 |
|
---|
2113 | @retval FALSE This interface is not supported.
|
---|
2114 |
|
---|
2115 | **/
|
---|
2116 | BOOLEAN
|
---|
2117 | EFIAPI
|
---|
2118 | DeprecatedCryptoServiceTdesEcbEncrypt (
|
---|
2119 | IN VOID *TdesContext,
|
---|
2120 | IN CONST UINT8 *Input,
|
---|
2121 | IN UINTN InputSize,
|
---|
2122 | OUT UINT8 *Output
|
---|
2123 | )
|
---|
2124 | {
|
---|
2125 | return BaseCryptLibServiceDeprecated ("TdesEcbEncrypt"), FALSE;
|
---|
2126 | }
|
---|
2127 |
|
---|
2128 | /**
|
---|
2129 | TDES is deprecated and unsupported any longer.
|
---|
2130 | Keep the function field for binary compability.
|
---|
2131 |
|
---|
2132 | @param[in] TdesContext Pointer to the TDES context.
|
---|
2133 | @param[in] Input Pointer to the buffer containing the data to be decrypted.
|
---|
2134 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2135 | @param[out] Output Pointer to a buffer that receives the TDES decryption output.
|
---|
2136 |
|
---|
2137 | @retval FALSE This interface is not supported.
|
---|
2138 |
|
---|
2139 | **/
|
---|
2140 | BOOLEAN
|
---|
2141 | EFIAPI
|
---|
2142 | DeprecatedCryptoServiceTdesEcbDecrypt (
|
---|
2143 | IN VOID *TdesContext,
|
---|
2144 | IN CONST UINT8 *Input,
|
---|
2145 | IN UINTN InputSize,
|
---|
2146 | OUT UINT8 *Output
|
---|
2147 | )
|
---|
2148 | {
|
---|
2149 | return BaseCryptLibServiceDeprecated ("TdesEcbDecrypt"), FALSE;
|
---|
2150 | }
|
---|
2151 |
|
---|
2152 | /**
|
---|
2153 | TDES is deprecated and unsupported any longer.
|
---|
2154 | Keep the function field for binary compability.
|
---|
2155 |
|
---|
2156 | @param[in] TdesContext Pointer to the TDES context.
|
---|
2157 | @param[in] Input Pointer to the buffer containing the data to be encrypted.
|
---|
2158 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2159 | @param[in] Ivec Pointer to initialization vector.
|
---|
2160 | @param[out] Output Pointer to a buffer that receives the TDES encryption output.
|
---|
2161 |
|
---|
2162 | @retval FALSE This interface is not supported.
|
---|
2163 |
|
---|
2164 | **/
|
---|
2165 | BOOLEAN
|
---|
2166 | EFIAPI
|
---|
2167 | DeprecatedCryptoServiceTdesCbcEncrypt (
|
---|
2168 | IN VOID *TdesContext,
|
---|
2169 | IN CONST UINT8 *Input,
|
---|
2170 | IN UINTN InputSize,
|
---|
2171 | IN CONST UINT8 *Ivec,
|
---|
2172 | OUT UINT8 *Output
|
---|
2173 | )
|
---|
2174 | {
|
---|
2175 | return BaseCryptLibServiceDeprecated ("TdesCbcEncrypt"), FALSE;
|
---|
2176 | }
|
---|
2177 |
|
---|
2178 | /**
|
---|
2179 | TDES is deprecated and unsupported any longer.
|
---|
2180 | Keep the function field for binary compability.
|
---|
2181 |
|
---|
2182 | @param[in] TdesContext Pointer to the TDES context.
|
---|
2183 | @param[in] Input Pointer to the buffer containing the data to be encrypted.
|
---|
2184 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2185 | @param[in] Ivec Pointer to initialization vector.
|
---|
2186 | @param[out] Output Pointer to a buffer that receives the TDES encryption output.
|
---|
2187 |
|
---|
2188 | @retval FALSE This interface is not supported.
|
---|
2189 |
|
---|
2190 | **/
|
---|
2191 | BOOLEAN
|
---|
2192 | EFIAPI
|
---|
2193 | DeprecatedCryptoServiceTdesCbcDecrypt (
|
---|
2194 | IN VOID *TdesContext,
|
---|
2195 | IN CONST UINT8 *Input,
|
---|
2196 | IN UINTN InputSize,
|
---|
2197 | IN CONST UINT8 *Ivec,
|
---|
2198 | OUT UINT8 *Output
|
---|
2199 | )
|
---|
2200 | {
|
---|
2201 | return BaseCryptLibServiceDeprecated ("TdesCbcDecrypt"), FALSE;
|
---|
2202 | }
|
---|
2203 |
|
---|
2204 | /**
|
---|
2205 | Retrieves the size, in bytes, of the context buffer required for AES operations.
|
---|
2206 |
|
---|
2207 | If this interface is not supported, then return zero.
|
---|
2208 |
|
---|
2209 | @return The size, in bytes, of the context buffer required for AES operations.
|
---|
2210 | @retval 0 This interface is not supported.
|
---|
2211 |
|
---|
2212 | **/
|
---|
2213 | UINTN
|
---|
2214 | EFIAPI
|
---|
2215 | CryptoServiceAesGetContextSize (
|
---|
2216 | VOID
|
---|
2217 | )
|
---|
2218 | {
|
---|
2219 | return CALL_BASECRYPTLIB (Aes.Services.GetContextSize, AesGetContextSize, (), 0);
|
---|
2220 | }
|
---|
2221 |
|
---|
2222 | /**
|
---|
2223 | Initializes user-supplied memory as AES context for subsequent use.
|
---|
2224 |
|
---|
2225 | This function initializes user-supplied memory pointed by AesContext as AES context.
|
---|
2226 | In addition, it sets up all AES key materials for subsequent encryption and decryption
|
---|
2227 | operations.
|
---|
2228 | There are 3 options for key length, 128 bits, 192 bits, and 256 bits.
|
---|
2229 |
|
---|
2230 | If AesContext is NULL, then return FALSE.
|
---|
2231 | If Key is NULL, then return FALSE.
|
---|
2232 | If KeyLength is not valid, then return FALSE.
|
---|
2233 | If this interface is not supported, then return FALSE.
|
---|
2234 |
|
---|
2235 | @param[out] AesContext Pointer to AES context being initialized.
|
---|
2236 | @param[in] Key Pointer to the user-supplied AES key.
|
---|
2237 | @param[in] KeyLength Length of AES key in bits.
|
---|
2238 |
|
---|
2239 | @retval TRUE AES context initialization succeeded.
|
---|
2240 | @retval FALSE AES context initialization failed.
|
---|
2241 | @retval FALSE This interface is not supported.
|
---|
2242 |
|
---|
2243 | **/
|
---|
2244 | BOOLEAN
|
---|
2245 | EFIAPI
|
---|
2246 | CryptoServiceAesInit (
|
---|
2247 | OUT VOID *AesContext,
|
---|
2248 | IN CONST UINT8 *Key,
|
---|
2249 | IN UINTN KeyLength
|
---|
2250 | )
|
---|
2251 | {
|
---|
2252 | return CALL_BASECRYPTLIB (Aes.Services.Init, AesInit, (AesContext, Key, KeyLength), FALSE);
|
---|
2253 | }
|
---|
2254 |
|
---|
2255 | /**
|
---|
2256 | AES ECB Mode is deprecated and unsupported any longer.
|
---|
2257 | Keep the function field for binary compability.
|
---|
2258 |
|
---|
2259 | @param[in] AesContext Pointer to the AES context.
|
---|
2260 | @param[in] Input Pointer to the buffer containing the data to be encrypted.
|
---|
2261 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2262 | @param[out] Output Pointer to a buffer that receives the AES encryption output.
|
---|
2263 |
|
---|
2264 | @retval FALSE This interface is not supported.
|
---|
2265 |
|
---|
2266 | **/
|
---|
2267 | BOOLEAN
|
---|
2268 | EFIAPI
|
---|
2269 | DeprecatedCryptoServiceAesEcbEncrypt (
|
---|
2270 | IN VOID *AesContext,
|
---|
2271 | IN CONST UINT8 *Input,
|
---|
2272 | IN UINTN InputSize,
|
---|
2273 | OUT UINT8 *Output
|
---|
2274 | )
|
---|
2275 | {
|
---|
2276 | return BaseCryptLibServiceDeprecated ("AesEcbEncrypt"), FALSE;
|
---|
2277 | }
|
---|
2278 |
|
---|
2279 | /**
|
---|
2280 | AES ECB Mode is deprecated and unsupported any longer.
|
---|
2281 | Keep the function field for binary compability.
|
---|
2282 |
|
---|
2283 | @param[in] AesContext Pointer to the AES context.
|
---|
2284 | @param[in] Input Pointer to the buffer containing the data to be decrypted.
|
---|
2285 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2286 | @param[out] Output Pointer to a buffer that receives the AES decryption output.
|
---|
2287 |
|
---|
2288 | @retval FALSE This interface is not supported.
|
---|
2289 |
|
---|
2290 | **/
|
---|
2291 | BOOLEAN
|
---|
2292 | EFIAPI
|
---|
2293 | DeprecatedCryptoServiceAesEcbDecrypt (
|
---|
2294 | IN VOID *AesContext,
|
---|
2295 | IN CONST UINT8 *Input,
|
---|
2296 | IN UINTN InputSize,
|
---|
2297 | OUT UINT8 *Output
|
---|
2298 | )
|
---|
2299 | {
|
---|
2300 | return BaseCryptLibServiceDeprecated ("AesEcbDecrypt"), FALSE;
|
---|
2301 | }
|
---|
2302 |
|
---|
2303 | /**
|
---|
2304 | Performs AES encryption on a data buffer of the specified size in CBC mode.
|
---|
2305 |
|
---|
2306 | This function performs AES encryption on data buffer pointed by Input, of specified
|
---|
2307 | size of InputSize, in CBC mode.
|
---|
2308 | InputSize must be multiple of block size (16 bytes). This function does not perform
|
---|
2309 | padding. Caller must perform padding, if necessary, to ensure valid input data size.
|
---|
2310 | Initialization vector should be one block size (16 bytes).
|
---|
2311 | AesContext should be already correctly initialized by AesInit(). Behavior with
|
---|
2312 | invalid AES context is undefined.
|
---|
2313 |
|
---|
2314 | If AesContext is NULL, then return FALSE.
|
---|
2315 | If Input is NULL, then return FALSE.
|
---|
2316 | If InputSize is not multiple of block size (16 bytes), then return FALSE.
|
---|
2317 | If Ivec is NULL, then return FALSE.
|
---|
2318 | If Output is NULL, then return FALSE.
|
---|
2319 | If this interface is not supported, then return FALSE.
|
---|
2320 |
|
---|
2321 | @param[in] AesContext Pointer to the AES context.
|
---|
2322 | @param[in] Input Pointer to the buffer containing the data to be encrypted.
|
---|
2323 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2324 | @param[in] Ivec Pointer to initialization vector.
|
---|
2325 | @param[out] Output Pointer to a buffer that receives the AES encryption output.
|
---|
2326 |
|
---|
2327 | @retval TRUE AES encryption succeeded.
|
---|
2328 | @retval FALSE AES encryption failed.
|
---|
2329 | @retval FALSE This interface is not supported.
|
---|
2330 |
|
---|
2331 | **/
|
---|
2332 | BOOLEAN
|
---|
2333 | EFIAPI
|
---|
2334 | CryptoServiceAesCbcEncrypt (
|
---|
2335 | IN VOID *AesContext,
|
---|
2336 | IN CONST UINT8 *Input,
|
---|
2337 | IN UINTN InputSize,
|
---|
2338 | IN CONST UINT8 *Ivec,
|
---|
2339 | OUT UINT8 *Output
|
---|
2340 | )
|
---|
2341 | {
|
---|
2342 | return CALL_BASECRYPTLIB (Aes.Services.CbcEncrypt, AesCbcEncrypt, (AesContext, Input, InputSize, Ivec, Output), FALSE);
|
---|
2343 | }
|
---|
2344 |
|
---|
2345 | /**
|
---|
2346 | Performs AES decryption on a data buffer of the specified size in CBC mode.
|
---|
2347 |
|
---|
2348 | This function performs AES decryption on data buffer pointed by Input, of specified
|
---|
2349 | size of InputSize, in CBC mode.
|
---|
2350 | InputSize must be multiple of block size (16 bytes). This function does not perform
|
---|
2351 | padding. Caller must perform padding, if necessary, to ensure valid input data size.
|
---|
2352 | Initialization vector should be one block size (16 bytes).
|
---|
2353 | AesContext should be already correctly initialized by AesInit(). Behavior with
|
---|
2354 | invalid AES context is undefined.
|
---|
2355 |
|
---|
2356 | If AesContext is NULL, then return FALSE.
|
---|
2357 | If Input is NULL, then return FALSE.
|
---|
2358 | If InputSize is not multiple of block size (16 bytes), then return FALSE.
|
---|
2359 | If Ivec is NULL, then return FALSE.
|
---|
2360 | If Output is NULL, then return FALSE.
|
---|
2361 | If this interface is not supported, then return FALSE.
|
---|
2362 |
|
---|
2363 | @param[in] AesContext Pointer to the AES context.
|
---|
2364 | @param[in] Input Pointer to the buffer containing the data to be encrypted.
|
---|
2365 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2366 | @param[in] Ivec Pointer to initialization vector.
|
---|
2367 | @param[out] Output Pointer to a buffer that receives the AES encryption output.
|
---|
2368 |
|
---|
2369 | @retval TRUE AES decryption succeeded.
|
---|
2370 | @retval FALSE AES decryption failed.
|
---|
2371 | @retval FALSE This interface is not supported.
|
---|
2372 |
|
---|
2373 | **/
|
---|
2374 | BOOLEAN
|
---|
2375 | EFIAPI
|
---|
2376 | CryptoServiceAesCbcDecrypt (
|
---|
2377 | IN VOID *AesContext,
|
---|
2378 | IN CONST UINT8 *Input,
|
---|
2379 | IN UINTN InputSize,
|
---|
2380 | IN CONST UINT8 *Ivec,
|
---|
2381 | OUT UINT8 *Output
|
---|
2382 | )
|
---|
2383 | {
|
---|
2384 | return CALL_BASECRYPTLIB (Aes.Services.CbcDecrypt, AesCbcDecrypt, (AesContext, Input, InputSize, Ivec, Output), FALSE);
|
---|
2385 | }
|
---|
2386 |
|
---|
2387 | /**
|
---|
2388 | ARC4 is deprecated and unsupported any longer.
|
---|
2389 | Keep the function field for binary compability.
|
---|
2390 |
|
---|
2391 | @retval 0 This interface is not supported.
|
---|
2392 |
|
---|
2393 | **/
|
---|
2394 | UINTN
|
---|
2395 | EFIAPI
|
---|
2396 | DeprecatedCryptoServiceArc4GetContextSize (
|
---|
2397 | VOID
|
---|
2398 | )
|
---|
2399 | {
|
---|
2400 | return BaseCryptLibServiceDeprecated ("Arc4GetContextSize"), 0;
|
---|
2401 | }
|
---|
2402 |
|
---|
2403 | /**
|
---|
2404 | ARC4 is deprecated and unsupported any longer.
|
---|
2405 | Keep the function field for binary compability.
|
---|
2406 |
|
---|
2407 | @param[out] Arc4Context Pointer to ARC4 context being initialized.
|
---|
2408 | @param[in] Key Pointer to the user-supplied ARC4 key.
|
---|
2409 | @param[in] KeySize Size of ARC4 key in bytes.
|
---|
2410 |
|
---|
2411 | @retval FALSE This interface is not supported.
|
---|
2412 |
|
---|
2413 | **/
|
---|
2414 | BOOLEAN
|
---|
2415 | EFIAPI
|
---|
2416 | DeprecatedCryptoServiceArc4Init (
|
---|
2417 | OUT VOID *Arc4Context,
|
---|
2418 | IN CONST UINT8 *Key,
|
---|
2419 | IN UINTN KeySize
|
---|
2420 | )
|
---|
2421 | {
|
---|
2422 | return BaseCryptLibServiceDeprecated ("Arc4Init"), FALSE;
|
---|
2423 | }
|
---|
2424 |
|
---|
2425 | /**
|
---|
2426 | ARC4 is deprecated and unsupported any longer.
|
---|
2427 | Keep the function field for binary compability.
|
---|
2428 |
|
---|
2429 | @param[in, out] Arc4Context Pointer to the ARC4 context.
|
---|
2430 | @param[in] Input Pointer to the buffer containing the data to be encrypted.
|
---|
2431 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2432 | @param[out] Output Pointer to a buffer that receives the ARC4 encryption output.
|
---|
2433 |
|
---|
2434 | @retval FALSE This interface is not supported.
|
---|
2435 |
|
---|
2436 | **/
|
---|
2437 | BOOLEAN
|
---|
2438 | EFIAPI
|
---|
2439 | DeprecatedCryptoServiceArc4Encrypt (
|
---|
2440 | IN OUT VOID *Arc4Context,
|
---|
2441 | IN CONST UINT8 *Input,
|
---|
2442 | IN UINTN InputSize,
|
---|
2443 | OUT UINT8 *Output
|
---|
2444 | )
|
---|
2445 | {
|
---|
2446 | return BaseCryptLibServiceDeprecated ("Arc4Encrypt"), FALSE;
|
---|
2447 | }
|
---|
2448 |
|
---|
2449 | /**
|
---|
2450 | ARC4 is deprecated and unsupported any longer.
|
---|
2451 | Keep the function field for binary compability.
|
---|
2452 |
|
---|
2453 | @param[in, out] Arc4Context Pointer to the ARC4 context.
|
---|
2454 | @param[in] Input Pointer to the buffer containing the data to be decrypted.
|
---|
2455 | @param[in] InputSize Size of the Input buffer in bytes.
|
---|
2456 | @param[out] Output Pointer to a buffer that receives the ARC4 decryption output.
|
---|
2457 |
|
---|
2458 | @retval FALSE This interface is not supported.
|
---|
2459 |
|
---|
2460 | **/
|
---|
2461 | BOOLEAN
|
---|
2462 | EFIAPI
|
---|
2463 | DeprecatedCryptoServiceArc4Decrypt (
|
---|
2464 | IN OUT VOID *Arc4Context,
|
---|
2465 | IN UINT8 *Input,
|
---|
2466 | IN UINTN InputSize,
|
---|
2467 | OUT UINT8 *Output
|
---|
2468 | )
|
---|
2469 | {
|
---|
2470 | return BaseCryptLibServiceDeprecated ("Arc4Decrypt"), FALSE;
|
---|
2471 | }
|
---|
2472 |
|
---|
2473 | /**
|
---|
2474 | ARC4 is deprecated and unsupported any longer.
|
---|
2475 | Keep the function field for binary compability.
|
---|
2476 |
|
---|
2477 | @param[in, out] Arc4Context Pointer to the ARC4 context.
|
---|
2478 |
|
---|
2479 | @retval FALSE This interface is not supported.
|
---|
2480 |
|
---|
2481 | **/
|
---|
2482 | BOOLEAN
|
---|
2483 | EFIAPI
|
---|
2484 | DeprecatedCryptoServiceArc4Reset (
|
---|
2485 | IN OUT VOID *Arc4Context
|
---|
2486 | )
|
---|
2487 | {
|
---|
2488 | return BaseCryptLibServiceDeprecated ("Arc4Reset"), FALSE;
|
---|
2489 | }
|
---|
2490 |
|
---|
2491 | // =====================================================================================
|
---|
2492 | // Asymmetric Cryptography Primitive
|
---|
2493 | // =====================================================================================
|
---|
2494 |
|
---|
2495 | /**
|
---|
2496 | Allocates and initializes one RSA context for subsequent use.
|
---|
2497 |
|
---|
2498 | @return Pointer to the RSA context that has been initialized.
|
---|
2499 | If the allocations fails, RsaNew() returns NULL.
|
---|
2500 |
|
---|
2501 | **/
|
---|
2502 | VOID *
|
---|
2503 | EFIAPI
|
---|
2504 | CryptoServiceRsaNew (
|
---|
2505 | VOID
|
---|
2506 | )
|
---|
2507 | {
|
---|
2508 | return CALL_BASECRYPTLIB (Rsa.Services.New, RsaNew, (), NULL);
|
---|
2509 | }
|
---|
2510 |
|
---|
2511 | /**
|
---|
2512 | Release the specified RSA context.
|
---|
2513 |
|
---|
2514 | If RsaContext is NULL, then return FALSE.
|
---|
2515 |
|
---|
2516 | @param[in] RsaContext Pointer to the RSA context to be released.
|
---|
2517 |
|
---|
2518 | **/
|
---|
2519 | VOID
|
---|
2520 | EFIAPI
|
---|
2521 | CryptoServiceRsaFree (
|
---|
2522 | IN VOID *RsaContext
|
---|
2523 | )
|
---|
2524 | {
|
---|
2525 | CALL_VOID_BASECRYPTLIB (Rsa.Services.Free, RsaFree, (RsaContext));
|
---|
2526 | }
|
---|
2527 |
|
---|
2528 | /**
|
---|
2529 | Sets the tag-designated key component into the established RSA context.
|
---|
2530 |
|
---|
2531 | This function sets the tag-designated RSA key component into the established
|
---|
2532 | RSA context from the user-specified non-negative integer (octet string format
|
---|
2533 | represented in RSA PKCS#1).
|
---|
2534 | If BigNumber is NULL, then the specified key component in RSA context is cleared.
|
---|
2535 |
|
---|
2536 | If RsaContext is NULL, then return FALSE.
|
---|
2537 |
|
---|
2538 | @param[in, out] RsaContext Pointer to RSA context being set.
|
---|
2539 | @param[in] KeyTag Tag of RSA key component being set.
|
---|
2540 | @param[in] BigNumber Pointer to octet integer buffer.
|
---|
2541 | If NULL, then the specified key component in RSA
|
---|
2542 | context is cleared.
|
---|
2543 | @param[in] BnSize Size of big number buffer in bytes.
|
---|
2544 | If BigNumber is NULL, then it is ignored.
|
---|
2545 |
|
---|
2546 | @retval TRUE RSA key component was set successfully.
|
---|
2547 | @retval FALSE Invalid RSA key component tag.
|
---|
2548 |
|
---|
2549 | **/
|
---|
2550 | BOOLEAN
|
---|
2551 | EFIAPI
|
---|
2552 | CryptoServiceRsaSetKey (
|
---|
2553 | IN OUT VOID *RsaContext,
|
---|
2554 | IN RSA_KEY_TAG KeyTag,
|
---|
2555 | IN CONST UINT8 *BigNumber,
|
---|
2556 | IN UINTN BnSize
|
---|
2557 | )
|
---|
2558 | {
|
---|
2559 | return CALL_BASECRYPTLIB (Rsa.Services.SetKey, RsaSetKey, (RsaContext, KeyTag, BigNumber, BnSize), FALSE);
|
---|
2560 | }
|
---|
2561 |
|
---|
2562 | /**
|
---|
2563 | Gets the tag-designated RSA key component from the established RSA context.
|
---|
2564 |
|
---|
2565 | This function retrieves the tag-designated RSA key component from the
|
---|
2566 | established RSA context as a non-negative integer (octet string format
|
---|
2567 | represented in RSA PKCS#1).
|
---|
2568 | If specified key component has not been set or has been cleared, then returned
|
---|
2569 | BnSize is set to 0.
|
---|
2570 | If the BigNumber buffer is too small to hold the contents of the key, FALSE
|
---|
2571 | is returned and BnSize is set to the required buffer size to obtain the key.
|
---|
2572 |
|
---|
2573 | If RsaContext is NULL, then return FALSE.
|
---|
2574 | If BnSize is NULL, then return FALSE.
|
---|
2575 | If BnSize is large enough but BigNumber is NULL, then return FALSE.
|
---|
2576 | If this interface is not supported, then return FALSE.
|
---|
2577 |
|
---|
2578 | @param[in, out] RsaContext Pointer to RSA context being set.
|
---|
2579 | @param[in] KeyTag Tag of RSA key component being set.
|
---|
2580 | @param[out] BigNumber Pointer to octet integer buffer.
|
---|
2581 | @param[in, out] BnSize On input, the size of big number buffer in bytes.
|
---|
2582 | On output, the size of data returned in big number buffer in bytes.
|
---|
2583 |
|
---|
2584 | @retval TRUE RSA key component was retrieved successfully.
|
---|
2585 | @retval FALSE Invalid RSA key component tag.
|
---|
2586 | @retval FALSE BnSize is too small.
|
---|
2587 | @retval FALSE This interface is not supported.
|
---|
2588 |
|
---|
2589 | **/
|
---|
2590 | BOOLEAN
|
---|
2591 | EFIAPI
|
---|
2592 | CryptoServiceRsaGetKey (
|
---|
2593 | IN OUT VOID *RsaContext,
|
---|
2594 | IN RSA_KEY_TAG KeyTag,
|
---|
2595 | OUT UINT8 *BigNumber,
|
---|
2596 | IN OUT UINTN *BnSize
|
---|
2597 | )
|
---|
2598 | {
|
---|
2599 | return CALL_BASECRYPTLIB (Rsa.Services.GetKey, RsaGetKey, (RsaContext, KeyTag, BigNumber, BnSize), FALSE);
|
---|
2600 | }
|
---|
2601 |
|
---|
2602 | /**
|
---|
2603 | Generates RSA key components.
|
---|
2604 |
|
---|
2605 | This function generates RSA key components. It takes RSA public exponent E and
|
---|
2606 | length in bits of RSA modulus N as input, and generates all key components.
|
---|
2607 | If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used.
|
---|
2608 |
|
---|
2609 | Before this function can be invoked, pseudorandom number generator must be correctly
|
---|
2610 | initialized by RandomSeed().
|
---|
2611 |
|
---|
2612 | If RsaContext is NULL, then return FALSE.
|
---|
2613 | If this interface is not supported, then return FALSE.
|
---|
2614 |
|
---|
2615 | @param[in, out] RsaContext Pointer to RSA context being set.
|
---|
2616 | @param[in] ModulusLength Length of RSA modulus N in bits.
|
---|
2617 | @param[in] PublicExponent Pointer to RSA public exponent.
|
---|
2618 | @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes.
|
---|
2619 |
|
---|
2620 | @retval TRUE RSA key component was generated successfully.
|
---|
2621 | @retval FALSE Invalid RSA key component tag.
|
---|
2622 | @retval FALSE This interface is not supported.
|
---|
2623 |
|
---|
2624 | **/
|
---|
2625 | BOOLEAN
|
---|
2626 | EFIAPI
|
---|
2627 | CryptoServiceRsaGenerateKey (
|
---|
2628 | IN OUT VOID *RsaContext,
|
---|
2629 | IN UINTN ModulusLength,
|
---|
2630 | IN CONST UINT8 *PublicExponent,
|
---|
2631 | IN UINTN PublicExponentSize
|
---|
2632 | )
|
---|
2633 | {
|
---|
2634 | return CALL_BASECRYPTLIB (Rsa.Services.GenerateKey, RsaGenerateKey, (RsaContext, ModulusLength, PublicExponent, PublicExponentSize), FALSE);
|
---|
2635 | }
|
---|
2636 |
|
---|
2637 | /**
|
---|
2638 | Validates key components of RSA context.
|
---|
2639 | NOTE: This function performs integrity checks on all the RSA key material, so
|
---|
2640 | the RSA key structure must contain all the private key data.
|
---|
2641 |
|
---|
2642 | This function validates key components of RSA context in following aspects:
|
---|
2643 | - Whether p is a prime
|
---|
2644 | - Whether q is a prime
|
---|
2645 | - Whether n = p * q
|
---|
2646 | - Whether d*e = 1 mod lcm(p-1,q-1)
|
---|
2647 |
|
---|
2648 | If RsaContext is NULL, then return FALSE.
|
---|
2649 | If this interface is not supported, then return FALSE.
|
---|
2650 |
|
---|
2651 | @param[in] RsaContext Pointer to RSA context to check.
|
---|
2652 |
|
---|
2653 | @retval TRUE RSA key components are valid.
|
---|
2654 | @retval FALSE RSA key components are not valid.
|
---|
2655 | @retval FALSE This interface is not supported.
|
---|
2656 |
|
---|
2657 | **/
|
---|
2658 | BOOLEAN
|
---|
2659 | EFIAPI
|
---|
2660 | CryptoServiceRsaCheckKey (
|
---|
2661 | IN VOID *RsaContext
|
---|
2662 | )
|
---|
2663 | {
|
---|
2664 | return CALL_BASECRYPTLIB (Rsa.Services.CheckKey, RsaCheckKey, (RsaContext), FALSE);
|
---|
2665 | }
|
---|
2666 |
|
---|
2667 | /**
|
---|
2668 | Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.
|
---|
2669 |
|
---|
2670 | This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in
|
---|
2671 | RSA PKCS#1.
|
---|
2672 | If the Signature buffer is too small to hold the contents of signature, FALSE
|
---|
2673 | is returned and SigSize is set to the required buffer size to obtain the signature.
|
---|
2674 |
|
---|
2675 | If RsaContext is NULL, then return FALSE.
|
---|
2676 | If MessageHash is NULL, then return FALSE.
|
---|
2677 | If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.
|
---|
2678 | If SigSize is large enough but Signature is NULL, then return FALSE.
|
---|
2679 | If this interface is not supported, then return FALSE.
|
---|
2680 |
|
---|
2681 | @param[in] RsaContext Pointer to RSA context for signature generation.
|
---|
2682 | @param[in] MessageHash Pointer to octet message hash to be signed.
|
---|
2683 | @param[in] HashSize Size of the message hash in bytes.
|
---|
2684 | @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature.
|
---|
2685 | @param[in, out] SigSize On input, the size of Signature buffer in bytes.
|
---|
2686 | On output, the size of data returned in Signature buffer in bytes.
|
---|
2687 |
|
---|
2688 | @retval TRUE Signature successfully generated in PKCS1-v1_5.
|
---|
2689 | @retval FALSE Signature generation failed.
|
---|
2690 | @retval FALSE SigSize is too small.
|
---|
2691 | @retval FALSE This interface is not supported.
|
---|
2692 |
|
---|
2693 | **/
|
---|
2694 | BOOLEAN
|
---|
2695 | EFIAPI
|
---|
2696 | CryptoServiceRsaPkcs1Sign (
|
---|
2697 | IN VOID *RsaContext,
|
---|
2698 | IN CONST UINT8 *MessageHash,
|
---|
2699 | IN UINTN HashSize,
|
---|
2700 | OUT UINT8 *Signature,
|
---|
2701 | IN OUT UINTN *SigSize
|
---|
2702 | )
|
---|
2703 | {
|
---|
2704 | return CALL_BASECRYPTLIB (Rsa.Services.Pkcs1Sign, RsaPkcs1Sign, (RsaContext, MessageHash, HashSize, Signature, SigSize), FALSE);
|
---|
2705 | }
|
---|
2706 |
|
---|
2707 | /**
|
---|
2708 | Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
|
---|
2709 | RSA PKCS#1.
|
---|
2710 |
|
---|
2711 | If RsaContext is NULL, then return FALSE.
|
---|
2712 | If MessageHash is NULL, then return FALSE.
|
---|
2713 | If Signature is NULL, then return FALSE.
|
---|
2714 | If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
|
---|
2715 |
|
---|
2716 | @param[in] RsaContext Pointer to RSA context for signature verification.
|
---|
2717 | @param[in] MessageHash Pointer to octet message hash to be checked.
|
---|
2718 | @param[in] HashSize Size of the message hash in bytes.
|
---|
2719 | @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
|
---|
2720 | @param[in] SigSize Size of signature in bytes.
|
---|
2721 |
|
---|
2722 | @retval TRUE Valid signature encoded in PKCS1-v1_5.
|
---|
2723 | @retval FALSE Invalid signature or invalid RSA context.
|
---|
2724 |
|
---|
2725 | **/
|
---|
2726 | BOOLEAN
|
---|
2727 | EFIAPI
|
---|
2728 | CryptoServiceRsaPkcs1Verify (
|
---|
2729 | IN VOID *RsaContext,
|
---|
2730 | IN CONST UINT8 *MessageHash,
|
---|
2731 | IN UINTN HashSize,
|
---|
2732 | IN CONST UINT8 *Signature,
|
---|
2733 | IN UINTN SigSize
|
---|
2734 | )
|
---|
2735 | {
|
---|
2736 | return CALL_BASECRYPTLIB (Rsa.Services.Pkcs1Verify, RsaPkcs1Verify, (RsaContext, MessageHash, HashSize, Signature, SigSize), FALSE);
|
---|
2737 | }
|
---|
2738 |
|
---|
2739 | /**
|
---|
2740 | Retrieve the RSA Private Key from the password-protected PEM key data.
|
---|
2741 |
|
---|
2742 | If PemData is NULL, then return FALSE.
|
---|
2743 | If RsaContext is NULL, then return FALSE.
|
---|
2744 | If this interface is not supported, then return FALSE.
|
---|
2745 |
|
---|
2746 | @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.
|
---|
2747 | @param[in] PemSize Size of the PEM key data in bytes.
|
---|
2748 | @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.
|
---|
2749 | @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
|
---|
2750 | RSA private key component. Use RsaFree() function to free the
|
---|
2751 | resource.
|
---|
2752 |
|
---|
2753 | @retval TRUE RSA Private Key was retrieved successfully.
|
---|
2754 | @retval FALSE Invalid PEM key data or incorrect password.
|
---|
2755 | @retval FALSE This interface is not supported.
|
---|
2756 |
|
---|
2757 | **/
|
---|
2758 | BOOLEAN
|
---|
2759 | EFIAPI
|
---|
2760 | CryptoServiceRsaGetPrivateKeyFromPem (
|
---|
2761 | IN CONST UINT8 *PemData,
|
---|
2762 | IN UINTN PemSize,
|
---|
2763 | IN CONST CHAR8 *Password,
|
---|
2764 | OUT VOID **RsaContext
|
---|
2765 | )
|
---|
2766 | {
|
---|
2767 | return CALL_BASECRYPTLIB (Rsa.Services.GetPrivateKeyFromPem, RsaGetPrivateKeyFromPem, (PemData, PemSize, Password, RsaContext), FALSE);
|
---|
2768 | }
|
---|
2769 |
|
---|
2770 | /**
|
---|
2771 | Retrieve the RSA Public Key from one DER-encoded X509 certificate.
|
---|
2772 |
|
---|
2773 | If Cert is NULL, then return FALSE.
|
---|
2774 | If RsaContext is NULL, then return FALSE.
|
---|
2775 | If this interface is not supported, then return FALSE.
|
---|
2776 |
|
---|
2777 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
2778 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
2779 | @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
|
---|
2780 | RSA public key component. Use RsaFree() function to free the
|
---|
2781 | resource.
|
---|
2782 |
|
---|
2783 | @retval TRUE RSA Public Key was retrieved successfully.
|
---|
2784 | @retval FALSE Fail to retrieve RSA public key from X509 certificate.
|
---|
2785 | @retval FALSE This interface is not supported.
|
---|
2786 |
|
---|
2787 | **/
|
---|
2788 | BOOLEAN
|
---|
2789 | EFIAPI
|
---|
2790 | CryptoServiceRsaGetPublicKeyFromX509 (
|
---|
2791 | IN CONST UINT8 *Cert,
|
---|
2792 | IN UINTN CertSize,
|
---|
2793 | OUT VOID **RsaContext
|
---|
2794 | )
|
---|
2795 | {
|
---|
2796 | return CALL_BASECRYPTLIB (Rsa.Services.GetPublicKeyFromX509, RsaGetPublicKeyFromX509, (Cert, CertSize, RsaContext), FALSE);
|
---|
2797 | }
|
---|
2798 |
|
---|
2799 | /**
|
---|
2800 | Retrieve the subject bytes from one X.509 certificate.
|
---|
2801 |
|
---|
2802 | If Cert is NULL, then return FALSE.
|
---|
2803 | If SubjectSize is NULL, then return FALSE.
|
---|
2804 | If this interface is not supported, then return FALSE.
|
---|
2805 |
|
---|
2806 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
2807 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
2808 | @param[out] CertSubject Pointer to the retrieved certificate subject bytes.
|
---|
2809 | @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,
|
---|
2810 | and the size of buffer returned CertSubject on output.
|
---|
2811 |
|
---|
2812 | @retval TRUE The certificate subject retrieved successfully.
|
---|
2813 | @retval FALSE Invalid certificate, or the SubjectSize is too small for the result.
|
---|
2814 | The SubjectSize will be updated with the required size.
|
---|
2815 | @retval FALSE This interface is not supported.
|
---|
2816 |
|
---|
2817 | **/
|
---|
2818 | BOOLEAN
|
---|
2819 | EFIAPI
|
---|
2820 | CryptoServiceX509GetSubjectName (
|
---|
2821 | IN CONST UINT8 *Cert,
|
---|
2822 | IN UINTN CertSize,
|
---|
2823 | OUT UINT8 *CertSubject,
|
---|
2824 | IN OUT UINTN *SubjectSize
|
---|
2825 | )
|
---|
2826 | {
|
---|
2827 | return CALL_BASECRYPTLIB (X509.Services.GetSubjectName, X509GetSubjectName, (Cert, CertSize, CertSubject, SubjectSize), FALSE);
|
---|
2828 | }
|
---|
2829 |
|
---|
2830 | /**
|
---|
2831 | Retrieve the common name (CN) string from one X.509 certificate.
|
---|
2832 |
|
---|
2833 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
2834 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
2835 | @param[out] CommonName Buffer to contain the retrieved certificate common
|
---|
2836 | name string (UTF8). At most CommonNameSize bytes will be
|
---|
2837 | written and the string will be null terminated. May be
|
---|
2838 | NULL in order to determine the size buffer needed.
|
---|
2839 | @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,
|
---|
2840 | and the size of buffer returned CommonName on output.
|
---|
2841 | If CommonName is NULL then the amount of space needed
|
---|
2842 | in buffer (including the final null) is returned.
|
---|
2843 |
|
---|
2844 | @retval RETURN_SUCCESS The certificate CommonName retrieved successfully.
|
---|
2845 | @retval RETURN_INVALID_PARAMETER If Cert is NULL.
|
---|
2846 | If CommonNameSize is NULL.
|
---|
2847 | If CommonName is not NULL and *CommonNameSize is 0.
|
---|
2848 | If Certificate is invalid.
|
---|
2849 | @retval RETURN_NOT_FOUND If no CommonName entry exists.
|
---|
2850 | @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size
|
---|
2851 | (including the final null) is returned in the
|
---|
2852 | CommonNameSize parameter.
|
---|
2853 | @retval RETURN_UNSUPPORTED The operation is not supported.
|
---|
2854 |
|
---|
2855 | **/
|
---|
2856 | RETURN_STATUS
|
---|
2857 | EFIAPI
|
---|
2858 | CryptoServiceX509GetCommonName (
|
---|
2859 | IN CONST UINT8 *Cert,
|
---|
2860 | IN UINTN CertSize,
|
---|
2861 | OUT CHAR8 *CommonName OPTIONAL,
|
---|
2862 | IN OUT UINTN *CommonNameSize
|
---|
2863 | )
|
---|
2864 | {
|
---|
2865 | return CALL_BASECRYPTLIB (X509.Services.GetCommonName, X509GetCommonName, (Cert, CertSize, CommonName, CommonNameSize), RETURN_UNSUPPORTED);
|
---|
2866 | }
|
---|
2867 |
|
---|
2868 | /**
|
---|
2869 | Retrieve the organization name (O) string from one X.509 certificate.
|
---|
2870 |
|
---|
2871 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
2872 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
2873 | @param[out] NameBuffer Buffer to contain the retrieved certificate organization
|
---|
2874 | name string. At most NameBufferSize bytes will be
|
---|
2875 | written and the string will be null terminated. May be
|
---|
2876 | NULL in order to determine the size buffer needed.
|
---|
2877 | @param[in,out] NameBufferSize The size in bytes of the Name buffer on input,
|
---|
2878 | and the size of buffer returned Name on output.
|
---|
2879 | If NameBuffer is NULL then the amount of space needed
|
---|
2880 | in buffer (including the final null) is returned.
|
---|
2881 |
|
---|
2882 | @retval RETURN_SUCCESS The certificate Organization Name retrieved successfully.
|
---|
2883 | @retval RETURN_INVALID_PARAMETER If Cert is NULL.
|
---|
2884 | If NameBufferSize is NULL.
|
---|
2885 | If NameBuffer is not NULL and *CommonNameSize is 0.
|
---|
2886 | If Certificate is invalid.
|
---|
2887 | @retval RETURN_NOT_FOUND If no Organization Name entry exists.
|
---|
2888 | @retval RETURN_BUFFER_TOO_SMALL If the NameBuffer is NULL. The required buffer size
|
---|
2889 | (including the final null) is returned in the
|
---|
2890 | CommonNameSize parameter.
|
---|
2891 | @retval RETURN_UNSUPPORTED The operation is not supported.
|
---|
2892 |
|
---|
2893 | **/
|
---|
2894 | RETURN_STATUS
|
---|
2895 | EFIAPI
|
---|
2896 | CryptoServiceX509GetOrganizationName (
|
---|
2897 | IN CONST UINT8 *Cert,
|
---|
2898 | IN UINTN CertSize,
|
---|
2899 | OUT CHAR8 *NameBuffer OPTIONAL,
|
---|
2900 | IN OUT UINTN *NameBufferSize
|
---|
2901 | )
|
---|
2902 | {
|
---|
2903 | return CALL_BASECRYPTLIB (X509.Services.GetOrganizationName, X509GetOrganizationName, (Cert, CertSize, NameBuffer, NameBufferSize), RETURN_UNSUPPORTED);
|
---|
2904 | }
|
---|
2905 |
|
---|
2906 | /**
|
---|
2907 | Verify one X509 certificate was issued by the trusted CA.
|
---|
2908 |
|
---|
2909 | If Cert is NULL, then return FALSE.
|
---|
2910 | If CACert is NULL, then return FALSE.
|
---|
2911 | If this interface is not supported, then return FALSE.
|
---|
2912 |
|
---|
2913 | @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.
|
---|
2914 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
2915 | @param[in] CACert Pointer to the DER-encoded trusted CA certificate.
|
---|
2916 | @param[in] CACertSize Size of the CA Certificate in bytes.
|
---|
2917 |
|
---|
2918 | @retval TRUE The certificate was issued by the trusted CA.
|
---|
2919 | @retval FALSE Invalid certificate or the certificate was not issued by the given
|
---|
2920 | trusted CA.
|
---|
2921 | @retval FALSE This interface is not supported.
|
---|
2922 |
|
---|
2923 | **/
|
---|
2924 | BOOLEAN
|
---|
2925 | EFIAPI
|
---|
2926 | CryptoServiceX509VerifyCert (
|
---|
2927 | IN CONST UINT8 *Cert,
|
---|
2928 | IN UINTN CertSize,
|
---|
2929 | IN CONST UINT8 *CACert,
|
---|
2930 | IN UINTN CACertSize
|
---|
2931 | )
|
---|
2932 | {
|
---|
2933 | return CALL_BASECRYPTLIB (X509.Services.VerifyCert, X509VerifyCert, (Cert, CertSize, CACert, CACertSize), FALSE);
|
---|
2934 | }
|
---|
2935 |
|
---|
2936 | /**
|
---|
2937 | Construct a X509 object from DER-encoded certificate data.
|
---|
2938 |
|
---|
2939 | If Cert is NULL, then return FALSE.
|
---|
2940 | If SingleX509Cert is NULL, then return FALSE.
|
---|
2941 | If this interface is not supported, then return FALSE.
|
---|
2942 |
|
---|
2943 | @param[in] Cert Pointer to the DER-encoded certificate data.
|
---|
2944 | @param[in] CertSize The size of certificate data in bytes.
|
---|
2945 | @param[out] SingleX509Cert The generated X509 object.
|
---|
2946 |
|
---|
2947 | @retval TRUE The X509 object generation succeeded.
|
---|
2948 | @retval FALSE The operation failed.
|
---|
2949 | @retval FALSE This interface is not supported.
|
---|
2950 |
|
---|
2951 | **/
|
---|
2952 | BOOLEAN
|
---|
2953 | EFIAPI
|
---|
2954 | CryptoServiceX509ConstructCertificate (
|
---|
2955 | IN CONST UINT8 *Cert,
|
---|
2956 | IN UINTN CertSize,
|
---|
2957 | OUT UINT8 **SingleX509Cert
|
---|
2958 | )
|
---|
2959 | {
|
---|
2960 | return CALL_BASECRYPTLIB (X509.Services.ConstructCertificate, X509ConstructCertificate, (Cert, CertSize, SingleX509Cert), FALSE);
|
---|
2961 | }
|
---|
2962 |
|
---|
2963 | /**
|
---|
2964 | Construct a X509 stack object from a list of DER-encoded certificate data.
|
---|
2965 |
|
---|
2966 | If X509Stack is NULL, then return FALSE.
|
---|
2967 | If this interface is not supported, then return FALSE.
|
---|
2968 |
|
---|
2969 | @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
|
---|
2970 | On output, pointer to the X509 stack object with new
|
---|
2971 | inserted X509 certificate.
|
---|
2972 | @param[in] Args VA_LIST marker for the variable argument list.
|
---|
2973 | A list of DER-encoded single certificate data followed
|
---|
2974 | by certificate size. A NULL terminates the list. The
|
---|
2975 | pairs are the arguments to X509ConstructCertificate().
|
---|
2976 |
|
---|
2977 | @retval TRUE The X509 stack construction succeeded.
|
---|
2978 | @retval FALSE The construction operation failed.
|
---|
2979 | @retval FALSE This interface is not supported.
|
---|
2980 |
|
---|
2981 | **/
|
---|
2982 | BOOLEAN
|
---|
2983 | EFIAPI
|
---|
2984 | CryptoServiceX509ConstructCertificateStackV (
|
---|
2985 | IN OUT UINT8 **X509Stack,
|
---|
2986 | IN VA_LIST Args
|
---|
2987 | )
|
---|
2988 | {
|
---|
2989 | return CALL_BASECRYPTLIB (X509.Services.ConstructCertificateStackV, X509ConstructCertificateStackV, (X509Stack, Args), FALSE);
|
---|
2990 | }
|
---|
2991 |
|
---|
2992 | /**
|
---|
2993 | Construct a X509 stack object from a list of DER-encoded certificate data.
|
---|
2994 |
|
---|
2995 | If X509Stack is NULL, then return FALSE.
|
---|
2996 | If this interface is not supported, then return FALSE.
|
---|
2997 |
|
---|
2998 | @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
|
---|
2999 | On output, pointer to the X509 stack object with new
|
---|
3000 | inserted X509 certificate.
|
---|
3001 | @param ... A list of DER-encoded single certificate data followed
|
---|
3002 | by certificate size. A NULL terminates the list. The
|
---|
3003 | pairs are the arguments to X509ConstructCertificate().
|
---|
3004 |
|
---|
3005 | @retval TRUE The X509 stack construction succeeded.
|
---|
3006 | @retval FALSE The construction operation failed.
|
---|
3007 | @retval FALSE This interface is not supported.
|
---|
3008 |
|
---|
3009 | **/
|
---|
3010 | BOOLEAN
|
---|
3011 | EFIAPI
|
---|
3012 | CryptoServiceX509ConstructCertificateStack (
|
---|
3013 | IN OUT UINT8 **X509Stack,
|
---|
3014 | ...
|
---|
3015 | )
|
---|
3016 | {
|
---|
3017 | VA_LIST Args;
|
---|
3018 | BOOLEAN Result;
|
---|
3019 |
|
---|
3020 | VA_START (Args, X509Stack);
|
---|
3021 | Result = CryptoServiceX509ConstructCertificateStackV (X509Stack, Args);
|
---|
3022 | VA_END (Args);
|
---|
3023 | return Result;
|
---|
3024 | }
|
---|
3025 |
|
---|
3026 | /**
|
---|
3027 | Release the specified X509 object.
|
---|
3028 |
|
---|
3029 | If the interface is not supported, then ASSERT().
|
---|
3030 |
|
---|
3031 | @param[in] X509Cert Pointer to the X509 object to be released.
|
---|
3032 |
|
---|
3033 | **/
|
---|
3034 | VOID
|
---|
3035 | EFIAPI
|
---|
3036 | CryptoServiceX509Free (
|
---|
3037 | IN VOID *X509Cert
|
---|
3038 | )
|
---|
3039 | {
|
---|
3040 | CALL_VOID_BASECRYPTLIB (X509.Services.Free, X509Free, (X509Cert));
|
---|
3041 | }
|
---|
3042 |
|
---|
3043 | /**
|
---|
3044 | Release the specified X509 stack object.
|
---|
3045 |
|
---|
3046 | If the interface is not supported, then ASSERT().
|
---|
3047 |
|
---|
3048 | @param[in] X509Stack Pointer to the X509 stack object to be released.
|
---|
3049 |
|
---|
3050 | **/
|
---|
3051 | VOID
|
---|
3052 | EFIAPI
|
---|
3053 | CryptoServiceX509StackFree (
|
---|
3054 | IN VOID *X509Stack
|
---|
3055 | )
|
---|
3056 | {
|
---|
3057 | CALL_VOID_BASECRYPTLIB (X509.Services.StackFree, X509StackFree, (X509Stack));
|
---|
3058 | }
|
---|
3059 |
|
---|
3060 | /**
|
---|
3061 | Retrieve the TBSCertificate from one given X.509 certificate.
|
---|
3062 |
|
---|
3063 | @param[in] Cert Pointer to the given DER-encoded X509 certificate.
|
---|
3064 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3065 | @param[out] TBSCert DER-Encoded To-Be-Signed certificate.
|
---|
3066 | @param[out] TBSCertSize Size of the TBS certificate in bytes.
|
---|
3067 |
|
---|
3068 | If Cert is NULL, then return FALSE.
|
---|
3069 | If TBSCert is NULL, then return FALSE.
|
---|
3070 | If TBSCertSize is NULL, then return FALSE.
|
---|
3071 | If this interface is not supported, then return FALSE.
|
---|
3072 |
|
---|
3073 | @retval TRUE The TBSCertificate was retrieved successfully.
|
---|
3074 | @retval FALSE Invalid X.509 certificate.
|
---|
3075 |
|
---|
3076 | **/
|
---|
3077 | BOOLEAN
|
---|
3078 | EFIAPI
|
---|
3079 | CryptoServiceX509GetTBSCert (
|
---|
3080 | IN CONST UINT8 *Cert,
|
---|
3081 | IN UINTN CertSize,
|
---|
3082 | OUT UINT8 **TBSCert,
|
---|
3083 | OUT UINTN *TBSCertSize
|
---|
3084 | )
|
---|
3085 | {
|
---|
3086 | return CALL_BASECRYPTLIB (X509.Services.GetTBSCert, X509GetTBSCert, (Cert, CertSize, TBSCert, TBSCertSize), FALSE);
|
---|
3087 | }
|
---|
3088 |
|
---|
3089 | /**
|
---|
3090 | Retrieve the version from one X.509 certificate.
|
---|
3091 |
|
---|
3092 | If Cert is NULL, then return FALSE.
|
---|
3093 | If CertSize is 0, then return FALSE.
|
---|
3094 | If this interface is not supported, then return FALSE.
|
---|
3095 |
|
---|
3096 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3097 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3098 | @param[out] Version Pointer to the retrieved version integer.
|
---|
3099 |
|
---|
3100 | @retval TRUE The certificate version retrieved successfully.
|
---|
3101 | @retval FALSE If Cert is NULL or CertSize is Zero.
|
---|
3102 | @retval FALSE The operation is not supported.
|
---|
3103 |
|
---|
3104 | **/
|
---|
3105 | BOOLEAN
|
---|
3106 | EFIAPI
|
---|
3107 | CryptoServiceX509GetVersion (
|
---|
3108 | IN CONST UINT8 *Cert,
|
---|
3109 | IN UINTN CertSize,
|
---|
3110 | OUT UINTN *Version
|
---|
3111 | )
|
---|
3112 | {
|
---|
3113 | return CALL_BASECRYPTLIB (X509.Services.GetVersion, X509GetVersion, (Cert, CertSize, Version), FALSE);
|
---|
3114 | }
|
---|
3115 |
|
---|
3116 | /**
|
---|
3117 | Retrieve the serialNumber from one X.509 certificate.
|
---|
3118 |
|
---|
3119 | If Cert is NULL, then return FALSE.
|
---|
3120 | If CertSize is 0, then return FALSE.
|
---|
3121 | If this interface is not supported, then return FALSE.
|
---|
3122 |
|
---|
3123 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3124 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3125 | @param[out] SerialNumber Pointer to the retrieved certificate SerialNumber bytes.
|
---|
3126 | @param[in, out] SerialNumberSize The size in bytes of the SerialNumber buffer on input,
|
---|
3127 | and the size of buffer returned SerialNumber on output.
|
---|
3128 |
|
---|
3129 | @retval TRUE The certificate serialNumber retrieved successfully.
|
---|
3130 | @retval FALSE If Cert is NULL or CertSize is Zero.
|
---|
3131 | If SerialNumberSize is NULL.
|
---|
3132 | If Certificate is invalid.
|
---|
3133 | @retval FALSE If no SerialNumber exists.
|
---|
3134 | @retval FALSE If the SerialNumber is NULL. The required buffer size
|
---|
3135 | (including the final null) is returned in the
|
---|
3136 | SerialNumberSize parameter.
|
---|
3137 | @retval FALSE The operation is not supported.
|
---|
3138 | **/
|
---|
3139 | BOOLEAN
|
---|
3140 | EFIAPI
|
---|
3141 | CryptoServiceX509GetSerialNumber (
|
---|
3142 | IN CONST UINT8 *Cert,
|
---|
3143 | IN UINTN CertSize,
|
---|
3144 | OUT UINT8 *SerialNumber, OPTIONAL
|
---|
3145 | IN OUT UINTN *SerialNumberSize
|
---|
3146 | )
|
---|
3147 | {
|
---|
3148 | return CALL_BASECRYPTLIB (X509.Services.GetSerialNumber, X509GetSerialNumber, (Cert, CertSize, SerialNumber, SerialNumberSize), FALSE);
|
---|
3149 | }
|
---|
3150 |
|
---|
3151 | /**
|
---|
3152 | Retrieve the issuer bytes from one X.509 certificate.
|
---|
3153 |
|
---|
3154 | If Cert is NULL, then return FALSE.
|
---|
3155 | If CertIssuerSize is NULL, then return FALSE.
|
---|
3156 | If this interface is not supported, then return FALSE.
|
---|
3157 |
|
---|
3158 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3159 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3160 | @param[out] CertIssuer Pointer to the retrieved certificate subject bytes.
|
---|
3161 | @param[in, out] CertIssuerSize The size in bytes of the CertIssuer buffer on input,
|
---|
3162 | and the size of buffer returned CertSubject on output.
|
---|
3163 |
|
---|
3164 | @retval TRUE The certificate issuer retrieved successfully.
|
---|
3165 | @retval FALSE Invalid certificate, or the CertIssuerSize is too small for the result.
|
---|
3166 | The CertIssuerSize will be updated with the required size.
|
---|
3167 | @retval FALSE This interface is not supported.
|
---|
3168 |
|
---|
3169 | **/
|
---|
3170 | BOOLEAN
|
---|
3171 | EFIAPI
|
---|
3172 | CryptoServiceX509GetIssuerName (
|
---|
3173 | IN CONST UINT8 *Cert,
|
---|
3174 | IN UINTN CertSize,
|
---|
3175 | OUT UINT8 *CertIssuer,
|
---|
3176 | IN OUT UINTN *CertIssuerSize
|
---|
3177 | )
|
---|
3178 | {
|
---|
3179 | return CALL_BASECRYPTLIB (X509.Services.GetIssuerName, X509GetIssuerName, (Cert, CertSize, CertIssuer, CertIssuerSize), FALSE);
|
---|
3180 | }
|
---|
3181 |
|
---|
3182 | /**
|
---|
3183 | Retrieve the Signature Algorithm from one X.509 certificate.
|
---|
3184 |
|
---|
3185 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3186 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3187 | @param[out] Oid Signature Algorithm Object identifier buffer.
|
---|
3188 | @param[in,out] OidSize Signature Algorithm Object identifier buffer size
|
---|
3189 |
|
---|
3190 | @retval TRUE The certificate Extension data retrieved successfully.
|
---|
3191 | @retval FALSE If Cert is NULL.
|
---|
3192 | If OidSize is NULL.
|
---|
3193 | If Oid is not NULL and *OidSize is 0.
|
---|
3194 | If Certificate is invalid.
|
---|
3195 | @retval FALSE If no SignatureType.
|
---|
3196 | @retval FALSE If the Oid is NULL. The required buffer size
|
---|
3197 | is returned in the OidSize.
|
---|
3198 | @retval FALSE The operation is not supported.
|
---|
3199 | **/
|
---|
3200 | BOOLEAN
|
---|
3201 | EFIAPI
|
---|
3202 | CryptoServiceX509GetSignatureAlgorithm (
|
---|
3203 | IN CONST UINT8 *Cert,
|
---|
3204 | IN UINTN CertSize,
|
---|
3205 | OUT UINT8 *Oid, OPTIONAL
|
---|
3206 | IN OUT UINTN *OidSize
|
---|
3207 | )
|
---|
3208 | {
|
---|
3209 | return CALL_BASECRYPTLIB (X509.Services.GetSignatureAlgorithm, X509GetSignatureAlgorithm, (Cert, CertSize, Oid, OidSize), FALSE);
|
---|
3210 | }
|
---|
3211 |
|
---|
3212 | /**
|
---|
3213 | Retrieve Extension data from one X.509 certificate.
|
---|
3214 |
|
---|
3215 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3216 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3217 | @param[in] Oid Object identifier buffer
|
---|
3218 | @param[in] OidSize Object identifier buffer size
|
---|
3219 | @param[out] ExtensionData Extension bytes.
|
---|
3220 | @param[in, out] ExtensionDataSize Extension bytes size.
|
---|
3221 |
|
---|
3222 | @retval TRUE The certificate Extension data retrieved successfully.
|
---|
3223 | @retval FALSE If Cert is NULL.
|
---|
3224 | If ExtensionDataSize is NULL.
|
---|
3225 | If ExtensionData is not NULL and *ExtensionDataSize is 0.
|
---|
3226 | If Certificate is invalid.
|
---|
3227 | @retval FALSE If no Extension entry match Oid.
|
---|
3228 | @retval FALSE If the ExtensionData is NULL. The required buffer size
|
---|
3229 | is returned in the ExtensionDataSize parameter.
|
---|
3230 | @retval FALSE The operation is not supported.
|
---|
3231 | **/
|
---|
3232 | BOOLEAN
|
---|
3233 | EFIAPI
|
---|
3234 | CryptoServiceX509GetExtensionData (
|
---|
3235 | IN CONST UINT8 *Cert,
|
---|
3236 | IN UINTN CertSize,
|
---|
3237 | IN CONST UINT8 *Oid,
|
---|
3238 | IN UINTN OidSize,
|
---|
3239 | OUT UINT8 *ExtensionData,
|
---|
3240 | IN OUT UINTN *ExtensionDataSize
|
---|
3241 | )
|
---|
3242 | {
|
---|
3243 | return CALL_BASECRYPTLIB (X509.Services.GetExtensionData, X509GetExtensionData, (Cert, CertSize, Oid, OidSize, ExtensionData, ExtensionDataSize), FALSE);
|
---|
3244 | }
|
---|
3245 |
|
---|
3246 | /**
|
---|
3247 | Retrieve the Extended Key Usage from one X.509 certificate.
|
---|
3248 |
|
---|
3249 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3250 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3251 | @param[out] Usage Key Usage bytes.
|
---|
3252 | @param[in, out] UsageSize Key Usage buffer sizs in bytes.
|
---|
3253 |
|
---|
3254 | @retval TRUE The Usage bytes retrieve successfully.
|
---|
3255 | @retval FALSE If Cert is NULL.
|
---|
3256 | If CertSize is NULL.
|
---|
3257 | If Usage is not NULL and *UsageSize is 0.
|
---|
3258 | If Cert is invalid.
|
---|
3259 | @retval FALSE If the Usage is NULL. The required buffer size
|
---|
3260 | is returned in the UsageSize parameter.
|
---|
3261 | @retval FALSE The operation is not supported.
|
---|
3262 | **/
|
---|
3263 | BOOLEAN
|
---|
3264 | EFIAPI
|
---|
3265 | CryptoServiceX509GetExtendedKeyUsage (
|
---|
3266 | IN CONST UINT8 *Cert,
|
---|
3267 | IN UINTN CertSize,
|
---|
3268 | OUT UINT8 *Usage,
|
---|
3269 | IN OUT UINTN *UsageSize
|
---|
3270 | )
|
---|
3271 | {
|
---|
3272 | return CALL_BASECRYPTLIB (X509.Services.GetExtendedKeyUsage, X509GetExtendedKeyUsage, (Cert, CertSize, Usage, UsageSize), FALSE);
|
---|
3273 | }
|
---|
3274 |
|
---|
3275 | /**
|
---|
3276 | Retrieve the Validity from one X.509 certificate
|
---|
3277 |
|
---|
3278 | If Cert is NULL, then return FALSE.
|
---|
3279 | If CertIssuerSize is NULL, then return FALSE.
|
---|
3280 | If this interface is not supported, then return FALSE.
|
---|
3281 |
|
---|
3282 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3283 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3284 | @param[in] From notBefore Pointer to DateTime object.
|
---|
3285 | @param[in,out] FromSize notBefore DateTime object size.
|
---|
3286 | @param[in] To notAfter Pointer to DateTime object.
|
---|
3287 | @param[in,out] ToSize notAfter DateTime object size.
|
---|
3288 |
|
---|
3289 | Note: X509CompareDateTime to compare DateTime oject
|
---|
3290 | x509SetDateTime to get a DateTime object from a DateTimeStr
|
---|
3291 |
|
---|
3292 | @retval TRUE The certificate Validity retrieved successfully.
|
---|
3293 | @retval FALSE Invalid certificate, or Validity retrieve failed.
|
---|
3294 | @retval FALSE This interface is not supported.
|
---|
3295 | **/
|
---|
3296 | BOOLEAN
|
---|
3297 | EFIAPI
|
---|
3298 | CryptoServiceX509GetValidity (
|
---|
3299 | IN CONST UINT8 *Cert,
|
---|
3300 | IN UINTN CertSize,
|
---|
3301 | IN UINT8 *From,
|
---|
3302 | IN OUT UINTN *FromSize,
|
---|
3303 | IN UINT8 *To,
|
---|
3304 | IN OUT UINTN *ToSize
|
---|
3305 | )
|
---|
3306 | {
|
---|
3307 | return CALL_BASECRYPTLIB (X509.Services.GetValidity, X509GetValidity, (Cert, CertSize, From, FromSize, To, ToSize), FALSE);
|
---|
3308 | }
|
---|
3309 |
|
---|
3310 | /**
|
---|
3311 | Format a DateTimeStr to DataTime object in DataTime Buffer
|
---|
3312 |
|
---|
3313 | If DateTimeStr is NULL, then return FALSE.
|
---|
3314 | If DateTimeSize is NULL, then return FALSE.
|
---|
3315 | If this interface is not supported, then return FALSE.
|
---|
3316 |
|
---|
3317 | @param[in] DateTimeStr DateTime string like YYYYMMDDhhmmssZ
|
---|
3318 | Ref: https://www.w3.org/TR/NOTE-datetime
|
---|
3319 | Z stand for UTC time
|
---|
3320 | @param[out] DateTime Pointer to a DateTime object.
|
---|
3321 | @param[in,out] DateTimeSize DateTime object buffer size.
|
---|
3322 |
|
---|
3323 | @retval TRUE The DateTime object create successfully.
|
---|
3324 | @retval FALSE If DateTimeStr is NULL.
|
---|
3325 | If DateTimeSize is NULL.
|
---|
3326 | If DateTime is not NULL and *DateTimeSize is 0.
|
---|
3327 | If Year Month Day Hour Minute Second combination is invalid datetime.
|
---|
3328 | @retval FALSE If the DateTime is NULL. The required buffer size
|
---|
3329 | (including the final null) is returned in the
|
---|
3330 | DateTimeSize parameter.
|
---|
3331 | @retval FALSE The operation is not supported.
|
---|
3332 | **/
|
---|
3333 | BOOLEAN
|
---|
3334 | EFIAPI
|
---|
3335 | CryptoServiceX509FormatDateTime (
|
---|
3336 | IN CONST CHAR8 *DateTimeStr,
|
---|
3337 | OUT VOID *DateTime,
|
---|
3338 | IN OUT UINTN *DateTimeSize
|
---|
3339 | )
|
---|
3340 | {
|
---|
3341 | return CALL_BASECRYPTLIB (X509.Services.FormatDateTime, X509FormatDateTime, (DateTimeStr, DateTime, DateTimeSize), FALSE);
|
---|
3342 | }
|
---|
3343 |
|
---|
3344 | /**
|
---|
3345 | Compare DateTime1 object and DateTime2 object.
|
---|
3346 |
|
---|
3347 | If DateTime1 is NULL, then return -2.
|
---|
3348 | If DateTime2 is NULL, then return -2.
|
---|
3349 | If DateTime1 == DateTime2, then return 0
|
---|
3350 | If DateTime1 > DateTime2, then return 1
|
---|
3351 | If DateTime1 < DateTime2, then return -1
|
---|
3352 |
|
---|
3353 | @param[in] DateTime1 Pointer to a DateTime Ojbect
|
---|
3354 | @param[in] DateTime2 Pointer to a DateTime Object
|
---|
3355 |
|
---|
3356 | @retval 0 If DateTime1 == DateTime2
|
---|
3357 | @retval 1 If DateTime1 > DateTime2
|
---|
3358 | @retval -1 If DateTime1 < DateTime2
|
---|
3359 | **/
|
---|
3360 | INT32
|
---|
3361 | EFIAPI
|
---|
3362 | CryptoServiceX509CompareDateTime (
|
---|
3363 | IN CONST VOID *DateTime1,
|
---|
3364 | IN CONST VOID *DateTime2
|
---|
3365 | )
|
---|
3366 | {
|
---|
3367 | return CALL_BASECRYPTLIB (X509.Services.CompareDateTime, X509CompareDateTime, (DateTime1, DateTime2), FALSE);
|
---|
3368 | }
|
---|
3369 |
|
---|
3370 | /**
|
---|
3371 | Retrieve the Key Usage from one X.509 certificate.
|
---|
3372 |
|
---|
3373 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3374 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
3375 | @param[out] Usage Key Usage (CRYPTO_X509_KU_*)
|
---|
3376 |
|
---|
3377 | @retval TRUE The certificate Key Usage retrieved successfully.
|
---|
3378 | @retval FALSE Invalid certificate, or Usage is NULL
|
---|
3379 | @retval FALSE This interface is not supported.
|
---|
3380 | **/
|
---|
3381 | BOOLEAN
|
---|
3382 | EFIAPI
|
---|
3383 | CryptoServiceX509GetKeyUsage (
|
---|
3384 | IN CONST UINT8 *Cert,
|
---|
3385 | IN UINTN CertSize,
|
---|
3386 | OUT UINTN *Usage
|
---|
3387 | )
|
---|
3388 | {
|
---|
3389 | return CALL_BASECRYPTLIB (X509.Services.GetKeyUsage, X509GetKeyUsage, (Cert, CertSize, Usage), FALSE);
|
---|
3390 | }
|
---|
3391 |
|
---|
3392 | /**
|
---|
3393 | Verify one X509 certificate was issued by the trusted CA.
|
---|
3394 | @param[in] RootCert Trusted Root Certificate buffer
|
---|
3395 |
|
---|
3396 | @param[in] RootCertLength Trusted Root Certificate buffer length
|
---|
3397 | @param[in] CertChain One or more ASN.1 DER-encoded X.509 certificates
|
---|
3398 | where the first certificate is signed by the Root
|
---|
3399 | Certificate or is the Root Cerificate itself. and
|
---|
3400 | subsequent cerificate is signed by the preceding
|
---|
3401 | cerificate.
|
---|
3402 | @param[in] CertChainLength Total length of the certificate chain, in bytes.
|
---|
3403 |
|
---|
3404 | @retval TRUE All cerificates was issued by the first certificate in X509Certchain.
|
---|
3405 | @retval FALSE Invalid certificate or the certificate was not issued by the given
|
---|
3406 | trusted CA.
|
---|
3407 | **/
|
---|
3408 | BOOLEAN
|
---|
3409 | EFIAPI
|
---|
3410 | CryptoServiceX509VerifyCertChain (
|
---|
3411 | IN CONST UINT8 *RootCert,
|
---|
3412 | IN UINTN RootCertLength,
|
---|
3413 | IN CONST UINT8 *CertChain,
|
---|
3414 | IN UINTN CertChainLength
|
---|
3415 | )
|
---|
3416 | {
|
---|
3417 | return CALL_BASECRYPTLIB (X509.Services.VerifyCertChain, X509VerifyCertChain, (RootCert, RootCertLength, CertChain, CertChainLength), FALSE);
|
---|
3418 | }
|
---|
3419 |
|
---|
3420 | /**
|
---|
3421 | Get one X509 certificate from CertChain.
|
---|
3422 |
|
---|
3423 | @param[in] CertChain One or more ASN.1 DER-encoded X.509 certificates
|
---|
3424 | where the first certificate is signed by the Root
|
---|
3425 | Certificate or is the Root Cerificate itself. and
|
---|
3426 | subsequent cerificate is signed by the preceding
|
---|
3427 | cerificate.
|
---|
3428 | @param[in] CertChainLength Total length of the certificate chain, in bytes.
|
---|
3429 |
|
---|
3430 | @param[in] CertIndex Index of certificate.
|
---|
3431 |
|
---|
3432 | @param[out] Cert The certificate at the index of CertChain.
|
---|
3433 | @param[out] CertLength The length certificate at the index of CertChain.
|
---|
3434 |
|
---|
3435 | @retval TRUE Success.
|
---|
3436 | @retval FALSE Failed to get certificate from certificate chain.
|
---|
3437 | **/
|
---|
3438 | BOOLEAN
|
---|
3439 | EFIAPI
|
---|
3440 | CryptoServiceX509GetCertFromCertChain (
|
---|
3441 | IN CONST UINT8 *CertChain,
|
---|
3442 | IN UINTN CertChainLength,
|
---|
3443 | IN CONST INT32 CertIndex,
|
---|
3444 | OUT CONST UINT8 **Cert,
|
---|
3445 | OUT UINTN *CertLength
|
---|
3446 | )
|
---|
3447 | {
|
---|
3448 | return CALL_BASECRYPTLIB (X509.Services.GetCertFromCertChain, X509GetCertFromCertChain, (CertChain, CertChainLength, CertIndex, Cert, CertLength), FALSE);
|
---|
3449 | }
|
---|
3450 |
|
---|
3451 | /**
|
---|
3452 | Retrieve the tag and length of the tag.
|
---|
3453 |
|
---|
3454 | @param Ptr The position in the ASN.1 data
|
---|
3455 | @param End End of data
|
---|
3456 | @param Length The variable that will receive the length
|
---|
3457 | @param Tag The expected tag
|
---|
3458 |
|
---|
3459 | @retval TRUE Get tag successful
|
---|
3460 | @retval FALSe Failed to get tag or tag not match
|
---|
3461 | **/
|
---|
3462 | BOOLEAN
|
---|
3463 | EFIAPI
|
---|
3464 | CryptoServiceAsn1GetTag (
|
---|
3465 | IN OUT UINT8 **Ptr,
|
---|
3466 | IN CONST UINT8 *End,
|
---|
3467 | OUT UINTN *Length,
|
---|
3468 | IN UINT32 Tag
|
---|
3469 | )
|
---|
3470 | {
|
---|
3471 | return CALL_BASECRYPTLIB (X509.Services.Asn1GetTag, Asn1GetTag, (Ptr, End, Length, Tag), FALSE);
|
---|
3472 | }
|
---|
3473 |
|
---|
3474 | /**
|
---|
3475 | Retrieve the basic constraints from one X.509 certificate.
|
---|
3476 |
|
---|
3477 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
3478 | @param[in] CertSize size of the X509 certificate in bytes.
|
---|
3479 | @param[out] BasicConstraints basic constraints bytes.
|
---|
3480 | @param[in, out] BasicConstraintsSize basic constraints buffer sizs in bytes.
|
---|
3481 |
|
---|
3482 | @retval TRUE The basic constraints retrieve successfully.
|
---|
3483 | @retval FALSE If cert is NULL.
|
---|
3484 | If cert_size is NULL.
|
---|
3485 | If basic_constraints is not NULL and *basic_constraints_size is 0.
|
---|
3486 | If cert is invalid.
|
---|
3487 | @retval FALSE The required buffer size is small.
|
---|
3488 | The return buffer size is basic_constraints_size parameter.
|
---|
3489 | @retval FALSE If no Extension entry match oid.
|
---|
3490 | @retval FALSE The operation is not supported.
|
---|
3491 | **/
|
---|
3492 | BOOLEAN
|
---|
3493 | EFIAPI
|
---|
3494 | CryptoServiceX509GetExtendedBasicConstraints (
|
---|
3495 | CONST UINT8 *Cert,
|
---|
3496 | UINTN CertSize,
|
---|
3497 | UINT8 *BasicConstraints,
|
---|
3498 | UINTN *BasicConstraintsSize
|
---|
3499 | )
|
---|
3500 | {
|
---|
3501 | return CALL_BASECRYPTLIB (X509.Services.GetExtendedBasicConstraints, X509GetExtendedBasicConstraints, (Cert, CertSize, BasicConstraints, BasicConstraintsSize), FALSE);
|
---|
3502 | }
|
---|
3503 |
|
---|
3504 | /**
|
---|
3505 | Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0
|
---|
3506 | password based encryption key derivation function PBKDF2, as specified in RFC 2898.
|
---|
3507 |
|
---|
3508 | If Password or Salt or OutKey is NULL, then return FALSE.
|
---|
3509 | If the hash algorithm could not be determined, then return FALSE.
|
---|
3510 | If this interface is not supported, then return FALSE.
|
---|
3511 |
|
---|
3512 | @param[in] PasswordLength Length of input password in bytes.
|
---|
3513 | @param[in] Password Pointer to the array for the password.
|
---|
3514 | @param[in] SaltLength Size of the Salt in bytes.
|
---|
3515 | @param[in] Salt Pointer to the Salt.
|
---|
3516 | @param[in] IterationCount Number of iterations to perform. Its value should be
|
---|
3517 | greater than or equal to 1.
|
---|
3518 | @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).
|
---|
3519 | NOTE: DigestSize will be used to determine the hash algorithm.
|
---|
3520 | Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.
|
---|
3521 | @param[in] KeyLength Size of the derived key buffer in bytes.
|
---|
3522 | @param[out] OutKey Pointer to the output derived key buffer.
|
---|
3523 |
|
---|
3524 | @retval TRUE A key was derived successfully.
|
---|
3525 | @retval FALSE One of the pointers was NULL or one of the sizes was too large.
|
---|
3526 | @retval FALSE The hash algorithm could not be determined from the digest size.
|
---|
3527 | @retval FALSE The key derivation operation failed.
|
---|
3528 | @retval FALSE This interface is not supported.
|
---|
3529 |
|
---|
3530 | **/
|
---|
3531 | BOOLEAN
|
---|
3532 | EFIAPI
|
---|
3533 | CryptoServicePkcs5HashPassword (
|
---|
3534 | IN UINTN PasswordLength,
|
---|
3535 | IN CONST CHAR8 *Password,
|
---|
3536 | IN UINTN SaltLength,
|
---|
3537 | IN CONST UINT8 *Salt,
|
---|
3538 | IN UINTN IterationCount,
|
---|
3539 | IN UINTN DigestSize,
|
---|
3540 | IN UINTN KeyLength,
|
---|
3541 | OUT UINT8 *OutKey
|
---|
3542 | )
|
---|
3543 | {
|
---|
3544 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs5HashPassword, Pkcs5HashPassword, (PasswordLength, Password, SaltLength, Salt, IterationCount, DigestSize, KeyLength, OutKey), FALSE);
|
---|
3545 | }
|
---|
3546 |
|
---|
3547 | /**
|
---|
3548 | Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
---|
3549 | encrypted message in a newly allocated buffer.
|
---|
3550 |
|
---|
3551 | Things that can cause a failure include:
|
---|
3552 | - X509 key size does not match any known key size.
|
---|
3553 | - Fail to parse X509 certificate.
|
---|
3554 | - Fail to allocate an intermediate buffer.
|
---|
3555 | - Null pointer provided for a non-optional parameter.
|
---|
3556 | - Data size is too large for the provided key size (max size is a function of key size
|
---|
3557 | and hash digest size).
|
---|
3558 |
|
---|
3559 | @param[in] PublicKey A pointer to the DER-encoded X509 certificate that
|
---|
3560 | will be used to encrypt the data.
|
---|
3561 | @param[in] PublicKeySize Size of the X509 cert buffer.
|
---|
3562 | @param[in] InData Data to be encrypted.
|
---|
3563 | @param[in] InDataSize Size of the data buffer.
|
---|
3564 | @param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
---|
3565 | to be used when initializing the PRNG. NULL otherwise.
|
---|
3566 | @param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
---|
3567 | 0 otherwise.
|
---|
3568 | @param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
---|
3569 | message.
|
---|
3570 | @param[out] EncryptedDataSize Size of the encrypted message buffer.
|
---|
3571 |
|
---|
3572 | @retval TRUE Encryption was successful.
|
---|
3573 | @retval FALSE Encryption failed.
|
---|
3574 |
|
---|
3575 | **/
|
---|
3576 | BOOLEAN
|
---|
3577 | EFIAPI
|
---|
3578 | CryptoServicePkcs1v2Encrypt (
|
---|
3579 | IN CONST UINT8 *PublicKey,
|
---|
3580 | IN UINTN PublicKeySize,
|
---|
3581 | IN UINT8 *InData,
|
---|
3582 | IN UINTN InDataSize,
|
---|
3583 | IN CONST UINT8 *PrngSeed OPTIONAL,
|
---|
3584 | IN UINTN PrngSeedSize OPTIONAL,
|
---|
3585 | OUT UINT8 **EncryptedData,
|
---|
3586 | OUT UINTN *EncryptedDataSize
|
---|
3587 | )
|
---|
3588 | {
|
---|
3589 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs1v2Encrypt, Pkcs1v2Encrypt, (PublicKey, PublicKeySize, InData, InDataSize, PrngSeed, PrngSeedSize, EncryptedData, EncryptedDataSize), FALSE);
|
---|
3590 | }
|
---|
3591 |
|
---|
3592 | /**
|
---|
3593 | Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
|
---|
3594 | Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
---|
3595 | in a ContentInfo structure.
|
---|
3596 |
|
---|
3597 | If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then
|
---|
3598 | return FALSE. If P7Length overflow, then return FALSE.
|
---|
3599 | If this interface is not supported, then return FALSE.
|
---|
3600 |
|
---|
3601 | @param[in] P7Data Pointer to the PKCS#7 message to verify.
|
---|
3602 | @param[in] P7Length Length of the PKCS#7 message in bytes.
|
---|
3603 | @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
|
---|
3604 | It's caller's responsibility to free the buffer with
|
---|
3605 | Pkcs7FreeSigners().
|
---|
3606 | This data structure is EFI_CERT_STACK type.
|
---|
3607 | @param[out] StackLength Length of signer's certificates in bytes.
|
---|
3608 | @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
|
---|
3609 | It's caller's responsibility to free the buffer with
|
---|
3610 | Pkcs7FreeSigners().
|
---|
3611 | @param[out] CertLength Length of the trusted certificate in bytes.
|
---|
3612 |
|
---|
3613 | @retval TRUE The operation is finished successfully.
|
---|
3614 | @retval FALSE Error occurs during the operation.
|
---|
3615 | @retval FALSE This interface is not supported.
|
---|
3616 |
|
---|
3617 | **/
|
---|
3618 | BOOLEAN
|
---|
3619 | EFIAPI
|
---|
3620 | CryptoServicePkcs7GetSigners (
|
---|
3621 | IN CONST UINT8 *P7Data,
|
---|
3622 | IN UINTN P7Length,
|
---|
3623 | OUT UINT8 **CertStack,
|
---|
3624 | OUT UINTN *StackLength,
|
---|
3625 | OUT UINT8 **TrustedCert,
|
---|
3626 | OUT UINTN *CertLength
|
---|
3627 | )
|
---|
3628 | {
|
---|
3629 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7GetSigners, Pkcs7GetSigners, (P7Data, P7Length, CertStack, StackLength, TrustedCert, CertLength), FALSE);
|
---|
3630 | }
|
---|
3631 |
|
---|
3632 | /**
|
---|
3633 | Wrap function to use free() to free allocated memory for certificates.
|
---|
3634 |
|
---|
3635 | If this interface is not supported, then ASSERT().
|
---|
3636 |
|
---|
3637 | @param[in] Certs Pointer to the certificates to be freed.
|
---|
3638 |
|
---|
3639 | **/
|
---|
3640 | VOID
|
---|
3641 | EFIAPI
|
---|
3642 | CryptoServicePkcs7FreeSigners (
|
---|
3643 | IN UINT8 *Certs
|
---|
3644 | )
|
---|
3645 | {
|
---|
3646 | CALL_VOID_BASECRYPTLIB (Pkcs.Services.Pkcs7FreeSigners, Pkcs7FreeSigners, (Certs));
|
---|
3647 | }
|
---|
3648 |
|
---|
3649 | /**
|
---|
3650 | Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
|
---|
3651 | Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
|
---|
3652 | unchained to the signer's certificates.
|
---|
3653 | The input signed data could be wrapped in a ContentInfo structure.
|
---|
3654 |
|
---|
3655 | @param[in] P7Data Pointer to the PKCS#7 message.
|
---|
3656 | @param[in] P7Length Length of the PKCS#7 message in bytes.
|
---|
3657 | @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
|
---|
3658 | certificate. It's caller's responsibility to free the buffer
|
---|
3659 | with Pkcs7FreeSigners().
|
---|
3660 | This data structure is EFI_CERT_STACK type.
|
---|
3661 | @param[out] ChainLength Length of the chained certificates list buffer in bytes.
|
---|
3662 | @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
|
---|
3663 | responsibility to free the buffer with Pkcs7FreeSigners().
|
---|
3664 | This data structure is EFI_CERT_STACK type.
|
---|
3665 | @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
|
---|
3666 |
|
---|
3667 | @retval TRUE The operation is finished successfully.
|
---|
3668 | @retval FALSE Error occurs during the operation.
|
---|
3669 |
|
---|
3670 | **/
|
---|
3671 | BOOLEAN
|
---|
3672 | EFIAPI
|
---|
3673 | CryptoServicePkcs7GetCertificatesList (
|
---|
3674 | IN CONST UINT8 *P7Data,
|
---|
3675 | IN UINTN P7Length,
|
---|
3676 | OUT UINT8 **SignerChainCerts,
|
---|
3677 | OUT UINTN *ChainLength,
|
---|
3678 | OUT UINT8 **UnchainCerts,
|
---|
3679 | OUT UINTN *UnchainLength
|
---|
3680 | )
|
---|
3681 | {
|
---|
3682 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7GetCertificatesList, Pkcs7GetCertificatesList, (P7Data, P7Length, SignerChainCerts, ChainLength, UnchainCerts, UnchainLength), FALSE);
|
---|
3683 | }
|
---|
3684 |
|
---|
3685 | /**
|
---|
3686 | Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
|
---|
3687 | Syntax Standard, version 1.5". This interface is only intended to be used for
|
---|
3688 | application to perform PKCS#7 functionality validation.
|
---|
3689 |
|
---|
3690 | If this interface is not supported, then return FALSE.
|
---|
3691 |
|
---|
3692 | @param[in] PrivateKey Pointer to the PEM-formatted private key data for
|
---|
3693 | data signing.
|
---|
3694 | @param[in] PrivateKeySize Size of the PEM private key data in bytes.
|
---|
3695 | @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
|
---|
3696 | key data.
|
---|
3697 | @param[in] InData Pointer to the content to be signed.
|
---|
3698 | @param[in] InDataSize Size of InData in bytes.
|
---|
3699 | @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
|
---|
3700 | @param[in] OtherCerts Pointer to an optional additional set of certificates to
|
---|
3701 | include in the PKCS#7 signedData (e.g. any intermediate
|
---|
3702 | CAs in the chain).
|
---|
3703 | @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's
|
---|
3704 | responsibility to free the buffer with FreePool().
|
---|
3705 | @param[out] SignedDataSize Size of SignedData in bytes.
|
---|
3706 |
|
---|
3707 | @retval TRUE PKCS#7 data signing succeeded.
|
---|
3708 | @retval FALSE PKCS#7 data signing failed.
|
---|
3709 | @retval FALSE This interface is not supported.
|
---|
3710 |
|
---|
3711 | **/
|
---|
3712 | BOOLEAN
|
---|
3713 | EFIAPI
|
---|
3714 | CryptoServicePkcs7Sign (
|
---|
3715 | IN CONST UINT8 *PrivateKey,
|
---|
3716 | IN UINTN PrivateKeySize,
|
---|
3717 | IN CONST UINT8 *KeyPassword,
|
---|
3718 | IN UINT8 *InData,
|
---|
3719 | IN UINTN InDataSize,
|
---|
3720 | IN UINT8 *SignCert,
|
---|
3721 | IN UINT8 *OtherCerts OPTIONAL,
|
---|
3722 | OUT UINT8 **SignedData,
|
---|
3723 | OUT UINTN *SignedDataSize
|
---|
3724 | )
|
---|
3725 | {
|
---|
3726 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7Sign, Pkcs7Sign, (PrivateKey, PrivateKeySize, KeyPassword, InData, InDataSize, SignCert, OtherCerts, SignedData, SignedDataSize), FALSE);
|
---|
3727 | }
|
---|
3728 |
|
---|
3729 | /**
|
---|
3730 | Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
|
---|
3731 | Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
---|
3732 | in a ContentInfo structure.
|
---|
3733 |
|
---|
3734 | If P7Data, TrustedCert or InData is NULL, then return FALSE.
|
---|
3735 | If P7Length, CertLength or DataLength overflow, then return FALSE.
|
---|
3736 | If this interface is not supported, then return FALSE.
|
---|
3737 |
|
---|
3738 | @param[in] P7Data Pointer to the PKCS#7 message to verify.
|
---|
3739 | @param[in] P7Length Length of the PKCS#7 message in bytes.
|
---|
3740 | @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
|
---|
3741 | is used for certificate chain verification.
|
---|
3742 | @param[in] CertLength Length of the trusted certificate in bytes.
|
---|
3743 | @param[in] InData Pointer to the content to be verified.
|
---|
3744 | @param[in] DataLength Length of InData in bytes.
|
---|
3745 |
|
---|
3746 | @retval TRUE The specified PKCS#7 signed data is valid.
|
---|
3747 | @retval FALSE Invalid PKCS#7 signed data.
|
---|
3748 | @retval FALSE This interface is not supported.
|
---|
3749 |
|
---|
3750 | **/
|
---|
3751 | BOOLEAN
|
---|
3752 | EFIAPI
|
---|
3753 | CryptoServicePkcs7Verify (
|
---|
3754 | IN CONST UINT8 *P7Data,
|
---|
3755 | IN UINTN P7Length,
|
---|
3756 | IN CONST UINT8 *TrustedCert,
|
---|
3757 | IN UINTN CertLength,
|
---|
3758 | IN CONST UINT8 *InData,
|
---|
3759 | IN UINTN DataLength
|
---|
3760 | )
|
---|
3761 | {
|
---|
3762 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7Verify, Pkcs7Verify, (P7Data, P7Length, TrustedCert, CertLength, InData, DataLength), FALSE);
|
---|
3763 | }
|
---|
3764 |
|
---|
3765 | /**
|
---|
3766 | This function receives a PKCS7 formatted signature, and then verifies that
|
---|
3767 | the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity
|
---|
3768 | leaf signing certificate.
|
---|
3769 | Note that this function does not validate the certificate chain.
|
---|
3770 |
|
---|
3771 | Applications for custom EKU's are quite flexible. For example, a policy EKU
|
---|
3772 | may be present in an Issuing Certificate Authority (CA), and any sub-ordinate
|
---|
3773 | certificate issued might also contain this EKU, thus constraining the
|
---|
3774 | sub-ordinate certificate. Other applications might allow a certificate
|
---|
3775 | embedded in a device to specify that other Object Identifiers (OIDs) are
|
---|
3776 | present which contains binary data specifying custom capabilities that
|
---|
3777 | the device is able to do.
|
---|
3778 |
|
---|
3779 | @param[in] Pkcs7Signature The PKCS#7 signed information content block. An array
|
---|
3780 | containing the content block with both the signature,
|
---|
3781 | the signer's certificate, and any necessary intermediate
|
---|
3782 | certificates.
|
---|
3783 | @param[in] Pkcs7SignatureSize Number of bytes in Pkcs7Signature.
|
---|
3784 | @param[in] RequiredEKUs Array of null-terminated strings listing OIDs of
|
---|
3785 | required EKUs that must be present in the signature.
|
---|
3786 | @param[in] RequiredEKUsSize Number of elements in the RequiredEKUs string array.
|
---|
3787 | @param[in] RequireAllPresent If this is TRUE, then all of the specified EKU's
|
---|
3788 | must be present in the leaf signer. If it is
|
---|
3789 | FALSE, then we will succeed if we find any
|
---|
3790 | of the specified EKU's.
|
---|
3791 |
|
---|
3792 | @retval EFI_SUCCESS The required EKUs were found in the signature.
|
---|
3793 | @retval EFI_INVALID_PARAMETER A parameter was invalid.
|
---|
3794 | @retval EFI_NOT_FOUND One or more EKU's were not found in the signature.
|
---|
3795 |
|
---|
3796 | **/
|
---|
3797 | RETURN_STATUS
|
---|
3798 | EFIAPI
|
---|
3799 | CryptoServiceVerifyEKUsInPkcs7Signature (
|
---|
3800 | IN CONST UINT8 *Pkcs7Signature,
|
---|
3801 | IN CONST UINT32 SignatureSize,
|
---|
3802 | IN CONST CHAR8 *RequiredEKUs[],
|
---|
3803 | IN CONST UINT32 RequiredEKUsSize,
|
---|
3804 | IN BOOLEAN RequireAllPresent
|
---|
3805 | )
|
---|
3806 | {
|
---|
3807 | return CALL_BASECRYPTLIB (Pkcs.Services.VerifyEKUsInPkcs7Signature, VerifyEKUsInPkcs7Signature, (Pkcs7Signature, SignatureSize, RequiredEKUs, RequiredEKUsSize, RequireAllPresent), FALSE);
|
---|
3808 | }
|
---|
3809 |
|
---|
3810 | /**
|
---|
3811 | Extracts the attached content from a PKCS#7 signed data if existed. The input signed
|
---|
3812 | data could be wrapped in a ContentInfo structure.
|
---|
3813 |
|
---|
3814 | If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow,
|
---|
3815 | then return FALSE. If the P7Data is not correctly formatted, then return FALSE.
|
---|
3816 |
|
---|
3817 | Caution: This function may receive untrusted input. So this function will do
|
---|
3818 | basic check for PKCS#7 data structure.
|
---|
3819 |
|
---|
3820 | @param[in] P7Data Pointer to the PKCS#7 signed data to process.
|
---|
3821 | @param[in] P7Length Length of the PKCS#7 signed data in bytes.
|
---|
3822 | @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
|
---|
3823 | It's caller's responsibility to free the buffer with FreePool().
|
---|
3824 | @param[out] ContentSize The size of the extracted content in bytes.
|
---|
3825 |
|
---|
3826 | @retval TRUE The P7Data was correctly formatted for processing.
|
---|
3827 | @retval FALSE The P7Data was not correctly formatted for processing.
|
---|
3828 |
|
---|
3829 | **/
|
---|
3830 | BOOLEAN
|
---|
3831 | EFIAPI
|
---|
3832 | CryptoServicePkcs7GetAttachedContent (
|
---|
3833 | IN CONST UINT8 *P7Data,
|
---|
3834 | IN UINTN P7Length,
|
---|
3835 | OUT VOID **Content,
|
---|
3836 | OUT UINTN *ContentSize
|
---|
3837 | )
|
---|
3838 | {
|
---|
3839 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7GetAttachedContent, Pkcs7GetAttachedContent, (P7Data, P7Length, Content, ContentSize), FALSE);
|
---|
3840 | }
|
---|
3841 |
|
---|
3842 | /**
|
---|
3843 | Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows
|
---|
3844 | Authenticode Portable Executable Signature Format".
|
---|
3845 |
|
---|
3846 | If AuthData is NULL, then return FALSE.
|
---|
3847 | If ImageHash is NULL, then return FALSE.
|
---|
3848 | If this interface is not supported, then return FALSE.
|
---|
3849 |
|
---|
3850 | @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
|
---|
3851 | PE/COFF image to be verified.
|
---|
3852 | @param[in] DataSize Size of the Authenticode Signature in bytes.
|
---|
3853 | @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
|
---|
3854 | is used for certificate chain verification.
|
---|
3855 | @param[in] CertSize Size of the trusted certificate in bytes.
|
---|
3856 | @param[in] ImageHash Pointer to the original image file hash value. The procedure
|
---|
3857 | for calculating the image hash value is described in Authenticode
|
---|
3858 | specification.
|
---|
3859 | @param[in] HashSize Size of Image hash value in bytes.
|
---|
3860 |
|
---|
3861 | @retval TRUE The specified Authenticode Signature is valid.
|
---|
3862 | @retval FALSE Invalid Authenticode Signature.
|
---|
3863 | @retval FALSE This interface is not supported.
|
---|
3864 |
|
---|
3865 | **/
|
---|
3866 | BOOLEAN
|
---|
3867 | EFIAPI
|
---|
3868 | CryptoServiceAuthenticodeVerify (
|
---|
3869 | IN CONST UINT8 *AuthData,
|
---|
3870 | IN UINTN DataSize,
|
---|
3871 | IN CONST UINT8 *TrustedCert,
|
---|
3872 | IN UINTN CertSize,
|
---|
3873 | IN CONST UINT8 *ImageHash,
|
---|
3874 | IN UINTN HashSize
|
---|
3875 | )
|
---|
3876 | {
|
---|
3877 | return CALL_BASECRYPTLIB (Pkcs.Services.AuthenticodeVerify, AuthenticodeVerify, (AuthData, DataSize, TrustedCert, CertSize, ImageHash, HashSize), FALSE);
|
---|
3878 | }
|
---|
3879 |
|
---|
3880 | /**
|
---|
3881 | Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode
|
---|
3882 | signature.
|
---|
3883 |
|
---|
3884 | If AuthData is NULL, then return FALSE.
|
---|
3885 | If this interface is not supported, then return FALSE.
|
---|
3886 |
|
---|
3887 | @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
|
---|
3888 | PE/COFF image to be verified.
|
---|
3889 | @param[in] DataSize Size of the Authenticode Signature in bytes.
|
---|
3890 | @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which
|
---|
3891 | is used for TSA certificate chain verification.
|
---|
3892 | @param[in] CertSize Size of the trusted certificate in bytes.
|
---|
3893 | @param[out] SigningTime Return the time of timestamp generation time if the timestamp
|
---|
3894 | signature is valid.
|
---|
3895 |
|
---|
3896 | @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.
|
---|
3897 | @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.
|
---|
3898 |
|
---|
3899 | **/
|
---|
3900 | BOOLEAN
|
---|
3901 | EFIAPI
|
---|
3902 | CryptoServiceImageTimestampVerify (
|
---|
3903 | IN CONST UINT8 *AuthData,
|
---|
3904 | IN UINTN DataSize,
|
---|
3905 | IN CONST UINT8 *TsaCert,
|
---|
3906 | IN UINTN CertSize,
|
---|
3907 | OUT EFI_TIME *SigningTime
|
---|
3908 | )
|
---|
3909 | {
|
---|
3910 | return CALL_BASECRYPTLIB (Pkcs.Services.ImageTimestampVerify, ImageTimestampVerify, (AuthData, DataSize, TsaCert, CertSize, SigningTime), FALSE);
|
---|
3911 | }
|
---|
3912 |
|
---|
3913 | // =====================================================================================
|
---|
3914 | // DH Key Exchange Primitive
|
---|
3915 | // =====================================================================================
|
---|
3916 |
|
---|
3917 | /**
|
---|
3918 | Allocates and Initializes one Diffie-Hellman Context for subsequent use.
|
---|
3919 |
|
---|
3920 | @return Pointer to the Diffie-Hellman Context that has been initialized.
|
---|
3921 | If the allocations fails, DhNew() returns NULL.
|
---|
3922 | If the interface is not supported, DhNew() returns NULL.
|
---|
3923 |
|
---|
3924 | **/
|
---|
3925 | VOID *
|
---|
3926 | EFIAPI
|
---|
3927 | CryptoServiceDhNew (
|
---|
3928 | VOID
|
---|
3929 | )
|
---|
3930 | {
|
---|
3931 | return CALL_BASECRYPTLIB (Dh.Services.New, DhNew, (), NULL);
|
---|
3932 | }
|
---|
3933 |
|
---|
3934 | /**
|
---|
3935 | Release the specified DH context.
|
---|
3936 |
|
---|
3937 | If the interface is not supported, then ASSERT().
|
---|
3938 |
|
---|
3939 | @param[in] DhContext Pointer to the DH context to be released.
|
---|
3940 |
|
---|
3941 | **/
|
---|
3942 | VOID
|
---|
3943 | EFIAPI
|
---|
3944 | CryptoServiceDhFree (
|
---|
3945 | IN VOID *DhContext
|
---|
3946 | )
|
---|
3947 | {
|
---|
3948 | CALL_VOID_BASECRYPTLIB (Dh.Services.Free, DhFree, (DhContext));
|
---|
3949 | }
|
---|
3950 |
|
---|
3951 | /**
|
---|
3952 | Generates DH parameter.
|
---|
3953 |
|
---|
3954 | Given generator g, and length of prime number p in bits, this function generates p,
|
---|
3955 | and sets DH context according to value of g and p.
|
---|
3956 |
|
---|
3957 | Before this function can be invoked, pseudorandom number generator must be correctly
|
---|
3958 | initialized by RandomSeed().
|
---|
3959 |
|
---|
3960 | If DhContext is NULL, then return FALSE.
|
---|
3961 | If Prime is NULL, then return FALSE.
|
---|
3962 | If this interface is not supported, then return FALSE.
|
---|
3963 |
|
---|
3964 | @param[in, out] DhContext Pointer to the DH context.
|
---|
3965 | @param[in] Generator Value of generator.
|
---|
3966 | @param[in] PrimeLength Length in bits of prime to be generated.
|
---|
3967 | @param[out] Prime Pointer to the buffer to receive the generated prime number.
|
---|
3968 |
|
---|
3969 | @retval TRUE DH parameter generation succeeded.
|
---|
3970 | @retval FALSE Value of Generator is not supported.
|
---|
3971 | @retval FALSE PRNG fails to generate random prime number with PrimeLength.
|
---|
3972 | @retval FALSE This interface is not supported.
|
---|
3973 |
|
---|
3974 | **/
|
---|
3975 | BOOLEAN
|
---|
3976 | EFIAPI
|
---|
3977 | CryptoServiceDhGenerateParameter (
|
---|
3978 | IN OUT VOID *DhContext,
|
---|
3979 | IN UINTN Generator,
|
---|
3980 | IN UINTN PrimeLength,
|
---|
3981 | OUT UINT8 *Prime
|
---|
3982 | )
|
---|
3983 | {
|
---|
3984 | return CALL_BASECRYPTLIB (Dh.Services.GenerateParameter, DhGenerateParameter, (DhContext, Generator, PrimeLength, Prime), FALSE);
|
---|
3985 | }
|
---|
3986 |
|
---|
3987 | /**
|
---|
3988 | Sets generator and prime parameters for DH.
|
---|
3989 |
|
---|
3990 | Given generator g, and prime number p, this function and sets DH
|
---|
3991 | context accordingly.
|
---|
3992 |
|
---|
3993 | If DhContext is NULL, then return FALSE.
|
---|
3994 | If Prime is NULL, then return FALSE.
|
---|
3995 | If this interface is not supported, then return FALSE.
|
---|
3996 |
|
---|
3997 | @param[in, out] DhContext Pointer to the DH context.
|
---|
3998 | @param[in] Generator Value of generator.
|
---|
3999 | @param[in] PrimeLength Length in bits of prime to be generated.
|
---|
4000 | @param[in] Prime Pointer to the prime number.
|
---|
4001 |
|
---|
4002 | @retval TRUE DH parameter setting succeeded.
|
---|
4003 | @retval FALSE Value of Generator is not supported.
|
---|
4004 | @retval FALSE Value of Generator is not suitable for the Prime.
|
---|
4005 | @retval FALSE Value of Prime is not a prime number.
|
---|
4006 | @retval FALSE Value of Prime is not a safe prime number.
|
---|
4007 | @retval FALSE This interface is not supported.
|
---|
4008 |
|
---|
4009 | **/
|
---|
4010 | BOOLEAN
|
---|
4011 | EFIAPI
|
---|
4012 | CryptoServiceDhSetParameter (
|
---|
4013 | IN OUT VOID *DhContext,
|
---|
4014 | IN UINTN Generator,
|
---|
4015 | IN UINTN PrimeLength,
|
---|
4016 | IN CONST UINT8 *Prime
|
---|
4017 | )
|
---|
4018 | {
|
---|
4019 | return CALL_BASECRYPTLIB (Dh.Services.SetParameter, DhSetParameter, (DhContext, Generator, PrimeLength, Prime), FALSE);
|
---|
4020 | }
|
---|
4021 |
|
---|
4022 | /**
|
---|
4023 | Generates DH public key.
|
---|
4024 |
|
---|
4025 | This function generates random secret exponent, and computes the public key, which is
|
---|
4026 | returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.
|
---|
4027 | If the PublicKey buffer is too small to hold the public key, FALSE is returned and
|
---|
4028 | PublicKeySize is set to the required buffer size to obtain the public key.
|
---|
4029 |
|
---|
4030 | If DhContext is NULL, then return FALSE.
|
---|
4031 | If PublicKeySize is NULL, then return FALSE.
|
---|
4032 | If PublicKeySize is large enough but PublicKey is NULL, then return FALSE.
|
---|
4033 | If this interface is not supported, then return FALSE.
|
---|
4034 |
|
---|
4035 | @param[in, out] DhContext Pointer to the DH context.
|
---|
4036 | @param[out] PublicKey Pointer to the buffer to receive generated public key.
|
---|
4037 | @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.
|
---|
4038 | On output, the size of data returned in PublicKey buffer in bytes.
|
---|
4039 |
|
---|
4040 | @retval TRUE DH public key generation succeeded.
|
---|
4041 | @retval FALSE DH public key generation failed.
|
---|
4042 | @retval FALSE PublicKeySize is not large enough.
|
---|
4043 | @retval FALSE This interface is not supported.
|
---|
4044 |
|
---|
4045 | **/
|
---|
4046 | BOOLEAN
|
---|
4047 | EFIAPI
|
---|
4048 | CryptoServiceDhGenerateKey (
|
---|
4049 | IN OUT VOID *DhContext,
|
---|
4050 | OUT UINT8 *PublicKey,
|
---|
4051 | IN OUT UINTN *PublicKeySize
|
---|
4052 | )
|
---|
4053 | {
|
---|
4054 | return CALL_BASECRYPTLIB (Dh.Services.GenerateKey, DhGenerateKey, (DhContext, PublicKey, PublicKeySize), FALSE);
|
---|
4055 | }
|
---|
4056 |
|
---|
4057 | /**
|
---|
4058 | Computes exchanged common key.
|
---|
4059 |
|
---|
4060 | Given peer's public key, this function computes the exchanged common key, based on its own
|
---|
4061 | context including value of prime modulus and random secret exponent.
|
---|
4062 |
|
---|
4063 | If DhContext is NULL, then return FALSE.
|
---|
4064 | If PeerPublicKey is NULL, then return FALSE.
|
---|
4065 | If KeySize is NULL, then return FALSE.
|
---|
4066 | If Key is NULL, then return FALSE.
|
---|
4067 | If KeySize is not large enough, then return FALSE.
|
---|
4068 | If this interface is not supported, then return FALSE.
|
---|
4069 |
|
---|
4070 | @param[in, out] DhContext Pointer to the DH context.
|
---|
4071 | @param[in] PeerPublicKey Pointer to the peer's public key.
|
---|
4072 | @param[in] PeerPublicKeySize Size of peer's public key in bytes.
|
---|
4073 | @param[out] Key Pointer to the buffer to receive generated key.
|
---|
4074 | @param[in, out] KeySize On input, the size of Key buffer in bytes.
|
---|
4075 | On output, the size of data returned in Key buffer in bytes.
|
---|
4076 |
|
---|
4077 | @retval TRUE DH exchanged key generation succeeded.
|
---|
4078 | @retval FALSE DH exchanged key generation failed.
|
---|
4079 | @retval FALSE KeySize is not large enough.
|
---|
4080 | @retval FALSE This interface is not supported.
|
---|
4081 |
|
---|
4082 | **/
|
---|
4083 | BOOLEAN
|
---|
4084 | EFIAPI
|
---|
4085 | CryptoServiceDhComputeKey (
|
---|
4086 | IN OUT VOID *DhContext,
|
---|
4087 | IN CONST UINT8 *PeerPublicKey,
|
---|
4088 | IN UINTN PeerPublicKeySize,
|
---|
4089 | OUT UINT8 *Key,
|
---|
4090 | IN OUT UINTN *KeySize
|
---|
4091 | )
|
---|
4092 | {
|
---|
4093 | return CALL_BASECRYPTLIB (Dh.Services.ComputeKey, DhComputeKey, (DhContext, PeerPublicKey, PeerPublicKeySize, Key, KeySize), FALSE);
|
---|
4094 | }
|
---|
4095 |
|
---|
4096 | // =====================================================================================
|
---|
4097 | // Pseudo-Random Generation Primitive
|
---|
4098 | // =====================================================================================
|
---|
4099 |
|
---|
4100 | /**
|
---|
4101 | Sets up the seed value for the pseudorandom number generator.
|
---|
4102 |
|
---|
4103 | This function sets up the seed value for the pseudorandom number generator.
|
---|
4104 | If Seed is not NULL, then the seed passed in is used.
|
---|
4105 | If Seed is NULL, then default seed is used.
|
---|
4106 | If this interface is not supported, then return FALSE.
|
---|
4107 |
|
---|
4108 | @param[in] Seed Pointer to seed value.
|
---|
4109 | If NULL, default seed is used.
|
---|
4110 | @param[in] SeedSize Size of seed value.
|
---|
4111 | If Seed is NULL, this parameter is ignored.
|
---|
4112 |
|
---|
4113 | @retval TRUE Pseudorandom number generator has enough entropy for random generation.
|
---|
4114 | @retval FALSE Pseudorandom number generator does not have enough entropy for random generation.
|
---|
4115 | @retval FALSE This interface is not supported.
|
---|
4116 |
|
---|
4117 | **/
|
---|
4118 | BOOLEAN
|
---|
4119 | EFIAPI
|
---|
4120 | CryptoServiceRandomSeed (
|
---|
4121 | IN CONST UINT8 *Seed OPTIONAL,
|
---|
4122 | IN UINTN SeedSize
|
---|
4123 | )
|
---|
4124 | {
|
---|
4125 | return CALL_BASECRYPTLIB (Random.Services.Seed, RandomSeed, (Seed, SeedSize), FALSE);
|
---|
4126 | }
|
---|
4127 |
|
---|
4128 | /**
|
---|
4129 | Generates a pseudorandom byte stream of the specified size.
|
---|
4130 |
|
---|
4131 | If Output is NULL, then return FALSE.
|
---|
4132 | If this interface is not supported, then return FALSE.
|
---|
4133 |
|
---|
4134 | @param[out] Output Pointer to buffer to receive random value.
|
---|
4135 | @param[in] Size Size of random bytes to generate.
|
---|
4136 |
|
---|
4137 | @retval TRUE Pseudorandom byte stream generated successfully.
|
---|
4138 | @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.
|
---|
4139 | @retval FALSE This interface is not supported.
|
---|
4140 |
|
---|
4141 | **/
|
---|
4142 | BOOLEAN
|
---|
4143 | EFIAPI
|
---|
4144 | CryptoServiceRandomBytes (
|
---|
4145 | OUT UINT8 *Output,
|
---|
4146 | IN UINTN Size
|
---|
4147 | )
|
---|
4148 | {
|
---|
4149 | return CALL_BASECRYPTLIB (Random.Services.Bytes, RandomBytes, (Output, Size), FALSE);
|
---|
4150 | }
|
---|
4151 |
|
---|
4152 | // =====================================================================================
|
---|
4153 | // Key Derivation Function Primitive
|
---|
4154 | // =====================================================================================
|
---|
4155 |
|
---|
4156 | /**
|
---|
4157 | Derive key data using HMAC-SHA256 based KDF.
|
---|
4158 |
|
---|
4159 | @param[in] Key Pointer to the user-supplied key.
|
---|
4160 | @param[in] KeySize Key size in bytes.
|
---|
4161 | @param[in] Salt Pointer to the salt(non-secret) value.
|
---|
4162 | @param[in] SaltSize Salt size in bytes.
|
---|
4163 | @param[in] Info Pointer to the application specific info.
|
---|
4164 | @param[in] InfoSize Info size in bytes.
|
---|
4165 | @param[out] Out Pointer to buffer to receive hkdf value.
|
---|
4166 | @param[in] OutSize Size of hkdf bytes to generate.
|
---|
4167 |
|
---|
4168 | @retval TRUE Hkdf generated successfully.
|
---|
4169 | @retval FALSE Hkdf generation failed.
|
---|
4170 |
|
---|
4171 | **/
|
---|
4172 | BOOLEAN
|
---|
4173 | EFIAPI
|
---|
4174 | CryptoServiceHkdfSha256ExtractAndExpand (
|
---|
4175 | IN CONST UINT8 *Key,
|
---|
4176 | IN UINTN KeySize,
|
---|
4177 | IN CONST UINT8 *Salt,
|
---|
4178 | IN UINTN SaltSize,
|
---|
4179 | IN CONST UINT8 *Info,
|
---|
4180 | IN UINTN InfoSize,
|
---|
4181 | OUT UINT8 *Out,
|
---|
4182 | IN UINTN OutSize
|
---|
4183 | )
|
---|
4184 | {
|
---|
4185 | return CALL_BASECRYPTLIB (Hkdf.Services.Sha256ExtractAndExpand, HkdfSha256ExtractAndExpand, (Key, KeySize, Salt, SaltSize, Info, InfoSize, Out, OutSize), FALSE);
|
---|
4186 | }
|
---|
4187 |
|
---|
4188 | /**
|
---|
4189 | Derive SHA256 HMAC-based Extract key Derivation Function (HKDF).
|
---|
4190 |
|
---|
4191 | @param[in] Key Pointer to the user-supplied key.
|
---|
4192 | @param[in] KeySize key size in bytes.
|
---|
4193 | @param[in] Salt Pointer to the salt(non-secret) value.
|
---|
4194 | @param[in] SaltSize salt size in bytes.
|
---|
4195 | @param[out] PrkOut Pointer to buffer to receive hkdf value.
|
---|
4196 | @param[in] PrkOutSize size of hkdf bytes to generate.
|
---|
4197 |
|
---|
4198 | @retval true Hkdf generated successfully.
|
---|
4199 | @retval false Hkdf generation failed.
|
---|
4200 |
|
---|
4201 | **/
|
---|
4202 | BOOLEAN
|
---|
4203 | EFIAPI
|
---|
4204 | CryptoServiceHkdfSha256Extract (
|
---|
4205 | IN CONST UINT8 *Key,
|
---|
4206 | IN UINTN KeySize,
|
---|
4207 | IN CONST UINT8 *Salt,
|
---|
4208 | IN UINTN SaltSize,
|
---|
4209 | OUT UINT8 *PrkOut,
|
---|
4210 | UINTN PrkOutSize
|
---|
4211 | )
|
---|
4212 | {
|
---|
4213 | return CALL_BASECRYPTLIB (Hkdf.Services.Sha256Extract, HkdfSha256Extract, (Key, KeySize, Salt, SaltSize, PrkOut, PrkOutSize), FALSE);
|
---|
4214 | }
|
---|
4215 |
|
---|
4216 | /**
|
---|
4217 | Derive SHA256 HMAC-based Expand Key Derivation Function (HKDF).
|
---|
4218 |
|
---|
4219 | @param[in] Prk Pointer to the user-supplied key.
|
---|
4220 | @param[in] PrkSize Key size in bytes.
|
---|
4221 | @param[in] Info Pointer to the application specific info.
|
---|
4222 | @param[in] InfoSize Info size in bytes.
|
---|
4223 | @param[out] Out Pointer to buffer to receive hkdf value.
|
---|
4224 | @param[in] OutSize Size of hkdf bytes to generate.
|
---|
4225 |
|
---|
4226 | @retval TRUE Hkdf generated successfully.
|
---|
4227 | @retval FALSE Hkdf generation failed.
|
---|
4228 |
|
---|
4229 | **/
|
---|
4230 | BOOLEAN
|
---|
4231 | EFIAPI
|
---|
4232 | CryptoServiceHkdfSha256Expand (
|
---|
4233 | IN CONST UINT8 *Prk,
|
---|
4234 | IN UINTN PrkSize,
|
---|
4235 | IN CONST UINT8 *Info,
|
---|
4236 | IN UINTN InfoSize,
|
---|
4237 | OUT UINT8 *Out,
|
---|
4238 | IN UINTN OutSize
|
---|
4239 | )
|
---|
4240 | {
|
---|
4241 | return CALL_BASECRYPTLIB (Hkdf.Services.Sha256Expand, HkdfSha256Expand, (Prk, PrkSize, Info, InfoSize, Out, OutSize), FALSE);
|
---|
4242 | }
|
---|
4243 |
|
---|
4244 | /**
|
---|
4245 | Derive SHA384 HMAC-based Extract-and-Expand Key Derivation Function (HKDF).
|
---|
4246 |
|
---|
4247 | @param[in] Key Pointer to the user-supplied key.
|
---|
4248 | @param[in] KeySize Key size in bytes.
|
---|
4249 | @param[in] Salt Pointer to the salt(non-secret) value.
|
---|
4250 | @param[in] SaltSize Salt size in bytes.
|
---|
4251 | @param[in] Info Pointer to the application specific info.
|
---|
4252 | @param[in] InfoSize Info size in bytes.
|
---|
4253 | @param[out] Out Pointer to buffer to receive hkdf value.
|
---|
4254 | @param[in] OutSize Size of hkdf bytes to generate.
|
---|
4255 |
|
---|
4256 | @retval TRUE Hkdf generated successfully.
|
---|
4257 | @retval FALSE Hkdf generation failed.
|
---|
4258 |
|
---|
4259 | **/
|
---|
4260 | BOOLEAN
|
---|
4261 | EFIAPI
|
---|
4262 | CryptoServiceHkdfSha384ExtractAndExpand (
|
---|
4263 | IN CONST UINT8 *Key,
|
---|
4264 | IN UINTN KeySize,
|
---|
4265 | IN CONST UINT8 *Salt,
|
---|
4266 | IN UINTN SaltSize,
|
---|
4267 | IN CONST UINT8 *Info,
|
---|
4268 | IN UINTN InfoSize,
|
---|
4269 | OUT UINT8 *Out,
|
---|
4270 | IN UINTN OutSize
|
---|
4271 | )
|
---|
4272 | {
|
---|
4273 | return CALL_BASECRYPTLIB (Hkdf.Services.Sha384ExtractAndExpand, HkdfSha384ExtractAndExpand, (Key, KeySize, Salt, SaltSize, Info, InfoSize, Out, OutSize), FALSE);
|
---|
4274 | }
|
---|
4275 |
|
---|
4276 | /**
|
---|
4277 | Derive SHA384 HMAC-based Extract key Derivation Function (HKDF).
|
---|
4278 |
|
---|
4279 | @param[in] Key Pointer to the user-supplied key.
|
---|
4280 | @param[in] KeySize key size in bytes.
|
---|
4281 | @param[in] Salt Pointer to the salt(non-secret) value.
|
---|
4282 | @param[in] SaltSize salt size in bytes.
|
---|
4283 | @param[out] PrkOut Pointer to buffer to receive hkdf value.
|
---|
4284 | @param[in] PrkOutSize size of hkdf bytes to generate.
|
---|
4285 |
|
---|
4286 | @retval true Hkdf generated successfully.
|
---|
4287 | @retval false Hkdf generation failed.
|
---|
4288 |
|
---|
4289 | **/
|
---|
4290 | BOOLEAN
|
---|
4291 | EFIAPI
|
---|
4292 | CryptoServiceHkdfSha384Extract (
|
---|
4293 | IN CONST UINT8 *Key,
|
---|
4294 | IN UINTN KeySize,
|
---|
4295 | IN CONST UINT8 *Salt,
|
---|
4296 | IN UINTN SaltSize,
|
---|
4297 | OUT UINT8 *PrkOut,
|
---|
4298 | UINTN PrkOutSize
|
---|
4299 | )
|
---|
4300 | {
|
---|
4301 | return CALL_BASECRYPTLIB (Hkdf.Services.Sha384Extract, HkdfSha384Extract, (Key, KeySize, Salt, SaltSize, PrkOut, PrkOutSize), FALSE);
|
---|
4302 | }
|
---|
4303 |
|
---|
4304 | /**
|
---|
4305 | Derive SHA384 HMAC-based Expand Key Derivation Function (HKDF).
|
---|
4306 |
|
---|
4307 | @param[in] Prk Pointer to the user-supplied key.
|
---|
4308 | @param[in] PrkSize Key size in bytes.
|
---|
4309 | @param[in] Info Pointer to the application specific info.
|
---|
4310 | @param[in] InfoSize Info size in bytes.
|
---|
4311 | @param[out] Out Pointer to buffer to receive hkdf value.
|
---|
4312 | @param[in] OutSize Size of hkdf bytes to generate.
|
---|
4313 |
|
---|
4314 | @retval TRUE Hkdf generated successfully.
|
---|
4315 | @retval FALSE Hkdf generation failed.
|
---|
4316 |
|
---|
4317 | **/
|
---|
4318 | BOOLEAN
|
---|
4319 | EFIAPI
|
---|
4320 | CryptoServiceHkdfSha384Expand (
|
---|
4321 | IN CONST UINT8 *Prk,
|
---|
4322 | IN UINTN PrkSize,
|
---|
4323 | IN CONST UINT8 *Info,
|
---|
4324 | IN UINTN InfoSize,
|
---|
4325 | OUT UINT8 *Out,
|
---|
4326 | IN UINTN OutSize
|
---|
4327 | )
|
---|
4328 | {
|
---|
4329 | return CALL_BASECRYPTLIB (Hkdf.Services.Sha384Expand, HkdfSha384Expand, (Prk, PrkSize, Info, InfoSize, Out, OutSize), FALSE);
|
---|
4330 | }
|
---|
4331 |
|
---|
4332 | /**
|
---|
4333 | Initializes the OpenSSL library.
|
---|
4334 |
|
---|
4335 | This function registers ciphers and digests used directly and indirectly
|
---|
4336 | by SSL/TLS, and initializes the readable error messages.
|
---|
4337 | This function must be called before any other action takes places.
|
---|
4338 |
|
---|
4339 | @retval TRUE The OpenSSL library has been initialized.
|
---|
4340 | @retval FALSE Failed to initialize the OpenSSL library.
|
---|
4341 |
|
---|
4342 | **/
|
---|
4343 | BOOLEAN
|
---|
4344 | EFIAPI
|
---|
4345 | CryptoServiceTlsInitialize (
|
---|
4346 | VOID
|
---|
4347 | )
|
---|
4348 | {
|
---|
4349 | return CALL_BASECRYPTLIB (Tls.Services.Initialize, TlsInitialize, (), FALSE);
|
---|
4350 | }
|
---|
4351 |
|
---|
4352 | /**
|
---|
4353 | Free an allocated SSL_CTX object.
|
---|
4354 |
|
---|
4355 | @param[in] TlsCtx Pointer to the SSL_CTX object to be released.
|
---|
4356 |
|
---|
4357 | **/
|
---|
4358 | VOID
|
---|
4359 | EFIAPI
|
---|
4360 | CryptoServiceTlsCtxFree (
|
---|
4361 | IN VOID *TlsCtx
|
---|
4362 | )
|
---|
4363 | {
|
---|
4364 | CALL_VOID_BASECRYPTLIB (Tls.Services.CtxFree, TlsCtxFree, (TlsCtx));
|
---|
4365 | }
|
---|
4366 |
|
---|
4367 | /**
|
---|
4368 | Creates a new SSL_CTX object as framework to establish TLS/SSL enabled
|
---|
4369 | connections.
|
---|
4370 |
|
---|
4371 | @param[in] MajorVer Major Version of TLS/SSL Protocol.
|
---|
4372 | @param[in] MinorVer Minor Version of TLS/SSL Protocol.
|
---|
4373 |
|
---|
4374 | @return Pointer to an allocated SSL_CTX object.
|
---|
4375 | If the creation failed, TlsCtxNew() returns NULL.
|
---|
4376 |
|
---|
4377 | **/
|
---|
4378 | VOID *
|
---|
4379 | EFIAPI
|
---|
4380 | CryptoServiceTlsCtxNew (
|
---|
4381 | IN UINT8 MajorVer,
|
---|
4382 | IN UINT8 MinorVer
|
---|
4383 | )
|
---|
4384 | {
|
---|
4385 | return CALL_BASECRYPTLIB (Tls.Services.CtxNew, TlsCtxNew, (MajorVer, MinorVer), NULL);
|
---|
4386 | }
|
---|
4387 |
|
---|
4388 | /**
|
---|
4389 | Free an allocated TLS object.
|
---|
4390 |
|
---|
4391 | This function removes the TLS object pointed to by Tls and frees up the
|
---|
4392 | allocated memory. If Tls is NULL, nothing is done.
|
---|
4393 |
|
---|
4394 | @param[in] Tls Pointer to the TLS object to be freed.
|
---|
4395 |
|
---|
4396 | **/
|
---|
4397 | VOID
|
---|
4398 | EFIAPI
|
---|
4399 | CryptoServiceTlsFree (
|
---|
4400 | IN VOID *Tls
|
---|
4401 | )
|
---|
4402 | {
|
---|
4403 | CALL_VOID_BASECRYPTLIB (Tls.Services.Free, TlsFree, (Tls));
|
---|
4404 | }
|
---|
4405 |
|
---|
4406 | /**
|
---|
4407 | Create a new TLS object for a connection.
|
---|
4408 |
|
---|
4409 | This function creates a new TLS object for a connection. The new object
|
---|
4410 | inherits the setting of the underlying context TlsCtx: connection method,
|
---|
4411 | options, verification setting.
|
---|
4412 |
|
---|
4413 | @param[in] TlsCtx Pointer to the SSL_CTX object.
|
---|
4414 |
|
---|
4415 | @return Pointer to an allocated SSL object.
|
---|
4416 | If the creation failed, TlsNew() returns NULL.
|
---|
4417 |
|
---|
4418 | **/
|
---|
4419 | VOID *
|
---|
4420 | EFIAPI
|
---|
4421 | CryptoServiceTlsNew (
|
---|
4422 | IN VOID *TlsCtx
|
---|
4423 | )
|
---|
4424 | {
|
---|
4425 | return CALL_BASECRYPTLIB (Tls.Services.New, TlsNew, (TlsCtx), NULL);
|
---|
4426 | }
|
---|
4427 |
|
---|
4428 | /**
|
---|
4429 | Checks if the TLS handshake was done.
|
---|
4430 |
|
---|
4431 | This function will check if the specified TLS handshake was done.
|
---|
4432 |
|
---|
4433 | @param[in] Tls Pointer to the TLS object for handshake state checking.
|
---|
4434 |
|
---|
4435 | @retval TRUE The TLS handshake was done.
|
---|
4436 | @retval FALSE The TLS handshake was not done.
|
---|
4437 |
|
---|
4438 | **/
|
---|
4439 | BOOLEAN
|
---|
4440 | EFIAPI
|
---|
4441 | CryptoServiceTlsInHandshake (
|
---|
4442 | IN VOID *Tls
|
---|
4443 | )
|
---|
4444 | {
|
---|
4445 | return CALL_BASECRYPTLIB (Tls.Services.InHandshake, TlsInHandshake, (Tls), FALSE);
|
---|
4446 | }
|
---|
4447 |
|
---|
4448 | /**
|
---|
4449 | Perform a TLS/SSL handshake.
|
---|
4450 |
|
---|
4451 | This function will perform a TLS/SSL handshake.
|
---|
4452 |
|
---|
4453 | @param[in] Tls Pointer to the TLS object for handshake operation.
|
---|
4454 | @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.
|
---|
4455 | @param[in] BufferInSize Packet size in bytes for the most recently received TLS
|
---|
4456 | Handshake packet.
|
---|
4457 | @param[out] BufferOut Pointer to the buffer to hold the built packet.
|
---|
4458 | @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
|
---|
4459 | the buffer size provided by the caller. On output, it
|
---|
4460 | is the buffer size in fact needed to contain the
|
---|
4461 | packet.
|
---|
4462 |
|
---|
4463 | @retval EFI_SUCCESS The required TLS packet is built successfully.
|
---|
4464 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
4465 | Tls is NULL.
|
---|
4466 | BufferIn is NULL but BufferInSize is NOT 0.
|
---|
4467 | BufferInSize is 0 but BufferIn is NOT NULL.
|
---|
4468 | BufferOutSize is NULL.
|
---|
4469 | BufferOut is NULL if *BufferOutSize is not zero.
|
---|
4470 | @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
|
---|
4471 | @retval EFI_ABORTED Something wrong during handshake.
|
---|
4472 |
|
---|
4473 | **/
|
---|
4474 | EFI_STATUS
|
---|
4475 | EFIAPI
|
---|
4476 | CryptoServiceTlsDoHandshake (
|
---|
4477 | IN VOID *Tls,
|
---|
4478 | IN UINT8 *BufferIn OPTIONAL,
|
---|
4479 | IN UINTN BufferInSize OPTIONAL,
|
---|
4480 | OUT UINT8 *BufferOut OPTIONAL,
|
---|
4481 | IN OUT UINTN *BufferOutSize
|
---|
4482 | )
|
---|
4483 | {
|
---|
4484 | return CALL_BASECRYPTLIB (Tls.Services.DoHandshake, TlsDoHandshake, (Tls, BufferIn, BufferInSize, BufferOut, BufferOutSize), EFI_UNSUPPORTED);
|
---|
4485 | }
|
---|
4486 |
|
---|
4487 | /**
|
---|
4488 | Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,
|
---|
4489 | TLS session has errors and the response packet needs to be Alert message based on error type.
|
---|
4490 |
|
---|
4491 | @param[in] Tls Pointer to the TLS object for state checking.
|
---|
4492 | @param[in] BufferIn Pointer to the most recently received TLS Alert packet.
|
---|
4493 | @param[in] BufferInSize Packet size in bytes for the most recently received TLS
|
---|
4494 | Alert packet.
|
---|
4495 | @param[out] BufferOut Pointer to the buffer to hold the built packet.
|
---|
4496 | @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
|
---|
4497 | the buffer size provided by the caller. On output, it
|
---|
4498 | is the buffer size in fact needed to contain the
|
---|
4499 | packet.
|
---|
4500 |
|
---|
4501 | @retval EFI_SUCCESS The required TLS packet is built successfully.
|
---|
4502 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
4503 | Tls is NULL.
|
---|
4504 | BufferIn is NULL but BufferInSize is NOT 0.
|
---|
4505 | BufferInSize is 0 but BufferIn is NOT NULL.
|
---|
4506 | BufferOutSize is NULL.
|
---|
4507 | BufferOut is NULL if *BufferOutSize is not zero.
|
---|
4508 | @retval EFI_ABORTED An error occurred.
|
---|
4509 | @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
|
---|
4510 |
|
---|
4511 | **/
|
---|
4512 | EFI_STATUS
|
---|
4513 | EFIAPI
|
---|
4514 | CryptoServiceTlsHandleAlert (
|
---|
4515 | IN VOID *Tls,
|
---|
4516 | IN UINT8 *BufferIn OPTIONAL,
|
---|
4517 | IN UINTN BufferInSize OPTIONAL,
|
---|
4518 | OUT UINT8 *BufferOut OPTIONAL,
|
---|
4519 | IN OUT UINTN *BufferOutSize
|
---|
4520 | )
|
---|
4521 | {
|
---|
4522 | return CALL_BASECRYPTLIB (Tls.Services.HandleAlert, TlsHandleAlert, (Tls, BufferIn, BufferInSize, BufferOut, BufferOutSize), EFI_UNSUPPORTED);
|
---|
4523 | }
|
---|
4524 |
|
---|
4525 | /**
|
---|
4526 | Build the CloseNotify packet.
|
---|
4527 |
|
---|
4528 | @param[in] Tls Pointer to the TLS object for state checking.
|
---|
4529 | @param[in, out] Buffer Pointer to the buffer to hold the built packet.
|
---|
4530 | @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is
|
---|
4531 | the buffer size provided by the caller. On output, it
|
---|
4532 | is the buffer size in fact needed to contain the
|
---|
4533 | packet.
|
---|
4534 |
|
---|
4535 | @retval EFI_SUCCESS The required TLS packet is built successfully.
|
---|
4536 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
4537 | Tls is NULL.
|
---|
4538 | BufferSize is NULL.
|
---|
4539 | Buffer is NULL if *BufferSize is not zero.
|
---|
4540 | @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.
|
---|
4541 |
|
---|
4542 | **/
|
---|
4543 | EFI_STATUS
|
---|
4544 | EFIAPI
|
---|
4545 | CryptoServiceTlsCloseNotify (
|
---|
4546 | IN VOID *Tls,
|
---|
4547 | IN OUT UINT8 *Buffer,
|
---|
4548 | IN OUT UINTN *BufferSize
|
---|
4549 | )
|
---|
4550 | {
|
---|
4551 | return CALL_BASECRYPTLIB (Tls.Services.CloseNotify, TlsCloseNotify, (Tls, Buffer, BufferSize), EFI_UNSUPPORTED);
|
---|
4552 | }
|
---|
4553 |
|
---|
4554 | /**
|
---|
4555 | Attempts to read bytes from one TLS object and places the data in Buffer.
|
---|
4556 |
|
---|
4557 | This function will attempt to read BufferSize bytes from the TLS object
|
---|
4558 | and places the data in Buffer.
|
---|
4559 |
|
---|
4560 | @param[in] Tls Pointer to the TLS object.
|
---|
4561 | @param[in,out] Buffer Pointer to the buffer to store the data.
|
---|
4562 | @param[in] BufferSize The size of Buffer in bytes.
|
---|
4563 |
|
---|
4564 | @retval >0 The amount of data successfully read from the TLS object.
|
---|
4565 | @retval <=0 No data was successfully read.
|
---|
4566 |
|
---|
4567 | **/
|
---|
4568 | INTN
|
---|
4569 | EFIAPI
|
---|
4570 | CryptoServiceTlsCtrlTrafficOut (
|
---|
4571 | IN VOID *Tls,
|
---|
4572 | IN OUT VOID *Buffer,
|
---|
4573 | IN UINTN BufferSize
|
---|
4574 | )
|
---|
4575 | {
|
---|
4576 | return CALL_BASECRYPTLIB (Tls.Services.CtrlTrafficOut, TlsCtrlTrafficOut, (Tls, Buffer, BufferSize), 0);
|
---|
4577 | }
|
---|
4578 |
|
---|
4579 | /**
|
---|
4580 | Attempts to write data from the buffer to TLS object.
|
---|
4581 |
|
---|
4582 | This function will attempt to write BufferSize bytes data from the Buffer
|
---|
4583 | to the TLS object.
|
---|
4584 |
|
---|
4585 | @param[in] Tls Pointer to the TLS object.
|
---|
4586 | @param[in] Buffer Pointer to the data buffer.
|
---|
4587 | @param[in] BufferSize The size of Buffer in bytes.
|
---|
4588 |
|
---|
4589 | @retval >0 The amount of data successfully written to the TLS object.
|
---|
4590 | @retval <=0 No data was successfully written.
|
---|
4591 |
|
---|
4592 | **/
|
---|
4593 | INTN
|
---|
4594 | EFIAPI
|
---|
4595 | CryptoServiceTlsCtrlTrafficIn (
|
---|
4596 | IN VOID *Tls,
|
---|
4597 | IN VOID *Buffer,
|
---|
4598 | IN UINTN BufferSize
|
---|
4599 | )
|
---|
4600 | {
|
---|
4601 | return CALL_BASECRYPTLIB (Tls.Services.CtrlTrafficIn, TlsCtrlTrafficIn, (Tls, Buffer, BufferSize), 0);
|
---|
4602 | }
|
---|
4603 |
|
---|
4604 | /**
|
---|
4605 | Attempts to read bytes from the specified TLS connection into the buffer.
|
---|
4606 |
|
---|
4607 | This function tries to read BufferSize bytes data from the specified TLS
|
---|
4608 | connection into the Buffer.
|
---|
4609 |
|
---|
4610 | @param[in] Tls Pointer to the TLS connection for data reading.
|
---|
4611 | @param[in,out] Buffer Pointer to the data buffer.
|
---|
4612 | @param[in] BufferSize The size of Buffer in bytes.
|
---|
4613 |
|
---|
4614 | @retval >0 The read operation was successful, and return value is the
|
---|
4615 | number of bytes actually read from the TLS connection.
|
---|
4616 | @retval <=0 The read operation was not successful.
|
---|
4617 |
|
---|
4618 | **/
|
---|
4619 | INTN
|
---|
4620 | EFIAPI
|
---|
4621 | CryptoServiceTlsRead (
|
---|
4622 | IN VOID *Tls,
|
---|
4623 | IN OUT VOID *Buffer,
|
---|
4624 | IN UINTN BufferSize
|
---|
4625 | )
|
---|
4626 | {
|
---|
4627 | return CALL_BASECRYPTLIB (Tls.Services.Read, TlsRead, (Tls, Buffer, BufferSize), 0);
|
---|
4628 | }
|
---|
4629 |
|
---|
4630 | /**
|
---|
4631 | Attempts to write data to a TLS connection.
|
---|
4632 |
|
---|
4633 | This function tries to write BufferSize bytes data from the Buffer into the
|
---|
4634 | specified TLS connection.
|
---|
4635 |
|
---|
4636 | @param[in] Tls Pointer to the TLS connection for data writing.
|
---|
4637 | @param[in] Buffer Pointer to the data buffer.
|
---|
4638 | @param[in] BufferSize The size of Buffer in bytes.
|
---|
4639 |
|
---|
4640 | @retval >0 The write operation was successful, and return value is the
|
---|
4641 | number of bytes actually written to the TLS connection.
|
---|
4642 | @retval <=0 The write operation was not successful.
|
---|
4643 |
|
---|
4644 | **/
|
---|
4645 | INTN
|
---|
4646 | EFIAPI
|
---|
4647 | CryptoServiceTlsWrite (
|
---|
4648 | IN VOID *Tls,
|
---|
4649 | IN VOID *Buffer,
|
---|
4650 | IN UINTN BufferSize
|
---|
4651 | )
|
---|
4652 | {
|
---|
4653 | return CALL_BASECRYPTLIB (Tls.Services.Write, TlsWrite, (Tls, Buffer, BufferSize), 0);
|
---|
4654 | }
|
---|
4655 |
|
---|
4656 | /**
|
---|
4657 | Shutdown a TLS connection.
|
---|
4658 |
|
---|
4659 | Shutdown the TLS connection without releasing the resources, meaning a new
|
---|
4660 | connection can be started without calling TlsNew() and without setting
|
---|
4661 | certificates etc.
|
---|
4662 |
|
---|
4663 | @param[in] Tls Pointer to the TLS object to shutdown.
|
---|
4664 |
|
---|
4665 | @retval EFI_SUCCESS The TLS is shutdown successfully.
|
---|
4666 | @retval EFI_INVALID_PARAMETER Tls is NULL.
|
---|
4667 | @retval EFI_PROTOCOL_ERROR Some other error occurred.
|
---|
4668 | **/
|
---|
4669 | EFI_STATUS
|
---|
4670 | EFIAPI
|
---|
4671 | CryptoServiceTlsShutdown (
|
---|
4672 | IN VOID *Tls
|
---|
4673 | )
|
---|
4674 | {
|
---|
4675 | return CALL_BASECRYPTLIB (Tls.Services.Shutdown, TlsShutdown, (Tls), EFI_UNSUPPORTED);
|
---|
4676 | }
|
---|
4677 |
|
---|
4678 | /**
|
---|
4679 | Set a new TLS/SSL method for a particular TLS object.
|
---|
4680 |
|
---|
4681 | This function sets a new TLS/SSL method for a particular TLS object.
|
---|
4682 |
|
---|
4683 | @param[in] Tls Pointer to a TLS object.
|
---|
4684 | @param[in] MajorVer Major Version of TLS/SSL Protocol.
|
---|
4685 | @param[in] MinorVer Minor Version of TLS/SSL Protocol.
|
---|
4686 |
|
---|
4687 | @retval EFI_SUCCESS The TLS/SSL method was set successfully.
|
---|
4688 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
4689 | @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.
|
---|
4690 |
|
---|
4691 | **/
|
---|
4692 | EFI_STATUS
|
---|
4693 | EFIAPI
|
---|
4694 | CryptoServiceTlsSetVersion (
|
---|
4695 | IN VOID *Tls,
|
---|
4696 | IN UINT8 MajorVer,
|
---|
4697 | IN UINT8 MinorVer
|
---|
4698 | )
|
---|
4699 | {
|
---|
4700 | return CALL_BASECRYPTLIB (TlsSet.Services.Version, TlsSetVersion, (Tls, MajorVer, MinorVer), EFI_UNSUPPORTED);
|
---|
4701 | }
|
---|
4702 |
|
---|
4703 | /**
|
---|
4704 | Set TLS object to work in client or server mode.
|
---|
4705 |
|
---|
4706 | This function prepares a TLS object to work in client or server mode.
|
---|
4707 |
|
---|
4708 | @param[in] Tls Pointer to a TLS object.
|
---|
4709 | @param[in] IsServer Work in server mode.
|
---|
4710 |
|
---|
4711 | @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.
|
---|
4712 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
4713 | @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.
|
---|
4714 |
|
---|
4715 | **/
|
---|
4716 | EFI_STATUS
|
---|
4717 | EFIAPI
|
---|
4718 | CryptoServiceTlsSetConnectionEnd (
|
---|
4719 | IN VOID *Tls,
|
---|
4720 | IN BOOLEAN IsServer
|
---|
4721 | )
|
---|
4722 | {
|
---|
4723 | return CALL_BASECRYPTLIB (TlsSet.Services.ConnectionEnd, TlsSetConnectionEnd, (Tls, IsServer), EFI_UNSUPPORTED);
|
---|
4724 | }
|
---|
4725 |
|
---|
4726 | /**
|
---|
4727 | Set the ciphers list to be used by the TLS object.
|
---|
4728 |
|
---|
4729 | This function sets the ciphers for use by a specified TLS object.
|
---|
4730 |
|
---|
4731 | @param[in] Tls Pointer to a TLS object.
|
---|
4732 | @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16
|
---|
4733 | cipher identifier comes from the TLS Cipher Suite
|
---|
4734 | Registry of the IANA, interpreting Byte1 and Byte2
|
---|
4735 | in network (big endian) byte order.
|
---|
4736 | @param[in] CipherNum The number of cipher in the list.
|
---|
4737 |
|
---|
4738 | @retval EFI_SUCCESS The ciphers list was set successfully.
|
---|
4739 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
4740 | @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.
|
---|
4741 | @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
|
---|
4742 |
|
---|
4743 | **/
|
---|
4744 | EFI_STATUS
|
---|
4745 | EFIAPI
|
---|
4746 | CryptoServiceTlsSetCipherList (
|
---|
4747 | IN VOID *Tls,
|
---|
4748 | IN UINT16 *CipherId,
|
---|
4749 | IN UINTN CipherNum
|
---|
4750 | )
|
---|
4751 | {
|
---|
4752 | return CALL_BASECRYPTLIB (TlsSet.Services.CipherList, TlsSetCipherList, (Tls, CipherId, CipherNum), EFI_UNSUPPORTED);
|
---|
4753 | }
|
---|
4754 |
|
---|
4755 | /**
|
---|
4756 | Set the compression method for TLS/SSL operations.
|
---|
4757 |
|
---|
4758 | This function handles TLS/SSL integrated compression methods.
|
---|
4759 |
|
---|
4760 | @param[in] CompMethod The compression method ID.
|
---|
4761 |
|
---|
4762 | @retval EFI_SUCCESS The compression method for the communication was
|
---|
4763 | set successfully.
|
---|
4764 | @retval EFI_UNSUPPORTED Unsupported compression method.
|
---|
4765 |
|
---|
4766 | **/
|
---|
4767 | EFI_STATUS
|
---|
4768 | EFIAPI
|
---|
4769 | CryptoServiceTlsSetCompressionMethod (
|
---|
4770 | IN UINT8 CompMethod
|
---|
4771 | )
|
---|
4772 | {
|
---|
4773 | return CALL_BASECRYPTLIB (TlsSet.Services.CompressionMethod, TlsSetCompressionMethod, (CompMethod), EFI_UNSUPPORTED);
|
---|
4774 | }
|
---|
4775 |
|
---|
4776 | /**
|
---|
4777 | Set peer certificate verification mode for the TLS connection.
|
---|
4778 |
|
---|
4779 | This function sets the verification mode flags for the TLS connection.
|
---|
4780 |
|
---|
4781 | @param[in] Tls Pointer to the TLS object.
|
---|
4782 | @param[in] VerifyMode A set of logically or'ed verification mode flags.
|
---|
4783 |
|
---|
4784 | **/
|
---|
4785 | VOID
|
---|
4786 | EFIAPI
|
---|
4787 | CryptoServiceTlsSetVerify (
|
---|
4788 | IN VOID *Tls,
|
---|
4789 | IN UINT32 VerifyMode
|
---|
4790 | )
|
---|
4791 | {
|
---|
4792 | CALL_VOID_BASECRYPTLIB (TlsSet.Services.Verify, TlsSetVerify, (Tls, VerifyMode));
|
---|
4793 | }
|
---|
4794 |
|
---|
4795 | /**
|
---|
4796 | Set the specified host name to be verified.
|
---|
4797 |
|
---|
4798 | @param[in] Tls Pointer to the TLS object.
|
---|
4799 | @param[in] Flags The setting flags during the validation.
|
---|
4800 | @param[in] HostName The specified host name to be verified.
|
---|
4801 |
|
---|
4802 | @retval EFI_SUCCESS The HostName setting was set successfully.
|
---|
4803 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
4804 | @retval EFI_ABORTED Invalid HostName setting.
|
---|
4805 |
|
---|
4806 | **/
|
---|
4807 | EFI_STATUS
|
---|
4808 | EFIAPI
|
---|
4809 | CryptoServiceTlsSetVerifyHost (
|
---|
4810 | IN VOID *Tls,
|
---|
4811 | IN UINT32 Flags,
|
---|
4812 | IN CHAR8 *HostName
|
---|
4813 | )
|
---|
4814 | {
|
---|
4815 | return CALL_BASECRYPTLIB (TlsSet.Services.VerifyHost, TlsSetVerifyHost, (Tls, Flags, HostName), EFI_UNSUPPORTED);
|
---|
4816 | }
|
---|
4817 |
|
---|
4818 | /**
|
---|
4819 | Sets a TLS/SSL session ID to be used during TLS/SSL connect.
|
---|
4820 |
|
---|
4821 | This function sets a session ID to be used when the TLS/SSL connection is
|
---|
4822 | to be established.
|
---|
4823 |
|
---|
4824 | @param[in] Tls Pointer to the TLS object.
|
---|
4825 | @param[in] SessionId Session ID data used for session resumption.
|
---|
4826 | @param[in] SessionIdLen Length of Session ID in bytes.
|
---|
4827 |
|
---|
4828 | @retval EFI_SUCCESS Session ID was set successfully.
|
---|
4829 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
4830 | @retval EFI_UNSUPPORTED No available session for ID setting.
|
---|
4831 |
|
---|
4832 | **/
|
---|
4833 | EFI_STATUS
|
---|
4834 | EFIAPI
|
---|
4835 | CryptoServiceTlsSetSessionId (
|
---|
4836 | IN VOID *Tls,
|
---|
4837 | IN UINT8 *SessionId,
|
---|
4838 | IN UINT16 SessionIdLen
|
---|
4839 | )
|
---|
4840 | {
|
---|
4841 | return CALL_BASECRYPTLIB (TlsSet.Services.SessionId, TlsSetSessionId, (Tls, SessionId, SessionIdLen), EFI_UNSUPPORTED);
|
---|
4842 | }
|
---|
4843 |
|
---|
4844 | /**
|
---|
4845 | Adds the CA to the cert store when requesting Server or Client authentication.
|
---|
4846 |
|
---|
4847 | This function adds the CA certificate to the list of CAs when requesting
|
---|
4848 | Server or Client authentication for the chosen TLS connection.
|
---|
4849 |
|
---|
4850 | @param[in] Tls Pointer to the TLS object.
|
---|
4851 | @param[in] Data Pointer to the data buffer of a DER-encoded binary
|
---|
4852 | X.509 certificate or PEM-encoded X.509 certificate.
|
---|
4853 | @param[in] DataSize The size of data buffer in bytes.
|
---|
4854 |
|
---|
4855 | @retval EFI_SUCCESS The operation succeeded.
|
---|
4856 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
4857 | @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
|
---|
4858 | @retval EFI_ABORTED Invalid X.509 certificate.
|
---|
4859 |
|
---|
4860 | **/
|
---|
4861 | EFI_STATUS
|
---|
4862 | EFIAPI
|
---|
4863 | CryptoServiceTlsSetCaCertificate (
|
---|
4864 | IN VOID *Tls,
|
---|
4865 | IN VOID *Data,
|
---|
4866 | IN UINTN DataSize
|
---|
4867 | )
|
---|
4868 | {
|
---|
4869 | return CALL_BASECRYPTLIB (TlsSet.Services.CaCertificate, TlsSetCaCertificate, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
4870 | }
|
---|
4871 |
|
---|
4872 | /**
|
---|
4873 | Loads the local public certificate into the specified TLS object.
|
---|
4874 |
|
---|
4875 | This function loads the X.509 certificate into the specified TLS object
|
---|
4876 | for TLS negotiation.
|
---|
4877 |
|
---|
4878 | @param[in] Tls Pointer to the TLS object.
|
---|
4879 | @param[in] Data Pointer to the data buffer of a DER-encoded binary
|
---|
4880 | X.509 certificate or PEM-encoded X.509 certificate.
|
---|
4881 | @param[in] DataSize The size of data buffer in bytes.
|
---|
4882 |
|
---|
4883 | @retval EFI_SUCCESS The operation succeeded.
|
---|
4884 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
4885 | @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
|
---|
4886 | @retval EFI_ABORTED Invalid X.509 certificate.
|
---|
4887 |
|
---|
4888 | **/
|
---|
4889 | EFI_STATUS
|
---|
4890 | EFIAPI
|
---|
4891 | CryptoServiceTlsSetHostPublicCert (
|
---|
4892 | IN VOID *Tls,
|
---|
4893 | IN VOID *Data,
|
---|
4894 | IN UINTN DataSize
|
---|
4895 | )
|
---|
4896 | {
|
---|
4897 | return CALL_BASECRYPTLIB (TlsSet.Services.HostPublicCert, TlsSetHostPublicCert, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
4898 | }
|
---|
4899 |
|
---|
4900 | /**
|
---|
4901 | Adds the local private key to the specified TLS object.
|
---|
4902 |
|
---|
4903 | This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private
|
---|
4904 | key) into the specified TLS object for TLS negotiation.
|
---|
4905 |
|
---|
4906 | @param[in] Tls Pointer to the TLS object.
|
---|
4907 | @param[in] Data Pointer to the data buffer of a DER-encoded or PEM-encoded
|
---|
4908 | or PKCS#8 private key.
|
---|
4909 | @param[in] DataSize The size of data buffer in bytes.
|
---|
4910 | @param[in] Password Pointer to NULL-terminated private key password, set it to NULL
|
---|
4911 | if private key not encrypted.
|
---|
4912 |
|
---|
4913 | @retval EFI_SUCCESS The operation succeeded.
|
---|
4914 | @retval EFI_UNSUPPORTED This function is not supported.
|
---|
4915 | @retval EFI_ABORTED Invalid private key data.
|
---|
4916 |
|
---|
4917 | **/
|
---|
4918 | EFI_STATUS
|
---|
4919 | EFIAPI
|
---|
4920 | CryptoServiceTlsSetHostPrivateKeyEx (
|
---|
4921 | IN VOID *Tls,
|
---|
4922 | IN VOID *Data,
|
---|
4923 | IN UINTN DataSize,
|
---|
4924 | IN VOID *Password OPTIONAL
|
---|
4925 | )
|
---|
4926 | {
|
---|
4927 | return CALL_BASECRYPTLIB (TlsSet.Services.HostPrivateKeyEx, TlsSetHostPrivateKeyEx, (Tls, Data, DataSize, Password), EFI_UNSUPPORTED);
|
---|
4928 | }
|
---|
4929 |
|
---|
4930 | /**
|
---|
4931 | Adds the local private key to the specified TLS object.
|
---|
4932 |
|
---|
4933 | This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private
|
---|
4934 | key) into the specified TLS object for TLS negotiation.
|
---|
4935 |
|
---|
4936 | @param[in] Tls Pointer to the TLS object.
|
---|
4937 | @param[in] Data Pointer to the data buffer of a DER-encoded or PEM-encoded
|
---|
4938 | or PKCS#8 private key.
|
---|
4939 | @param[in] DataSize The size of data buffer in bytes.
|
---|
4940 |
|
---|
4941 | @retval EFI_SUCCESS The operation succeeded.
|
---|
4942 | @retval EFI_UNSUPPORTED This function is not supported.
|
---|
4943 | @retval EFI_ABORTED Invalid private key data.
|
---|
4944 |
|
---|
4945 | **/
|
---|
4946 | EFI_STATUS
|
---|
4947 | EFIAPI
|
---|
4948 | CryptoServiceTlsSetHostPrivateKey (
|
---|
4949 | IN VOID *Tls,
|
---|
4950 | IN VOID *Data,
|
---|
4951 | IN UINTN DataSize
|
---|
4952 | )
|
---|
4953 | {
|
---|
4954 | return CALL_BASECRYPTLIB (TlsSet.Services.HostPrivateKey, TlsSetHostPrivateKey, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
4955 | }
|
---|
4956 |
|
---|
4957 | /**
|
---|
4958 | Adds the CA-supplied certificate revocation list for certificate validation.
|
---|
4959 |
|
---|
4960 | This function adds the CA-supplied certificate revocation list data for
|
---|
4961 | certificate validity checking.
|
---|
4962 |
|
---|
4963 | @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
|
---|
4964 | @param[in] DataSize The size of data buffer in bytes.
|
---|
4965 |
|
---|
4966 | @retval EFI_SUCCESS The operation succeeded.
|
---|
4967 | @retval EFI_UNSUPPORTED This function is not supported.
|
---|
4968 | @retval EFI_ABORTED Invalid CRL data.
|
---|
4969 |
|
---|
4970 | **/
|
---|
4971 | EFI_STATUS
|
---|
4972 | EFIAPI
|
---|
4973 | CryptoServiceTlsSetCertRevocationList (
|
---|
4974 | IN VOID *Data,
|
---|
4975 | IN UINTN DataSize
|
---|
4976 | )
|
---|
4977 | {
|
---|
4978 | return CALL_BASECRYPTLIB (TlsSet.Services.CertRevocationList, TlsSetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED);
|
---|
4979 | }
|
---|
4980 |
|
---|
4981 | /**
|
---|
4982 | Set the signature algorithm list to used by the TLS object.
|
---|
4983 |
|
---|
4984 | This function sets the signature algorithms for use by a specified TLS object.
|
---|
4985 |
|
---|
4986 | @param[in] Tls Pointer to a TLS object.
|
---|
4987 | @param[in] Data Array of UINT8 of signature algorithms. The array consists of
|
---|
4988 | pairs of the hash algorithm and the signature algorithm as defined
|
---|
4989 | in RFC 5246
|
---|
4990 | @param[in] DataSize The length the SignatureAlgoList. Must be divisible by 2.
|
---|
4991 |
|
---|
4992 | @retval EFI_SUCCESS The signature algorithm list was set successfully.
|
---|
4993 | @retval EFI_INVALID_PARAMETER The parameters are invalid.
|
---|
4994 | @retval EFI_UNSUPPORTED No supported TLS signature algorithm was found in SignatureAlgoList
|
---|
4995 | @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
|
---|
4996 |
|
---|
4997 | **/
|
---|
4998 | EFI_STATUS
|
---|
4999 | EFIAPI
|
---|
5000 | CryptoServiceTlsSetSignatureAlgoList (
|
---|
5001 | IN VOID *Tls,
|
---|
5002 | IN UINT8 *Data,
|
---|
5003 | IN UINTN DataSize
|
---|
5004 | )
|
---|
5005 | {
|
---|
5006 | return CALL_BASECRYPTLIB (TlsSet.Services.SignatureAlgoList, TlsSetSignatureAlgoList, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
5007 | }
|
---|
5008 |
|
---|
5009 | /**
|
---|
5010 | Set the EC curve to be used for TLS flows
|
---|
5011 |
|
---|
5012 | This function sets the EC curve to be used for TLS flows.
|
---|
5013 |
|
---|
5014 | @param[in] Tls Pointer to a TLS object.
|
---|
5015 | @param[in] Data An EC named curve as defined in section 5.1.1 of RFC 4492.
|
---|
5016 | @param[in] DataSize Size of Data, it should be sizeof (UINT32)
|
---|
5017 |
|
---|
5018 | @retval EFI_SUCCESS The EC curve was set successfully.
|
---|
5019 | @retval EFI_INVALID_PARAMETER The parameters are invalid.
|
---|
5020 | @retval EFI_UNSUPPORTED The requested TLS EC curve is not supported
|
---|
5021 |
|
---|
5022 | **/
|
---|
5023 | EFI_STATUS
|
---|
5024 | EFIAPI
|
---|
5025 | CryptoServiceTlsSetEcCurve (
|
---|
5026 | IN VOID *Tls,
|
---|
5027 | IN UINT8 *Data,
|
---|
5028 | IN UINTN DataSize
|
---|
5029 | )
|
---|
5030 | {
|
---|
5031 | return CALL_BASECRYPTLIB (TlsSet.Services.EcCurve, TlsSetEcCurve, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
5032 | }
|
---|
5033 |
|
---|
5034 | /**
|
---|
5035 | Gets the protocol version used by the specified TLS connection.
|
---|
5036 |
|
---|
5037 | This function returns the protocol version used by the specified TLS
|
---|
5038 | connection.
|
---|
5039 |
|
---|
5040 | If Tls is NULL, then ASSERT().
|
---|
5041 |
|
---|
5042 | @param[in] Tls Pointer to the TLS object.
|
---|
5043 |
|
---|
5044 | @return The protocol version of the specified TLS connection.
|
---|
5045 |
|
---|
5046 | **/
|
---|
5047 | UINT16
|
---|
5048 | EFIAPI
|
---|
5049 | CryptoServiceTlsGetVersion (
|
---|
5050 | IN VOID *Tls
|
---|
5051 | )
|
---|
5052 | {
|
---|
5053 | return CALL_BASECRYPTLIB (TlsGet.Services.Version, TlsGetVersion, (Tls), 0);
|
---|
5054 | }
|
---|
5055 |
|
---|
5056 | /**
|
---|
5057 | Gets the connection end of the specified TLS connection.
|
---|
5058 |
|
---|
5059 | This function returns the connection end (as client or as server) used by
|
---|
5060 | the specified TLS connection.
|
---|
5061 |
|
---|
5062 | If Tls is NULL, then ASSERT().
|
---|
5063 |
|
---|
5064 | @param[in] Tls Pointer to the TLS object.
|
---|
5065 |
|
---|
5066 | @return The connection end used by the specified TLS connection.
|
---|
5067 |
|
---|
5068 | **/
|
---|
5069 | UINT8
|
---|
5070 | EFIAPI
|
---|
5071 | CryptoServiceTlsGetConnectionEnd (
|
---|
5072 | IN VOID *Tls
|
---|
5073 | )
|
---|
5074 | {
|
---|
5075 | return CALL_BASECRYPTLIB (TlsGet.Services.ConnectionEnd, TlsGetConnectionEnd, (Tls), 0);
|
---|
5076 | }
|
---|
5077 |
|
---|
5078 | /**
|
---|
5079 | Gets the cipher suite used by the specified TLS connection.
|
---|
5080 |
|
---|
5081 | This function returns current cipher suite used by the specified
|
---|
5082 | TLS connection.
|
---|
5083 |
|
---|
5084 | @param[in] Tls Pointer to the TLS object.
|
---|
5085 | @param[in,out] CipherId The cipher suite used by the TLS object.
|
---|
5086 |
|
---|
5087 | @retval EFI_SUCCESS The cipher suite was returned successfully.
|
---|
5088 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
5089 | @retval EFI_UNSUPPORTED Unsupported cipher suite.
|
---|
5090 |
|
---|
5091 | **/
|
---|
5092 | EFI_STATUS
|
---|
5093 | EFIAPI
|
---|
5094 | CryptoServiceTlsGetCurrentCipher (
|
---|
5095 | IN VOID *Tls,
|
---|
5096 | IN OUT UINT16 *CipherId
|
---|
5097 | )
|
---|
5098 | {
|
---|
5099 | return CALL_BASECRYPTLIB (TlsGet.Services.CurrentCipher, TlsGetCurrentCipher, (Tls, CipherId), EFI_UNSUPPORTED);
|
---|
5100 | }
|
---|
5101 |
|
---|
5102 | /**
|
---|
5103 | Gets the compression methods used by the specified TLS connection.
|
---|
5104 |
|
---|
5105 | This function returns current integrated compression methods used by
|
---|
5106 | the specified TLS connection.
|
---|
5107 |
|
---|
5108 | @param[in] Tls Pointer to the TLS object.
|
---|
5109 | @param[in,out] CompressionId The current compression method used by
|
---|
5110 | the TLS object.
|
---|
5111 |
|
---|
5112 | @retval EFI_SUCCESS The compression method was returned successfully.
|
---|
5113 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
5114 | @retval EFI_ABORTED Invalid Compression method.
|
---|
5115 | @retval EFI_UNSUPPORTED This function is not supported.
|
---|
5116 |
|
---|
5117 | **/
|
---|
5118 | EFI_STATUS
|
---|
5119 | EFIAPI
|
---|
5120 | CryptoServiceTlsGetCurrentCompressionId (
|
---|
5121 | IN VOID *Tls,
|
---|
5122 | IN OUT UINT8 *CompressionId
|
---|
5123 | )
|
---|
5124 | {
|
---|
5125 | return CALL_BASECRYPTLIB (TlsGet.Services.CurrentCompressionId, TlsGetCurrentCompressionId, (Tls, CompressionId), EFI_UNSUPPORTED);
|
---|
5126 | }
|
---|
5127 |
|
---|
5128 | /**
|
---|
5129 | Gets the verification mode currently set in the TLS connection.
|
---|
5130 |
|
---|
5131 | This function returns the peer verification mode currently set in the
|
---|
5132 | specified TLS connection.
|
---|
5133 |
|
---|
5134 | If Tls is NULL, then ASSERT().
|
---|
5135 |
|
---|
5136 | @param[in] Tls Pointer to the TLS object.
|
---|
5137 |
|
---|
5138 | @return The verification mode set in the specified TLS connection.
|
---|
5139 |
|
---|
5140 | **/
|
---|
5141 | UINT32
|
---|
5142 | EFIAPI
|
---|
5143 | CryptoServiceTlsGetVerify (
|
---|
5144 | IN VOID *Tls
|
---|
5145 | )
|
---|
5146 | {
|
---|
5147 | return CALL_BASECRYPTLIB (TlsGet.Services.Verify, TlsGetVerify, (Tls), 0);
|
---|
5148 | }
|
---|
5149 |
|
---|
5150 | /**
|
---|
5151 | Gets the session ID used by the specified TLS connection.
|
---|
5152 |
|
---|
5153 | This function returns the TLS/SSL session ID currently used by the
|
---|
5154 | specified TLS connection.
|
---|
5155 |
|
---|
5156 | @param[in] Tls Pointer to the TLS object.
|
---|
5157 | @param[in,out] SessionId Buffer to contain the returned session ID.
|
---|
5158 | @param[in,out] SessionIdLen The length of Session ID in bytes.
|
---|
5159 |
|
---|
5160 | @retval EFI_SUCCESS The Session ID was returned successfully.
|
---|
5161 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
5162 | @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
|
---|
5163 |
|
---|
5164 | **/
|
---|
5165 | EFI_STATUS
|
---|
5166 | EFIAPI
|
---|
5167 | CryptoServiceTlsGetSessionId (
|
---|
5168 | IN VOID *Tls,
|
---|
5169 | IN OUT UINT8 *SessionId,
|
---|
5170 | IN OUT UINT16 *SessionIdLen
|
---|
5171 | )
|
---|
5172 | {
|
---|
5173 | return CALL_BASECRYPTLIB (TlsGet.Services.SessionId, TlsGetSessionId, (Tls, SessionId, SessionIdLen), EFI_UNSUPPORTED);
|
---|
5174 | }
|
---|
5175 |
|
---|
5176 | /**
|
---|
5177 | Gets the client random data used in the specified TLS connection.
|
---|
5178 |
|
---|
5179 | This function returns the TLS/SSL client random data currently used in
|
---|
5180 | the specified TLS connection.
|
---|
5181 |
|
---|
5182 | @param[in] Tls Pointer to the TLS object.
|
---|
5183 | @param[in,out] ClientRandom Buffer to contain the returned client
|
---|
5184 | random data (32 bytes).
|
---|
5185 |
|
---|
5186 | **/
|
---|
5187 | VOID
|
---|
5188 | EFIAPI
|
---|
5189 | CryptoServiceTlsGetClientRandom (
|
---|
5190 | IN VOID *Tls,
|
---|
5191 | IN OUT UINT8 *ClientRandom
|
---|
5192 | )
|
---|
5193 | {
|
---|
5194 | CALL_VOID_BASECRYPTLIB (TlsGet.Services.ClientRandom, TlsGetClientRandom, (Tls, ClientRandom));
|
---|
5195 | }
|
---|
5196 |
|
---|
5197 | /**
|
---|
5198 | Gets the server random data used in the specified TLS connection.
|
---|
5199 |
|
---|
5200 | This function returns the TLS/SSL server random data currently used in
|
---|
5201 | the specified TLS connection.
|
---|
5202 |
|
---|
5203 | @param[in] Tls Pointer to the TLS object.
|
---|
5204 | @param[in,out] ServerRandom Buffer to contain the returned server
|
---|
5205 | random data (32 bytes).
|
---|
5206 |
|
---|
5207 | **/
|
---|
5208 | VOID
|
---|
5209 | EFIAPI
|
---|
5210 | CryptoServiceTlsGetServerRandom (
|
---|
5211 | IN VOID *Tls,
|
---|
5212 | IN OUT UINT8 *ServerRandom
|
---|
5213 | )
|
---|
5214 | {
|
---|
5215 | CALL_VOID_BASECRYPTLIB (TlsGet.Services.ServerRandom, TlsGetServerRandom, (Tls, ServerRandom));
|
---|
5216 | }
|
---|
5217 |
|
---|
5218 | /**
|
---|
5219 | Gets the master key data used in the specified TLS connection.
|
---|
5220 |
|
---|
5221 | This function returns the TLS/SSL master key material currently used in
|
---|
5222 | the specified TLS connection.
|
---|
5223 |
|
---|
5224 | @param[in] Tls Pointer to the TLS object.
|
---|
5225 | @param[in,out] KeyMaterial Buffer to contain the returned key material.
|
---|
5226 |
|
---|
5227 | @retval EFI_SUCCESS Key material was returned successfully.
|
---|
5228 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
5229 | @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
|
---|
5230 |
|
---|
5231 | **/
|
---|
5232 | EFI_STATUS
|
---|
5233 | EFIAPI
|
---|
5234 | CryptoServiceTlsGetKeyMaterial (
|
---|
5235 | IN VOID *Tls,
|
---|
5236 | IN OUT UINT8 *KeyMaterial
|
---|
5237 | )
|
---|
5238 | {
|
---|
5239 | return CALL_BASECRYPTLIB (TlsGet.Services.KeyMaterial, TlsGetKeyMaterial, (Tls, KeyMaterial), EFI_UNSUPPORTED);
|
---|
5240 | }
|
---|
5241 |
|
---|
5242 | /**
|
---|
5243 | Gets the CA Certificate from the cert store.
|
---|
5244 |
|
---|
5245 | This function returns the CA certificate for the chosen
|
---|
5246 | TLS connection.
|
---|
5247 |
|
---|
5248 | @param[in] Tls Pointer to the TLS object.
|
---|
5249 | @param[out] Data Pointer to the data buffer to receive the CA
|
---|
5250 | certificate data sent to the client.
|
---|
5251 | @param[in,out] DataSize The size of data buffer in bytes.
|
---|
5252 |
|
---|
5253 | @retval EFI_SUCCESS The operation succeeded.
|
---|
5254 | @retval EFI_UNSUPPORTED This function is not supported.
|
---|
5255 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
|
---|
5256 |
|
---|
5257 | **/
|
---|
5258 | EFI_STATUS
|
---|
5259 | EFIAPI
|
---|
5260 | CryptoServiceTlsGetCaCertificate (
|
---|
5261 | IN VOID *Tls,
|
---|
5262 | OUT VOID *Data,
|
---|
5263 | IN OUT UINTN *DataSize
|
---|
5264 | )
|
---|
5265 | {
|
---|
5266 | return CALL_BASECRYPTLIB (TlsGet.Services.CaCertificate, TlsGetCaCertificate, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
5267 | }
|
---|
5268 |
|
---|
5269 | /**
|
---|
5270 | Gets the local public Certificate set in the specified TLS object.
|
---|
5271 |
|
---|
5272 | This function returns the local public certificate which was currently set
|
---|
5273 | in the specified TLS object.
|
---|
5274 |
|
---|
5275 | @param[in] Tls Pointer to the TLS object.
|
---|
5276 | @param[out] Data Pointer to the data buffer to receive the local
|
---|
5277 | public certificate.
|
---|
5278 | @param[in,out] DataSize The size of data buffer in bytes.
|
---|
5279 |
|
---|
5280 | @retval EFI_SUCCESS The operation succeeded.
|
---|
5281 | @retval EFI_INVALID_PARAMETER The parameter is invalid.
|
---|
5282 | @retval EFI_NOT_FOUND The certificate is not found.
|
---|
5283 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
|
---|
5284 |
|
---|
5285 | **/
|
---|
5286 | EFI_STATUS
|
---|
5287 | EFIAPI
|
---|
5288 | CryptoServiceTlsGetHostPublicCert (
|
---|
5289 | IN VOID *Tls,
|
---|
5290 | OUT VOID *Data,
|
---|
5291 | IN OUT UINTN *DataSize
|
---|
5292 | )
|
---|
5293 | {
|
---|
5294 | return CALL_BASECRYPTLIB (TlsGet.Services.HostPublicCert, TlsGetHostPublicCert, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
5295 | }
|
---|
5296 |
|
---|
5297 | /**
|
---|
5298 | Gets the local private key set in the specified TLS object.
|
---|
5299 |
|
---|
5300 | This function returns the local private key data which was currently set
|
---|
5301 | in the specified TLS object.
|
---|
5302 |
|
---|
5303 | @param[in] Tls Pointer to the TLS object.
|
---|
5304 | @param[out] Data Pointer to the data buffer to receive the local
|
---|
5305 | private key data.
|
---|
5306 | @param[in,out] DataSize The size of data buffer in bytes.
|
---|
5307 |
|
---|
5308 | @retval EFI_SUCCESS The operation succeeded.
|
---|
5309 | @retval EFI_UNSUPPORTED This function is not supported.
|
---|
5310 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
|
---|
5311 |
|
---|
5312 | **/
|
---|
5313 | EFI_STATUS
|
---|
5314 | EFIAPI
|
---|
5315 | CryptoServiceTlsGetHostPrivateKey (
|
---|
5316 | IN VOID *Tls,
|
---|
5317 | OUT VOID *Data,
|
---|
5318 | IN OUT UINTN *DataSize
|
---|
5319 | )
|
---|
5320 | {
|
---|
5321 | return CALL_BASECRYPTLIB (TlsGet.Services.HostPrivateKey, TlsGetHostPrivateKey, (Tls, Data, DataSize), EFI_UNSUPPORTED);
|
---|
5322 | }
|
---|
5323 |
|
---|
5324 | /**
|
---|
5325 | Gets the CA-supplied certificate revocation list data set in the specified
|
---|
5326 | TLS object.
|
---|
5327 |
|
---|
5328 | This function returns the CA-supplied certificate revocation list data which
|
---|
5329 | was currently set in the specified TLS object.
|
---|
5330 |
|
---|
5331 | @param[out] Data Pointer to the data buffer to receive the CRL data.
|
---|
5332 | @param[in,out] DataSize The size of data buffer in bytes.
|
---|
5333 |
|
---|
5334 | @retval EFI_SUCCESS The operation succeeded.
|
---|
5335 | @retval EFI_UNSUPPORTED This function is not supported.
|
---|
5336 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
|
---|
5337 |
|
---|
5338 | **/
|
---|
5339 | EFI_STATUS
|
---|
5340 | EFIAPI
|
---|
5341 | CryptoServiceTlsGetCertRevocationList (
|
---|
5342 | OUT VOID *Data,
|
---|
5343 | IN OUT UINTN *DataSize
|
---|
5344 | )
|
---|
5345 | {
|
---|
5346 | return CALL_BASECRYPTLIB (TlsGet.Services.CertRevocationList, TlsGetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED);
|
---|
5347 | }
|
---|
5348 |
|
---|
5349 | /**
|
---|
5350 | Derive keying material from a TLS connection.
|
---|
5351 |
|
---|
5352 | This function exports keying material using the mechanism described in RFC
|
---|
5353 | 5705.
|
---|
5354 |
|
---|
5355 | @param[in] Tls Pointer to the TLS object
|
---|
5356 | @param[in] Label Description of the key for the PRF function
|
---|
5357 | @param[in] Context Optional context
|
---|
5358 | @param[in] ContextLen The length of the context value in bytes
|
---|
5359 | @param[out] KeyBuffer Buffer to hold the output of the TLS-PRF
|
---|
5360 | @param[in] KeyBufferLen The length of the KeyBuffer
|
---|
5361 |
|
---|
5362 | @retval EFI_SUCCESS The operation succeeded.
|
---|
5363 | @retval EFI_INVALID_PARAMETER The TLS object is invalid.
|
---|
5364 | @retval EFI_PROTOCOL_ERROR Some other error occurred.
|
---|
5365 |
|
---|
5366 | **/
|
---|
5367 | EFI_STATUS
|
---|
5368 | EFIAPI
|
---|
5369 | CryptoServiceTlsGetExportKey (
|
---|
5370 | IN VOID *Tls,
|
---|
5371 | IN CONST VOID *Label,
|
---|
5372 | IN CONST VOID *Context,
|
---|
5373 | IN UINTN ContextLen,
|
---|
5374 | OUT VOID *KeyBuffer,
|
---|
5375 | IN UINTN KeyBufferLen
|
---|
5376 | )
|
---|
5377 | {
|
---|
5378 | return CALL_BASECRYPTLIB (
|
---|
5379 | TlsGet.Services.ExportKey,
|
---|
5380 | TlsGetExportKey,
|
---|
5381 | (Tls, Label, Context, ContextLen,
|
---|
5382 | KeyBuffer, KeyBufferLen),
|
---|
5383 | EFI_UNSUPPORTED
|
---|
5384 | );
|
---|
5385 | }
|
---|
5386 |
|
---|
5387 | /**
|
---|
5388 | Carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme.
|
---|
5389 |
|
---|
5390 | This function carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme defined in
|
---|
5391 | RFC 8017.
|
---|
5392 | Mask generation function is the same as the message digest algorithm.
|
---|
5393 | If the Signature buffer is too small to hold the contents of signature, FALSE
|
---|
5394 | is returned and SigSize is set to the required buffer size to obtain the signature.
|
---|
5395 |
|
---|
5396 | If RsaContext is NULL, then return FALSE.
|
---|
5397 | If Message is NULL, then return FALSE.
|
---|
5398 | If MsgSize is zero or > INT_MAX, then return FALSE.
|
---|
5399 | If DigestLen is NOT 32, 48 or 64, return FALSE.
|
---|
5400 | If SaltLen is not equal to DigestLen, then return FALSE.
|
---|
5401 | If SigSize is large enough but Signature is NULL, then return FALSE.
|
---|
5402 | If this interface is not supported, then return FALSE.
|
---|
5403 |
|
---|
5404 | @param[in] RsaContext Pointer to RSA context for signature generation.
|
---|
5405 | @param[in] Message Pointer to octet message to be signed.
|
---|
5406 | @param[in] MsgSize Size of the message in bytes.
|
---|
5407 | @param[in] DigestLen Length of the digest in bytes to be used for RSA signature operation.
|
---|
5408 | @param[in] SaltLen Length of the salt in bytes to be used for PSS encoding.
|
---|
5409 | @param[out] Signature Pointer to buffer to receive RSA PSS signature.
|
---|
5410 | @param[in, out] SigSize On input, the size of Signature buffer in bytes.
|
---|
5411 | On output, the size of data returned in Signature buffer in bytes.
|
---|
5412 |
|
---|
5413 | @retval TRUE Signature successfully generated in RSASSA-PSS.
|
---|
5414 | @retval FALSE Signature generation failed.
|
---|
5415 | @retval FALSE SigSize is too small.
|
---|
5416 | @retval FALSE This interface is not supported.
|
---|
5417 |
|
---|
5418 | **/
|
---|
5419 | BOOLEAN
|
---|
5420 | EFIAPI
|
---|
5421 | CryptoServiceRsaPssSign (
|
---|
5422 | IN VOID *RsaContext,
|
---|
5423 | IN CONST UINT8 *Message,
|
---|
5424 | IN UINTN MsgSize,
|
---|
5425 | IN UINT16 DigestLen,
|
---|
5426 | IN UINT16 SaltLen,
|
---|
5427 | OUT UINT8 *Signature,
|
---|
5428 | IN OUT UINTN *SigSize
|
---|
5429 | )
|
---|
5430 | {
|
---|
5431 | return CALL_BASECRYPTLIB (RsaPss.Services.Sign, RsaPssSign, (RsaContext, Message, MsgSize, DigestLen, SaltLen, Signature, SigSize), FALSE);
|
---|
5432 | }
|
---|
5433 |
|
---|
5434 | /**
|
---|
5435 | Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017.
|
---|
5436 | Implementation determines salt length automatically from the signature encoding.
|
---|
5437 | Mask generation function is the same as the message digest algorithm.
|
---|
5438 | Salt length should be equal to digest length.
|
---|
5439 |
|
---|
5440 | @param[in] RsaContext Pointer to RSA context for signature verification.
|
---|
5441 | @param[in] Message Pointer to octet message to be verified.
|
---|
5442 | @param[in] MsgSize Size of the message in bytes.
|
---|
5443 | @param[in] Signature Pointer to RSASSA-PSS signature to be verified.
|
---|
5444 | @param[in] SigSize Size of signature in bytes.
|
---|
5445 | @param[in] DigestLen Length of digest for RSA operation.
|
---|
5446 | @param[in] SaltLen Salt length for PSS encoding.
|
---|
5447 |
|
---|
5448 | @retval TRUE Valid signature encoded in RSASSA-PSS.
|
---|
5449 | @retval FALSE Invalid signature or invalid RSA context.
|
---|
5450 |
|
---|
5451 | **/
|
---|
5452 | BOOLEAN
|
---|
5453 | EFIAPI
|
---|
5454 | CryptoServiceRsaPssVerify (
|
---|
5455 | IN VOID *RsaContext,
|
---|
5456 | IN CONST UINT8 *Message,
|
---|
5457 | IN UINTN MsgSize,
|
---|
5458 | IN CONST UINT8 *Signature,
|
---|
5459 | IN UINTN SigSize,
|
---|
5460 | IN UINT16 DigestLen,
|
---|
5461 | IN UINT16 SaltLen
|
---|
5462 | )
|
---|
5463 | {
|
---|
5464 | return CALL_BASECRYPTLIB (RsaPss.Services.Verify, RsaPssVerify, (RsaContext, Message, MsgSize, Signature, SigSize, DigestLen, SaltLen), FALSE);
|
---|
5465 | }
|
---|
5466 |
|
---|
5467 | /**
|
---|
5468 | Parallel hash function ParallelHash256, as defined in NIST's Special Publication 800-185,
|
---|
5469 | published December 2016.
|
---|
5470 |
|
---|
5471 | @param[in] Input Pointer to the input message (X).
|
---|
5472 | @param[in] InputByteLen The number(>0) of input bytes provided for the input data.
|
---|
5473 | @param[in] BlockSize The size of each block (B).
|
---|
5474 | @param[out] Output Pointer to the output buffer.
|
---|
5475 | @param[in] OutputByteLen The desired number of output bytes (L).
|
---|
5476 | @param[in] Customization Pointer to the customization string (S).
|
---|
5477 | @param[in] CustomByteLen The length of the customization string in bytes.
|
---|
5478 |
|
---|
5479 | @retval TRUE ParallelHash256 digest computation succeeded.
|
---|
5480 | @retval FALSE ParallelHash256 digest computation failed.
|
---|
5481 | @retval FALSE This interface is not supported.
|
---|
5482 |
|
---|
5483 | **/
|
---|
5484 | BOOLEAN
|
---|
5485 | EFIAPI
|
---|
5486 | CryptoServiceParallelHash256HashAll (
|
---|
5487 | IN CONST VOID *Input,
|
---|
5488 | IN UINTN InputByteLen,
|
---|
5489 | IN UINTN BlockSize,
|
---|
5490 | OUT VOID *Output,
|
---|
5491 | IN UINTN OutputByteLen,
|
---|
5492 | IN CONST VOID *Customization,
|
---|
5493 | IN UINTN CustomByteLen
|
---|
5494 | )
|
---|
5495 | {
|
---|
5496 | return CALL_BASECRYPTLIB (ParallelHash.Services.HashAll, ParallelHash256HashAll, (Input, InputByteLen, BlockSize, Output, OutputByteLen, Customization, CustomByteLen), FALSE);
|
---|
5497 | }
|
---|
5498 |
|
---|
5499 | /**
|
---|
5500 | Performs AEAD AES-GCM authenticated encryption on a data buffer and additional authenticated data (AAD).
|
---|
5501 |
|
---|
5502 | IvSize must be 12, otherwise FALSE is returned.
|
---|
5503 | KeySize must be 16, 24 or 32, otherwise FALSE is returned.
|
---|
5504 | TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned.
|
---|
5505 |
|
---|
5506 | @param[in] Key Pointer to the encryption key.
|
---|
5507 | @param[in] KeySize Size of the encryption key in bytes.
|
---|
5508 | @param[in] Iv Pointer to the IV value.
|
---|
5509 | @param[in] IvSize Size of the IV value in bytes.
|
---|
5510 | @param[in] AData Pointer to the additional authenticated data (AAD).
|
---|
5511 | @param[in] ADataSize Size of the additional authenticated data (AAD) in bytes.
|
---|
5512 | @param[in] DataIn Pointer to the input data buffer to be encrypted.
|
---|
5513 | @param[in] DataInSize Size of the input data buffer in bytes.
|
---|
5514 | @param[out] TagOut Pointer to a buffer that receives the authentication tag output.
|
---|
5515 | @param[in] TagSize Size of the authentication tag in bytes.
|
---|
5516 | @param[out] DataOut Pointer to a buffer that receives the encryption output.
|
---|
5517 | @param[out] DataOutSize Size of the output data buffer in bytes.
|
---|
5518 |
|
---|
5519 | @retval TRUE AEAD AES-GCM authenticated encryption succeeded.
|
---|
5520 | @retval FALSE AEAD AES-GCM authenticated encryption failed.
|
---|
5521 |
|
---|
5522 | **/
|
---|
5523 | BOOLEAN
|
---|
5524 | EFIAPI
|
---|
5525 | CryptoServiceAeadAesGcmEncrypt (
|
---|
5526 | IN CONST UINT8 *Key,
|
---|
5527 | IN UINTN KeySize,
|
---|
5528 | IN CONST UINT8 *Iv,
|
---|
5529 | IN UINTN IvSize,
|
---|
5530 | IN CONST UINT8 *AData,
|
---|
5531 | IN UINTN ADataSize,
|
---|
5532 | IN CONST UINT8 *DataIn,
|
---|
5533 | IN UINTN DataInSize,
|
---|
5534 | OUT UINT8 *TagOut,
|
---|
5535 | IN UINTN TagSize,
|
---|
5536 | OUT UINT8 *DataOut,
|
---|
5537 | OUT UINTN *DataOutSize
|
---|
5538 | )
|
---|
5539 | {
|
---|
5540 | return CALL_BASECRYPTLIB (AeadAesGcm.Services.Encrypt, AeadAesGcmEncrypt, (Key, KeySize, Iv, IvSize, AData, ADataSize, DataIn, DataInSize, TagOut, TagSize, DataOut, DataOutSize), FALSE);
|
---|
5541 | }
|
---|
5542 |
|
---|
5543 | /**
|
---|
5544 | Performs AEAD AES-GCM authenticated decryption on a data buffer and additional authenticated data (AAD).
|
---|
5545 |
|
---|
5546 | IvSize must be 12, otherwise FALSE is returned.
|
---|
5547 | KeySize must be 16, 24 or 32, otherwise FALSE is returned.
|
---|
5548 | TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned.
|
---|
5549 | If additional authenticated data verification fails, FALSE is returned.
|
---|
5550 |
|
---|
5551 | @param[in] Key Pointer to the encryption key.
|
---|
5552 | @param[in] KeySize Size of the encryption key in bytes.
|
---|
5553 | @param[in] Iv Pointer to the IV value.
|
---|
5554 | @param[in] IvSize Size of the IV value in bytes.
|
---|
5555 | @param[in] AData Pointer to the additional authenticated data (AAD).
|
---|
5556 | @param[in] ADataSize Size of the additional authenticated data (AAD) in bytes.
|
---|
5557 | @param[in] DataIn Pointer to the input data buffer to be decrypted.
|
---|
5558 | @param[in] DataInSize Size of the input data buffer in bytes.
|
---|
5559 | @param[in] Tag Pointer to a buffer that contains the authentication tag.
|
---|
5560 | @param[in] TagSize Size of the authentication tag in bytes.
|
---|
5561 | @param[out] DataOut Pointer to a buffer that receives the decryption output.
|
---|
5562 | @param[out] DataOutSize Size of the output data buffer in bytes.
|
---|
5563 |
|
---|
5564 | @retval TRUE AEAD AES-GCM authenticated decryption succeeded.
|
---|
5565 | @retval FALSE AEAD AES-GCM authenticated decryption failed.
|
---|
5566 |
|
---|
5567 | **/
|
---|
5568 | BOOLEAN
|
---|
5569 | EFIAPI
|
---|
5570 | CryptoServiceAeadAesGcmDecrypt (
|
---|
5571 | IN CONST UINT8 *Key,
|
---|
5572 | IN UINTN KeySize,
|
---|
5573 | IN CONST UINT8 *Iv,
|
---|
5574 | IN UINTN IvSize,
|
---|
5575 | IN CONST UINT8 *AData,
|
---|
5576 | IN UINTN ADataSize,
|
---|
5577 | IN CONST UINT8 *DataIn,
|
---|
5578 | IN UINTN DataInSize,
|
---|
5579 | IN CONST UINT8 *Tag,
|
---|
5580 | IN UINTN TagSize,
|
---|
5581 | OUT UINT8 *DataOut,
|
---|
5582 | OUT UINTN *DataOutSize
|
---|
5583 | )
|
---|
5584 | {
|
---|
5585 | return CALL_BASECRYPTLIB (AeadAesGcm.Services.Decrypt, AeadAesGcmDecrypt, (Key, KeySize, Iv, IvSize, AData, ADataSize, DataIn, DataInSize, Tag, TagSize, DataOut, DataOutSize), FALSE);
|
---|
5586 | }
|
---|
5587 |
|
---|
5588 | // =====================================================================================
|
---|
5589 | // Big number primitives
|
---|
5590 | // =====================================================================================
|
---|
5591 |
|
---|
5592 | /**
|
---|
5593 | Allocate new Big Number.
|
---|
5594 |
|
---|
5595 | @retval New BigNum opaque structure or NULL on failure.
|
---|
5596 | **/
|
---|
5597 | VOID *
|
---|
5598 | EFIAPI
|
---|
5599 | CryptoServiceBigNumInit (
|
---|
5600 | VOID
|
---|
5601 | )
|
---|
5602 | {
|
---|
5603 | return CALL_BASECRYPTLIB (Bn.Services.Init, BigNumInit, (), NULL);
|
---|
5604 | }
|
---|
5605 |
|
---|
5606 | /**
|
---|
5607 | Allocate new Big Number and assign the provided value to it.
|
---|
5608 |
|
---|
5609 | @param[in] Buf Big endian encoded buffer.
|
---|
5610 | @param[in] Len Buffer length.
|
---|
5611 |
|
---|
5612 | @retval New BigNum opaque structure or NULL on failure.
|
---|
5613 | **/
|
---|
5614 | VOID *
|
---|
5615 | EFIAPI
|
---|
5616 | CryptoServiceBigNumFromBin (
|
---|
5617 | IN CONST UINT8 *Buf,
|
---|
5618 | IN UINTN Len
|
---|
5619 | )
|
---|
5620 | {
|
---|
5621 | return CALL_BASECRYPTLIB (Bn.Services.FromBin, BigNumFromBin, (Buf, Len), NULL);
|
---|
5622 | }
|
---|
5623 |
|
---|
5624 | /**
|
---|
5625 | Convert the absolute value of Bn into big-endian form and store it at Buf.
|
---|
5626 | The Buf array should have at least BigNumBytes() in it.
|
---|
5627 |
|
---|
5628 | @param[in] Bn Big number to convert.
|
---|
5629 | @param[out] Buf Output buffer.
|
---|
5630 |
|
---|
5631 | @retval The length of the big-endian number placed at Buf or -1 on error.
|
---|
5632 | **/
|
---|
5633 | INTN
|
---|
5634 | EFIAPI
|
---|
5635 | CryptoServiceBigNumToBin (
|
---|
5636 | IN CONST VOID *Bn,
|
---|
5637 | OUT UINT8 *Buf
|
---|
5638 | )
|
---|
5639 | {
|
---|
5640 | return CALL_BASECRYPTLIB (Bn.Services.ToBin, BigNumToBin, (Bn, Buf), -1);
|
---|
5641 | }
|
---|
5642 |
|
---|
5643 | /**
|
---|
5644 | Free the Big Number.
|
---|
5645 |
|
---|
5646 | @param[in] Bn Big number to free.
|
---|
5647 | @param[in] Clear TRUE if the buffer should be cleared.
|
---|
5648 | **/
|
---|
5649 | VOID
|
---|
5650 | EFIAPI
|
---|
5651 | CryptoServiceBigNumFree (
|
---|
5652 | IN VOID *Bn,
|
---|
5653 | IN BOOLEAN Clear
|
---|
5654 | )
|
---|
5655 | {
|
---|
5656 | CALL_VOID_BASECRYPTLIB (Bn.Services.Free, BigNumFree, (Bn, Clear));
|
---|
5657 | }
|
---|
5658 |
|
---|
5659 | /**
|
---|
5660 | Calculate the sum of two Big Numbers.
|
---|
5661 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5662 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5663 |
|
---|
5664 | @param[in] BnA Big number.
|
---|
5665 | @param[in] BnB Big number.
|
---|
5666 | @param[out] BnRes The result of BnA + BnB.
|
---|
5667 |
|
---|
5668 | @retval TRUE On success.
|
---|
5669 | @retval FALSE Otherwise.
|
---|
5670 | **/
|
---|
5671 | BOOLEAN
|
---|
5672 | EFIAPI
|
---|
5673 | CryptoServiceBigNumAdd (
|
---|
5674 | IN CONST VOID *BnA,
|
---|
5675 | IN CONST VOID *BnB,
|
---|
5676 | OUT VOID *BnRes
|
---|
5677 | )
|
---|
5678 | {
|
---|
5679 | return CALL_BASECRYPTLIB (Bn.Services.Add, BigNumAdd, (BnA, BnB, BnRes), FALSE);
|
---|
5680 | }
|
---|
5681 |
|
---|
5682 | /**
|
---|
5683 | Subtract two Big Numbers.
|
---|
5684 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5685 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5686 |
|
---|
5687 | @param[in] BnA Big number.
|
---|
5688 | @param[in] BnB Big number.
|
---|
5689 | @param[out] BnRes The result of BnA - BnB.
|
---|
5690 |
|
---|
5691 | @retval TRUE On success.
|
---|
5692 | @retval FALSE Otherwise.
|
---|
5693 | **/
|
---|
5694 | BOOLEAN
|
---|
5695 | EFIAPI
|
---|
5696 | CryptoServiceBigNumSub (
|
---|
5697 | IN CONST VOID *BnA,
|
---|
5698 | IN CONST VOID *BnB,
|
---|
5699 | OUT VOID *BnRes
|
---|
5700 | )
|
---|
5701 | {
|
---|
5702 | return CALL_BASECRYPTLIB (Bn.Services.Sub, BigNumSub, (BnA, BnB, BnRes), FALSE);
|
---|
5703 | }
|
---|
5704 |
|
---|
5705 | /**
|
---|
5706 | Calculate remainder: BnRes = BnA % BnB.
|
---|
5707 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5708 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5709 |
|
---|
5710 | @param[in] BnA Big number.
|
---|
5711 | @param[in] BnB Big number.
|
---|
5712 | @param[out] BnRes The result of BnA % BnB.
|
---|
5713 |
|
---|
5714 | @retval TRUE On success.
|
---|
5715 | @retval FALSE Otherwise.
|
---|
5716 | **/
|
---|
5717 | BOOLEAN
|
---|
5718 | EFIAPI
|
---|
5719 | CryptoServiceBigNumMod (
|
---|
5720 | IN CONST VOID *BnA,
|
---|
5721 | IN CONST VOID *BnB,
|
---|
5722 | OUT VOID *BnRes
|
---|
5723 | )
|
---|
5724 | {
|
---|
5725 | return CALL_BASECRYPTLIB (Bn.Services.Mod, BigNumMod, (BnA, BnB, BnRes), FALSE);
|
---|
5726 | }
|
---|
5727 |
|
---|
5728 | /**
|
---|
5729 | Compute BnA to the BnP-th power modulo BnM.
|
---|
5730 | Please note, all "out" Big number arguments should be properly initialized.
|
---|
5731 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5732 |
|
---|
5733 | @param[in] BnA Big number.
|
---|
5734 | @param[in] BnP Big number (power).
|
---|
5735 | @param[in] BnM Big number (modulo).
|
---|
5736 | @param[out] BnRes The result of (BnA ^ BnP) % BnM.
|
---|
5737 |
|
---|
5738 | @retval TRUE On success.
|
---|
5739 | @retval FALSE Otherwise.
|
---|
5740 | **/
|
---|
5741 | BOOLEAN
|
---|
5742 | EFIAPI
|
---|
5743 | CryptoServiceBigNumExpMod (
|
---|
5744 | IN CONST VOID *BnA,
|
---|
5745 | IN CONST VOID *BnP,
|
---|
5746 | IN CONST VOID *BnM,
|
---|
5747 | OUT VOID *BnRes
|
---|
5748 | )
|
---|
5749 | {
|
---|
5750 | return CALL_BASECRYPTLIB (Bn.Services.ExpMod, BigNumExpMod, (BnA, BnP, BnM, BnRes), FALSE);
|
---|
5751 | }
|
---|
5752 |
|
---|
5753 | /**
|
---|
5754 | Compute BnA inverse modulo BnM.
|
---|
5755 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5756 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5757 |
|
---|
5758 | @param[in] BnA Big number.
|
---|
5759 | @param[in] BnM Big number (modulo).
|
---|
5760 | @param[out] BnRes The result, such that (BnA * BnRes) % BnM == 1.
|
---|
5761 |
|
---|
5762 | @retval TRUE On success.
|
---|
5763 | @retval FALSE Otherwise.
|
---|
5764 | **/
|
---|
5765 | BOOLEAN
|
---|
5766 | EFIAPI
|
---|
5767 | CryptoServiceBigNumInverseMod (
|
---|
5768 | IN CONST VOID *BnA,
|
---|
5769 | IN CONST VOID *BnM,
|
---|
5770 | OUT VOID *BnRes
|
---|
5771 | )
|
---|
5772 | {
|
---|
5773 | return CALL_BASECRYPTLIB (Bn.Services.InverseMod, BigNumInverseMod, (BnA, BnM, BnRes), FALSE);
|
---|
5774 | }
|
---|
5775 |
|
---|
5776 | /**
|
---|
5777 | Divide two Big Numbers.
|
---|
5778 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5779 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5780 |
|
---|
5781 | @param[in] BnA Big number.
|
---|
5782 | @param[in] BnB Big number.
|
---|
5783 | @param[out] BnRes The result, such that BnA / BnB.
|
---|
5784 |
|
---|
5785 | @retval TRUE On success.
|
---|
5786 | @retval FALSE Otherwise.
|
---|
5787 | **/
|
---|
5788 | BOOLEAN
|
---|
5789 | EFIAPI
|
---|
5790 | CryptoServiceBigNumDiv (
|
---|
5791 | IN CONST VOID *BnA,
|
---|
5792 | IN CONST VOID *BnB,
|
---|
5793 | OUT VOID *BnRes
|
---|
5794 | )
|
---|
5795 | {
|
---|
5796 | return CALL_BASECRYPTLIB (Bn.Services.Div, BigNumDiv, (BnA, BnB, BnRes), FALSE);
|
---|
5797 | }
|
---|
5798 |
|
---|
5799 | /**
|
---|
5800 | Multiply two Big Numbers modulo BnM.
|
---|
5801 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5802 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5803 |
|
---|
5804 | @param[in] BnA Big number.
|
---|
5805 | @param[in] BnB Big number.
|
---|
5806 | @param[in] BnM Big number (modulo).
|
---|
5807 | @param[out] BnRes The result, such that (BnA * BnB) % BnM.
|
---|
5808 |
|
---|
5809 | @retval TRUE On success.
|
---|
5810 | @retval FALSE Otherwise.
|
---|
5811 | **/
|
---|
5812 | BOOLEAN
|
---|
5813 | EFIAPI
|
---|
5814 | CryptoServiceBigNumMulMod (
|
---|
5815 | IN CONST VOID *BnA,
|
---|
5816 | IN CONST VOID *BnB,
|
---|
5817 | IN CONST VOID *BnM,
|
---|
5818 | OUT VOID *BnRes
|
---|
5819 | )
|
---|
5820 | {
|
---|
5821 | return CALL_BASECRYPTLIB (Bn.Services.MulMod, BigNumMulMod, (BnA, BnB, BnM, BnRes), FALSE);
|
---|
5822 | }
|
---|
5823 |
|
---|
5824 | /**
|
---|
5825 | Compare two Big Numbers.
|
---|
5826 |
|
---|
5827 | @param[in] BnA Big number.
|
---|
5828 | @param[in] BnB Big number.
|
---|
5829 |
|
---|
5830 | @retval 0 BnA == BnB.
|
---|
5831 | @retval 1 BnA > BnB.
|
---|
5832 | @retval -1 BnA < BnB.
|
---|
5833 | **/
|
---|
5834 | INTN
|
---|
5835 | EFIAPI
|
---|
5836 | CryptoServiceBigNumCmp (
|
---|
5837 | IN CONST VOID *BnA,
|
---|
5838 | IN CONST VOID *BnB
|
---|
5839 | )
|
---|
5840 | {
|
---|
5841 | return CALL_BASECRYPTLIB (Bn.Services.Cmp, BigNumCmp, (BnA, BnB), 0);
|
---|
5842 | }
|
---|
5843 |
|
---|
5844 | /**
|
---|
5845 | Get number of bits in Bn.
|
---|
5846 |
|
---|
5847 | @param[in] Bn Big number.
|
---|
5848 |
|
---|
5849 | @retval Number of bits.
|
---|
5850 | **/
|
---|
5851 | UINTN
|
---|
5852 | EFIAPI
|
---|
5853 | CryptoServiceBigNumBits (
|
---|
5854 | IN CONST VOID *Bn
|
---|
5855 | )
|
---|
5856 | {
|
---|
5857 | return CALL_BASECRYPTLIB (Bn.Services.Bits, BigNumBits, (Bn), 0);
|
---|
5858 | }
|
---|
5859 |
|
---|
5860 | /**
|
---|
5861 | Get number of bytes in Bn.
|
---|
5862 |
|
---|
5863 | @param[in] Bn Big number.
|
---|
5864 |
|
---|
5865 | @retval Number of bytes.
|
---|
5866 | **/
|
---|
5867 | UINTN
|
---|
5868 | EFIAPI
|
---|
5869 | CryptoServiceBigNumBytes (
|
---|
5870 | IN CONST VOID *Bn
|
---|
5871 | )
|
---|
5872 | {
|
---|
5873 | return CALL_BASECRYPTLIB (Bn.Services.Bytes, BigNumBytes, (Bn), 0);
|
---|
5874 | }
|
---|
5875 |
|
---|
5876 | /**
|
---|
5877 | Checks if Big Number equals to the given Num.
|
---|
5878 |
|
---|
5879 | @param[in] Bn Big number.
|
---|
5880 | @param[in] Num Number.
|
---|
5881 |
|
---|
5882 | @retval TRUE iff Bn == Num.
|
---|
5883 | @retval FALSE otherwise.
|
---|
5884 | **/
|
---|
5885 | BOOLEAN
|
---|
5886 | EFIAPI
|
---|
5887 | CryptoServiceBigNumIsWord (
|
---|
5888 | IN CONST VOID *Bn,
|
---|
5889 | IN UINTN Num
|
---|
5890 | )
|
---|
5891 | {
|
---|
5892 | return CALL_BASECRYPTLIB (Bn.Services.IsWord, BigNumIsWord, (Bn, Num), FALSE);
|
---|
5893 | }
|
---|
5894 |
|
---|
5895 | /**
|
---|
5896 | Checks if Big Number is odd.
|
---|
5897 |
|
---|
5898 | @param[in] Bn Big number.
|
---|
5899 |
|
---|
5900 | @retval TRUE Bn is odd (Bn % 2 == 1).
|
---|
5901 | @retval FALSE otherwise.
|
---|
5902 | **/
|
---|
5903 | BOOLEAN
|
---|
5904 | EFIAPI
|
---|
5905 | CryptoServiceBigNumIsOdd (
|
---|
5906 | IN CONST VOID *Bn
|
---|
5907 | )
|
---|
5908 | {
|
---|
5909 | return CALL_BASECRYPTLIB (Bn.Services.IsOdd, BigNumIsOdd, (Bn), FALSE);
|
---|
5910 | }
|
---|
5911 |
|
---|
5912 | /**
|
---|
5913 | Copy Big number.
|
---|
5914 |
|
---|
5915 | @param[out] BnDst Destination.
|
---|
5916 | @param[in] BnSrc Source.
|
---|
5917 |
|
---|
5918 | @retval BnDst on success.
|
---|
5919 | @retval NULL otherwise.
|
---|
5920 | **/
|
---|
5921 | VOID *
|
---|
5922 | EFIAPI
|
---|
5923 | CryptoServiceBigNumCopy (
|
---|
5924 | OUT VOID *BnDst,
|
---|
5925 | IN CONST VOID *BnSrc
|
---|
5926 | )
|
---|
5927 | {
|
---|
5928 | return CALL_BASECRYPTLIB (Bn.Services.Copy, BigNumCopy, (BnDst, BnSrc), NULL);
|
---|
5929 | }
|
---|
5930 |
|
---|
5931 | /**
|
---|
5932 | Get constant Big number with value of "1".
|
---|
5933 | This may be used to save expensive allocations.
|
---|
5934 |
|
---|
5935 | @retval Big Number with value of 1.
|
---|
5936 | **/
|
---|
5937 | CONST VOID *
|
---|
5938 | EFIAPI
|
---|
5939 | CryptoServiceBigNumValueOne (
|
---|
5940 | VOID
|
---|
5941 | )
|
---|
5942 | {
|
---|
5943 | return CALL_BASECRYPTLIB (Bn.Services.ValueOne, BigNumValueOne, (), NULL);
|
---|
5944 | }
|
---|
5945 |
|
---|
5946 | /**
|
---|
5947 | Shift right Big Number.
|
---|
5948 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5949 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5950 |
|
---|
5951 | @param[in] Bn Big number.
|
---|
5952 | @param[in] N Number of bits to shift.
|
---|
5953 | @param[out] BnRes The result.
|
---|
5954 |
|
---|
5955 | @retval TRUE On success.
|
---|
5956 | @retval FALSE Otherwise.
|
---|
5957 | **/
|
---|
5958 | BOOLEAN
|
---|
5959 | EFIAPI
|
---|
5960 | CryptoServiceBigNumRShift (
|
---|
5961 | IN CONST VOID *Bn,
|
---|
5962 | IN UINTN N,
|
---|
5963 | OUT VOID *BnRes
|
---|
5964 | )
|
---|
5965 | {
|
---|
5966 | return CALL_BASECRYPTLIB (Bn.Services.RShift, BigNumRShift, (Bn, N, BnRes), FALSE);
|
---|
5967 | }
|
---|
5968 |
|
---|
5969 | /**
|
---|
5970 | Mark Big Number for constant time computations.
|
---|
5971 | This function should be called before any constant time computations are
|
---|
5972 | performed on the given Big number.
|
---|
5973 |
|
---|
5974 | @param[in] Bn Big number.
|
---|
5975 | **/
|
---|
5976 | VOID
|
---|
5977 | EFIAPI
|
---|
5978 | CryptoServiceBigNumConstTime (
|
---|
5979 | IN VOID *Bn
|
---|
5980 | )
|
---|
5981 | {
|
---|
5982 | CALL_VOID_BASECRYPTLIB (Bn.Services.ConstTime, BigNumConstTime, (Bn));
|
---|
5983 | }
|
---|
5984 |
|
---|
5985 | /**
|
---|
5986 | Calculate square modulo.
|
---|
5987 | Please note, all "out" Big number arguments should be properly initialized
|
---|
5988 | by calling to BigNumInit() or BigNumFromBin() functions.
|
---|
5989 |
|
---|
5990 | @param[in] BnA Big number.
|
---|
5991 | @param[in] BnM Big number (modulo).
|
---|
5992 | @param[out] BnRes The result, such that (BnA ^ 2) % BnM.
|
---|
5993 |
|
---|
5994 | @retval TRUE On success.
|
---|
5995 | @retval FALSE Otherwise.
|
---|
5996 | **/
|
---|
5997 | BOOLEAN
|
---|
5998 | EFIAPI
|
---|
5999 | CryptoServiceBigNumSqrMod (
|
---|
6000 | IN CONST VOID *BnA,
|
---|
6001 | IN CONST VOID *BnM,
|
---|
6002 | OUT VOID *BnRes
|
---|
6003 | )
|
---|
6004 | {
|
---|
6005 | return CALL_BASECRYPTLIB (Bn.Services.SqrMod, BigNumSqrMod, (BnA, BnM, BnRes), FALSE);
|
---|
6006 | }
|
---|
6007 |
|
---|
6008 | /**
|
---|
6009 | Create new Big Number computation context. This is an opaque structure
|
---|
6010 | which should be passed to any function that requires it. The BN context is
|
---|
6011 | needed to optimize calculations and expensive allocations.
|
---|
6012 |
|
---|
6013 | @retval Big Number context struct or NULL on failure.
|
---|
6014 | **/
|
---|
6015 | VOID *
|
---|
6016 | EFIAPI
|
---|
6017 | CryptoServiceBigNumNewContext (
|
---|
6018 | VOID
|
---|
6019 | )
|
---|
6020 | {
|
---|
6021 | return CALL_BASECRYPTLIB (Bn.Services.NewContext, BigNumNewContext, (), NULL);
|
---|
6022 | }
|
---|
6023 |
|
---|
6024 | /**
|
---|
6025 | Free Big Number context that was allocated with BigNumNewContext().
|
---|
6026 |
|
---|
6027 | @param[in] BnCtx Big number context to free.
|
---|
6028 | **/
|
---|
6029 | VOID
|
---|
6030 | EFIAPI
|
---|
6031 | CryptoServiceBigNumContextFree (
|
---|
6032 | IN VOID *BnCtx
|
---|
6033 | )
|
---|
6034 | {
|
---|
6035 | CALL_VOID_BASECRYPTLIB (Bn.Services.ContextFree, BigNumContextFree, (BnCtx));
|
---|
6036 | }
|
---|
6037 |
|
---|
6038 | /**
|
---|
6039 | Set Big Number to a given value.
|
---|
6040 |
|
---|
6041 | @param[in] Bn Big number to set.
|
---|
6042 | @param[in] Val Value to set.
|
---|
6043 |
|
---|
6044 | @retval TRUE On success.
|
---|
6045 | @retval FALSE Otherwise.
|
---|
6046 | **/
|
---|
6047 | BOOLEAN
|
---|
6048 | EFIAPI
|
---|
6049 | CryptoServiceBigNumSetUint (
|
---|
6050 | IN VOID *Bn,
|
---|
6051 | IN UINTN Val
|
---|
6052 | )
|
---|
6053 | {
|
---|
6054 | return CALL_BASECRYPTLIB (Bn.Services.SetUint, BigNumSetUint, (Bn, Val), FALSE);
|
---|
6055 | }
|
---|
6056 |
|
---|
6057 | /**
|
---|
6058 | Add two Big Numbers modulo BnM.
|
---|
6059 |
|
---|
6060 | @param[in] BnA Big number.
|
---|
6061 | @param[in] BnB Big number.
|
---|
6062 | @param[in] BnM Big number (modulo).
|
---|
6063 | @param[out] BnRes The result, such that (BnA + BnB) % BnM.
|
---|
6064 |
|
---|
6065 | @retval TRUE On success.
|
---|
6066 | @retval FALSE Otherwise.
|
---|
6067 | **/
|
---|
6068 | BOOLEAN
|
---|
6069 | EFIAPI
|
---|
6070 | CryptoServiceBigNumAddMod (
|
---|
6071 | IN CONST VOID *BnA,
|
---|
6072 | IN CONST VOID *BnB,
|
---|
6073 | IN CONST VOID *BnM,
|
---|
6074 | OUT VOID *BnRes
|
---|
6075 | )
|
---|
6076 | {
|
---|
6077 | return CALL_BASECRYPTLIB (Bn.Services.AddMod, BigNumAddMod, (BnA, BnB, BnM, BnRes), FALSE);
|
---|
6078 | }
|
---|
6079 |
|
---|
6080 | // =====================================================================================
|
---|
6081 | // Basic Elliptic Curve Primitives
|
---|
6082 | // =====================================================================================
|
---|
6083 |
|
---|
6084 | /**
|
---|
6085 | Initialize new opaque EcGroup object. This object represents an EC curve and
|
---|
6086 | and is used for calculation within this group. This object should be freed
|
---|
6087 | using EcGroupFree() function.
|
---|
6088 |
|
---|
6089 | @param[in] CryptoNid Identifying number for the ECC curve (Defined in
|
---|
6090 | BaseCryptLib.h).
|
---|
6091 |
|
---|
6092 | @retval EcGroup object On success.
|
---|
6093 | @retval NULL On failure.
|
---|
6094 | **/
|
---|
6095 | VOID *
|
---|
6096 | EFIAPI
|
---|
6097 | CryptoServiceEcGroupInit (
|
---|
6098 | IN UINTN CryptoNid
|
---|
6099 | )
|
---|
6100 | {
|
---|
6101 | return CALL_BASECRYPTLIB (Ec.Services.GroupInit, EcGroupInit, (CryptoNid), NULL);
|
---|
6102 | }
|
---|
6103 |
|
---|
6104 | /**
|
---|
6105 | Get EC curve parameters. While elliptic curve equation is Y^2 mod P = (X^3 + AX + B) Mod P.
|
---|
6106 | This function will set the provided Big Number objects to the corresponding
|
---|
6107 | values. The caller needs to make sure all the "out" BigNumber parameters
|
---|
6108 | are properly initialized.
|
---|
6109 | @param[in] EcGroup EC group object.
|
---|
6110 | @param[out] BnPrime Group prime number.
|
---|
6111 | @param[out] BnA A coefficient.
|
---|
6112 | @param[out] BnB B coefficient.
|
---|
6113 | @param[in] BnCtx BN context.
|
---|
6114 |
|
---|
6115 | @retval TRUE On success.
|
---|
6116 | @retval FALSE Otherwise.
|
---|
6117 | **/
|
---|
6118 | BOOLEAN
|
---|
6119 | EFIAPI
|
---|
6120 | CryptoServiceEcGroupGetCurve (
|
---|
6121 | IN CONST VOID *EcGroup,
|
---|
6122 | OUT VOID *BnPrime,
|
---|
6123 | OUT VOID *BnA,
|
---|
6124 | OUT VOID *BnB,
|
---|
6125 | IN VOID *BnCtx
|
---|
6126 | )
|
---|
6127 | {
|
---|
6128 | return CALL_BASECRYPTLIB (Ec.Services.GroupGetCurve, EcGroupGetCurve, (EcGroup, BnPrime, BnA, BnB, BnCtx), FALSE);
|
---|
6129 | }
|
---|
6130 |
|
---|
6131 | /**
|
---|
6132 | Get EC group order.
|
---|
6133 | This function will set the provided Big Number object to the corresponding
|
---|
6134 | value. The caller needs to make sure that the "out" BigNumber parameter
|
---|
6135 | is properly initialized.
|
---|
6136 |
|
---|
6137 | @param[in] EcGroup EC group object.
|
---|
6138 | @param[out] BnOrder Group prime number.
|
---|
6139 |
|
---|
6140 | @retval TRUE On success.
|
---|
6141 | @retval FALSE Otherwise.
|
---|
6142 | **/
|
---|
6143 | BOOLEAN
|
---|
6144 | EFIAPI
|
---|
6145 | CryptoServiceEcGroupGetOrder (
|
---|
6146 | IN VOID *EcGroup,
|
---|
6147 | OUT VOID *BnOrder
|
---|
6148 | )
|
---|
6149 | {
|
---|
6150 | return CALL_BASECRYPTLIB (Ec.Services.GroupGetOrder, EcGroupGetOrder, (EcGroup, BnOrder), FALSE);
|
---|
6151 | }
|
---|
6152 |
|
---|
6153 | /**
|
---|
6154 | Free previously allocated EC group object using EcGroupInit().
|
---|
6155 |
|
---|
6156 | @param[in] EcGroup EC group object to free.
|
---|
6157 | **/
|
---|
6158 | VOID
|
---|
6159 | EFIAPI
|
---|
6160 | CryptoServiceEcGroupFree (
|
---|
6161 | IN VOID *EcGroup
|
---|
6162 | )
|
---|
6163 | {
|
---|
6164 | CALL_VOID_BASECRYPTLIB (Ec.Services.GroupFree, EcGroupFree, (EcGroup));
|
---|
6165 | }
|
---|
6166 |
|
---|
6167 | /**
|
---|
6168 | Initialize new opaque EC Point object. This object represents an EC point
|
---|
6169 | within the given EC group (curve).
|
---|
6170 |
|
---|
6171 | @param[in] EC Group, properly initialized using EcGroupInit().
|
---|
6172 |
|
---|
6173 | @retval EC Point object On success.
|
---|
6174 | @retval NULL On failure.
|
---|
6175 | **/
|
---|
6176 | VOID *
|
---|
6177 | EFIAPI
|
---|
6178 | CryptoServiceEcPointInit (
|
---|
6179 | IN CONST VOID *EcGroup
|
---|
6180 | )
|
---|
6181 | {
|
---|
6182 | return CALL_BASECRYPTLIB (Ec.Services.PointInit, EcPointInit, (EcGroup), NULL);
|
---|
6183 | }
|
---|
6184 |
|
---|
6185 | /**
|
---|
6186 | Free previously allocated EC Point object using EcPointInit().
|
---|
6187 |
|
---|
6188 | @param[in] EcPoint EC Point to free.
|
---|
6189 | @param[in] Clear TRUE iff the memory should be cleared.
|
---|
6190 | **/
|
---|
6191 | VOID
|
---|
6192 | EFIAPI
|
---|
6193 | CryptoServiceEcPointDeInit (
|
---|
6194 | IN VOID *EcPoint,
|
---|
6195 | IN BOOLEAN Clear
|
---|
6196 | )
|
---|
6197 | {
|
---|
6198 | CALL_VOID_BASECRYPTLIB (Ec.Services.PointDeInit, EcPointDeInit, (EcPoint, Clear));
|
---|
6199 | }
|
---|
6200 |
|
---|
6201 | /**
|
---|
6202 | Get EC point affine (x,y) coordinates.
|
---|
6203 | This function will set the provided Big Number objects to the corresponding
|
---|
6204 | values. The caller needs to make sure all the "out" BigNumber parameters
|
---|
6205 | are properly initialized.
|
---|
6206 |
|
---|
6207 | @param[in] EcGroup EC group object.
|
---|
6208 | @param[in] EcPoint EC point object.
|
---|
6209 | @param[out] BnX X coordinate.
|
---|
6210 | @param[out] BnY Y coordinate.
|
---|
6211 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6212 |
|
---|
6213 | @retval TRUE On success.
|
---|
6214 | @retval FALSE Otherwise.
|
---|
6215 | **/
|
---|
6216 | BOOLEAN
|
---|
6217 | EFIAPI
|
---|
6218 | CryptoServiceEcPointGetAffineCoordinates (
|
---|
6219 | IN CONST VOID *EcGroup,
|
---|
6220 | IN CONST VOID *EcPoint,
|
---|
6221 | OUT VOID *BnX,
|
---|
6222 | OUT VOID *BnY,
|
---|
6223 | IN VOID *BnCtx
|
---|
6224 | )
|
---|
6225 | {
|
---|
6226 | return CALL_BASECRYPTLIB (Ec.Services.PointGetAffineCoordinates, EcPointGetAffineCoordinates, (EcGroup, EcPoint, BnX, BnY, BnCtx), FALSE);
|
---|
6227 | }
|
---|
6228 |
|
---|
6229 | /**
|
---|
6230 | Set EC point affine (x,y) coordinates.
|
---|
6231 |
|
---|
6232 | @param[in] EcGroup EC group object.
|
---|
6233 | @param[in] EcPoint EC point object.
|
---|
6234 | @param[in] BnX X coordinate.
|
---|
6235 | @param[in] BnY Y coordinate.
|
---|
6236 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6237 |
|
---|
6238 | @retval TRUE On success.
|
---|
6239 | @retval FALSE Otherwise.
|
---|
6240 | **/
|
---|
6241 | BOOLEAN
|
---|
6242 | EFIAPI
|
---|
6243 | CryptoServiceEcPointSetAffineCoordinates (
|
---|
6244 | IN CONST VOID *EcGroup,
|
---|
6245 | IN VOID *EcPoint,
|
---|
6246 | IN CONST VOID *BnX,
|
---|
6247 | IN CONST VOID *BnY,
|
---|
6248 | IN VOID *BnCtx
|
---|
6249 | )
|
---|
6250 | {
|
---|
6251 | return CALL_BASECRYPTLIB (Ec.Services.PointSetAffineCoordinates, EcPointSetAffineCoordinates, (EcGroup, EcPoint, BnX, BnY, BnCtx), FALSE);
|
---|
6252 | }
|
---|
6253 |
|
---|
6254 | /**
|
---|
6255 | EC Point addition. EcPointResult = EcPointA + EcPointB.
|
---|
6256 | @param[in] EcGroup EC group object.
|
---|
6257 | @param[out] EcPointResult EC point to hold the result. The point should
|
---|
6258 | be properly initialized.
|
---|
6259 | @param[in] EcPointA EC Point.
|
---|
6260 | @param[in] EcPointB EC Point.
|
---|
6261 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6262 |
|
---|
6263 | @retval TRUE On success.
|
---|
6264 | @retval FALSE Otherwise.
|
---|
6265 | **/
|
---|
6266 | BOOLEAN
|
---|
6267 | EFIAPI
|
---|
6268 | CryptoServiceEcPointAdd (
|
---|
6269 | IN CONST VOID *EcGroup,
|
---|
6270 | OUT VOID *EcPointResult,
|
---|
6271 | IN CONST VOID *EcPointA,
|
---|
6272 | IN CONST VOID *EcPointB,
|
---|
6273 | IN VOID *BnCtx
|
---|
6274 | )
|
---|
6275 | {
|
---|
6276 | return CALL_BASECRYPTLIB (Ec.Services.PointAdd, EcPointAdd, (EcGroup, EcPointResult, EcPointA, EcPointB, BnCtx), FALSE);
|
---|
6277 | }
|
---|
6278 |
|
---|
6279 | /**
|
---|
6280 | Variable EC point multiplication. EcPointResult = EcPoint * BnPScalar.
|
---|
6281 |
|
---|
6282 | @param[in] EcGroup EC group object.
|
---|
6283 | @param[out] EcPointResult EC point to hold the result. The point should
|
---|
6284 | be properly initialized.
|
---|
6285 | @param[in] EcPoint EC Point.
|
---|
6286 | @param[in] BnPScalar P Scalar.
|
---|
6287 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6288 |
|
---|
6289 | @retval TRUE On success.
|
---|
6290 | @retval FALSE Otherwise.
|
---|
6291 | **/
|
---|
6292 | BOOLEAN
|
---|
6293 | EFIAPI
|
---|
6294 | CryptoServiceEcPointMul (
|
---|
6295 | IN CONST VOID *EcGroup,
|
---|
6296 | OUT VOID *EcPointResult,
|
---|
6297 | IN CONST VOID *EcPoint,
|
---|
6298 | IN CONST VOID *BnPScalar,
|
---|
6299 | IN VOID *BnCtx
|
---|
6300 | )
|
---|
6301 | {
|
---|
6302 | return CALL_BASECRYPTLIB (Ec.Services.PointMul, EcPointMul, (EcGroup, EcPointResult, EcPoint, BnPScalar, BnCtx), FALSE);
|
---|
6303 | }
|
---|
6304 |
|
---|
6305 | /**
|
---|
6306 | Calculate the inverse of the supplied EC point.
|
---|
6307 |
|
---|
6308 | @param[in] EcGroup EC group object.
|
---|
6309 | @param[in,out] EcPoint EC point to invert.
|
---|
6310 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6311 |
|
---|
6312 | @retval TRUE On success.
|
---|
6313 | @retval FALSE Otherwise.
|
---|
6314 | **/
|
---|
6315 | BOOLEAN
|
---|
6316 | EFIAPI
|
---|
6317 | CryptoServiceEcPointInvert (
|
---|
6318 | IN CONST VOID *EcGroup,
|
---|
6319 | IN OUT VOID *EcPoint,
|
---|
6320 | IN VOID *BnCtx
|
---|
6321 | )
|
---|
6322 | {
|
---|
6323 | return CALL_BASECRYPTLIB (Ec.Services.PointInvert, EcPointInvert, (EcGroup, EcPoint, BnCtx), FALSE);
|
---|
6324 | }
|
---|
6325 |
|
---|
6326 | /**
|
---|
6327 | Check if the supplied point is on EC curve.
|
---|
6328 |
|
---|
6329 | @param[in] EcGroup EC group object.
|
---|
6330 | @param[in] EcPoint EC point to check.
|
---|
6331 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6332 |
|
---|
6333 | @retval TRUE On curve.
|
---|
6334 | @retval FALSE Otherwise.
|
---|
6335 | **/
|
---|
6336 | BOOLEAN
|
---|
6337 | EFIAPI
|
---|
6338 | CryptoServiceEcPointIsOnCurve (
|
---|
6339 | IN CONST VOID *EcGroup,
|
---|
6340 | IN CONST VOID *EcPoint,
|
---|
6341 | IN VOID *BnCtx
|
---|
6342 | )
|
---|
6343 | {
|
---|
6344 | return CALL_BASECRYPTLIB (Ec.Services.PointIsOnCurve, EcPointIsOnCurve, (EcGroup, EcPoint, BnCtx), FALSE);
|
---|
6345 | }
|
---|
6346 |
|
---|
6347 | /**
|
---|
6348 | Check if the supplied point is at infinity.
|
---|
6349 |
|
---|
6350 | @param[in] EcGroup EC group object.
|
---|
6351 | @param[in] EcPoint EC point to check.
|
---|
6352 |
|
---|
6353 | @retval TRUE At infinity.
|
---|
6354 | @retval FALSE Otherwise.
|
---|
6355 | **/
|
---|
6356 | BOOLEAN
|
---|
6357 | EFIAPI
|
---|
6358 | CryptoServiceEcPointIsAtInfinity (
|
---|
6359 | IN CONST VOID *EcGroup,
|
---|
6360 | IN CONST VOID *EcPoint
|
---|
6361 | )
|
---|
6362 | {
|
---|
6363 | return CALL_BASECRYPTLIB (Ec.Services.PointIsAtInfinity, EcPointIsAtInfinity, (EcGroup, EcPoint), FALSE);
|
---|
6364 | }
|
---|
6365 |
|
---|
6366 | /**
|
---|
6367 | Check if EC points are equal.
|
---|
6368 |
|
---|
6369 | @param[in] EcGroup EC group object.
|
---|
6370 | @param[in] EcPointA EC point A.
|
---|
6371 | @param[in] EcPointB EC point B.
|
---|
6372 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6373 |
|
---|
6374 | @retval TRUE A == B.
|
---|
6375 | @retval FALSE Otherwise.
|
---|
6376 | **/
|
---|
6377 | BOOLEAN
|
---|
6378 | EFIAPI
|
---|
6379 | CryptoServiceEcPointEqual (
|
---|
6380 | IN CONST VOID *EcGroup,
|
---|
6381 | IN CONST VOID *EcPointA,
|
---|
6382 | IN CONST VOID *EcPointB,
|
---|
6383 | IN VOID *BnCtx
|
---|
6384 | )
|
---|
6385 | {
|
---|
6386 | return CALL_BASECRYPTLIB (Ec.Services.PointEqual, EcPointEqual, (EcGroup, EcPointA, EcPointB, BnCtx), FALSE);
|
---|
6387 | }
|
---|
6388 |
|
---|
6389 | /**
|
---|
6390 | Set EC point compressed coordinates. Points can be described in terms of
|
---|
6391 | their compressed coordinates. For a point (x, y), for any given value for x
|
---|
6392 | such that the point is on the curve there will only ever be two possible
|
---|
6393 | values for y. Therefore, a point can be set using this function where BnX is
|
---|
6394 | the x coordinate and YBit is a value 0 or 1 to identify which of the two
|
---|
6395 | possible values for y should be used.
|
---|
6396 |
|
---|
6397 | @param[in] EcGroup EC group object.
|
---|
6398 | @param[in] EcPoint EC Point.
|
---|
6399 | @param[in] BnX X coordinate.
|
---|
6400 | @param[in] YBit 0 or 1 to identify which Y value is used.
|
---|
6401 | @param[in] BnCtx BN context, created with BigNumNewContext().
|
---|
6402 |
|
---|
6403 | @retval TRUE On success.
|
---|
6404 | @retval FALSE Otherwise.
|
---|
6405 | **/
|
---|
6406 | BOOLEAN
|
---|
6407 | EFIAPI
|
---|
6408 | CryptoServiceEcPointSetCompressedCoordinates (
|
---|
6409 | IN CONST VOID *EcGroup,
|
---|
6410 | IN VOID *EcPoint,
|
---|
6411 | IN CONST VOID *BnX,
|
---|
6412 | IN UINT8 YBit,
|
---|
6413 | IN VOID *BnCtx
|
---|
6414 | )
|
---|
6415 | {
|
---|
6416 | return CALL_BASECRYPTLIB (Ec.Services.PointSetCompressedCoordinates, EcPointSetCompressedCoordinates, (EcGroup, EcPoint, BnX, YBit, BnCtx), FALSE);
|
---|
6417 | }
|
---|
6418 |
|
---|
6419 | // =====================================================================================
|
---|
6420 | // Elliptic Curve Diffie Hellman Primitives
|
---|
6421 | // =====================================================================================
|
---|
6422 |
|
---|
6423 | /**
|
---|
6424 | Allocates and Initializes one Elliptic Curve Context for subsequent use
|
---|
6425 | with the NID.
|
---|
6426 |
|
---|
6427 | @param[in] Nid cipher NID
|
---|
6428 | @return Pointer to the Elliptic Curve Context that has been initialized.
|
---|
6429 | If the allocations fails, EcNewByNid() returns NULL.
|
---|
6430 | **/
|
---|
6431 | VOID *
|
---|
6432 | EFIAPI
|
---|
6433 | CryptoServiceEcNewByNid (
|
---|
6434 | IN UINTN Nid
|
---|
6435 | )
|
---|
6436 | {
|
---|
6437 | return CALL_BASECRYPTLIB (Ec.Services.NewByNid, EcNewByNid, (Nid), NULL);
|
---|
6438 | }
|
---|
6439 |
|
---|
6440 | /**
|
---|
6441 | Release the specified EC context.
|
---|
6442 |
|
---|
6443 | @param[in] EcContext Pointer to the EC context to be released.
|
---|
6444 | **/
|
---|
6445 | VOID
|
---|
6446 | EFIAPI
|
---|
6447 | CryptoServiceEcFree (
|
---|
6448 | IN VOID *EcContext
|
---|
6449 | )
|
---|
6450 | {
|
---|
6451 | CALL_VOID_BASECRYPTLIB (Ec.Services.Free, EcFree, (EcContext));
|
---|
6452 | }
|
---|
6453 |
|
---|
6454 | /**
|
---|
6455 | Generates EC key and returns EC public key (X, Y), Please note, this function uses
|
---|
6456 | pseudo random number generator. The caller must make sure RandomSeed()
|
---|
6457 | function was properly called before.
|
---|
6458 | The Ec context should be correctly initialized by EcNewByNid.
|
---|
6459 | This function generates random secret, and computes the public key (X, Y), which is
|
---|
6460 | returned via parameter Public, PublicSize.
|
---|
6461 | X is the first half of Public with size being PublicSize / 2,
|
---|
6462 | Y is the second half of Public with size being PublicSize / 2.
|
---|
6463 | EC context is updated accordingly.
|
---|
6464 | If the Public buffer is too small to hold the public X, Y, FALSE is returned and
|
---|
6465 | PublicSize is set to the required buffer size to obtain the public X, Y.
|
---|
6466 | For P-256, the PublicSize is 64. First 32-byte is X, Second 32-byte is Y.
|
---|
6467 | For P-384, the PublicSize is 96. First 48-byte is X, Second 48-byte is Y.
|
---|
6468 | For P-521, the PublicSize is 132. First 66-byte is X, Second 66-byte is Y.
|
---|
6469 | If EcContext is NULL, then return FALSE.
|
---|
6470 | If PublicSize is NULL, then return FALSE.
|
---|
6471 | If PublicSize is large enough but Public is NULL, then return FALSE.
|
---|
6472 | @param[in, out] EcContext Pointer to the EC context.
|
---|
6473 | @param[out] PublicKey Pointer to t buffer to receive generated public X,Y.
|
---|
6474 | @param[in, out] PublicKeySize On input, the size of Public buffer in bytes.
|
---|
6475 | On output, the size of data returned in Public buffer in bytes.
|
---|
6476 | @retval TRUE EC public X,Y generation succeeded.
|
---|
6477 | @retval FALSE EC public X,Y generation failed.
|
---|
6478 | @retval FALSE PublicKeySize is not large enough.
|
---|
6479 | **/
|
---|
6480 | BOOLEAN
|
---|
6481 | EFIAPI
|
---|
6482 | CryptoServiceEcGenerateKey (
|
---|
6483 | IN OUT VOID *EcContext,
|
---|
6484 | OUT UINT8 *PublicKey,
|
---|
6485 | IN OUT UINTN *PublicKeySize
|
---|
6486 | )
|
---|
6487 | {
|
---|
6488 | return CALL_BASECRYPTLIB (Ec.Services.GenerateKey, EcGenerateKey, (EcContext, PublicKey, PublicKeySize), FALSE);
|
---|
6489 | }
|
---|
6490 |
|
---|
6491 | /**
|
---|
6492 | Gets the public key component from the established EC context.
|
---|
6493 | The Ec context should be correctly initialized by EcNewByNid, and successfully
|
---|
6494 | generate key pair from EcGenerateKey().
|
---|
6495 | For P-256, the PublicSize is 64. First 32-byte is X, Second 32-byte is Y.
|
---|
6496 | For P-384, the PublicSize is 96. First 48-byte is X, Second 48-byte is Y.
|
---|
6497 | For P-521, the PublicSize is 132. First 66-byte is X, Second 66-byte is Y.
|
---|
6498 | @param[in, out] EcContext Pointer to EC context being set.
|
---|
6499 | @param[out] PublicKey Pointer to t buffer to receive generated public X,Y.
|
---|
6500 | @param[in, out] PublicKeySize On input, the size of Public buffer in bytes.
|
---|
6501 | On output, the size of data returned in Public buffer in bytes.
|
---|
6502 | @retval TRUE EC key component was retrieved successfully.
|
---|
6503 | @retval FALSE Invalid EC key component.
|
---|
6504 | **/
|
---|
6505 | BOOLEAN
|
---|
6506 | EFIAPI
|
---|
6507 | CryptoServiceEcGetPubKey (
|
---|
6508 | IN OUT VOID *EcContext,
|
---|
6509 | OUT UINT8 *PublicKey,
|
---|
6510 | IN OUT UINTN *PublicKeySize
|
---|
6511 | )
|
---|
6512 | {
|
---|
6513 | return CALL_BASECRYPTLIB (Ec.Services.GetPubKey, EcGetPubKey, (EcContext, PublicKey, PublicKeySize), FALSE);
|
---|
6514 | }
|
---|
6515 |
|
---|
6516 | /**
|
---|
6517 | Computes exchanged common key.
|
---|
6518 | Given peer's public key (X, Y), this function computes the exchanged common key,
|
---|
6519 | based on its own context including value of curve parameter and random secret.
|
---|
6520 | X is the first half of PeerPublic with size being PeerPublicSize / 2,
|
---|
6521 | Y is the second half of PeerPublic with size being PeerPublicSize / 2.
|
---|
6522 | If EcContext is NULL, then return FALSE.
|
---|
6523 | If PeerPublic is NULL, then return FALSE.
|
---|
6524 | If PeerPublicSize is 0, then return FALSE.
|
---|
6525 | If Key is NULL, then return FALSE.
|
---|
6526 | If KeySize is not large enough, then return FALSE.
|
---|
6527 | For P-256, the PeerPublicSize is 64. First 32-byte is X, Second 32-byte is Y.
|
---|
6528 | For P-384, the PeerPublicSize is 96. First 48-byte is X, Second 48-byte is Y.
|
---|
6529 | For P-521, the PeerPublicSize is 132. First 66-byte is X, Second 66-byte is Y.
|
---|
6530 | @param[in, out] EcContext Pointer to the EC context.
|
---|
6531 | @param[in] PeerPublic Pointer to the peer's public X,Y.
|
---|
6532 | @param[in] PeerPublicSize Size of peer's public X,Y in bytes.
|
---|
6533 | @param[in] CompressFlag Flag of PeerPublic is compressed or not.
|
---|
6534 | @param[out] Key Pointer to the buffer to receive generated key.
|
---|
6535 | @param[in, out] KeySize On input, the size of Key buffer in bytes.
|
---|
6536 | On output, the size of data returned in Key buffer in bytes.
|
---|
6537 | @retval TRUE EC exchanged key generation succeeded.
|
---|
6538 | @retval FALSE EC exchanged key generation failed.
|
---|
6539 | @retval FALSE KeySize is not large enough.
|
---|
6540 | **/
|
---|
6541 | BOOLEAN
|
---|
6542 | EFIAPI
|
---|
6543 | CryptoServiceEcDhComputeKey (
|
---|
6544 | IN OUT VOID *EcContext,
|
---|
6545 | IN CONST UINT8 *PeerPublic,
|
---|
6546 | IN UINTN PeerPublicSize,
|
---|
6547 | IN CONST INT32 *CompressFlag,
|
---|
6548 | OUT UINT8 *Key,
|
---|
6549 | IN OUT UINTN *KeySize
|
---|
6550 | )
|
---|
6551 | {
|
---|
6552 | return CALL_BASECRYPTLIB (Ec.Services.DhComputeKey, EcDhComputeKey, (EcContext, PeerPublic, PeerPublicSize, CompressFlag, Key, KeySize), FALSE);
|
---|
6553 | }
|
---|
6554 |
|
---|
6555 | /**
|
---|
6556 | Retrieve the EC Public Key from one DER-encoded X509 certificate.
|
---|
6557 |
|
---|
6558 | @param[in] Cert Pointer to the DER-encoded X509 certificate.
|
---|
6559 | @param[in] CertSize Size of the X509 certificate in bytes.
|
---|
6560 | @param[out] EcContext Pointer to new-generated EC DSA context which contain the retrieved
|
---|
6561 | EC public key component. Use EcFree() function to free the
|
---|
6562 | resource.
|
---|
6563 |
|
---|
6564 | If Cert is NULL, then return FALSE.
|
---|
6565 | If EcContext is NULL, then return FALSE.
|
---|
6566 |
|
---|
6567 | @retval TRUE EC Public Key was retrieved successfully.
|
---|
6568 | @retval FALSE Fail to retrieve EC public key from X509 certificate.
|
---|
6569 |
|
---|
6570 | **/
|
---|
6571 | BOOLEAN
|
---|
6572 | EFIAPI
|
---|
6573 | CryptoServiceEcGetPublicKeyFromX509 (
|
---|
6574 | IN CONST UINT8 *Cert,
|
---|
6575 | IN UINTN CertSize,
|
---|
6576 | OUT VOID **EcContext
|
---|
6577 | )
|
---|
6578 | {
|
---|
6579 | return CALL_BASECRYPTLIB (Ec.Services.GetPublicKeyFromX509, EcGetPublicKeyFromX509, (Cert, CertSize, EcContext), FALSE);
|
---|
6580 | }
|
---|
6581 |
|
---|
6582 | /**
|
---|
6583 | Retrieve the EC Private Key from the password-protected PEM key data.
|
---|
6584 |
|
---|
6585 | @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.
|
---|
6586 | @param[in] PemSize Size of the PEM key data in bytes.
|
---|
6587 | @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.
|
---|
6588 | @param[out] EcContext Pointer to new-generated EC DSA context which contain the retrieved
|
---|
6589 | EC private key component. Use EcFree() function to free the
|
---|
6590 | resource.
|
---|
6591 |
|
---|
6592 | If PemData is NULL, then return FALSE.
|
---|
6593 | If EcContext is NULL, then return FALSE.
|
---|
6594 |
|
---|
6595 | @retval TRUE EC Private Key was retrieved successfully.
|
---|
6596 | @retval FALSE Invalid PEM key data or incorrect password.
|
---|
6597 |
|
---|
6598 | **/
|
---|
6599 | BOOLEAN
|
---|
6600 | EFIAPI
|
---|
6601 | CryptoServiceEcGetPrivateKeyFromPem (
|
---|
6602 | IN CONST UINT8 *PemData,
|
---|
6603 | IN UINTN PemSize,
|
---|
6604 | IN CONST CHAR8 *Password,
|
---|
6605 | OUT VOID **EcContext
|
---|
6606 | )
|
---|
6607 | {
|
---|
6608 | return CALL_BASECRYPTLIB (Ec.Services.GetPrivateKeyFromPem, EcGetPrivateKeyFromPem, (PemData, PemSize, Password, EcContext), FALSE);
|
---|
6609 | }
|
---|
6610 |
|
---|
6611 | /**
|
---|
6612 | Carries out the EC-DSA signature.
|
---|
6613 |
|
---|
6614 | This function carries out the EC-DSA signature.
|
---|
6615 | If the Signature buffer is too small to hold the contents of signature, FALSE
|
---|
6616 | is returned and SigSize is set to the required buffer size to obtain the signature.
|
---|
6617 |
|
---|
6618 | If EcContext is NULL, then return FALSE.
|
---|
6619 | If MessageHash is NULL, then return FALSE.
|
---|
6620 | If HashSize need match the HashNid. HashNid could be SHA256, SHA384, SHA512, SHA3_256, SHA3_384, SHA3_512.
|
---|
6621 | If SigSize is large enough but Signature is NULL, then return FALSE.
|
---|
6622 |
|
---|
6623 | For P-256, the SigSize is 64. First 32-byte is R, Second 32-byte is S.
|
---|
6624 | For P-384, the SigSize is 96. First 48-byte is R, Second 48-byte is S.
|
---|
6625 | For P-521, the SigSize is 132. First 66-byte is R, Second 66-byte is S.
|
---|
6626 |
|
---|
6627 | @param[in] EcContext Pointer to EC context for signature generation.
|
---|
6628 | @param[in] HashNid hash NID
|
---|
6629 | @param[in] MessageHash Pointer to octet message hash to be signed.
|
---|
6630 | @param[in] HashSize Size of the message hash in bytes.
|
---|
6631 | @param[out] Signature Pointer to buffer to receive EC-DSA signature.
|
---|
6632 | @param[in, out] SigSize On input, the size of Signature buffer in bytes.
|
---|
6633 | On output, the size of data returned in Signature buffer in bytes.
|
---|
6634 |
|
---|
6635 | @retval TRUE Signature successfully generated in EC-DSA.
|
---|
6636 | @retval FALSE Signature generation failed.
|
---|
6637 | @retval FALSE SigSize is too small.
|
---|
6638 |
|
---|
6639 | **/
|
---|
6640 | BOOLEAN
|
---|
6641 | EFIAPI
|
---|
6642 | CryptoServiceEcDsaSign (
|
---|
6643 | IN VOID *EcContext,
|
---|
6644 | IN UINTN HashNid,
|
---|
6645 | IN CONST UINT8 *MessageHash,
|
---|
6646 | IN UINTN HashSize,
|
---|
6647 | OUT UINT8 *Signature,
|
---|
6648 | IN OUT UINTN *SigSize
|
---|
6649 | )
|
---|
6650 | {
|
---|
6651 | return CALL_BASECRYPTLIB (Ec.Services.DsaSign, EcDsaSign, (EcContext, HashNid, MessageHash, HashSize, Signature, SigSize), FALSE);
|
---|
6652 | }
|
---|
6653 |
|
---|
6654 | /**
|
---|
6655 | Verifies the EC-DSA signature.
|
---|
6656 |
|
---|
6657 | If EcContext is NULL, then return FALSE.
|
---|
6658 | If MessageHash is NULL, then return FALSE.
|
---|
6659 | If Signature is NULL, then return FALSE.
|
---|
6660 | If HashSize need match the HashNid. HashNid could be SHA256, SHA384, SHA512, SHA3_256, SHA3_384, SHA3_512.
|
---|
6661 |
|
---|
6662 | For P-256, the SigSize is 64. First 32-byte is R, Second 32-byte is S.
|
---|
6663 | For P-384, the SigSize is 96. First 48-byte is R, Second 48-byte is S.
|
---|
6664 | For P-521, the SigSize is 132. First 66-byte is R, Second 66-byte is S.
|
---|
6665 |
|
---|
6666 | @param[in] EcContext Pointer to EC context for signature verification.
|
---|
6667 | @param[in] HashNid hash NID
|
---|
6668 | @param[in] MessageHash Pointer to octet message hash to be checked.
|
---|
6669 | @param[in] HashSize Size of the message hash in bytes.
|
---|
6670 | @param[in] Signature Pointer to EC-DSA signature to be verified.
|
---|
6671 | @param[in] SigSize Size of signature in bytes.
|
---|
6672 |
|
---|
6673 | @retval TRUE Valid signature encoded in EC-DSA.
|
---|
6674 | @retval FALSE Invalid signature or invalid EC context.
|
---|
6675 |
|
---|
6676 | **/
|
---|
6677 | BOOLEAN
|
---|
6678 | EFIAPI
|
---|
6679 | CryptoServiceEcDsaVerify (
|
---|
6680 | IN VOID *EcContext,
|
---|
6681 | IN UINTN HashNid,
|
---|
6682 | IN CONST UINT8 *MessageHash,
|
---|
6683 | IN UINTN HashSize,
|
---|
6684 | IN CONST UINT8 *Signature,
|
---|
6685 | IN UINTN SigSize
|
---|
6686 | )
|
---|
6687 | {
|
---|
6688 | return CALL_BASECRYPTLIB (Ec.Services.DsaVerify, EcDsaVerify, (EcContext, HashNid, MessageHash, HashSize, Signature, SigSize), FALSE);
|
---|
6689 | }
|
---|
6690 |
|
---|
6691 | const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
|
---|
6692 | /// Version
|
---|
6693 | CryptoServiceGetCryptoVersion,
|
---|
6694 | /// HMAC MD5 - deprecated and unsupported
|
---|
6695 | DeprecatedCryptoServiceHmacMd5New,
|
---|
6696 | DeprecatedCryptoServiceHmacMd5Free,
|
---|
6697 | DeprecatedCryptoServiceHmacMd5SetKey,
|
---|
6698 | DeprecatedCryptoServiceHmacMd5Duplicate,
|
---|
6699 | DeprecatedCryptoServiceHmacMd5Update,
|
---|
6700 | DeprecatedCryptoServiceHmacMd5Final,
|
---|
6701 | /// HMAC SHA1 - deprecated and unsupported
|
---|
6702 | DeprecatedCryptoServiceHmacSha1New,
|
---|
6703 | DeprecatedCryptoServiceHmacSha1Free,
|
---|
6704 | DeprecatedCryptoServiceHmacSha1SetKey,
|
---|
6705 | DeprecatedCryptoServiceHmacSha1Duplicate,
|
---|
6706 | DeprecatedCryptoServiceHmacSha1Update,
|
---|
6707 | DeprecatedCryptoServiceHmacSha1Final,
|
---|
6708 | /// HMAC SHA256
|
---|
6709 | CryptoServiceHmacSha256New,
|
---|
6710 | CryptoServiceHmacSha256Free,
|
---|
6711 | CryptoServiceHmacSha256SetKey,
|
---|
6712 | CryptoServiceHmacSha256Duplicate,
|
---|
6713 | CryptoServiceHmacSha256Update,
|
---|
6714 | CryptoServiceHmacSha256Final,
|
---|
6715 | /// Md4 - deprecated and unsupported
|
---|
6716 | DeprecatedCryptoServiceMd4GetContextSize,
|
---|
6717 | DeprecatedCryptoServiceMd4Init,
|
---|
6718 | DeprecatedCryptoServiceMd4Duplicate,
|
---|
6719 | DeprecatedCryptoServiceMd4Update,
|
---|
6720 | DeprecatedCryptoServiceMd4Final,
|
---|
6721 | DeprecatedCryptoServiceMd4HashAll,
|
---|
6722 | #ifndef ENABLE_MD5_DEPRECATED_INTERFACES
|
---|
6723 | /// Md5 - deprecated and unsupported
|
---|
6724 | DeprecatedCryptoServiceMd5GetContextSize,
|
---|
6725 | DeprecatedCryptoServiceMd5Init,
|
---|
6726 | DeprecatedCryptoServiceMd5Duplicate,
|
---|
6727 | DeprecatedCryptoServiceMd5Update,
|
---|
6728 | DeprecatedCryptoServiceMd5Final,
|
---|
6729 | DeprecatedCryptoServiceMd5HashAll,
|
---|
6730 | #else
|
---|
6731 | /// Md5
|
---|
6732 | CryptoServiceMd5GetContextSize,
|
---|
6733 | CryptoServiceMd5Init,
|
---|
6734 | CryptoServiceMd5Duplicate,
|
---|
6735 | CryptoServiceMd5Update,
|
---|
6736 | CryptoServiceMd5Final,
|
---|
6737 | CryptoServiceMd5HashAll,
|
---|
6738 | #endif
|
---|
6739 | /// Pkcs
|
---|
6740 | CryptoServicePkcs1v2Encrypt,
|
---|
6741 | CryptoServicePkcs5HashPassword,
|
---|
6742 | CryptoServicePkcs7Verify,
|
---|
6743 | CryptoServiceVerifyEKUsInPkcs7Signature,
|
---|
6744 | CryptoServicePkcs7GetSigners,
|
---|
6745 | CryptoServicePkcs7FreeSigners,
|
---|
6746 | CryptoServicePkcs7Sign,
|
---|
6747 | CryptoServicePkcs7GetAttachedContent,
|
---|
6748 | CryptoServicePkcs7GetCertificatesList,
|
---|
6749 | CryptoServiceAuthenticodeVerify,
|
---|
6750 | CryptoServiceImageTimestampVerify,
|
---|
6751 | /// DH
|
---|
6752 | CryptoServiceDhNew,
|
---|
6753 | CryptoServiceDhFree,
|
---|
6754 | CryptoServiceDhGenerateParameter,
|
---|
6755 | CryptoServiceDhSetParameter,
|
---|
6756 | CryptoServiceDhGenerateKey,
|
---|
6757 | CryptoServiceDhComputeKey,
|
---|
6758 | /// Random
|
---|
6759 | CryptoServiceRandomSeed,
|
---|
6760 | CryptoServiceRandomBytes,
|
---|
6761 | /// RSA
|
---|
6762 | CryptoServiceRsaPkcs1Verify,
|
---|
6763 | CryptoServiceRsaNew,
|
---|
6764 | CryptoServiceRsaFree,
|
---|
6765 | CryptoServiceRsaSetKey,
|
---|
6766 | CryptoServiceRsaGetKey,
|
---|
6767 | CryptoServiceRsaGenerateKey,
|
---|
6768 | CryptoServiceRsaCheckKey,
|
---|
6769 | CryptoServiceRsaPkcs1Sign,
|
---|
6770 | CryptoServiceRsaPkcs1Verify,
|
---|
6771 | CryptoServiceRsaGetPrivateKeyFromPem,
|
---|
6772 | CryptoServiceRsaGetPublicKeyFromX509,
|
---|
6773 | #ifdef DISABLE_SHA1_DEPRECATED_INTERFACES
|
---|
6774 | /// Sha1 - deprecated and unsupported
|
---|
6775 | DeprecatedCryptoServiceSha1GetContextSize,
|
---|
6776 | DeprecatedCryptoServiceSha1Init,
|
---|
6777 | DeprecatedCryptoServiceSha1Duplicate,
|
---|
6778 | DeprecatedCryptoServiceSha1Update,
|
---|
6779 | DeprecatedCryptoServiceSha1Final,
|
---|
6780 | DeprecatedCryptoServiceSha1HashAll,
|
---|
6781 | #else
|
---|
6782 | /// Sha1
|
---|
6783 | CryptoServiceSha1GetContextSize,
|
---|
6784 | CryptoServiceSha1Init,
|
---|
6785 | CryptoServiceSha1Duplicate,
|
---|
6786 | CryptoServiceSha1Update,
|
---|
6787 | CryptoServiceSha1Final,
|
---|
6788 | CryptoServiceSha1HashAll,
|
---|
6789 | #endif
|
---|
6790 | /// Sha256
|
---|
6791 | CryptoServiceSha256GetContextSize,
|
---|
6792 | CryptoServiceSha256Init,
|
---|
6793 | CryptoServiceSha256Duplicate,
|
---|
6794 | CryptoServiceSha256Update,
|
---|
6795 | CryptoServiceSha256Final,
|
---|
6796 | CryptoServiceSha256HashAll,
|
---|
6797 | /// Sha384
|
---|
6798 | CryptoServiceSha384GetContextSize,
|
---|
6799 | CryptoServiceSha384Init,
|
---|
6800 | CryptoServiceSha384Duplicate,
|
---|
6801 | CryptoServiceSha384Update,
|
---|
6802 | CryptoServiceSha384Final,
|
---|
6803 | CryptoServiceSha384HashAll,
|
---|
6804 | /// Sha512
|
---|
6805 | CryptoServiceSha512GetContextSize,
|
---|
6806 | CryptoServiceSha512Init,
|
---|
6807 | CryptoServiceSha512Duplicate,
|
---|
6808 | CryptoServiceSha512Update,
|
---|
6809 | CryptoServiceSha512Final,
|
---|
6810 | CryptoServiceSha512HashAll,
|
---|
6811 | /// X509
|
---|
6812 | CryptoServiceX509GetSubjectName,
|
---|
6813 | CryptoServiceX509GetCommonName,
|
---|
6814 | CryptoServiceX509GetOrganizationName,
|
---|
6815 | CryptoServiceX509VerifyCert,
|
---|
6816 | CryptoServiceX509ConstructCertificate,
|
---|
6817 | CryptoServiceX509ConstructCertificateStack,
|
---|
6818 | CryptoServiceX509Free,
|
---|
6819 | CryptoServiceX509StackFree,
|
---|
6820 | CryptoServiceX509GetTBSCert,
|
---|
6821 | /// TDES - deprecated and unsupported
|
---|
6822 | DeprecatedCryptoServiceTdesGetContextSize,
|
---|
6823 | DeprecatedCryptoServiceTdesInit,
|
---|
6824 | DeprecatedCryptoServiceTdesEcbEncrypt,
|
---|
6825 | DeprecatedCryptoServiceTdesEcbDecrypt,
|
---|
6826 | DeprecatedCryptoServiceTdesCbcEncrypt,
|
---|
6827 | DeprecatedCryptoServiceTdesCbcDecrypt,
|
---|
6828 | /// AES - ECB mode is deprecated and unsupported
|
---|
6829 | CryptoServiceAesGetContextSize,
|
---|
6830 | CryptoServiceAesInit,
|
---|
6831 | DeprecatedCryptoServiceAesEcbEncrypt,
|
---|
6832 | DeprecatedCryptoServiceAesEcbDecrypt,
|
---|
6833 | CryptoServiceAesCbcEncrypt,
|
---|
6834 | CryptoServiceAesCbcDecrypt,
|
---|
6835 | /// Arc4 - deprecated and unsupported
|
---|
6836 | DeprecatedCryptoServiceArc4GetContextSize,
|
---|
6837 | DeprecatedCryptoServiceArc4Init,
|
---|
6838 | DeprecatedCryptoServiceArc4Encrypt,
|
---|
6839 | DeprecatedCryptoServiceArc4Decrypt,
|
---|
6840 | DeprecatedCryptoServiceArc4Reset,
|
---|
6841 | /// SM3
|
---|
6842 | CryptoServiceSm3GetContextSize,
|
---|
6843 | CryptoServiceSm3Init,
|
---|
6844 | CryptoServiceSm3Duplicate,
|
---|
6845 | CryptoServiceSm3Update,
|
---|
6846 | CryptoServiceSm3Final,
|
---|
6847 | CryptoServiceSm3HashAll,
|
---|
6848 | /// HKDF
|
---|
6849 | CryptoServiceHkdfSha256ExtractAndExpand,
|
---|
6850 | /// X509 (Continued)
|
---|
6851 | CryptoServiceX509ConstructCertificateStackV,
|
---|
6852 | /// TLS
|
---|
6853 | CryptoServiceTlsInitialize,
|
---|
6854 | CryptoServiceTlsCtxFree,
|
---|
6855 | CryptoServiceTlsCtxNew,
|
---|
6856 | CryptoServiceTlsFree,
|
---|
6857 | CryptoServiceTlsNew,
|
---|
6858 | CryptoServiceTlsInHandshake,
|
---|
6859 | CryptoServiceTlsDoHandshake,
|
---|
6860 | CryptoServiceTlsHandleAlert,
|
---|
6861 | CryptoServiceTlsCloseNotify,
|
---|
6862 | CryptoServiceTlsCtrlTrafficOut,
|
---|
6863 | CryptoServiceTlsCtrlTrafficIn,
|
---|
6864 | CryptoServiceTlsRead,
|
---|
6865 | CryptoServiceTlsWrite,
|
---|
6866 | /// TLS Set
|
---|
6867 | CryptoServiceTlsSetVersion,
|
---|
6868 | CryptoServiceTlsSetConnectionEnd,
|
---|
6869 | CryptoServiceTlsSetCipherList,
|
---|
6870 | CryptoServiceTlsSetCompressionMethod,
|
---|
6871 | CryptoServiceTlsSetVerify,
|
---|
6872 | CryptoServiceTlsSetVerifyHost,
|
---|
6873 | CryptoServiceTlsSetSessionId,
|
---|
6874 | CryptoServiceTlsSetCaCertificate,
|
---|
6875 | CryptoServiceTlsSetHostPublicCert,
|
---|
6876 | CryptoServiceTlsSetHostPrivateKey,
|
---|
6877 | CryptoServiceTlsSetCertRevocationList,
|
---|
6878 | /// TLS Get
|
---|
6879 | CryptoServiceTlsGetVersion,
|
---|
6880 | CryptoServiceTlsGetConnectionEnd,
|
---|
6881 | CryptoServiceTlsGetCurrentCipher,
|
---|
6882 | CryptoServiceTlsGetCurrentCompressionId,
|
---|
6883 | CryptoServiceTlsGetVerify,
|
---|
6884 | CryptoServiceTlsGetSessionId,
|
---|
6885 | CryptoServiceTlsGetClientRandom,
|
---|
6886 | CryptoServiceTlsGetServerRandom,
|
---|
6887 | CryptoServiceTlsGetKeyMaterial,
|
---|
6888 | CryptoServiceTlsGetCaCertificate,
|
---|
6889 | CryptoServiceTlsGetHostPublicCert,
|
---|
6890 | CryptoServiceTlsGetHostPrivateKey,
|
---|
6891 | CryptoServiceTlsGetCertRevocationList,
|
---|
6892 | /// RSA PSS
|
---|
6893 | CryptoServiceRsaPssSign,
|
---|
6894 | CryptoServiceRsaPssVerify,
|
---|
6895 | /// Parallel hash
|
---|
6896 | CryptoServiceParallelHash256HashAll,
|
---|
6897 | /// HMAC SHA256 (continued)
|
---|
6898 | CryptoServiceHmacSha256All,
|
---|
6899 | /// HMAC SHA384
|
---|
6900 | CryptoServiceHmacSha384New,
|
---|
6901 | CryptoServiceHmacSha384Free,
|
---|
6902 | CryptoServiceHmacSha384SetKey,
|
---|
6903 | CryptoServiceHmacSha384Duplicate,
|
---|
6904 | CryptoServiceHmacSha384Update,
|
---|
6905 | CryptoServiceHmacSha384Final,
|
---|
6906 | CryptoServiceHmacSha384All,
|
---|
6907 | /// HKDF (continued)
|
---|
6908 | CryptoServiceHkdfSha256Extract,
|
---|
6909 | CryptoServiceHkdfSha256Expand,
|
---|
6910 | CryptoServiceHkdfSha384ExtractAndExpand,
|
---|
6911 | CryptoServiceHkdfSha384Extract,
|
---|
6912 | CryptoServiceHkdfSha384Expand,
|
---|
6913 | /// Aead Aes GCM
|
---|
6914 | CryptoServiceAeadAesGcmEncrypt,
|
---|
6915 | CryptoServiceAeadAesGcmDecrypt,
|
---|
6916 | /// Big Numbers
|
---|
6917 | CryptoServiceBigNumInit,
|
---|
6918 | CryptoServiceBigNumFromBin,
|
---|
6919 | CryptoServiceBigNumToBin,
|
---|
6920 | CryptoServiceBigNumFree,
|
---|
6921 | CryptoServiceBigNumAdd,
|
---|
6922 | CryptoServiceBigNumSub,
|
---|
6923 | CryptoServiceBigNumMod,
|
---|
6924 | CryptoServiceBigNumExpMod,
|
---|
6925 | CryptoServiceBigNumInverseMod,
|
---|
6926 | CryptoServiceBigNumDiv,
|
---|
6927 | CryptoServiceBigNumMulMod,
|
---|
6928 | CryptoServiceBigNumCmp,
|
---|
6929 | CryptoServiceBigNumBits,
|
---|
6930 | CryptoServiceBigNumBytes,
|
---|
6931 | CryptoServiceBigNumIsWord,
|
---|
6932 | CryptoServiceBigNumIsOdd,
|
---|
6933 | CryptoServiceBigNumCopy,
|
---|
6934 | CryptoServiceBigNumValueOne,
|
---|
6935 | CryptoServiceBigNumRShift,
|
---|
6936 | CryptoServiceBigNumConstTime,
|
---|
6937 | CryptoServiceBigNumSqrMod,
|
---|
6938 | CryptoServiceBigNumNewContext,
|
---|
6939 | CryptoServiceBigNumContextFree,
|
---|
6940 | CryptoServiceBigNumSetUint,
|
---|
6941 | CryptoServiceBigNumAddMod,
|
---|
6942 | /// EC
|
---|
6943 | CryptoServiceEcGroupInit,
|
---|
6944 | CryptoServiceEcGroupGetCurve,
|
---|
6945 | CryptoServiceEcGroupGetOrder,
|
---|
6946 | CryptoServiceEcGroupFree,
|
---|
6947 | CryptoServiceEcPointInit,
|
---|
6948 | CryptoServiceEcPointDeInit,
|
---|
6949 | CryptoServiceEcPointGetAffineCoordinates,
|
---|
6950 | CryptoServiceEcPointSetAffineCoordinates,
|
---|
6951 | CryptoServiceEcPointAdd,
|
---|
6952 | CryptoServiceEcPointMul,
|
---|
6953 | CryptoServiceEcPointInvert,
|
---|
6954 | CryptoServiceEcPointIsOnCurve,
|
---|
6955 | CryptoServiceEcPointIsAtInfinity,
|
---|
6956 | CryptoServiceEcPointEqual,
|
---|
6957 | CryptoServiceEcPointSetCompressedCoordinates,
|
---|
6958 | CryptoServiceEcNewByNid,
|
---|
6959 | CryptoServiceEcFree,
|
---|
6960 | CryptoServiceEcGenerateKey,
|
---|
6961 | CryptoServiceEcGetPubKey,
|
---|
6962 | CryptoServiceEcDhComputeKey,
|
---|
6963 | /// TLS (continued)
|
---|
6964 | CryptoServiceTlsShutdown,
|
---|
6965 | /// TLS Set (continued)
|
---|
6966 | CryptoServiceTlsSetHostPrivateKeyEx,
|
---|
6967 | CryptoServiceTlsSetSignatureAlgoList,
|
---|
6968 | CryptoServiceTlsSetEcCurve,
|
---|
6969 | /// TLS Get (continued)
|
---|
6970 | CryptoServiceTlsGetExportKey,
|
---|
6971 | /// Ec (Continued)
|
---|
6972 | CryptoServiceEcGetPublicKeyFromX509,
|
---|
6973 | CryptoServiceEcGetPrivateKeyFromPem,
|
---|
6974 | CryptoServiceEcDsaSign,
|
---|
6975 | CryptoServiceEcDsaVerify,
|
---|
6976 | /// X509 (Continued)
|
---|
6977 | CryptoServiceX509GetVersion,
|
---|
6978 | CryptoServiceX509GetSerialNumber,
|
---|
6979 | CryptoServiceX509GetIssuerName,
|
---|
6980 | CryptoServiceX509GetSignatureAlgorithm,
|
---|
6981 | CryptoServiceX509GetExtensionData,
|
---|
6982 | CryptoServiceX509GetExtendedKeyUsage,
|
---|
6983 | CryptoServiceX509GetValidity,
|
---|
6984 | CryptoServiceX509FormatDateTime,
|
---|
6985 | CryptoServiceX509CompareDateTime,
|
---|
6986 | CryptoServiceX509GetKeyUsage,
|
---|
6987 | CryptoServiceX509VerifyCertChain,
|
---|
6988 | CryptoServiceX509GetCertFromCertChain,
|
---|
6989 | CryptoServiceAsn1GetTag,
|
---|
6990 | CryptoServiceX509GetExtendedBasicConstraints
|
---|
6991 | };
|
---|