2 Implements the EDK II Crypto Protocol/PPI services using the library services
3 from BaseCryptLib and TlsLib.
5 Copyright (C) Microsoft Corporation. All rights reserved.
6 Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
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>
18 A macro used to retrieve the FixedAtBuild PcdCryptoServiceFamilyEnable with a
19 typecast to its associcted structure type PCD_CRYPTO_SERVICE_FAMILY_ENABLE.
21 #define EDKII_CRYPTO_PCD ((const PCD_CRYPTO_SERVICE_FAMILY_ENABLE *) \
22 (FixedPcdGetPtr (PcdCryptoServiceFamilyEnable)))
25 A macro used to call a non-void BaseCryptLib function if it is enabled.
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.
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
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
41 #define CALL_BASECRYPTLIB(Enable, Function, Args, ErrorReturnValue) \
42 EDKII_CRYPTO_PCD->Enable \
44 : (BaseCryptLibServciceNotEnabled (#Function), ErrorReturnValue)
47 A macro used to call a void BaseCryptLib function if it is enabled.
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.
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
57 @param Function The name of the BaseCryptLib function.
58 @param Args The argument list to pass to Function.
61 #define CALL_VOID_BASECRYPTLIB(Enable, Function, Args) \
62 EDKII_CRYPTO_PCD->Enable \
64 : BaseCryptLibServciceNotEnabled (#Function)
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
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.
75 @param[in] FunctionName Null-terminated ASCII string that is the name of an
76 EDK II Crypto service.
81 BaseCryptLibServciceNotEnabled (
82 IN CONST CHAR8
*FunctionName
85 DEBUG ((DEBUG_ERROR
, "[%a] Function %a() is not enabled\n", gEfiCallerBaseName
, FunctionName
));
86 ASSERT_EFI_ERROR (EFI_UNSUPPORTED
);
90 Returns the version of the EDK II Crypto Protocol.
92 @return The version of the EDK II Crypto Protocol.
97 CryptoServiceGetCryptoVersion (
101 return EDKII_CRYPTO_VERSION
;
104 //=====================================================================================
105 // One-Way Cryptographic Hash Primitives
106 //=====================================================================================
109 Retrieves the size, in bytes, of the context buffer required for MD4 hash operations.
111 If this interface is not supported, then return zero.
113 @return The size, in bytes, of the context buffer required for MD4 hash operations.
114 @retval 0 This interface is not supported.
119 CryptoServiceMd4GetContextSize (
123 return CALL_BASECRYPTLIB (Md4
.Services
.GetContextSize
, Md4GetContextSize
, (), 0);
127 Initializes user-supplied memory pointed by Md4Context as MD4 hash context for
130 If Md4Context is NULL, then return FALSE.
131 If this interface is not supported, then return FALSE.
133 @param[out] Md4Context Pointer to MD4 context being initialized.
135 @retval TRUE MD4 context initialization succeeded.
136 @retval FALSE MD4 context initialization failed.
137 @retval FALSE This interface is not supported.
142 CryptoServiceMd4Init (
146 return CALL_BASECRYPTLIB (Md4
.Services
.Init
, Md4Init
, (Md4Context
), FALSE
);
150 Makes a copy of an existing MD4 context.
152 If Md4Context is NULL, then return FALSE.
153 If NewMd4Context is NULL, then return FALSE.
154 If this interface is not supported, then return FALSE.
156 @param[in] Md4Context Pointer to MD4 context being copied.
157 @param[out] NewMd4Context Pointer to new MD4 context.
159 @retval TRUE MD4 context copy succeeded.
160 @retval FALSE MD4 context copy failed.
161 @retval FALSE This interface is not supported.
166 CryptoServiceMd4Duplicate (
167 IN CONST VOID
*Md4Context
,
168 OUT VOID
*NewMd4Context
171 return CALL_BASECRYPTLIB (Md4
.Services
.Duplicate
, Md4Duplicate
, (Md4Context
, NewMd4Context
), FALSE
);
175 Digests the input data and updates MD4 context.
177 This function performs MD4 digest on a data buffer of the specified size.
178 It can be called multiple times to compute the digest of long or discontinuous data streams.
179 MD4 context should be already correctly initialized by Md4Init(), and should not be finalized
180 by Md4Final(). Behavior with invalid context is undefined.
182 If Md4Context is NULL, then return FALSE.
183 If this interface is not supported, then return FALSE.
185 @param[in, out] Md4Context Pointer to the MD4 context.
186 @param[in] Data Pointer to the buffer containing the data to be hashed.
187 @param[in] DataSize Size of Data buffer in bytes.
189 @retval TRUE MD4 data digest succeeded.
190 @retval FALSE MD4 data digest failed.
191 @retval FALSE This interface is not supported.
196 CryptoServiceMd4Update (
197 IN OUT VOID
*Md4Context
,
202 return CALL_BASECRYPTLIB (Md4
.Services
.Update
, Md4Update
, (Md4Context
, Data
, DataSize
), FALSE
);
206 Completes computation of the MD4 digest value.
208 This function completes MD4 hash computation and retrieves the digest value into
209 the specified memory. After this function has been called, the MD4 context cannot
211 MD4 context should be already correctly initialized by Md4Init(), and should not be
212 finalized by Md4Final(). Behavior with invalid MD4 context is undefined.
214 If Md4Context is NULL, then return FALSE.
215 If HashValue is NULL, then return FALSE.
216 If this interface is not supported, then return FALSE.
218 @param[in, out] Md4Context Pointer to the MD4 context.
219 @param[out] HashValue Pointer to a buffer that receives the MD4 digest
222 @retval TRUE MD4 digest computation succeeded.
223 @retval FALSE MD4 digest computation failed.
224 @retval FALSE This interface is not supported.
229 CryptoServiceMd4Final (
230 IN OUT VOID
*Md4Context
,
234 return CALL_BASECRYPTLIB (Md4
.Services
.Final
, Md4Final
, (Md4Context
, HashValue
), FALSE
);
238 Computes the MD4 message digest of a input data buffer.
240 This function performs the MD4 message digest of a given data buffer, and places
241 the digest value into the specified memory.
243 If this interface is not supported, then return FALSE.
245 @param[in] Data Pointer to the buffer containing the data to be hashed.
246 @param[in] DataSize Size of Data buffer in bytes.
247 @param[out] HashValue Pointer to a buffer that receives the MD4 digest
250 @retval TRUE MD4 digest computation succeeded.
251 @retval FALSE MD4 digest computation failed.
252 @retval FALSE This interface is not supported.
257 CryptoServiceMd4HashAll (
263 return CALL_BASECRYPTLIB (Md4
.Services
.HashAll
, Md4HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
267 Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
269 If this interface is not supported, then return zero.
271 @return The size, in bytes, of the context buffer required for MD5 hash operations.
272 @retval 0 This interface is not supported.
277 CryptoServiceMd5GetContextSize (
281 return CALL_BASECRYPTLIB (Md5
.Services
.GetContextSize
, Md5GetContextSize
, (), 0);
285 Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
288 If Md5Context is NULL, then return FALSE.
289 If this interface is not supported, then return FALSE.
291 @param[out] Md5Context Pointer to MD5 context being initialized.
293 @retval TRUE MD5 context initialization succeeded.
294 @retval FALSE MD5 context initialization failed.
295 @retval FALSE This interface is not supported.
300 CryptoServiceMd5Init (
304 return CALL_BASECRYPTLIB (Md5
.Services
.Init
, Md5Init
, (Md5Context
), FALSE
);
308 Makes a copy of an existing MD5 context.
310 If Md5Context is NULL, then return FALSE.
311 If NewMd5Context is NULL, then return FALSE.
312 If this interface is not supported, then return FALSE.
314 @param[in] Md5Context Pointer to MD5 context being copied.
315 @param[out] NewMd5Context Pointer to new MD5 context.
317 @retval TRUE MD5 context copy succeeded.
318 @retval FALSE MD5 context copy failed.
319 @retval FALSE This interface is not supported.
324 CryptoServiceMd5Duplicate (
325 IN CONST VOID
*Md5Context
,
326 OUT VOID
*NewMd5Context
329 return CALL_BASECRYPTLIB (Md5
.Services
.Duplicate
, Md5Duplicate
, (Md5Context
, NewMd5Context
), FALSE
);
333 Digests the input data and updates MD5 context.
335 This function performs MD5 digest on a data buffer of the specified size.
336 It can be called multiple times to compute the digest of long or discontinuous data streams.
337 MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
338 by Md5Final(). Behavior with invalid context is undefined.
340 If Md5Context is NULL, then return FALSE.
341 If this interface is not supported, then return FALSE.
343 @param[in, out] Md5Context Pointer to the MD5 context.
344 @param[in] Data Pointer to the buffer containing the data to be hashed.
345 @param[in] DataSize Size of Data buffer in bytes.
347 @retval TRUE MD5 data digest succeeded.
348 @retval FALSE MD5 data digest failed.
349 @retval FALSE This interface is not supported.
354 CryptoServiceMd5Update (
355 IN OUT VOID
*Md5Context
,
360 return CALL_BASECRYPTLIB (Md5
.Services
.Update
, Md5Update
, (Md5Context
, Data
, DataSize
), FALSE
);
364 Completes computation of the MD5 digest value.
366 This function completes MD5 hash computation and retrieves the digest value into
367 the specified memory. After this function has been called, the MD5 context cannot
369 MD5 context should be already correctly initialized by Md5Init(), and should not be
370 finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
372 If Md5Context is NULL, then return FALSE.
373 If HashValue is NULL, then return FALSE.
374 If this interface is not supported, then return FALSE.
376 @param[in, out] Md5Context Pointer to the MD5 context.
377 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
380 @retval TRUE MD5 digest computation succeeded.
381 @retval FALSE MD5 digest computation failed.
382 @retval FALSE This interface is not supported.
387 CryptoServiceMd5Final (
388 IN OUT VOID
*Md5Context
,
392 return CALL_BASECRYPTLIB (Md5
.Services
.Final
, Md5Final
, (Md5Context
, HashValue
), FALSE
);
396 Computes the MD5 message digest of a input data buffer.
398 This function performs the MD5 message digest of a given data buffer, and places
399 the digest value into the specified memory.
401 If this interface is not supported, then return FALSE.
403 @param[in] Data Pointer to the buffer containing the data to be hashed.
404 @param[in] DataSize Size of Data buffer in bytes.
405 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
408 @retval TRUE MD5 digest computation succeeded.
409 @retval FALSE MD5 digest computation failed.
410 @retval FALSE This interface is not supported.
415 CryptoServiceMd5HashAll (
421 return CALL_BASECRYPTLIB (Md5
.Services
.HashAll
, Md5HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
425 Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
427 If this interface is not supported, then return zero.
429 @return The size, in bytes, of the context buffer required for SHA-1 hash operations.
430 @retval 0 This interface is not supported.
435 CryptoServiceSha1GetContextSize (
439 return CALL_BASECRYPTLIB (Sha1
.Services
.GetContextSize
, Sha1GetContextSize
, (), 0);
443 Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
446 If Sha1Context is NULL, then return FALSE.
447 If this interface is not supported, then return FALSE.
449 @param[out] Sha1Context Pointer to SHA-1 context being initialized.
451 @retval TRUE SHA-1 context initialization succeeded.
452 @retval FALSE SHA-1 context initialization failed.
453 @retval FALSE This interface is not supported.
458 CryptoServiceSha1Init (
459 OUT VOID
*Sha1Context
462 return CALL_BASECRYPTLIB (Sha1
.Services
.Init
, Sha1Init
, (Sha1Context
), FALSE
);
466 Makes a copy of an existing SHA-1 context.
468 If Sha1Context is NULL, then return FALSE.
469 If NewSha1Context is NULL, then return FALSE.
470 If this interface is not supported, then return FALSE.
472 @param[in] Sha1Context Pointer to SHA-1 context being copied.
473 @param[out] NewSha1Context Pointer to new SHA-1 context.
475 @retval TRUE SHA-1 context copy succeeded.
476 @retval FALSE SHA-1 context copy failed.
477 @retval FALSE This interface is not supported.
482 CryptoServiceSha1Duplicate (
483 IN CONST VOID
*Sha1Context
,
484 OUT VOID
*NewSha1Context
487 return CALL_BASECRYPTLIB (Sha1
.Services
.Duplicate
, Sha1Duplicate
, (Sha1Context
, NewSha1Context
), FALSE
);
491 Digests the input data and updates SHA-1 context.
493 This function performs SHA-1 digest on a data buffer of the specified size.
494 It can be called multiple times to compute the digest of long or discontinuous data streams.
495 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
496 by Sha1Final(). Behavior with invalid context is undefined.
498 If Sha1Context is NULL, then return FALSE.
499 If this interface is not supported, then return FALSE.
501 @param[in, out] Sha1Context Pointer to the SHA-1 context.
502 @param[in] Data Pointer to the buffer containing the data to be hashed.
503 @param[in] DataSize Size of Data buffer in bytes.
505 @retval TRUE SHA-1 data digest succeeded.
506 @retval FALSE SHA-1 data digest failed.
507 @retval FALSE This interface is not supported.
512 CryptoServiceSha1Update (
513 IN OUT VOID
*Sha1Context
,
518 return CALL_BASECRYPTLIB (Sha1
.Services
.Update
, Sha1Update
, (Sha1Context
, Data
, DataSize
), FALSE
);
522 Completes computation of the SHA-1 digest value.
524 This function completes SHA-1 hash computation and retrieves the digest value into
525 the specified memory. After this function has been called, the SHA-1 context cannot
527 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
528 finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
530 If Sha1Context is NULL, then return FALSE.
531 If HashValue is NULL, then return FALSE.
532 If this interface is not supported, then return FALSE.
534 @param[in, out] Sha1Context Pointer to the SHA-1 context.
535 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
538 @retval TRUE SHA-1 digest computation succeeded.
539 @retval FALSE SHA-1 digest computation failed.
540 @retval FALSE This interface is not supported.
545 CryptoServiceSha1Final (
546 IN OUT VOID
*Sha1Context
,
550 return CALL_BASECRYPTLIB (Sha1
.Services
.Final
, Sha1Final
, (Sha1Context
, HashValue
), FALSE
);
554 Computes the SHA-1 message digest of a input data buffer.
556 This function performs the SHA-1 message digest of a given data buffer, and places
557 the digest value into the specified memory.
559 If this interface is not supported, then return FALSE.
561 @param[in] Data Pointer to the buffer containing the data to be hashed.
562 @param[in] DataSize Size of Data buffer in bytes.
563 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
566 @retval TRUE SHA-1 digest computation succeeded.
567 @retval FALSE SHA-1 digest computation failed.
568 @retval FALSE This interface is not supported.
573 CryptoServiceSha1HashAll (
579 return CALL_BASECRYPTLIB (Sha1
.Services
.HashAll
, Sha1HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
583 Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
585 @return The size, in bytes, of the context buffer required for SHA-256 hash operations.
590 CryptoServiceSha256GetContextSize (
594 return CALL_BASECRYPTLIB (Sha256
.Services
.GetContextSize
, Sha256GetContextSize
, (), 0);
598 Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for
601 If Sha256Context is NULL, then return FALSE.
603 @param[out] Sha256Context Pointer to SHA-256 context being initialized.
605 @retval TRUE SHA-256 context initialization succeeded.
606 @retval FALSE SHA-256 context initialization failed.
611 CryptoServiceSha256Init (
612 OUT VOID
*Sha256Context
615 return CALL_BASECRYPTLIB (Sha256
.Services
.Init
, Sha256Init
, (Sha256Context
), FALSE
);
619 Makes a copy of an existing SHA-256 context.
621 If Sha256Context is NULL, then return FALSE.
622 If NewSha256Context is NULL, then return FALSE.
623 If this interface is not supported, then return FALSE.
625 @param[in] Sha256Context Pointer to SHA-256 context being copied.
626 @param[out] NewSha256Context Pointer to new SHA-256 context.
628 @retval TRUE SHA-256 context copy succeeded.
629 @retval FALSE SHA-256 context copy failed.
630 @retval FALSE This interface is not supported.
635 CryptoServiceSha256Duplicate (
636 IN CONST VOID
*Sha256Context
,
637 OUT VOID
*NewSha256Context
640 return CALL_BASECRYPTLIB (Sha256
.Services
.Duplicate
, Sha256Duplicate
, (Sha256Context
, NewSha256Context
), FALSE
);
644 Digests the input data and updates SHA-256 context.
646 This function performs SHA-256 digest on a data buffer of the specified size.
647 It can be called multiple times to compute the digest of long or discontinuous data streams.
648 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized
649 by Sha256Final(). Behavior with invalid context is undefined.
651 If Sha256Context is NULL, then return FALSE.
653 @param[in, out] Sha256Context Pointer to the SHA-256 context.
654 @param[in] Data Pointer to the buffer containing the data to be hashed.
655 @param[in] DataSize Size of Data buffer in bytes.
657 @retval TRUE SHA-256 data digest succeeded.
658 @retval FALSE SHA-256 data digest failed.
663 CryptoServiceSha256Update (
664 IN OUT VOID
*Sha256Context
,
669 return CALL_BASECRYPTLIB (Sha256
.Services
.Update
, Sha256Update
, (Sha256Context
, Data
, DataSize
), FALSE
);
673 Completes computation of the SHA-256 digest value.
675 This function completes SHA-256 hash computation and retrieves the digest value into
676 the specified memory. After this function has been called, the SHA-256 context cannot
678 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be
679 finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.
681 If Sha256Context is NULL, then return FALSE.
682 If HashValue is NULL, then return FALSE.
684 @param[in, out] Sha256Context Pointer to the SHA-256 context.
685 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
688 @retval TRUE SHA-256 digest computation succeeded.
689 @retval FALSE SHA-256 digest computation failed.
694 CryptoServiceSha256Final (
695 IN OUT VOID
*Sha256Context
,
699 return CALL_BASECRYPTLIB (Sha256
.Services
.Final
, Sha256Final
, (Sha256Context
, HashValue
), FALSE
);
703 Computes the SHA-256 message digest of a input data buffer.
705 This function performs the SHA-256 message digest of a given data buffer, and places
706 the digest value into the specified memory.
708 If this interface is not supported, then return FALSE.
710 @param[in] Data Pointer to the buffer containing the data to be hashed.
711 @param[in] DataSize Size of Data buffer in bytes.
712 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
715 @retval TRUE SHA-256 digest computation succeeded.
716 @retval FALSE SHA-256 digest computation failed.
717 @retval FALSE This interface is not supported.
722 CryptoServiceSha256HashAll (
728 return CALL_BASECRYPTLIB (Sha256
.Services
.HashAll
, Sha256HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
732 Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
734 @return The size, in bytes, of the context buffer required for SHA-384 hash operations.
739 CryptoServiceSha384GetContextSize (
743 return CALL_BASECRYPTLIB (Sha384
.Services
.GetContextSize
, Sha384GetContextSize
, (), 0);
747 Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for
750 If Sha384Context is NULL, then return FALSE.
752 @param[out] Sha384Context Pointer to SHA-384 context being initialized.
754 @retval TRUE SHA-384 context initialization succeeded.
755 @retval FALSE SHA-384 context initialization failed.
760 CryptoServiceSha384Init (
761 OUT VOID
*Sha384Context
764 return CALL_BASECRYPTLIB (Sha384
.Services
.Init
, Sha384Init
, (Sha384Context
), FALSE
);
768 Makes a copy of an existing SHA-384 context.
770 If Sha384Context is NULL, then return FALSE.
771 If NewSha384Context is NULL, then return FALSE.
772 If this interface is not supported, then return FALSE.
774 @param[in] Sha384Context Pointer to SHA-384 context being copied.
775 @param[out] NewSha384Context Pointer to new SHA-384 context.
777 @retval TRUE SHA-384 context copy succeeded.
778 @retval FALSE SHA-384 context copy failed.
779 @retval FALSE This interface is not supported.
784 CryptoServiceSha384Duplicate (
785 IN CONST VOID
*Sha384Context
,
786 OUT VOID
*NewSha384Context
789 return CALL_BASECRYPTLIB (Sha384
.Services
.Duplicate
, Sha384Duplicate
, (Sha384Context
, NewSha384Context
), FALSE
);
793 Digests the input data and updates SHA-384 context.
795 This function performs SHA-384 digest on a data buffer of the specified size.
796 It can be called multiple times to compute the digest of long or discontinuous data streams.
797 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized
798 by Sha384Final(). Behavior with invalid context is undefined.
800 If Sha384Context is NULL, then return FALSE.
802 @param[in, out] Sha384Context Pointer to the SHA-384 context.
803 @param[in] Data Pointer to the buffer containing the data to be hashed.
804 @param[in] DataSize Size of Data buffer in bytes.
806 @retval TRUE SHA-384 data digest succeeded.
807 @retval FALSE SHA-384 data digest failed.
812 CryptoServiceSha384Update (
813 IN OUT VOID
*Sha384Context
,
818 return CALL_BASECRYPTLIB (Sha384
.Services
.Update
, Sha384Update
, (Sha384Context
, Data
, DataSize
), FALSE
);
822 Completes computation of the SHA-384 digest value.
824 This function completes SHA-384 hash computation and retrieves the digest value into
825 the specified memory. After this function has been called, the SHA-384 context cannot
827 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be
828 finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.
830 If Sha384Context is NULL, then return FALSE.
831 If HashValue is NULL, then return FALSE.
833 @param[in, out] Sha384Context Pointer to the SHA-384 context.
834 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
837 @retval TRUE SHA-384 digest computation succeeded.
838 @retval FALSE SHA-384 digest computation failed.
843 CryptoServiceSha384Final (
844 IN OUT VOID
*Sha384Context
,
848 return CALL_BASECRYPTLIB (Sha384
.Services
.Final
, Sha384Final
, (Sha384Context
, HashValue
), FALSE
);
852 Computes the SHA-384 message digest of a input data buffer.
854 This function performs the SHA-384 message digest of a given data buffer, and places
855 the digest value into the specified memory.
857 If this interface is not supported, then return FALSE.
859 @param[in] Data Pointer to the buffer containing the data to be hashed.
860 @param[in] DataSize Size of Data buffer in bytes.
861 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
864 @retval TRUE SHA-384 digest computation succeeded.
865 @retval FALSE SHA-384 digest computation failed.
866 @retval FALSE This interface is not supported.
871 CryptoServiceSha384HashAll (
877 return CALL_BASECRYPTLIB (Sha384
.Services
.HashAll
, Sha384HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
881 Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.
883 @return The size, in bytes, of the context buffer required for SHA-512 hash operations.
888 CryptoServiceSha512GetContextSize (
892 return CALL_BASECRYPTLIB (Sha512
.Services
.GetContextSize
, Sha512GetContextSize
, (), 0);
896 Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for
899 If Sha512Context is NULL, then return FALSE.
901 @param[out] Sha512Context Pointer to SHA-512 context being initialized.
903 @retval TRUE SHA-512 context initialization succeeded.
904 @retval FALSE SHA-512 context initialization failed.
909 CryptoServiceSha512Init (
910 OUT VOID
*Sha512Context
913 return CALL_BASECRYPTLIB (Sha512
.Services
.Init
, Sha512Init
, (Sha512Context
), FALSE
);
917 Makes a copy of an existing SHA-512 context.
919 If Sha512Context is NULL, then return FALSE.
920 If NewSha512Context is NULL, then return FALSE.
921 If this interface is not supported, then return FALSE.
923 @param[in] Sha512Context Pointer to SHA-512 context being copied.
924 @param[out] NewSha512Context Pointer to new SHA-512 context.
926 @retval TRUE SHA-512 context copy succeeded.
927 @retval FALSE SHA-512 context copy failed.
928 @retval FALSE This interface is not supported.
933 CryptoServiceSha512Duplicate (
934 IN CONST VOID
*Sha512Context
,
935 OUT VOID
*NewSha512Context
938 return CALL_BASECRYPTLIB (Sha512
.Services
.Duplicate
, Sha512Duplicate
, (Sha512Context
, NewSha512Context
), FALSE
);
942 Digests the input data and updates SHA-512 context.
944 This function performs SHA-512 digest on a data buffer of the specified size.
945 It can be called multiple times to compute the digest of long or discontinuous data streams.
946 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized
947 by Sha512Final(). Behavior with invalid context is undefined.
949 If Sha512Context is NULL, then return FALSE.
951 @param[in, out] Sha512Context Pointer to the SHA-512 context.
952 @param[in] Data Pointer to the buffer containing the data to be hashed.
953 @param[in] DataSize Size of Data buffer in bytes.
955 @retval TRUE SHA-512 data digest succeeded.
956 @retval FALSE SHA-512 data digest failed.
961 CryptoServiceSha512Update (
962 IN OUT VOID
*Sha512Context
,
967 return CALL_BASECRYPTLIB (Sha512
.Services
.Update
, Sha512Update
, (Sha512Context
, Data
, DataSize
), FALSE
);
971 Completes computation of the SHA-512 digest value.
973 This function completes SHA-512 hash computation and retrieves the digest value into
974 the specified memory. After this function has been called, the SHA-512 context cannot
976 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be
977 finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.
979 If Sha512Context is NULL, then return FALSE.
980 If HashValue is NULL, then return FALSE.
982 @param[in, out] Sha512Context Pointer to the SHA-512 context.
983 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
986 @retval TRUE SHA-512 digest computation succeeded.
987 @retval FALSE SHA-512 digest computation failed.
992 CryptoServiceSha512Final (
993 IN OUT VOID
*Sha512Context
,
997 return CALL_BASECRYPTLIB (Sha512
.Services
.Final
, Sha512Final
, (Sha512Context
, HashValue
), FALSE
);
1001 Computes the SHA-512 message digest of a input data buffer.
1003 This function performs the SHA-512 message digest of a given data buffer, and places
1004 the digest value into the specified memory.
1006 If this interface is not supported, then return FALSE.
1008 @param[in] Data Pointer to the buffer containing the data to be hashed.
1009 @param[in] DataSize Size of Data buffer in bytes.
1010 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
1013 @retval TRUE SHA-512 digest computation succeeded.
1014 @retval FALSE SHA-512 digest computation failed.
1015 @retval FALSE This interface is not supported.
1020 CryptoServiceSha512HashAll (
1021 IN CONST VOID
*Data
,
1023 OUT UINT8
*HashValue
1026 return CALL_BASECRYPTLIB (Sha512
.Services
.HashAll
, Sha512HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
1030 Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
1032 @return The size, in bytes, of the context buffer required for SM3 hash operations.
1037 CryptoServiceSm3GetContextSize (
1041 return CALL_BASECRYPTLIB (Sm3
.Services
.GetContextSize
, Sm3GetContextSize
, (), 0);
1045 Initializes user-supplied memory pointed by Sm3Context as SM3 hash context for
1048 If Sm3Context is NULL, then return FALSE.
1050 @param[out] Sm3Context Pointer to SM3 context being initialized.
1052 @retval TRUE SM3 context initialization succeeded.
1053 @retval FALSE SM3 context initialization failed.
1058 CryptoServiceSm3Init (
1059 OUT VOID
*Sm3Context
1062 return CALL_BASECRYPTLIB (Sm3
.Services
.Init
, Sm3Init
, (Sm3Context
), FALSE
);
1066 Makes a copy of an existing SM3 context.
1068 If Sm3Context is NULL, then return FALSE.
1069 If NewSm3Context is NULL, then return FALSE.
1070 If this interface is not supported, then return FALSE.
1072 @param[in] Sm3Context Pointer to SM3 context being copied.
1073 @param[out] NewSm3Context Pointer to new SM3 context.
1075 @retval TRUE SM3 context copy succeeded.
1076 @retval FALSE SM3 context copy failed.
1077 @retval FALSE This interface is not supported.
1082 CryptoServiceSm3Duplicate (
1083 IN CONST VOID
*Sm3Context
,
1084 OUT VOID
*NewSm3Context
1087 return CALL_BASECRYPTLIB (Sm3
.Services
.Duplicate
, Sm3Duplicate
, (Sm3Context
, NewSm3Context
), FALSE
);
1091 Digests the input data and updates SM3 context.
1093 This function performs SM3 digest on a data buffer of the specified size.
1094 It can be called multiple times to compute the digest of long or discontinuous data streams.
1095 SM3 context should be already correctly initialized by Sm3Init(), and should not be finalized
1096 by Sm3Final(). Behavior with invalid context is undefined.
1098 If Sm3Context is NULL, then return FALSE.
1100 @param[in, out] Sm3Context Pointer to the SM3 context.
1101 @param[in] Data Pointer to the buffer containing the data to be hashed.
1102 @param[in] DataSize Size of Data buffer in bytes.
1104 @retval TRUE SM3 data digest succeeded.
1105 @retval FALSE SM3 data digest failed.
1110 CryptoServiceSm3Update (
1111 IN OUT VOID
*Sm3Context
,
1112 IN CONST VOID
*Data
,
1116 return CALL_BASECRYPTLIB (Sm3
.Services
.Update
, Sm3Update
, (Sm3Context
, Data
, DataSize
), FALSE
);
1120 Completes computation of the SM3 digest value.
1122 This function completes SM3 hash computation and retrieves the digest value into
1123 the specified memory. After this function has been called, the SM3 context cannot
1125 SM3 context should be already correctly initialized by Sm3Init(), and should not be
1126 finalized by Sm3Final(). Behavior with invalid SM3 context is undefined.
1128 If Sm3Context is NULL, then return FALSE.
1129 If HashValue is NULL, then return FALSE.
1131 @param[in, out] Sm3Context Pointer to the SM3 context.
1132 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
1135 @retval TRUE SM3 digest computation succeeded.
1136 @retval FALSE SM3 digest computation failed.
1141 CryptoServiceSm3Final (
1142 IN OUT VOID
*Sm3Context
,
1143 OUT UINT8
*HashValue
1146 return CALL_BASECRYPTLIB (Sm3
.Services
.Final
, Sm3Final
, (Sm3Context
, HashValue
), FALSE
);
1150 Computes the SM3 message digest of a input data buffer.
1152 This function performs the SM3 message digest of a given data buffer, and places
1153 the digest value into the specified memory.
1155 If this interface is not supported, then return FALSE.
1157 @param[in] Data Pointer to the buffer containing the data to be hashed.
1158 @param[in] DataSize Size of Data buffer in bytes.
1159 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
1162 @retval TRUE SM3 digest computation succeeded.
1163 @retval FALSE SM3 digest computation failed.
1164 @retval FALSE This interface is not supported.
1169 CryptoServiceSm3HashAll (
1170 IN CONST VOID
*Data
,
1172 OUT UINT8
*HashValue
1175 return CALL_BASECRYPTLIB (Sm3
.Services
.HashAll
, Sm3HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
1178 //=====================================================================================
1179 // MAC (Message Authentication Code) Primitive
1180 //=====================================================================================
1183 Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use.
1185 If this interface is not supported, then return NULL.
1187 @return Pointer to the HMAC_CTX context that has been initialized.
1188 If the allocations fails, HmacMd5New() returns NULL.
1189 @retval NULL This interface is not supported.
1194 CryptoServiceHmacMd5New (
1198 return CALL_BASECRYPTLIB (HmacMd5
.Services
.New
, HmacMd5New
, (), NULL
);
1202 Release the specified HMAC_CTX context.
1204 If this interface is not supported, then do nothing.
1206 @param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released.
1211 CryptoServiceHmacMd5Free (
1215 CALL_VOID_BASECRYPTLIB (HmacMd5
.Services
.Free
, HmacMd5Free
, (HmacMd5Ctx
));
1219 Set user-supplied key for subsequent use. It must be done before any
1220 calling to HmacMd5Update().
1222 If HmacMd5Context is NULL, then return FALSE.
1223 If this interface is not supported, then return FALSE.
1225 @param[out] HmacMd5Context Pointer to HMAC-MD5 context.
1226 @param[in] Key Pointer to the user-supplied key.
1227 @param[in] KeySize Key size in bytes.
1229 @retval TRUE Key is set successfully.
1230 @retval FALSE Key is set unsuccessfully.
1231 @retval FALSE This interface is not supported.
1236 CryptoServiceHmacMd5SetKey (
1237 OUT VOID
*HmacMd5Context
,
1238 IN CONST UINT8
*Key
,
1242 return CALL_BASECRYPTLIB (HmacMd5
.Services
.SetKey
, HmacMd5SetKey
, (HmacMd5Context
, Key
, KeySize
), FALSE
);
1246 Makes a copy of an existing HMAC-MD5 context.
1248 If HmacMd5Context is NULL, then return FALSE.
1249 If NewHmacMd5Context is NULL, then return FALSE.
1250 If this interface is not supported, then return FALSE.
1252 @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied.
1253 @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context.
1255 @retval TRUE HMAC-MD5 context copy succeeded.
1256 @retval FALSE HMAC-MD5 context copy failed.
1257 @retval FALSE This interface is not supported.
1262 CryptoServiceHmacMd5Duplicate (
1263 IN CONST VOID
*HmacMd5Context
,
1264 OUT VOID
*NewHmacMd5Context
1267 return CALL_BASECRYPTLIB (HmacMd5
.Services
.Duplicate
, HmacMd5Duplicate
, (HmacMd5Context
, NewHmacMd5Context
), FALSE
);
1271 Digests the input data and updates HMAC-MD5 context.
1273 This function performs HMAC-MD5 digest on a data buffer of the specified size.
1274 It can be called multiple times to compute the digest of long or discontinuous data streams.
1275 HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by
1276 HmacMd5Final(). Behavior with invalid context is undefined.
1278 If HmacMd5Context is NULL, then return FALSE.
1279 If this interface is not supported, then return FALSE.
1281 @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
1282 @param[in] Data Pointer to the buffer containing the data to be digested.
1283 @param[in] DataSize Size of Data buffer in bytes.
1285 @retval TRUE HMAC-MD5 data digest succeeded.
1286 @retval FALSE HMAC-MD5 data digest failed.
1287 @retval FALSE This interface is not supported.
1292 CryptoServiceHmacMd5Update (
1293 IN OUT VOID
*HmacMd5Context
,
1294 IN CONST VOID
*Data
,
1298 return CALL_BASECRYPTLIB (HmacMd5
.Services
.Update
, HmacMd5Update
, (HmacMd5Context
, Data
, DataSize
), FALSE
);
1302 Completes computation of the HMAC-MD5 digest value.
1304 This function completes HMAC-MD5 hash computation and retrieves the digest value into
1305 the specified memory. After this function has been called, the HMAC-MD5 context cannot
1307 HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by
1308 HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined.
1310 If HmacMd5Context is NULL, then return FALSE.
1311 If HmacValue is NULL, then return FALSE.
1312 If this interface is not supported, then return FALSE.
1314 @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
1315 @param[out] HmacValue Pointer to a buffer that receives the HMAC-MD5 digest
1318 @retval TRUE HMAC-MD5 digest computation succeeded.
1319 @retval FALSE HMAC-MD5 digest computation failed.
1320 @retval FALSE This interface is not supported.
1325 CryptoServiceHmacMd5Final (
1326 IN OUT VOID
*HmacMd5Context
,
1327 OUT UINT8
*HmacValue
1330 return CALL_BASECRYPTLIB (HmacMd5
.Services
.Final
, HmacMd5Final
, (HmacMd5Context
, HmacValue
), FALSE
);
1334 Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use.
1336 If this interface is not supported, then return NULL.
1338 @return Pointer to the HMAC_CTX context that has been initialized.
1339 If the allocations fails, HmacSha1New() returns NULL.
1340 @return NULL This interface is not supported.
1345 CryptoServiceHmacSha1New (
1349 return CALL_BASECRYPTLIB (HmacSha1
.Services
.New
, HmacSha1New
, (), NULL
);
1353 Release the specified HMAC_CTX context.
1355 If this interface is not supported, then do nothing.
1357 @param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released.
1362 CryptoServiceHmacSha1Free (
1363 IN VOID
*HmacSha1Ctx
1366 CALL_VOID_BASECRYPTLIB (HmacSha1
.Services
.Free
, HmacSha1Free
, (HmacSha1Ctx
));
1370 Set user-supplied key for subsequent use. It must be done before any
1371 calling to HmacSha1Update().
1373 If HmacSha1Context is NULL, then return FALSE.
1374 If this interface is not supported, then return FALSE.
1376 @param[out] HmacSha1Context Pointer to HMAC-SHA1 context.
1377 @param[in] Key Pointer to the user-supplied key.
1378 @param[in] KeySize Key size in bytes.
1380 @retval TRUE The Key is set successfully.
1381 @retval FALSE The Key is set unsuccessfully.
1382 @retval FALSE This interface is not supported.
1387 CryptoServiceHmacSha1SetKey (
1388 OUT VOID
*HmacSha1Context
,
1389 IN CONST UINT8
*Key
,
1393 return CALL_BASECRYPTLIB (HmacSha1
.Services
.SetKey
, HmacSha1SetKey
, (HmacSha1Context
, Key
, KeySize
), FALSE
);
1397 Makes a copy of an existing HMAC-SHA1 context.
1399 If HmacSha1Context is NULL, then return FALSE.
1400 If NewHmacSha1Context is NULL, then return FALSE.
1401 If this interface is not supported, then return FALSE.
1403 @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied.
1404 @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context.
1406 @retval TRUE HMAC-SHA1 context copy succeeded.
1407 @retval FALSE HMAC-SHA1 context copy failed.
1408 @retval FALSE This interface is not supported.
1413 CryptoServiceHmacSha1Duplicate (
1414 IN CONST VOID
*HmacSha1Context
,
1415 OUT VOID
*NewHmacSha1Context
1418 return CALL_BASECRYPTLIB (HmacSha1
.Services
.Duplicate
, HmacSha1Duplicate
, (HmacSha1Context
, NewHmacSha1Context
), FALSE
);
1422 Digests the input data and updates HMAC-SHA1 context.
1424 This function performs HMAC-SHA1 digest on a data buffer of the specified size.
1425 It can be called multiple times to compute the digest of long or discontinuous data streams.
1426 HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized by
1427 HmacSha1Final(). Behavior with invalid context is undefined.
1429 If HmacSha1Context is NULL, then return FALSE.
1430 If this interface is not supported, then return FALSE.
1432 @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
1433 @param[in] Data Pointer to the buffer containing the data to be digested.
1434 @param[in] DataSize Size of Data buffer in bytes.
1436 @retval TRUE HMAC-SHA1 data digest succeeded.
1437 @retval FALSE HMAC-SHA1 data digest failed.
1438 @retval FALSE This interface is not supported.
1443 CryptoServiceHmacSha1Update (
1444 IN OUT VOID
*HmacSha1Context
,
1445 IN CONST VOID
*Data
,
1449 return CALL_BASECRYPTLIB (HmacSha1
.Services
.Update
, HmacSha1Update
, (HmacSha1Context
, Data
, DataSize
), FALSE
);
1453 Completes computation of the HMAC-SHA1 digest value.
1455 This function completes HMAC-SHA1 hash computation and retrieves the digest value into
1456 the specified memory. After this function has been called, the HMAC-SHA1 context cannot
1458 HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized
1459 by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined.
1461 If HmacSha1Context is NULL, then return FALSE.
1462 If HmacValue is NULL, then return FALSE.
1463 If this interface is not supported, then return FALSE.
1465 @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
1466 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest
1469 @retval TRUE HMAC-SHA1 digest computation succeeded.
1470 @retval FALSE HMAC-SHA1 digest computation failed.
1471 @retval FALSE This interface is not supported.
1476 CryptoServiceHmacSha1Final (
1477 IN OUT VOID
*HmacSha1Context
,
1478 OUT UINT8
*HmacValue
1481 return CALL_BASECRYPTLIB (HmacSha1
.Services
.Final
, HmacSha1Final
, (HmacSha1Context
, HmacValue
), FALSE
);
1485 Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
1487 @return Pointer to the HMAC_CTX context that has been initialized.
1488 If the allocations fails, HmacSha256New() returns NULL.
1493 CryptoServiceHmacSha256New (
1497 return CALL_BASECRYPTLIB (HmacSha256
.Services
.New
, HmacSha256New
, (), NULL
);
1501 Release the specified HMAC_CTX context.
1503 @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released.
1508 CryptoServiceHmacSha256Free (
1509 IN VOID
*HmacSha256Ctx
1512 CALL_VOID_BASECRYPTLIB (HmacSha256
.Services
.Free
, HmacSha256Free
, (HmacSha256Ctx
));
1516 Set user-supplied key for subsequent use. It must be done before any
1517 calling to HmacSha256Update().
1519 If HmacSha256Context is NULL, then return FALSE.
1520 If this interface is not supported, then return FALSE.
1522 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.
1523 @param[in] Key Pointer to the user-supplied key.
1524 @param[in] KeySize Key size in bytes.
1526 @retval TRUE The Key is set successfully.
1527 @retval FALSE The Key is set unsuccessfully.
1528 @retval FALSE This interface is not supported.
1533 CryptoServiceHmacSha256SetKey (
1534 OUT VOID
*HmacSha256Context
,
1535 IN CONST UINT8
*Key
,
1539 return CALL_BASECRYPTLIB (HmacSha256
.Services
.SetKey
, HmacSha256SetKey
, (HmacSha256Context
, Key
, KeySize
), FALSE
);
1543 Makes a copy of an existing HMAC-SHA256 context.
1545 If HmacSha256Context is NULL, then return FALSE.
1546 If NewHmacSha256Context is NULL, then return FALSE.
1547 If this interface is not supported, then return FALSE.
1549 @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied.
1550 @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context.
1552 @retval TRUE HMAC-SHA256 context copy succeeded.
1553 @retval FALSE HMAC-SHA256 context copy failed.
1554 @retval FALSE This interface is not supported.
1559 CryptoServiceHmacSha256Duplicate (
1560 IN CONST VOID
*HmacSha256Context
,
1561 OUT VOID
*NewHmacSha256Context
1564 return CALL_BASECRYPTLIB (HmacSha256
.Services
.Duplicate
, HmacSha256Duplicate
, (HmacSha256Context
, NewHmacSha256Context
), FALSE
);
1568 Digests the input data and updates HMAC-SHA256 context.
1570 This function performs HMAC-SHA256 digest on a data buffer of the specified size.
1571 It can be called multiple times to compute the digest of long or discontinuous data streams.
1572 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
1573 by HmacSha256Final(). Behavior with invalid context is undefined.
1575 If HmacSha256Context is NULL, then return FALSE.
1576 If this interface is not supported, then return FALSE.
1578 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
1579 @param[in] Data Pointer to the buffer containing the data to be digested.
1580 @param[in] DataSize Size of Data buffer in bytes.
1582 @retval TRUE HMAC-SHA256 data digest succeeded.
1583 @retval FALSE HMAC-SHA256 data digest failed.
1584 @retval FALSE This interface is not supported.
1589 CryptoServiceHmacSha256Update (
1590 IN OUT VOID
*HmacSha256Context
,
1591 IN CONST VOID
*Data
,
1595 return CALL_BASECRYPTLIB (HmacSha256
.Services
.Update
, HmacSha256Update
, (HmacSha256Context
, Data
, DataSize
), FALSE
);
1599 Completes computation of the HMAC-SHA256 digest value.
1601 This function completes HMAC-SHA256 hash computation and retrieves the digest value into
1602 the specified memory. After this function has been called, the HMAC-SHA256 context cannot
1604 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
1605 by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.
1607 If HmacSha256Context is NULL, then return FALSE.
1608 If HmacValue is NULL, then return FALSE.
1609 If this interface is not supported, then return FALSE.
1611 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
1612 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest
1615 @retval TRUE HMAC-SHA256 digest computation succeeded.
1616 @retval FALSE HMAC-SHA256 digest computation failed.
1617 @retval FALSE This interface is not supported.
1622 CryptoServiceHmacSha256Final (
1623 IN OUT VOID
*HmacSha256Context
,
1624 OUT UINT8
*HmacValue
1627 return CALL_BASECRYPTLIB (HmacSha256
.Services
.Final
, HmacSha256Final
, (HmacSha256Context
, HmacValue
), FALSE
);
1630 //=====================================================================================
1631 // Symmetric Cryptography Primitive
1632 //=====================================================================================
1635 Retrieves the size, in bytes, of the context buffer required for TDES operations.
1637 If this interface is not supported, then return zero.
1639 @return The size, in bytes, of the context buffer required for TDES operations.
1640 @retval 0 This interface is not supported.
1645 CryptoServiceTdesGetContextSize (
1649 return CALL_BASECRYPTLIB (Tdes
.Services
.GetContextSize
, TdesGetContextSize
, (), 0);
1653 Initializes user-supplied memory as TDES context for subsequent use.
1655 This function initializes user-supplied memory pointed by TdesContext as TDES context.
1656 In addition, it sets up all TDES key materials for subsequent encryption and decryption
1658 There are 3 key options as follows:
1659 KeyLength = 64, Keying option 1: K1 == K2 == K3 (Backward compatibility with DES)
1660 KeyLength = 128, Keying option 2: K1 != K2 and K3 = K1 (Less Security)
1661 KeyLength = 192 Keying option 3: K1 != K2 != K3 (Strongest)
1663 If TdesContext is NULL, then return FALSE.
1664 If Key is NULL, then return FALSE.
1665 If KeyLength is not valid, then return FALSE.
1666 If this interface is not supported, then return FALSE.
1668 @param[out] TdesContext Pointer to TDES context being initialized.
1669 @param[in] Key Pointer to the user-supplied TDES key.
1670 @param[in] KeyLength Length of TDES key in bits.
1672 @retval TRUE TDES context initialization succeeded.
1673 @retval FALSE TDES context initialization failed.
1674 @retval FALSE This interface is not supported.
1679 CryptoServiceTdesInit (
1680 OUT VOID
*TdesContext
,
1681 IN CONST UINT8
*Key
,
1685 return CALL_BASECRYPTLIB (Tdes
.Services
.Init
, TdesInit
, (TdesContext
, Key
, KeyLength
), FALSE
);
1689 Performs TDES encryption on a data buffer of the specified size in ECB mode.
1691 This function performs TDES encryption on data buffer pointed by Input, of specified
1692 size of InputSize, in ECB mode.
1693 InputSize must be multiple of block size (8 bytes). This function does not perform
1694 padding. Caller must perform padding, if necessary, to ensure valid input data size.
1695 TdesContext should be already correctly initialized by TdesInit(). Behavior with
1696 invalid TDES context is undefined.
1698 If TdesContext is NULL, then return FALSE.
1699 If Input is NULL, then return FALSE.
1700 If InputSize is not multiple of block size (8 bytes), then return FALSE.
1701 If Output is NULL, then return FALSE.
1702 If this interface is not supported, then return FALSE.
1704 @param[in] TdesContext Pointer to the TDES context.
1705 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1706 @param[in] InputSize Size of the Input buffer in bytes.
1707 @param[out] Output Pointer to a buffer that receives the TDES encryption output.
1709 @retval TRUE TDES encryption succeeded.
1710 @retval FALSE TDES encryption failed.
1711 @retval FALSE This interface is not supported.
1716 CryptoServiceTdesEcbEncrypt (
1717 IN VOID
*TdesContext
,
1718 IN CONST UINT8
*Input
,
1723 return CALL_BASECRYPTLIB (Tdes
.Services
.EcbEncrypt
, TdesEcbEncrypt
, (TdesContext
, Input
, InputSize
, Output
), FALSE
);
1727 Performs TDES decryption on a data buffer of the specified size in ECB mode.
1729 This function performs TDES decryption on data buffer pointed by Input, of specified
1730 size of InputSize, in ECB mode.
1731 InputSize must be multiple of block size (8 bytes). This function does not perform
1732 padding. Caller must perform padding, if necessary, to ensure valid input data size.
1733 TdesContext should be already correctly initialized by TdesInit(). Behavior with
1734 invalid TDES context is undefined.
1736 If TdesContext is NULL, then return FALSE.
1737 If Input is NULL, then return FALSE.
1738 If InputSize is not multiple of block size (8 bytes), then return FALSE.
1739 If Output is NULL, then return FALSE.
1740 If this interface is not supported, then return FALSE.
1742 @param[in] TdesContext Pointer to the TDES context.
1743 @param[in] Input Pointer to the buffer containing the data to be decrypted.
1744 @param[in] InputSize Size of the Input buffer in bytes.
1745 @param[out] Output Pointer to a buffer that receives the TDES decryption output.
1747 @retval TRUE TDES decryption succeeded.
1748 @retval FALSE TDES decryption failed.
1749 @retval FALSE This interface is not supported.
1754 CryptoServiceTdesEcbDecrypt (
1755 IN VOID
*TdesContext
,
1756 IN CONST UINT8
*Input
,
1761 return CALL_BASECRYPTLIB (Tdes
.Services
.EcbDecrypt
, TdesEcbDecrypt
, (TdesContext
, Input
, InputSize
, Output
), FALSE
);
1765 Performs TDES encryption on a data buffer of the specified size in CBC mode.
1767 This function performs TDES encryption on data buffer pointed by Input, of specified
1768 size of InputSize, in CBC mode.
1769 InputSize must be multiple of block size (8 bytes). This function does not perform
1770 padding. Caller must perform padding, if necessary, to ensure valid input data size.
1771 Initialization vector should be one block size (8 bytes).
1772 TdesContext should be already correctly initialized by TdesInit(). Behavior with
1773 invalid TDES context is undefined.
1775 If TdesContext is NULL, then return FALSE.
1776 If Input is NULL, then return FALSE.
1777 If InputSize is not multiple of block size (8 bytes), then return FALSE.
1778 If Ivec is NULL, then return FALSE.
1779 If Output is NULL, then return FALSE.
1780 If this interface is not supported, then return FALSE.
1782 @param[in] TdesContext Pointer to the TDES context.
1783 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1784 @param[in] InputSize Size of the Input buffer in bytes.
1785 @param[in] Ivec Pointer to initialization vector.
1786 @param[out] Output Pointer to a buffer that receives the TDES encryption output.
1788 @retval TRUE TDES encryption succeeded.
1789 @retval FALSE TDES encryption failed.
1790 @retval FALSE This interface is not supported.
1795 CryptoServiceTdesCbcEncrypt (
1796 IN VOID
*TdesContext
,
1797 IN CONST UINT8
*Input
,
1799 IN CONST UINT8
*Ivec
,
1803 return CALL_BASECRYPTLIB (Tdes
.Services
.CbcEncrypt
, TdesCbcEncrypt
, (TdesContext
, Input
, InputSize
, Ivec
, Output
), FALSE
);
1807 Performs TDES decryption on a data buffer of the specified size in CBC mode.
1809 This function performs TDES decryption on data buffer pointed by Input, of specified
1810 size of InputSize, in CBC mode.
1811 InputSize must be multiple of block size (8 bytes). This function does not perform
1812 padding. Caller must perform padding, if necessary, to ensure valid input data size.
1813 Initialization vector should be one block size (8 bytes).
1814 TdesContext should be already correctly initialized by TdesInit(). Behavior with
1815 invalid TDES context is undefined.
1817 If TdesContext is NULL, then return FALSE.
1818 If Input is NULL, then return FALSE.
1819 If InputSize is not multiple of block size (8 bytes), then return FALSE.
1820 If Ivec is NULL, then return FALSE.
1821 If Output is NULL, then return FALSE.
1822 If this interface is not supported, then return FALSE.
1824 @param[in] TdesContext Pointer to the TDES context.
1825 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1826 @param[in] InputSize Size of the Input buffer in bytes.
1827 @param[in] Ivec Pointer to initialization vector.
1828 @param[out] Output Pointer to a buffer that receives the TDES encryption output.
1830 @retval TRUE TDES decryption succeeded.
1831 @retval FALSE TDES decryption failed.
1832 @retval FALSE This interface is not supported.
1837 CryptoServiceTdesCbcDecrypt (
1838 IN VOID
*TdesContext
,
1839 IN CONST UINT8
*Input
,
1841 IN CONST UINT8
*Ivec
,
1845 return CALL_BASECRYPTLIB (Tdes
.Services
.CbcDecrypt
, TdesCbcDecrypt
, (TdesContext
, Input
, InputSize
, Ivec
, Output
), FALSE
);
1849 Retrieves the size, in bytes, of the context buffer required for AES operations.
1851 If this interface is not supported, then return zero.
1853 @return The size, in bytes, of the context buffer required for AES operations.
1854 @retval 0 This interface is not supported.
1859 CryptoServiceAesGetContextSize (
1863 return CALL_BASECRYPTLIB (Aes
.Services
.GetContextSize
, AesGetContextSize
, (), 0);
1867 Initializes user-supplied memory as AES context for subsequent use.
1869 This function initializes user-supplied memory pointed by AesContext as AES context.
1870 In addition, it sets up all AES key materials for subsequent encryption and decryption
1872 There are 3 options for key length, 128 bits, 192 bits, and 256 bits.
1874 If AesContext is NULL, then return FALSE.
1875 If Key is NULL, then return FALSE.
1876 If KeyLength is not valid, then return FALSE.
1877 If this interface is not supported, then return FALSE.
1879 @param[out] AesContext Pointer to AES context being initialized.
1880 @param[in] Key Pointer to the user-supplied AES key.
1881 @param[in] KeyLength Length of AES key in bits.
1883 @retval TRUE AES context initialization succeeded.
1884 @retval FALSE AES context initialization failed.
1885 @retval FALSE This interface is not supported.
1890 CryptoServiceAesInit (
1891 OUT VOID
*AesContext
,
1892 IN CONST UINT8
*Key
,
1896 return CALL_BASECRYPTLIB (Aes
.Services
.Init
, AesInit
, (AesContext
, Key
, KeyLength
), FALSE
);
1900 Performs AES encryption on a data buffer of the specified size in ECB mode.
1902 This function performs AES encryption on data buffer pointed by Input, of specified
1903 size of InputSize, in ECB mode.
1904 InputSize must be multiple of block size (16 bytes). This function does not perform
1905 padding. Caller must perform padding, if necessary, to ensure valid input data size.
1906 AesContext should be already correctly initialized by AesInit(). Behavior with
1907 invalid AES context is undefined.
1909 If AesContext is NULL, then return FALSE.
1910 If Input is NULL, then return FALSE.
1911 If InputSize is not multiple of block size (16 bytes), then return FALSE.
1912 If Output is NULL, then return FALSE.
1913 If this interface is not supported, then return FALSE.
1915 @param[in] AesContext Pointer to the AES context.
1916 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1917 @param[in] InputSize Size of the Input buffer in bytes.
1918 @param[out] Output Pointer to a buffer that receives the AES encryption output.
1920 @retval TRUE AES encryption succeeded.
1921 @retval FALSE AES encryption failed.
1922 @retval FALSE This interface is not supported.
1927 CryptoServiceAesEcbEncrypt (
1928 IN VOID
*AesContext
,
1929 IN CONST UINT8
*Input
,
1934 return CALL_BASECRYPTLIB (Aes
.Services
.EcbEncrypt
, AesEcbEncrypt
, (AesContext
, Input
, InputSize
, Output
), FALSE
);
1938 Performs AES decryption on a data buffer of the specified size in ECB mode.
1940 This function performs AES decryption on data buffer pointed by Input, of specified
1941 size of InputSize, in ECB mode.
1942 InputSize must be multiple of block size (16 bytes). This function does not perform
1943 padding. Caller must perform padding, if necessary, to ensure valid input data size.
1944 AesContext should be already correctly initialized by AesInit(). Behavior with
1945 invalid AES context is undefined.
1947 If AesContext is NULL, then return FALSE.
1948 If Input is NULL, then return FALSE.
1949 If InputSize is not multiple of block size (16 bytes), then return FALSE.
1950 If Output is NULL, then return FALSE.
1951 If this interface is not supported, then return FALSE.
1953 @param[in] AesContext Pointer to the AES context.
1954 @param[in] Input Pointer to the buffer containing the data to be decrypted.
1955 @param[in] InputSize Size of the Input buffer in bytes.
1956 @param[out] Output Pointer to a buffer that receives the AES decryption output.
1958 @retval TRUE AES decryption succeeded.
1959 @retval FALSE AES decryption failed.
1960 @retval FALSE This interface is not supported.
1965 CryptoServiceAesEcbDecrypt (
1966 IN VOID
*AesContext
,
1967 IN CONST UINT8
*Input
,
1972 return CALL_BASECRYPTLIB (Aes
.Services
.EcbDecrypt
, AesEcbDecrypt
, (AesContext
, Input
, InputSize
, Output
), FALSE
);
1976 Performs AES encryption on a data buffer of the specified size in CBC mode.
1978 This function performs AES encryption on data buffer pointed by Input, of specified
1979 size of InputSize, in CBC mode.
1980 InputSize must be multiple of block size (16 bytes). This function does not perform
1981 padding. Caller must perform padding, if necessary, to ensure valid input data size.
1982 Initialization vector should be one block size (16 bytes).
1983 AesContext should be already correctly initialized by AesInit(). Behavior with
1984 invalid AES context is undefined.
1986 If AesContext is NULL, then return FALSE.
1987 If Input is NULL, then return FALSE.
1988 If InputSize is not multiple of block size (16 bytes), then return FALSE.
1989 If Ivec is NULL, then return FALSE.
1990 If Output is NULL, then return FALSE.
1991 If this interface is not supported, then return FALSE.
1993 @param[in] AesContext Pointer to the AES context.
1994 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1995 @param[in] InputSize Size of the Input buffer in bytes.
1996 @param[in] Ivec Pointer to initialization vector.
1997 @param[out] Output Pointer to a buffer that receives the AES encryption output.
1999 @retval TRUE AES encryption succeeded.
2000 @retval FALSE AES encryption failed.
2001 @retval FALSE This interface is not supported.
2006 CryptoServiceAesCbcEncrypt (
2007 IN VOID
*AesContext
,
2008 IN CONST UINT8
*Input
,
2010 IN CONST UINT8
*Ivec
,
2014 return CALL_BASECRYPTLIB (Aes
.Services
.CbcEncrypt
, AesCbcEncrypt
, (AesContext
, Input
, InputSize
, Ivec
, Output
), FALSE
);
2018 Performs AES decryption on a data buffer of the specified size in CBC mode.
2020 This function performs AES decryption on data buffer pointed by Input, of specified
2021 size of InputSize, in CBC mode.
2022 InputSize must be multiple of block size (16 bytes). This function does not perform
2023 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2024 Initialization vector should be one block size (16 bytes).
2025 AesContext should be already correctly initialized by AesInit(). Behavior with
2026 invalid AES context is undefined.
2028 If AesContext is NULL, then return FALSE.
2029 If Input is NULL, then return FALSE.
2030 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2031 If Ivec is NULL, then return FALSE.
2032 If Output is NULL, then return FALSE.
2033 If this interface is not supported, then return FALSE.
2035 @param[in] AesContext Pointer to the AES context.
2036 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2037 @param[in] InputSize Size of the Input buffer in bytes.
2038 @param[in] Ivec Pointer to initialization vector.
2039 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2041 @retval TRUE AES decryption succeeded.
2042 @retval FALSE AES decryption failed.
2043 @retval FALSE This interface is not supported.
2048 CryptoServiceAesCbcDecrypt (
2049 IN VOID
*AesContext
,
2050 IN CONST UINT8
*Input
,
2052 IN CONST UINT8
*Ivec
,
2056 return CALL_BASECRYPTLIB (Aes
.Services
.CbcDecrypt
, AesCbcDecrypt
, (AesContext
, Input
, InputSize
, Ivec
, Output
), FALSE
);
2060 Retrieves the size, in bytes, of the context buffer required for ARC4 operations.
2062 If this interface is not supported, then return zero.
2064 @return The size, in bytes, of the context buffer required for ARC4 operations.
2065 @retval 0 This interface is not supported.
2070 CryptoServiceArc4GetContextSize (
2074 return CALL_BASECRYPTLIB (Arc4
.Services
.GetContextSize
, Arc4GetContextSize
, (), 0);
2078 Initializes user-supplied memory as ARC4 context for subsequent use.
2080 This function initializes user-supplied memory pointed by Arc4Context as ARC4 context.
2081 In addition, it sets up all ARC4 key materials for subsequent encryption and decryption
2084 If Arc4Context is NULL, then return FALSE.
2085 If Key is NULL, then return FALSE.
2086 If KeySize does not in the range of [5, 256] bytes, then return FALSE.
2087 If this interface is not supported, then return FALSE.
2089 @param[out] Arc4Context Pointer to ARC4 context being initialized.
2090 @param[in] Key Pointer to the user-supplied ARC4 key.
2091 @param[in] KeySize Size of ARC4 key in bytes.
2093 @retval TRUE ARC4 context initialization succeeded.
2094 @retval FALSE ARC4 context initialization failed.
2095 @retval FALSE This interface is not supported.
2100 CryptoServiceArc4Init (
2101 OUT VOID
*Arc4Context
,
2102 IN CONST UINT8
*Key
,
2106 return CALL_BASECRYPTLIB (Arc4
.Services
.Init
, Arc4Init
, (Arc4Context
, Key
, KeySize
), FALSE
);
2110 Performs ARC4 encryption on a data buffer of the specified size.
2112 This function performs ARC4 encryption on data buffer pointed by Input, of specified
2114 Arc4Context should be already correctly initialized by Arc4Init(). Behavior with
2115 invalid ARC4 context is undefined.
2117 If Arc4Context is NULL, then return FALSE.
2118 If Input is NULL, then return FALSE.
2119 If Output is NULL, then return FALSE.
2120 If this interface is not supported, then return FALSE.
2122 @param[in, out] Arc4Context Pointer to the ARC4 context.
2123 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2124 @param[in] InputSize Size of the Input buffer in bytes.
2125 @param[out] Output Pointer to a buffer that receives the ARC4 encryption output.
2127 @retval TRUE ARC4 encryption succeeded.
2128 @retval FALSE ARC4 encryption failed.
2129 @retval FALSE This interface is not supported.
2134 CryptoServiceArc4Encrypt (
2135 IN OUT VOID
*Arc4Context
,
2136 IN CONST UINT8
*Input
,
2141 return CALL_BASECRYPTLIB (Arc4
.Services
.Encrypt
, Arc4Encrypt
, (Arc4Context
, Input
, InputSize
, Output
), FALSE
);
2145 Performs ARC4 decryption on a data buffer of the specified size.
2147 This function performs ARC4 decryption on data buffer pointed by Input, of specified
2149 Arc4Context should be already correctly initialized by Arc4Init(). Behavior with
2150 invalid ARC4 context is undefined.
2152 If Arc4Context is NULL, then return FALSE.
2153 If Input is NULL, then return FALSE.
2154 If Output is NULL, then return FALSE.
2155 If this interface is not supported, then return FALSE.
2157 @param[in, out] Arc4Context Pointer to the ARC4 context.
2158 @param[in] Input Pointer to the buffer containing the data to be decrypted.
2159 @param[in] InputSize Size of the Input buffer in bytes.
2160 @param[out] Output Pointer to a buffer that receives the ARC4 decryption output.
2162 @retval TRUE ARC4 decryption succeeded.
2163 @retval FALSE ARC4 decryption failed.
2164 @retval FALSE This interface is not supported.
2169 CryptoServiceArc4Decrypt (
2170 IN OUT VOID
*Arc4Context
,
2176 return CALL_BASECRYPTLIB (Arc4
.Services
.Decrypt
, Arc4Decrypt
, (Arc4Context
, Input
, InputSize
, Output
), FALSE
);
2180 Resets the ARC4 context to the initial state.
2182 The function resets the ARC4 context to the state it had immediately after the
2183 ARC4Init() function call.
2184 Contrary to ARC4Init(), Arc4Reset() requires no secret key as input, but ARC4 context
2185 should be already correctly initialized by ARC4Init().
2187 If Arc4Context is NULL, then return FALSE.
2188 If this interface is not supported, then return FALSE.
2190 @param[in, out] Arc4Context Pointer to the ARC4 context.
2192 @retval TRUE ARC4 reset succeeded.
2193 @retval FALSE ARC4 reset failed.
2194 @retval FALSE This interface is not supported.
2199 CryptoServiceArc4Reset (
2200 IN OUT VOID
*Arc4Context
2203 return CALL_BASECRYPTLIB (Arc4
.Services
.Reset
, Arc4Reset
, (Arc4Context
), FALSE
);
2206 //=====================================================================================
2207 // Asymmetric Cryptography Primitive
2208 //=====================================================================================
2211 Allocates and initializes one RSA context for subsequent use.
2213 @return Pointer to the RSA context that has been initialized.
2214 If the allocations fails, RsaNew() returns NULL.
2219 CryptoServiceRsaNew (
2223 return CALL_BASECRYPTLIB (Rsa
.Services
.New
, RsaNew
, (), NULL
);
2227 Release the specified RSA context.
2229 If RsaContext is NULL, then return FALSE.
2231 @param[in] RsaContext Pointer to the RSA context to be released.
2236 CryptoServiceRsaFree (
2240 CALL_VOID_BASECRYPTLIB (Rsa
.Services
.Free
, RsaFree
, (RsaContext
));
2244 Sets the tag-designated key component into the established RSA context.
2246 This function sets the tag-designated RSA key component into the established
2247 RSA context from the user-specified non-negative integer (octet string format
2248 represented in RSA PKCS#1).
2249 If BigNumber is NULL, then the specified key component in RSA context is cleared.
2251 If RsaContext is NULL, then return FALSE.
2253 @param[in, out] RsaContext Pointer to RSA context being set.
2254 @param[in] KeyTag Tag of RSA key component being set.
2255 @param[in] BigNumber Pointer to octet integer buffer.
2256 If NULL, then the specified key component in RSA
2258 @param[in] BnSize Size of big number buffer in bytes.
2259 If BigNumber is NULL, then it is ignored.
2261 @retval TRUE RSA key component was set successfully.
2262 @retval FALSE Invalid RSA key component tag.
2267 CryptoServiceRsaSetKey (
2268 IN OUT VOID
*RsaContext
,
2269 IN RSA_KEY_TAG KeyTag
,
2270 IN CONST UINT8
*BigNumber
,
2274 return CALL_BASECRYPTLIB (Rsa
.Services
.SetKey
, RsaSetKey
, (RsaContext
, KeyTag
, BigNumber
, BnSize
), FALSE
);
2278 Gets the tag-designated RSA key component from the established RSA context.
2280 This function retrieves the tag-designated RSA key component from the
2281 established RSA context as a non-negative integer (octet string format
2282 represented in RSA PKCS#1).
2283 If specified key component has not been set or has been cleared, then returned
2285 If the BigNumber buffer is too small to hold the contents of the key, FALSE
2286 is returned and BnSize is set to the required buffer size to obtain the key.
2288 If RsaContext is NULL, then return FALSE.
2289 If BnSize is NULL, then return FALSE.
2290 If BnSize is large enough but BigNumber is NULL, then return FALSE.
2291 If this interface is not supported, then return FALSE.
2293 @param[in, out] RsaContext Pointer to RSA context being set.
2294 @param[in] KeyTag Tag of RSA key component being set.
2295 @param[out] BigNumber Pointer to octet integer buffer.
2296 @param[in, out] BnSize On input, the size of big number buffer in bytes.
2297 On output, the size of data returned in big number buffer in bytes.
2299 @retval TRUE RSA key component was retrieved successfully.
2300 @retval FALSE Invalid RSA key component tag.
2301 @retval FALSE BnSize is too small.
2302 @retval FALSE This interface is not supported.
2307 CryptoServiceRsaGetKey (
2308 IN OUT VOID
*RsaContext
,
2309 IN RSA_KEY_TAG KeyTag
,
2310 OUT UINT8
*BigNumber
,
2311 IN OUT UINTN
*BnSize
2314 return CALL_BASECRYPTLIB (Rsa
.Services
.GetKey
, RsaGetKey
, (RsaContext
, KeyTag
, BigNumber
, BnSize
), FALSE
);
2318 Generates RSA key components.
2320 This function generates RSA key components. It takes RSA public exponent E and
2321 length in bits of RSA modulus N as input, and generates all key components.
2322 If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used.
2324 Before this function can be invoked, pseudorandom number generator must be correctly
2325 initialized by RandomSeed().
2327 If RsaContext is NULL, then return FALSE.
2328 If this interface is not supported, then return FALSE.
2330 @param[in, out] RsaContext Pointer to RSA context being set.
2331 @param[in] ModulusLength Length of RSA modulus N in bits.
2332 @param[in] PublicExponent Pointer to RSA public exponent.
2333 @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes.
2335 @retval TRUE RSA key component was generated successfully.
2336 @retval FALSE Invalid RSA key component tag.
2337 @retval FALSE This interface is not supported.
2342 CryptoServiceRsaGenerateKey (
2343 IN OUT VOID
*RsaContext
,
2344 IN UINTN ModulusLength
,
2345 IN CONST UINT8
*PublicExponent
,
2346 IN UINTN PublicExponentSize
2349 return CALL_BASECRYPTLIB (Rsa
.Services
.GenerateKey
, RsaGenerateKey
, (RsaContext
, ModulusLength
, PublicExponent
, PublicExponentSize
), FALSE
);
2353 Validates key components of RSA context.
2354 NOTE: This function performs integrity checks on all the RSA key material, so
2355 the RSA key structure must contain all the private key data.
2357 This function validates key components of RSA context in following aspects:
2358 - Whether p is a prime
2359 - Whether q is a prime
2361 - Whether d*e = 1 mod lcm(p-1,q-1)
2363 If RsaContext is NULL, then return FALSE.
2364 If this interface is not supported, then return FALSE.
2366 @param[in] RsaContext Pointer to RSA context to check.
2368 @retval TRUE RSA key components are valid.
2369 @retval FALSE RSA key components are not valid.
2370 @retval FALSE This interface is not supported.
2375 CryptoServiceRsaCheckKey (
2379 return CALL_BASECRYPTLIB (Rsa
.Services
.CheckKey
, RsaCheckKey
, (RsaContext
), FALSE
);
2383 Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.
2385 This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in
2387 If the Signature buffer is too small to hold the contents of signature, FALSE
2388 is returned and SigSize is set to the required buffer size to obtain the signature.
2390 If RsaContext is NULL, then return FALSE.
2391 If MessageHash is NULL, then return FALSE.
2392 If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.
2393 If SigSize is large enough but Signature is NULL, then return FALSE.
2394 If this interface is not supported, then return FALSE.
2396 @param[in] RsaContext Pointer to RSA context for signature generation.
2397 @param[in] MessageHash Pointer to octet message hash to be signed.
2398 @param[in] HashSize Size of the message hash in bytes.
2399 @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature.
2400 @param[in, out] SigSize On input, the size of Signature buffer in bytes.
2401 On output, the size of data returned in Signature buffer in bytes.
2403 @retval TRUE Signature successfully generated in PKCS1-v1_5.
2404 @retval FALSE Signature generation failed.
2405 @retval FALSE SigSize is too small.
2406 @retval FALSE This interface is not supported.
2411 CryptoServiceRsaPkcs1Sign (
2412 IN VOID
*RsaContext
,
2413 IN CONST UINT8
*MessageHash
,
2415 OUT UINT8
*Signature
,
2416 IN OUT UINTN
*SigSize
2419 return CALL_BASECRYPTLIB (Rsa
.Services
.Pkcs1Sign
, RsaPkcs1Sign
, (RsaContext
, MessageHash
, HashSize
, Signature
, SigSize
), FALSE
);
2423 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
2426 If RsaContext is NULL, then return FALSE.
2427 If MessageHash is NULL, then return FALSE.
2428 If Signature is NULL, then return FALSE.
2429 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
2431 @param[in] RsaContext Pointer to RSA context for signature verification.
2432 @param[in] MessageHash Pointer to octet message hash to be checked.
2433 @param[in] HashSize Size of the message hash in bytes.
2434 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
2435 @param[in] SigSize Size of signature in bytes.
2437 @retval TRUE Valid signature encoded in PKCS1-v1_5.
2438 @retval FALSE Invalid signature or invalid RSA context.
2443 CryptoServiceRsaPkcs1Verify (
2444 IN VOID
*RsaContext
,
2445 IN CONST UINT8
*MessageHash
,
2447 IN CONST UINT8
*Signature
,
2451 return CALL_BASECRYPTLIB (Rsa
.Services
.Pkcs1Verify
, RsaPkcs1Verify
, (RsaContext
, MessageHash
, HashSize
, Signature
, SigSize
), FALSE
);
2455 Retrieve the RSA Private Key from the password-protected PEM key data.
2457 If PemData is NULL, then return FALSE.
2458 If RsaContext is NULL, then return FALSE.
2459 If this interface is not supported, then return FALSE.
2461 @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.
2462 @param[in] PemSize Size of the PEM key data in bytes.
2463 @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.
2464 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
2465 RSA private key component. Use RsaFree() function to free the
2468 @retval TRUE RSA Private Key was retrieved successfully.
2469 @retval FALSE Invalid PEM key data or incorrect password.
2470 @retval FALSE This interface is not supported.
2475 CryptoServiceRsaGetPrivateKeyFromPem (
2476 IN CONST UINT8
*PemData
,
2478 IN CONST CHAR8
*Password
,
2479 OUT VOID
**RsaContext
2482 return CALL_BASECRYPTLIB (Rsa
.Services
.GetPrivateKeyFromPem
, RsaGetPrivateKeyFromPem
, (PemData
, PemSize
, Password
, RsaContext
), FALSE
);
2486 Retrieve the RSA Public Key from one DER-encoded X509 certificate.
2488 If Cert is NULL, then return FALSE.
2489 If RsaContext is NULL, then return FALSE.
2490 If this interface is not supported, then return FALSE.
2492 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2493 @param[in] CertSize Size of the X509 certificate in bytes.
2494 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
2495 RSA public key component. Use RsaFree() function to free the
2498 @retval TRUE RSA Public Key was retrieved successfully.
2499 @retval FALSE Fail to retrieve RSA public key from X509 certificate.
2500 @retval FALSE This interface is not supported.
2505 CryptoServiceRsaGetPublicKeyFromX509 (
2506 IN CONST UINT8
*Cert
,
2508 OUT VOID
**RsaContext
2511 return CALL_BASECRYPTLIB (Rsa
.Services
.GetPublicKeyFromX509
, RsaGetPublicKeyFromX509
, (Cert
, CertSize
, RsaContext
), FALSE
);
2515 Retrieve the subject bytes from one X.509 certificate.
2517 If Cert is NULL, then return FALSE.
2518 If SubjectSize is NULL, then return FALSE.
2519 If this interface is not supported, then return FALSE.
2521 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2522 @param[in] CertSize Size of the X509 certificate in bytes.
2523 @param[out] CertSubject Pointer to the retrieved certificate subject bytes.
2524 @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,
2525 and the size of buffer returned CertSubject on output.
2527 @retval TRUE The certificate subject retrieved successfully.
2528 @retval FALSE Invalid certificate, or the SubjectSize is too small for the result.
2529 The SubjectSize will be updated with the required size.
2530 @retval FALSE This interface is not supported.
2535 CryptoServiceX509GetSubjectName (
2536 IN CONST UINT8
*Cert
,
2538 OUT UINT8
*CertSubject
,
2539 IN OUT UINTN
*SubjectSize
2542 return CALL_BASECRYPTLIB (X509
.Services
.GetSubjectName
, X509GetSubjectName
, (Cert
, CertSize
, CertSubject
, SubjectSize
), FALSE
);
2546 Retrieve the common name (CN) string from one X.509 certificate.
2548 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2549 @param[in] CertSize Size of the X509 certificate in bytes.
2550 @param[out] CommonName Buffer to contain the retrieved certificate common
2551 name string (UTF8). At most CommonNameSize bytes will be
2552 written and the string will be null terminated. May be
2553 NULL in order to determine the size buffer needed.
2554 @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,
2555 and the size of buffer returned CommonName on output.
2556 If CommonName is NULL then the amount of space needed
2557 in buffer (including the final null) is returned.
2559 @retval RETURN_SUCCESS The certificate CommonName retrieved successfully.
2560 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
2561 If CommonNameSize is NULL.
2562 If CommonName is not NULL and *CommonNameSize is 0.
2563 If Certificate is invalid.
2564 @retval RETURN_NOT_FOUND If no CommonName entry exists.
2565 @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size
2566 (including the final null) is returned in the
2567 CommonNameSize parameter.
2568 @retval RETURN_UNSUPPORTED The operation is not supported.
2573 CryptoServiceX509GetCommonName (
2574 IN CONST UINT8
*Cert
,
2576 OUT CHAR8
*CommonName
, OPTIONAL
2577 IN OUT UINTN
*CommonNameSize
2580 return CALL_BASECRYPTLIB (X509
.Services
.GetCommonName
, X509GetCommonName
, (Cert
, CertSize
, CommonName
, CommonNameSize
), RETURN_UNSUPPORTED
);
2584 Retrieve the organization name (O) string from one X.509 certificate.
2586 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2587 @param[in] CertSize Size of the X509 certificate in bytes.
2588 @param[out] NameBuffer Buffer to contain the retrieved certificate organization
2589 name string. At most NameBufferSize bytes will be
2590 written and the string will be null terminated. May be
2591 NULL in order to determine the size buffer needed.
2592 @param[in,out] NameBufferSize The size in bytes of the Name buffer on input,
2593 and the size of buffer returned Name on output.
2594 If NameBuffer is NULL then the amount of space needed
2595 in buffer (including the final null) is returned.
2597 @retval RETURN_SUCCESS The certificate Organization Name retrieved successfully.
2598 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
2599 If NameBufferSize is NULL.
2600 If NameBuffer is not NULL and *CommonNameSize is 0.
2601 If Certificate is invalid.
2602 @retval RETURN_NOT_FOUND If no Organization Name entry exists.
2603 @retval RETURN_BUFFER_TOO_SMALL If the NameBuffer is NULL. The required buffer size
2604 (including the final null) is returned in the
2605 CommonNameSize parameter.
2606 @retval RETURN_UNSUPPORTED The operation is not supported.
2611 CryptoServiceX509GetOrganizationName (
2612 IN CONST UINT8
*Cert
,
2614 OUT CHAR8
*NameBuffer
, OPTIONAL
2615 IN OUT UINTN
*NameBufferSize
2618 return CALL_BASECRYPTLIB (X509
.Services
.GetOrganizationName
, X509GetOrganizationName
, (Cert
, CertSize
, NameBuffer
, NameBufferSize
), RETURN_UNSUPPORTED
);
2622 Verify one X509 certificate was issued by the trusted CA.
2624 If Cert is NULL, then return FALSE.
2625 If CACert is NULL, then return FALSE.
2626 If this interface is not supported, then return FALSE.
2628 @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.
2629 @param[in] CertSize Size of the X509 certificate in bytes.
2630 @param[in] CACert Pointer to the DER-encoded trusted CA certificate.
2631 @param[in] CACertSize Size of the CA Certificate in bytes.
2633 @retval TRUE The certificate was issued by the trusted CA.
2634 @retval FALSE Invalid certificate or the certificate was not issued by the given
2636 @retval FALSE This interface is not supported.
2641 CryptoServiceX509VerifyCert (
2642 IN CONST UINT8
*Cert
,
2644 IN CONST UINT8
*CACert
,
2648 return CALL_BASECRYPTLIB (X509
.Services
.VerifyCert
, X509VerifyCert
, (Cert
, CertSize
, CACert
, CACertSize
), FALSE
);
2652 Construct a X509 object from DER-encoded certificate data.
2654 If Cert is NULL, then return FALSE.
2655 If SingleX509Cert is NULL, then return FALSE.
2656 If this interface is not supported, then return FALSE.
2658 @param[in] Cert Pointer to the DER-encoded certificate data.
2659 @param[in] CertSize The size of certificate data in bytes.
2660 @param[out] SingleX509Cert The generated X509 object.
2662 @retval TRUE The X509 object generation succeeded.
2663 @retval FALSE The operation failed.
2664 @retval FALSE This interface is not supported.
2669 CryptoServiceX509ConstructCertificate (
2670 IN CONST UINT8
*Cert
,
2672 OUT UINT8
**SingleX509Cert
2675 return CALL_BASECRYPTLIB (X509
.Services
.ConstructCertificate
, X509ConstructCertificate
, (Cert
, CertSize
, SingleX509Cert
), FALSE
);
2679 Construct a X509 stack object from a list of DER-encoded certificate data.
2681 If X509Stack is NULL, then return FALSE.
2682 If this interface is not supported, then return FALSE.
2684 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2685 On output, pointer to the X509 stack object with new
2686 inserted X509 certificate.
2687 @param[in] Args VA_LIST marker for the variable argument list.
2688 A list of DER-encoded single certificate data followed
2689 by certificate size. A NULL terminates the list. The
2690 pairs are the arguments to X509ConstructCertificate().
2692 @retval TRUE The X509 stack construction succeeded.
2693 @retval FALSE The construction operation failed.
2694 @retval FALSE This interface is not supported.
2699 CryptoServiceX509ConstructCertificateStackV (
2700 IN OUT UINT8
**X509Stack
,
2704 return CALL_BASECRYPTLIB (X509
.Services
.ConstructCertificateStackV
, X509ConstructCertificateStackV
, (X509Stack
, Args
), FALSE
);
2708 Construct a X509 stack object from a list of DER-encoded certificate data.
2710 If X509Stack is NULL, then return FALSE.
2711 If this interface is not supported, then return FALSE.
2713 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2714 On output, pointer to the X509 stack object with new
2715 inserted X509 certificate.
2716 @param ... A list of DER-encoded single certificate data followed
2717 by certificate size. A NULL terminates the list. The
2718 pairs are the arguments to X509ConstructCertificate().
2720 @retval TRUE The X509 stack construction succeeded.
2721 @retval FALSE The construction operation failed.
2722 @retval FALSE This interface is not supported.
2727 CryptoServiceX509ConstructCertificateStack (
2728 IN OUT UINT8
**X509Stack
,
2735 VA_START (Args
, X509Stack
);
2736 Result
= CryptoServiceX509ConstructCertificateStackV (X509Stack
, Args
);
2742 Release the specified X509 object.
2744 If the interface is not supported, then ASSERT().
2746 @param[in] X509Cert Pointer to the X509 object to be released.
2751 CryptoServiceX509Free (
2755 CALL_VOID_BASECRYPTLIB (X509
.Services
.Free
, X509Free
, (X509Cert
));
2759 Release the specified X509 stack object.
2761 If the interface is not supported, then ASSERT().
2763 @param[in] X509Stack Pointer to the X509 stack object to be released.
2768 CryptoServiceX509StackFree (
2772 CALL_VOID_BASECRYPTLIB (X509
.Services
.StackFree
, X509StackFree
, (X509Stack
));
2776 Retrieve the TBSCertificate from one given X.509 certificate.
2778 @param[in] Cert Pointer to the given DER-encoded X509 certificate.
2779 @param[in] CertSize Size of the X509 certificate in bytes.
2780 @param[out] TBSCert DER-Encoded To-Be-Signed certificate.
2781 @param[out] TBSCertSize Size of the TBS certificate in bytes.
2783 If Cert is NULL, then return FALSE.
2784 If TBSCert is NULL, then return FALSE.
2785 If TBSCertSize is NULL, then return FALSE.
2786 If this interface is not supported, then return FALSE.
2788 @retval TRUE The TBSCertificate was retrieved successfully.
2789 @retval FALSE Invalid X.509 certificate.
2794 CryptoServiceX509GetTBSCert (
2795 IN CONST UINT8
*Cert
,
2797 OUT UINT8
**TBSCert
,
2798 OUT UINTN
*TBSCertSize
2801 return CALL_BASECRYPTLIB (X509
.Services
.GetTBSCert
, X509GetTBSCert
, (Cert
, CertSize
, TBSCert
, TBSCertSize
), FALSE
);
2805 Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0
2806 password based encryption key derivation function PBKDF2, as specified in RFC 2898.
2808 If Password or Salt or OutKey is NULL, then return FALSE.
2809 If the hash algorithm could not be determined, then return FALSE.
2810 If this interface is not supported, then return FALSE.
2812 @param[in] PasswordLength Length of input password in bytes.
2813 @param[in] Password Pointer to the array for the password.
2814 @param[in] SaltLength Size of the Salt in bytes.
2815 @param[in] Salt Pointer to the Salt.
2816 @param[in] IterationCount Number of iterations to perform. Its value should be
2817 greater than or equal to 1.
2818 @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).
2819 NOTE: DigestSize will be used to determine the hash algorithm.
2820 Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.
2821 @param[in] KeyLength Size of the derived key buffer in bytes.
2822 @param[out] OutKey Pointer to the output derived key buffer.
2824 @retval TRUE A key was derived successfully.
2825 @retval FALSE One of the pointers was NULL or one of the sizes was too large.
2826 @retval FALSE The hash algorithm could not be determined from the digest size.
2827 @retval FALSE The key derivation operation failed.
2828 @retval FALSE This interface is not supported.
2833 CryptoServicePkcs5HashPassword (
2834 IN UINTN PasswordLength
,
2835 IN CONST CHAR8
*Password
,
2836 IN UINTN SaltLength
,
2837 IN CONST UINT8
*Salt
,
2838 IN UINTN IterationCount
,
2839 IN UINTN DigestSize
,
2844 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs5HashPassword
, Pkcs5HashPassword
, (PasswordLength
, Password
, SaltLength
, Salt
, IterationCount
, DigestSize
, KeyLength
, OutKey
), FALSE
);
2848 Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
2849 encrypted message in a newly allocated buffer.
2851 Things that can cause a failure include:
2852 - X509 key size does not match any known key size.
2853 - Fail to parse X509 certificate.
2854 - Fail to allocate an intermediate buffer.
2855 - Null pointer provided for a non-optional parameter.
2856 - Data size is too large for the provided key size (max size is a function of key size
2857 and hash digest size).
2859 @param[in] PublicKey A pointer to the DER-encoded X509 certificate that
2860 will be used to encrypt the data.
2861 @param[in] PublicKeySize Size of the X509 cert buffer.
2862 @param[in] InData Data to be encrypted.
2863 @param[in] InDataSize Size of the data buffer.
2864 @param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
2865 to be used when initializing the PRNG. NULL otherwise.
2866 @param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
2868 @param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
2870 @param[out] EncryptedDataSize Size of the encrypted message buffer.
2872 @retval TRUE Encryption was successful.
2873 @retval FALSE Encryption failed.
2878 CryptoServicePkcs1v2Encrypt (
2879 IN CONST UINT8
*PublicKey
,
2880 IN UINTN PublicKeySize
,
2882 IN UINTN InDataSize
,
2883 IN CONST UINT8
*PrngSeed
, OPTIONAL
2884 IN UINTN PrngSeedSize
, OPTIONAL
2885 OUT UINT8
**EncryptedData
,
2886 OUT UINTN
*EncryptedDataSize
2889 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs1v2Encrypt
, Pkcs1v2Encrypt
, (PublicKey
, PublicKeySize
, InData
, InDataSize
, PrngSeed
, PrngSeedSize
, EncryptedData
, EncryptedDataSize
), FALSE
);
2893 Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
2894 Cryptographic Message Syntax Standard". The input signed data could be wrapped
2895 in a ContentInfo structure.
2897 If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then
2898 return FALSE. If P7Length overflow, then return FALSE.
2899 If this interface is not supported, then return FALSE.
2901 @param[in] P7Data Pointer to the PKCS#7 message to verify.
2902 @param[in] P7Length Length of the PKCS#7 message in bytes.
2903 @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
2904 It's caller's responsibility to free the buffer with
2906 This data structure is EFI_CERT_STACK type.
2907 @param[out] StackLength Length of signer's certificates in bytes.
2908 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
2909 It's caller's responsibility to free the buffer with
2911 @param[out] CertLength Length of the trusted certificate in bytes.
2913 @retval TRUE The operation is finished successfully.
2914 @retval FALSE Error occurs during the operation.
2915 @retval FALSE This interface is not supported.
2920 CryptoServicePkcs7GetSigners (
2921 IN CONST UINT8
*P7Data
,
2923 OUT UINT8
**CertStack
,
2924 OUT UINTN
*StackLength
,
2925 OUT UINT8
**TrustedCert
,
2926 OUT UINTN
*CertLength
2929 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7GetSigners
, Pkcs7GetSigners
, (P7Data
, P7Length
, CertStack
, StackLength
, TrustedCert
, CertLength
), FALSE
);
2933 Wrap function to use free() to free allocated memory for certificates.
2935 If this interface is not supported, then ASSERT().
2937 @param[in] Certs Pointer to the certificates to be freed.
2942 CryptoServicePkcs7FreeSigners (
2946 CALL_VOID_BASECRYPTLIB (Pkcs
.Services
.Pkcs7FreeSigners
, Pkcs7FreeSigners
, (Certs
));
2950 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
2951 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
2952 unchained to the signer's certificates.
2953 The input signed data could be wrapped in a ContentInfo structure.
2955 @param[in] P7Data Pointer to the PKCS#7 message.
2956 @param[in] P7Length Length of the PKCS#7 message in bytes.
2957 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
2958 certificate. It's caller's responsibility to free the buffer
2959 with Pkcs7FreeSigners().
2960 This data structure is EFI_CERT_STACK type.
2961 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
2962 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
2963 responsibility to free the buffer with Pkcs7FreeSigners().
2964 This data structure is EFI_CERT_STACK type.
2965 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
2967 @retval TRUE The operation is finished successfully.
2968 @retval FALSE Error occurs during the operation.
2973 CryptoServicePkcs7GetCertificatesList (
2974 IN CONST UINT8
*P7Data
,
2976 OUT UINT8
**SignerChainCerts
,
2977 OUT UINTN
*ChainLength
,
2978 OUT UINT8
**UnchainCerts
,
2979 OUT UINTN
*UnchainLength
2982 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7GetCertificatesList
, Pkcs7GetCertificatesList
, (P7Data
, P7Length
, SignerChainCerts
, ChainLength
, UnchainCerts
, UnchainLength
), FALSE
);
2986 Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
2987 Syntax Standard, version 1.5". This interface is only intended to be used for
2988 application to perform PKCS#7 functionality validation.
2990 If this interface is not supported, then return FALSE.
2992 @param[in] PrivateKey Pointer to the PEM-formatted private key data for
2994 @param[in] PrivateKeySize Size of the PEM private key data in bytes.
2995 @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
2997 @param[in] InData Pointer to the content to be signed.
2998 @param[in] InDataSize Size of InData in bytes.
2999 @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
3000 @param[in] OtherCerts Pointer to an optional additional set of certificates to
3001 include in the PKCS#7 signedData (e.g. any intermediate
3003 @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's
3004 responsibility to free the buffer with FreePool().
3005 @param[out] SignedDataSize Size of SignedData in bytes.
3007 @retval TRUE PKCS#7 data signing succeeded.
3008 @retval FALSE PKCS#7 data signing failed.
3009 @retval FALSE This interface is not supported.
3014 CryptoServicePkcs7Sign (
3015 IN CONST UINT8
*PrivateKey
,
3016 IN UINTN PrivateKeySize
,
3017 IN CONST UINT8
*KeyPassword
,
3019 IN UINTN InDataSize
,
3021 IN UINT8
*OtherCerts OPTIONAL
,
3022 OUT UINT8
**SignedData
,
3023 OUT UINTN
*SignedDataSize
3026 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7Sign
, Pkcs7Sign
, (PrivateKey
, PrivateKeySize
, KeyPassword
, InData
, InDataSize
, SignCert
, OtherCerts
, SignedData
, SignedDataSize
), FALSE
);
3030 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
3031 Cryptographic Message Syntax Standard". The input signed data could be wrapped
3032 in a ContentInfo structure.
3034 If P7Data, TrustedCert or InData is NULL, then return FALSE.
3035 If P7Length, CertLength or DataLength overflow, then return FALSE.
3036 If this interface is not supported, then return FALSE.
3038 @param[in] P7Data Pointer to the PKCS#7 message to verify.
3039 @param[in] P7Length Length of the PKCS#7 message in bytes.
3040 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
3041 is used for certificate chain verification.
3042 @param[in] CertLength Length of the trusted certificate in bytes.
3043 @param[in] InData Pointer to the content to be verified.
3044 @param[in] DataLength Length of InData in bytes.
3046 @retval TRUE The specified PKCS#7 signed data is valid.
3047 @retval FALSE Invalid PKCS#7 signed data.
3048 @retval FALSE This interface is not supported.
3053 CryptoServicePkcs7Verify (
3054 IN CONST UINT8
*P7Data
,
3056 IN CONST UINT8
*TrustedCert
,
3057 IN UINTN CertLength
,
3058 IN CONST UINT8
*InData
,
3062 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7Verify
, Pkcs7Verify
, (P7Data
, P7Length
, TrustedCert
, CertLength
, InData
, DataLength
), FALSE
);
3066 This function receives a PKCS7 formatted signature, and then verifies that
3067 the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity
3068 leaf signing certificate.
3069 Note that this function does not validate the certificate chain.
3071 Applications for custom EKU's are quite flexible. For example, a policy EKU
3072 may be present in an Issuing Certificate Authority (CA), and any sub-ordinate
3073 certificate issued might also contain this EKU, thus constraining the
3074 sub-ordinate certificate. Other applications might allow a certificate
3075 embedded in a device to specify that other Object Identifiers (OIDs) are
3076 present which contains binary data specifying custom capabilities that
3077 the device is able to do.
3079 @param[in] Pkcs7Signature The PKCS#7 signed information content block. An array
3080 containing the content block with both the signature,
3081 the signer's certificate, and any necessary intermediate
3083 @param[in] Pkcs7SignatureSize Number of bytes in Pkcs7Signature.
3084 @param[in] RequiredEKUs Array of null-terminated strings listing OIDs of
3085 required EKUs that must be present in the signature.
3086 @param[in] RequiredEKUsSize Number of elements in the RequiredEKUs string array.
3087 @param[in] RequireAllPresent If this is TRUE, then all of the specified EKU's
3088 must be present in the leaf signer. If it is
3089 FALSE, then we will succeed if we find any
3090 of the specified EKU's.
3092 @retval EFI_SUCCESS The required EKUs were found in the signature.
3093 @retval EFI_INVALID_PARAMETER A parameter was invalid.
3094 @retval EFI_NOT_FOUND One or more EKU's were not found in the signature.
3099 CryptoServiceVerifyEKUsInPkcs7Signature (
3100 IN CONST UINT8
*Pkcs7Signature
,
3101 IN CONST UINT32 SignatureSize
,
3102 IN CONST CHAR8
*RequiredEKUs
[],
3103 IN CONST UINT32 RequiredEKUsSize
,
3104 IN BOOLEAN RequireAllPresent
3107 return CALL_BASECRYPTLIB (Pkcs
.Services
.VerifyEKUsInPkcs7Signature
, VerifyEKUsInPkcs7Signature
, (Pkcs7Signature
, SignatureSize
, RequiredEKUs
, RequiredEKUsSize
, RequireAllPresent
), FALSE
);
3112 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
3113 data could be wrapped in a ContentInfo structure.
3115 If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow,
3116 then return FALSE. If the P7Data is not correctly formatted, then return FALSE.
3118 Caution: This function may receive untrusted input. So this function will do
3119 basic check for PKCS#7 data structure.
3121 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
3122 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
3123 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
3124 It's caller's responsibility to free the buffer with FreePool().
3125 @param[out] ContentSize The size of the extracted content in bytes.
3127 @retval TRUE The P7Data was correctly formatted for processing.
3128 @retval FALSE The P7Data was not correctly formatted for processing.
3133 CryptoServicePkcs7GetAttachedContent (
3134 IN CONST UINT8
*P7Data
,
3137 OUT UINTN
*ContentSize
3140 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7GetAttachedContent
, Pkcs7GetAttachedContent
, (P7Data
, P7Length
, Content
, ContentSize
), FALSE
);
3144 Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows
3145 Authenticode Portable Executable Signature Format".
3147 If AuthData is NULL, then return FALSE.
3148 If ImageHash is NULL, then return FALSE.
3149 If this interface is not supported, then return FALSE.
3151 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
3152 PE/COFF image to be verified.
3153 @param[in] DataSize Size of the Authenticode Signature in bytes.
3154 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
3155 is used for certificate chain verification.
3156 @param[in] CertSize Size of the trusted certificate in bytes.
3157 @param[in] ImageHash Pointer to the original image file hash value. The procedure
3158 for calculating the image hash value is described in Authenticode
3160 @param[in] HashSize Size of Image hash value in bytes.
3162 @retval TRUE The specified Authenticode Signature is valid.
3163 @retval FALSE Invalid Authenticode Signature.
3164 @retval FALSE This interface is not supported.
3169 CryptoServiceAuthenticodeVerify (
3170 IN CONST UINT8
*AuthData
,
3172 IN CONST UINT8
*TrustedCert
,
3174 IN CONST UINT8
*ImageHash
,
3178 return CALL_BASECRYPTLIB (Pkcs
.Services
.AuthenticodeVerify
, AuthenticodeVerify
, (AuthData
, DataSize
, TrustedCert
, CertSize
, ImageHash
, HashSize
), FALSE
);
3182 Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode
3185 If AuthData is NULL, then return FALSE.
3186 If this interface is not supported, then return FALSE.
3188 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
3189 PE/COFF image to be verified.
3190 @param[in] DataSize Size of the Authenticode Signature in bytes.
3191 @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which
3192 is used for TSA certificate chain verification.
3193 @param[in] CertSize Size of the trusted certificate in bytes.
3194 @param[out] SigningTime Return the time of timestamp generation time if the timestamp
3197 @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.
3198 @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.
3203 CryptoServiceImageTimestampVerify (
3204 IN CONST UINT8
*AuthData
,
3206 IN CONST UINT8
*TsaCert
,
3208 OUT EFI_TIME
*SigningTime
3211 return CALL_BASECRYPTLIB (Pkcs
.Services
.ImageTimestampVerify
, ImageTimestampVerify
, (AuthData
, DataSize
, TsaCert
, CertSize
, SigningTime
), FALSE
);
3214 //=====================================================================================
3215 // DH Key Exchange Primitive
3216 //=====================================================================================
3219 Allocates and Initializes one Diffie-Hellman Context for subsequent use.
3221 @return Pointer to the Diffie-Hellman Context that has been initialized.
3222 If the allocations fails, DhNew() returns NULL.
3223 If the interface is not supported, DhNew() returns NULL.
3228 CryptoServiceDhNew (
3232 return CALL_BASECRYPTLIB (Dh
.Services
.New
, DhNew
, (), NULL
);
3236 Release the specified DH context.
3238 If the interface is not supported, then ASSERT().
3240 @param[in] DhContext Pointer to the DH context to be released.
3245 CryptoServiceDhFree (
3249 CALL_VOID_BASECRYPTLIB (Dh
.Services
.Free
, DhFree
, (DhContext
));
3253 Generates DH parameter.
3255 Given generator g, and length of prime number p in bits, this function generates p,
3256 and sets DH context according to value of g and p.
3258 Before this function can be invoked, pseudorandom number generator must be correctly
3259 initialized by RandomSeed().
3261 If DhContext is NULL, then return FALSE.
3262 If Prime is NULL, then return FALSE.
3263 If this interface is not supported, then return FALSE.
3265 @param[in, out] DhContext Pointer to the DH context.
3266 @param[in] Generator Value of generator.
3267 @param[in] PrimeLength Length in bits of prime to be generated.
3268 @param[out] Prime Pointer to the buffer to receive the generated prime number.
3270 @retval TRUE DH parameter generation succeeded.
3271 @retval FALSE Value of Generator is not supported.
3272 @retval FALSE PRNG fails to generate random prime number with PrimeLength.
3273 @retval FALSE This interface is not supported.
3278 CryptoServiceDhGenerateParameter (
3279 IN OUT VOID
*DhContext
,
3281 IN UINTN PrimeLength
,
3285 return CALL_BASECRYPTLIB (Dh
.Services
.GenerateParameter
, DhGenerateParameter
, (DhContext
, Generator
, PrimeLength
, Prime
), FALSE
);
3289 Sets generator and prime parameters for DH.
3291 Given generator g, and prime number p, this function and sets DH
3292 context accordingly.
3294 If DhContext is NULL, then return FALSE.
3295 If Prime is NULL, then return FALSE.
3296 If this interface is not supported, then return FALSE.
3298 @param[in, out] DhContext Pointer to the DH context.
3299 @param[in] Generator Value of generator.
3300 @param[in] PrimeLength Length in bits of prime to be generated.
3301 @param[in] Prime Pointer to the prime number.
3303 @retval TRUE DH parameter setting succeeded.
3304 @retval FALSE Value of Generator is not supported.
3305 @retval FALSE Value of Generator is not suitable for the Prime.
3306 @retval FALSE Value of Prime is not a prime number.
3307 @retval FALSE Value of Prime is not a safe prime number.
3308 @retval FALSE This interface is not supported.
3313 CryptoServiceDhSetParameter (
3314 IN OUT VOID
*DhContext
,
3316 IN UINTN PrimeLength
,
3317 IN CONST UINT8
*Prime
3320 return CALL_BASECRYPTLIB (Dh
.Services
.SetParameter
, DhSetParameter
, (DhContext
, Generator
, PrimeLength
, Prime
), FALSE
);
3324 Generates DH public key.
3326 This function generates random secret exponent, and computes the public key, which is
3327 returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.
3328 If the PublicKey buffer is too small to hold the public key, FALSE is returned and
3329 PublicKeySize is set to the required buffer size to obtain the public key.
3331 If DhContext is NULL, then return FALSE.
3332 If PublicKeySize is NULL, then return FALSE.
3333 If PublicKeySize is large enough but PublicKey is NULL, then return FALSE.
3334 If this interface is not supported, then return FALSE.
3336 @param[in, out] DhContext Pointer to the DH context.
3337 @param[out] PublicKey Pointer to the buffer to receive generated public key.
3338 @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.
3339 On output, the size of data returned in PublicKey buffer in bytes.
3341 @retval TRUE DH public key generation succeeded.
3342 @retval FALSE DH public key generation failed.
3343 @retval FALSE PublicKeySize is not large enough.
3344 @retval FALSE This interface is not supported.
3349 CryptoServiceDhGenerateKey (
3350 IN OUT VOID
*DhContext
,
3351 OUT UINT8
*PublicKey
,
3352 IN OUT UINTN
*PublicKeySize
3355 return CALL_BASECRYPTLIB (Dh
.Services
.GenerateKey
, DhGenerateKey
, (DhContext
, PublicKey
, PublicKeySize
), FALSE
);
3359 Computes exchanged common key.
3361 Given peer's public key, this function computes the exchanged common key, based on its own
3362 context including value of prime modulus and random secret exponent.
3364 If DhContext is NULL, then return FALSE.
3365 If PeerPublicKey is NULL, then return FALSE.
3366 If KeySize is NULL, then return FALSE.
3367 If Key is NULL, then return FALSE.
3368 If KeySize is not large enough, then return FALSE.
3369 If this interface is not supported, then return FALSE.
3371 @param[in, out] DhContext Pointer to the DH context.
3372 @param[in] PeerPublicKey Pointer to the peer's public key.
3373 @param[in] PeerPublicKeySize Size of peer's public key in bytes.
3374 @param[out] Key Pointer to the buffer to receive generated key.
3375 @param[in, out] KeySize On input, the size of Key buffer in bytes.
3376 On output, the size of data returned in Key buffer in bytes.
3378 @retval TRUE DH exchanged key generation succeeded.
3379 @retval FALSE DH exchanged key generation failed.
3380 @retval FALSE KeySize is not large enough.
3381 @retval FALSE This interface is not supported.
3386 CryptoServiceDhComputeKey (
3387 IN OUT VOID
*DhContext
,
3388 IN CONST UINT8
*PeerPublicKey
,
3389 IN UINTN PeerPublicKeySize
,
3391 IN OUT UINTN
*KeySize
3394 return CALL_BASECRYPTLIB (Dh
.Services
.ComputeKey
, DhComputeKey
, (DhContext
, PeerPublicKey
, PeerPublicKeySize
, Key
, KeySize
), FALSE
);
3397 //=====================================================================================
3398 // Pseudo-Random Generation Primitive
3399 //=====================================================================================
3402 Sets up the seed value for the pseudorandom number generator.
3404 This function sets up the seed value for the pseudorandom number generator.
3405 If Seed is not NULL, then the seed passed in is used.
3406 If Seed is NULL, then default seed is used.
3407 If this interface is not supported, then return FALSE.
3409 @param[in] Seed Pointer to seed value.
3410 If NULL, default seed is used.
3411 @param[in] SeedSize Size of seed value.
3412 If Seed is NULL, this parameter is ignored.
3414 @retval TRUE Pseudorandom number generator has enough entropy for random generation.
3415 @retval FALSE Pseudorandom number generator does not have enough entropy for random generation.
3416 @retval FALSE This interface is not supported.
3421 CryptoServiceRandomSeed (
3422 IN CONST UINT8
*Seed OPTIONAL
,
3426 return CALL_BASECRYPTLIB (Random
.Services
.Seed
, RandomSeed
, (Seed
, SeedSize
), FALSE
);
3430 Generates a pseudorandom byte stream of the specified size.
3432 If Output is NULL, then return FALSE.
3433 If this interface is not supported, then return FALSE.
3435 @param[out] Output Pointer to buffer to receive random value.
3436 @param[in] Size Size of random bytes to generate.
3438 @retval TRUE Pseudorandom byte stream generated successfully.
3439 @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.
3440 @retval FALSE This interface is not supported.
3445 CryptoServiceRandomBytes (
3450 return CALL_BASECRYPTLIB (Random
.Services
.Bytes
, RandomBytes
, (Output
, Size
), FALSE
);
3453 //=====================================================================================
3454 // Key Derivation Function Primitive
3455 //=====================================================================================
3458 Derive key data using HMAC-SHA256 based KDF.
3460 @param[in] Key Pointer to the user-supplied key.
3461 @param[in] KeySize Key size in bytes.
3462 @param[in] Salt Pointer to the salt(non-secret) value.
3463 @param[in] SaltSize Salt size in bytes.
3464 @param[in] Info Pointer to the application specific info.
3465 @param[in] InfoSize Info size in bytes.
3466 @param[out] Out Pointer to buffer to receive hkdf value.
3467 @param[in] OutSize Size of hkdf bytes to generate.
3469 @retval TRUE Hkdf generated successfully.
3470 @retval FALSE Hkdf generation failed.
3475 CryptoServiceHkdfSha256ExtractAndExpand (
3476 IN CONST UINT8
*Key
,
3478 IN CONST UINT8
*Salt
,
3480 IN CONST UINT8
*Info
,
3486 return CALL_BASECRYPTLIB (Hkdf
.Services
.Sha256ExtractAndExpand
, HkdfSha256ExtractAndExpand
, (Key
, KeySize
, Salt
, SaltSize
, Info
, InfoSize
, Out
, OutSize
), FALSE
);
3490 Initializes the OpenSSL library.
3492 This function registers ciphers and digests used directly and indirectly
3493 by SSL/TLS, and initializes the readable error messages.
3494 This function must be called before any other action takes places.
3496 @retval TRUE The OpenSSL library has been initialized.
3497 @retval FALSE Failed to initialize the OpenSSL library.
3502 CryptoServiceTlsInitialize (
3506 return CALL_BASECRYPTLIB (Tls
.Services
.Initialize
, TlsInitialize
, (), FALSE
);
3510 Free an allocated SSL_CTX object.
3512 @param[in] TlsCtx Pointer to the SSL_CTX object to be released.
3517 CryptoServiceTlsCtxFree (
3521 CALL_VOID_BASECRYPTLIB (Tls
.Services
.CtxFree
, TlsCtxFree
, (TlsCtx
));
3525 Creates a new SSL_CTX object as framework to establish TLS/SSL enabled
3528 @param[in] MajorVer Major Version of TLS/SSL Protocol.
3529 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
3531 @return Pointer to an allocated SSL_CTX object.
3532 If the creation failed, TlsCtxNew() returns NULL.
3537 CryptoServiceTlsCtxNew (
3542 return CALL_BASECRYPTLIB (Tls
.Services
.CtxNew
, TlsCtxNew
, (MajorVer
, MinorVer
), NULL
);
3546 Free an allocated TLS object.
3548 This function removes the TLS object pointed to by Tls and frees up the
3549 allocated memory. If Tls is NULL, nothing is done.
3551 @param[in] Tls Pointer to the TLS object to be freed.
3556 CryptoServiceTlsFree (
3560 CALL_VOID_BASECRYPTLIB (Tls
.Services
.Free
, TlsFree
, (Tls
));
3564 Create a new TLS object for a connection.
3566 This function creates a new TLS object for a connection. The new object
3567 inherits the setting of the underlying context TlsCtx: connection method,
3568 options, verification setting.
3570 @param[in] TlsCtx Pointer to the SSL_CTX object.
3572 @return Pointer to an allocated SSL object.
3573 If the creation failed, TlsNew() returns NULL.
3578 CryptoServiceTlsNew (
3582 return CALL_BASECRYPTLIB (Tls
.Services
.New
, TlsNew
, (TlsCtx
), NULL
);
3586 Checks if the TLS handshake was done.
3588 This function will check if the specified TLS handshake was done.
3590 @param[in] Tls Pointer to the TLS object for handshake state checking.
3592 @retval TRUE The TLS handshake was done.
3593 @retval FALSE The TLS handshake was not done.
3598 CryptoServiceTlsInHandshake (
3602 return CALL_BASECRYPTLIB (Tls
.Services
.InHandshake
, TlsInHandshake
, (Tls
), FALSE
);
3606 Perform a TLS/SSL handshake.
3608 This function will perform a TLS/SSL handshake.
3610 @param[in] Tls Pointer to the TLS object for handshake operation.
3611 @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.
3612 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
3614 @param[out] BufferOut Pointer to the buffer to hold the built packet.
3615 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
3616 the buffer size provided by the caller. On output, it
3617 is the buffer size in fact needed to contain the
3620 @retval EFI_SUCCESS The required TLS packet is built successfully.
3621 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
3623 BufferIn is NULL but BufferInSize is NOT 0.
3624 BufferInSize is 0 but BufferIn is NOT NULL.
3625 BufferOutSize is NULL.
3626 BufferOut is NULL if *BufferOutSize is not zero.
3627 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
3628 @retval EFI_ABORTED Something wrong during handshake.
3633 CryptoServiceTlsDoHandshake (
3635 IN UINT8
*BufferIn
, OPTIONAL
3636 IN UINTN BufferInSize
, OPTIONAL
3637 OUT UINT8
*BufferOut
, OPTIONAL
3638 IN OUT UINTN
*BufferOutSize
3641 return CALL_BASECRYPTLIB (Tls
.Services
.DoHandshake
, TlsDoHandshake
, (Tls
, BufferIn
, BufferInSize
, BufferOut
, BufferOutSize
), EFI_UNSUPPORTED
);
3645 Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,
3646 TLS session has errors and the response packet needs to be Alert message based on error type.
3648 @param[in] Tls Pointer to the TLS object for state checking.
3649 @param[in] BufferIn Pointer to the most recently received TLS Alert packet.
3650 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
3652 @param[out] BufferOut Pointer to the buffer to hold the built packet.
3653 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
3654 the buffer size provided by the caller. On output, it
3655 is the buffer size in fact needed to contain the
3658 @retval EFI_SUCCESS The required TLS packet is built successfully.
3659 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
3661 BufferIn is NULL but BufferInSize is NOT 0.
3662 BufferInSize is 0 but BufferIn is NOT NULL.
3663 BufferOutSize is NULL.
3664 BufferOut is NULL if *BufferOutSize is not zero.
3665 @retval EFI_ABORTED An error occurred.
3666 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
3671 CryptoServiceTlsHandleAlert (
3673 IN UINT8
*BufferIn
, OPTIONAL
3674 IN UINTN BufferInSize
, OPTIONAL
3675 OUT UINT8
*BufferOut
, OPTIONAL
3676 IN OUT UINTN
*BufferOutSize
3679 return CALL_BASECRYPTLIB (Tls
.Services
.HandleAlert
, TlsHandleAlert
, (Tls
, BufferIn
, BufferInSize
, BufferOut
, BufferOutSize
), EFI_UNSUPPORTED
);
3683 Build the CloseNotify packet.
3685 @param[in] Tls Pointer to the TLS object for state checking.
3686 @param[in, out] Buffer Pointer to the buffer to hold the built packet.
3687 @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is
3688 the buffer size provided by the caller. On output, it
3689 is the buffer size in fact needed to contain the
3692 @retval EFI_SUCCESS The required TLS packet is built successfully.
3693 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
3696 Buffer is NULL if *BufferSize is not zero.
3697 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.
3702 CryptoServiceTlsCloseNotify (
3704 IN OUT UINT8
*Buffer
,
3705 IN OUT UINTN
*BufferSize
3708 return CALL_BASECRYPTLIB (Tls
.Services
.CloseNotify
, TlsCloseNotify
, (Tls
, Buffer
, BufferSize
), EFI_UNSUPPORTED
);
3712 Attempts to read bytes from one TLS object and places the data in Buffer.
3714 This function will attempt to read BufferSize bytes from the TLS object
3715 and places the data in Buffer.
3717 @param[in] Tls Pointer to the TLS object.
3718 @param[in,out] Buffer Pointer to the buffer to store the data.
3719 @param[in] BufferSize The size of Buffer in bytes.
3721 @retval >0 The amount of data successfully read from the TLS object.
3722 @retval <=0 No data was successfully read.
3727 CryptoServiceTlsCtrlTrafficOut (
3729 IN OUT VOID
*Buffer
,
3733 return CALL_BASECRYPTLIB (Tls
.Services
.CtrlTrafficOut
, TlsCtrlTrafficOut
, (Tls
, Buffer
, BufferSize
), 0);
3737 Attempts to write data from the buffer to TLS object.
3739 This function will attempt to write BufferSize bytes data from the Buffer
3742 @param[in] Tls Pointer to the TLS object.
3743 @param[in] Buffer Pointer to the data buffer.
3744 @param[in] BufferSize The size of Buffer in bytes.
3746 @retval >0 The amount of data successfully written to the TLS object.
3747 @retval <=0 No data was successfully written.
3752 CryptoServiceTlsCtrlTrafficIn (
3758 return CALL_BASECRYPTLIB (Tls
.Services
.CtrlTrafficIn
, TlsCtrlTrafficIn
, (Tls
, Buffer
, BufferSize
), 0);
3762 Attempts to read bytes from the specified TLS connection into the buffer.
3764 This function tries to read BufferSize bytes data from the specified TLS
3765 connection into the Buffer.
3767 @param[in] Tls Pointer to the TLS connection for data reading.
3768 @param[in,out] Buffer Pointer to the data buffer.
3769 @param[in] BufferSize The size of Buffer in bytes.
3771 @retval >0 The read operation was successful, and return value is the
3772 number of bytes actually read from the TLS connection.
3773 @retval <=0 The read operation was not successful.
3778 CryptoServiceTlsRead (
3780 IN OUT VOID
*Buffer
,
3784 return CALL_BASECRYPTLIB (Tls
.Services
.Read
, TlsRead
, (Tls
, Buffer
, BufferSize
), 0);
3788 Attempts to write data to a TLS connection.
3790 This function tries to write BufferSize bytes data from the Buffer into the
3791 specified TLS connection.
3793 @param[in] Tls Pointer to the TLS connection for data writing.
3794 @param[in] Buffer Pointer to the data buffer.
3795 @param[in] BufferSize The size of Buffer in bytes.
3797 @retval >0 The write operation was successful, and return value is the
3798 number of bytes actually written to the TLS connection.
3799 @retval <=0 The write operation was not successful.
3804 CryptoServiceTlsWrite (
3810 return CALL_BASECRYPTLIB (Tls
.Services
.Write
, TlsWrite
, (Tls
, Buffer
, BufferSize
), 0);
3814 Set a new TLS/SSL method for a particular TLS object.
3816 This function sets a new TLS/SSL method for a particular TLS object.
3818 @param[in] Tls Pointer to a TLS object.
3819 @param[in] MajorVer Major Version of TLS/SSL Protocol.
3820 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
3822 @retval EFI_SUCCESS The TLS/SSL method was set successfully.
3823 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3824 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.
3829 CryptoServiceTlsSetVersion (
3835 return CALL_BASECRYPTLIB (TlsSet
.Services
.Version
, TlsSetVersion
, (Tls
, MajorVer
, MinorVer
), EFI_UNSUPPORTED
);
3839 Set TLS object to work in client or server mode.
3841 This function prepares a TLS object to work in client or server mode.
3843 @param[in] Tls Pointer to a TLS object.
3844 @param[in] IsServer Work in server mode.
3846 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.
3847 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3848 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.
3853 CryptoServiceTlsSetConnectionEnd (
3858 return CALL_BASECRYPTLIB (TlsSet
.Services
.ConnectionEnd
, TlsSetConnectionEnd
, (Tls
, IsServer
), EFI_UNSUPPORTED
);
3862 Set the ciphers list to be used by the TLS object.
3864 This function sets the ciphers for use by a specified TLS object.
3866 @param[in] Tls Pointer to a TLS object.
3867 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16
3868 cipher identifier comes from the TLS Cipher Suite
3869 Registry of the IANA, interpreting Byte1 and Byte2
3870 in network (big endian) byte order.
3871 @param[in] CipherNum The number of cipher in the list.
3873 @retval EFI_SUCCESS The ciphers list was set successfully.
3874 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3875 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.
3876 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
3881 CryptoServiceTlsSetCipherList (
3883 IN UINT16
*CipherId
,
3887 return CALL_BASECRYPTLIB (TlsSet
.Services
.CipherList
, TlsSetCipherList
, (Tls
, CipherId
, CipherNum
), EFI_UNSUPPORTED
);
3891 Set the compression method for TLS/SSL operations.
3893 This function handles TLS/SSL integrated compression methods.
3895 @param[in] CompMethod The compression method ID.
3897 @retval EFI_SUCCESS The compression method for the communication was
3899 @retval EFI_UNSUPPORTED Unsupported compression method.
3904 CryptoServiceTlsSetCompressionMethod (
3908 return CALL_BASECRYPTLIB (TlsSet
.Services
.CompressionMethod
, TlsSetCompressionMethod
, (CompMethod
), EFI_UNSUPPORTED
);
3912 Set peer certificate verification mode for the TLS connection.
3914 This function sets the verification mode flags for the TLS connection.
3916 @param[in] Tls Pointer to the TLS object.
3917 @param[in] VerifyMode A set of logically or'ed verification mode flags.
3922 CryptoServiceTlsSetVerify (
3924 IN UINT32 VerifyMode
3927 CALL_VOID_BASECRYPTLIB (TlsSet
.Services
.Verify
, TlsSetVerify
, (Tls
, VerifyMode
));
3931 Set the specified host name to be verified.
3933 @param[in] Tls Pointer to the TLS object.
3934 @param[in] Flags The setting flags during the validation.
3935 @param[in] HostName The specified host name to be verified.
3937 @retval EFI_SUCCESS The HostName setting was set successfully.
3938 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3939 @retval EFI_ABORTED Invalid HostName setting.
3944 CryptoServiceTlsSetVerifyHost (
3950 return CALL_BASECRYPTLIB (TlsSet
.Services
.VerifyHost
, TlsSetVerifyHost
, (Tls
, Flags
, HostName
), EFI_UNSUPPORTED
);
3954 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
3956 This function sets a session ID to be used when the TLS/SSL connection is
3959 @param[in] Tls Pointer to the TLS object.
3960 @param[in] SessionId Session ID data used for session resumption.
3961 @param[in] SessionIdLen Length of Session ID in bytes.
3963 @retval EFI_SUCCESS Session ID was set successfully.
3964 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3965 @retval EFI_UNSUPPORTED No available session for ID setting.
3970 CryptoServiceTlsSetSessionId (
3972 IN UINT8
*SessionId
,
3973 IN UINT16 SessionIdLen
3976 return CALL_BASECRYPTLIB (TlsSet
.Services
.SessionId
, TlsSetSessionId
, (Tls
, SessionId
, SessionIdLen
), EFI_UNSUPPORTED
);
3980 Adds the CA to the cert store when requesting Server or Client authentication.
3982 This function adds the CA certificate to the list of CAs when requesting
3983 Server or Client authentication for the chosen TLS connection.
3985 @param[in] Tls Pointer to the TLS object.
3986 @param[in] Data Pointer to the data buffer of a DER-encoded binary
3987 X.509 certificate or PEM-encoded X.509 certificate.
3988 @param[in] DataSize The size of data buffer in bytes.
3990 @retval EFI_SUCCESS The operation succeeded.
3991 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3992 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
3993 @retval EFI_ABORTED Invalid X.509 certificate.
3998 CryptoServiceTlsSetCaCertificate (
4004 return CALL_BASECRYPTLIB (TlsSet
.Services
.CaCertificate
, TlsSetCaCertificate
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4008 Loads the local public certificate into the specified TLS object.
4010 This function loads the X.509 certificate into the specified TLS object
4011 for TLS negotiation.
4013 @param[in] Tls Pointer to the TLS object.
4014 @param[in] Data Pointer to the data buffer of a DER-encoded binary
4015 X.509 certificate or PEM-encoded X.509 certificate.
4016 @param[in] DataSize The size of data buffer in bytes.
4018 @retval EFI_SUCCESS The operation succeeded.
4019 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4020 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
4021 @retval EFI_ABORTED Invalid X.509 certificate.
4026 CryptoServiceTlsSetHostPublicCert (
4032 return CALL_BASECRYPTLIB (TlsSet
.Services
.HostPublicCert
, TlsSetHostPublicCert
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4036 Adds the local private key to the specified TLS object.
4038 This function adds the local private key (PEM-encoded RSA or PKCS#8 private
4039 key) into the specified TLS object for TLS negotiation.
4041 @param[in] Tls Pointer to the TLS object.
4042 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA
4043 or PKCS#8 private key.
4044 @param[in] DataSize The size of data buffer in bytes.
4046 @retval EFI_SUCCESS The operation succeeded.
4047 @retval EFI_UNSUPPORTED This function is not supported.
4048 @retval EFI_ABORTED Invalid private key data.
4053 CryptoServiceTlsSetHostPrivateKey (
4059 return CALL_BASECRYPTLIB (TlsSet
.Services
.HostPrivateKey
, TlsSetHostPrivateKey
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4063 Adds the CA-supplied certificate revocation list for certificate validation.
4065 This function adds the CA-supplied certificate revocation list data for
4066 certificate validity checking.
4068 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
4069 @param[in] DataSize The size of data buffer in bytes.
4071 @retval EFI_SUCCESS The operation succeeded.
4072 @retval EFI_UNSUPPORTED This function is not supported.
4073 @retval EFI_ABORTED Invalid CRL data.
4078 CryptoServiceTlsSetCertRevocationList (
4083 return CALL_BASECRYPTLIB (TlsSet
.Services
.CertRevocationList
, TlsSetCertRevocationList
, (Data
, DataSize
), EFI_UNSUPPORTED
);
4087 Gets the protocol version used by the specified TLS connection.
4089 This function returns the protocol version used by the specified TLS
4092 If Tls is NULL, then ASSERT().
4094 @param[in] Tls Pointer to the TLS object.
4096 @return The protocol version of the specified TLS connection.
4101 CryptoServiceTlsGetVersion (
4105 return CALL_BASECRYPTLIB (TlsGet
.Services
.Version
, TlsGetVersion
, (Tls
), 0);
4109 Gets the connection end of the specified TLS connection.
4111 This function returns the connection end (as client or as server) used by
4112 the specified TLS connection.
4114 If Tls is NULL, then ASSERT().
4116 @param[in] Tls Pointer to the TLS object.
4118 @return The connection end used by the specified TLS connection.
4123 CryptoServiceTlsGetConnectionEnd (
4127 return CALL_BASECRYPTLIB (TlsGet
.Services
.ConnectionEnd
, TlsGetConnectionEnd
, (Tls
), 0);
4131 Gets the cipher suite used by the specified TLS connection.
4133 This function returns current cipher suite used by the specified
4136 @param[in] Tls Pointer to the TLS object.
4137 @param[in,out] CipherId The cipher suite used by the TLS object.
4139 @retval EFI_SUCCESS The cipher suite was returned successfully.
4140 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4141 @retval EFI_UNSUPPORTED Unsupported cipher suite.
4146 CryptoServiceTlsGetCurrentCipher (
4148 IN OUT UINT16
*CipherId
4151 return CALL_BASECRYPTLIB (TlsGet
.Services
.CurrentCipher
, TlsGetCurrentCipher
, (Tls
, CipherId
), EFI_UNSUPPORTED
);
4155 Gets the compression methods used by the specified TLS connection.
4157 This function returns current integrated compression methods used by
4158 the specified TLS connection.
4160 @param[in] Tls Pointer to the TLS object.
4161 @param[in,out] CompressionId The current compression method used by
4164 @retval EFI_SUCCESS The compression method was returned successfully.
4165 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4166 @retval EFI_ABORTED Invalid Compression method.
4167 @retval EFI_UNSUPPORTED This function is not supported.
4172 CryptoServiceTlsGetCurrentCompressionId (
4174 IN OUT UINT8
*CompressionId
4177 return CALL_BASECRYPTLIB (TlsGet
.Services
.CurrentCompressionId
, TlsGetCurrentCompressionId
, (Tls
, CompressionId
), EFI_UNSUPPORTED
);
4181 Gets the verification mode currently set in the TLS connection.
4183 This function returns the peer verification mode currently set in the
4184 specified TLS connection.
4186 If Tls is NULL, then ASSERT().
4188 @param[in] Tls Pointer to the TLS object.
4190 @return The verification mode set in the specified TLS connection.
4195 CryptoServiceTlsGetVerify (
4199 return CALL_BASECRYPTLIB (TlsGet
.Services
.Verify
, TlsGetVerify
, (Tls
), 0);
4203 Gets the session ID used by the specified TLS connection.
4205 This function returns the TLS/SSL session ID currently used by the
4206 specified TLS connection.
4208 @param[in] Tls Pointer to the TLS object.
4209 @param[in,out] SessionId Buffer to contain the returned session ID.
4210 @param[in,out] SessionIdLen The length of Session ID in bytes.
4212 @retval EFI_SUCCESS The Session ID was returned successfully.
4213 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4214 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
4219 CryptoServiceTlsGetSessionId (
4221 IN OUT UINT8
*SessionId
,
4222 IN OUT UINT16
*SessionIdLen
4225 return CALL_BASECRYPTLIB (TlsGet
.Services
.SessionId
, TlsGetSessionId
, (Tls
, SessionId
, SessionIdLen
), EFI_UNSUPPORTED
);
4229 Gets the client random data used in the specified TLS connection.
4231 This function returns the TLS/SSL client random data currently used in
4232 the specified TLS connection.
4234 @param[in] Tls Pointer to the TLS object.
4235 @param[in,out] ClientRandom Buffer to contain the returned client
4236 random data (32 bytes).
4241 CryptoServiceTlsGetClientRandom (
4243 IN OUT UINT8
*ClientRandom
4246 CALL_VOID_BASECRYPTLIB (TlsGet
.Services
.ClientRandom
, TlsGetClientRandom
, (Tls
, ClientRandom
));
4250 Gets the server random data used in the specified TLS connection.
4252 This function returns the TLS/SSL server random data currently used in
4253 the specified TLS connection.
4255 @param[in] Tls Pointer to the TLS object.
4256 @param[in,out] ServerRandom Buffer to contain the returned server
4257 random data (32 bytes).
4262 CryptoServiceTlsGetServerRandom (
4264 IN OUT UINT8
*ServerRandom
4267 CALL_VOID_BASECRYPTLIB (TlsGet
.Services
.ServerRandom
, TlsGetServerRandom
, (Tls
, ServerRandom
));
4271 Gets the master key data used in the specified TLS connection.
4273 This function returns the TLS/SSL master key material currently used in
4274 the specified TLS connection.
4276 @param[in] Tls Pointer to the TLS object.
4277 @param[in,out] KeyMaterial Buffer to contain the returned key material.
4279 @retval EFI_SUCCESS Key material was returned successfully.
4280 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4281 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
4286 CryptoServiceTlsGetKeyMaterial (
4288 IN OUT UINT8
*KeyMaterial
4291 return CALL_BASECRYPTLIB (TlsGet
.Services
.KeyMaterial
, TlsGetKeyMaterial
, (Tls
, KeyMaterial
), EFI_UNSUPPORTED
);
4295 Gets the CA Certificate from the cert store.
4297 This function returns the CA certificate for the chosen
4300 @param[in] Tls Pointer to the TLS object.
4301 @param[out] Data Pointer to the data buffer to receive the CA
4302 certificate data sent to the client.
4303 @param[in,out] DataSize The size of data buffer in bytes.
4305 @retval EFI_SUCCESS The operation succeeded.
4306 @retval EFI_UNSUPPORTED This function is not supported.
4307 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4312 CryptoServiceTlsGetCaCertificate (
4315 IN OUT UINTN
*DataSize
4318 return CALL_BASECRYPTLIB (TlsGet
.Services
.CaCertificate
, TlsGetCaCertificate
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4322 Gets the local public Certificate set in the specified TLS object.
4324 This function returns the local public certificate which was currently set
4325 in the specified TLS object.
4327 @param[in] Tls Pointer to the TLS object.
4328 @param[out] Data Pointer to the data buffer to receive the local
4330 @param[in,out] DataSize The size of data buffer in bytes.
4332 @retval EFI_SUCCESS The operation succeeded.
4333 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4334 @retval EFI_NOT_FOUND The certificate is not found.
4335 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4340 CryptoServiceTlsGetHostPublicCert (
4343 IN OUT UINTN
*DataSize
4346 return CALL_BASECRYPTLIB (TlsGet
.Services
.HostPublicCert
, TlsGetHostPublicCert
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4350 Gets the local private key set in the specified TLS object.
4352 This function returns the local private key data which was currently set
4353 in the specified TLS object.
4355 @param[in] Tls Pointer to the TLS object.
4356 @param[out] Data Pointer to the data buffer to receive the local
4358 @param[in,out] DataSize The size of data buffer in bytes.
4360 @retval EFI_SUCCESS The operation succeeded.
4361 @retval EFI_UNSUPPORTED This function is not supported.
4362 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4367 CryptoServiceTlsGetHostPrivateKey (
4370 IN OUT UINTN
*DataSize
4373 return CALL_BASECRYPTLIB (TlsGet
.Services
.HostPrivateKey
, TlsGetHostPrivateKey
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4377 Gets the CA-supplied certificate revocation list data set in the specified
4380 This function returns the CA-supplied certificate revocation list data which
4381 was currently set in the specified TLS object.
4383 @param[out] Data Pointer to the data buffer to receive the CRL data.
4384 @param[in,out] DataSize The size of data buffer in bytes.
4386 @retval EFI_SUCCESS The operation succeeded.
4387 @retval EFI_UNSUPPORTED This function is not supported.
4388 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4393 CryptoServiceTlsGetCertRevocationList (
4395 IN OUT UINTN
*DataSize
4398 return CALL_BASECRYPTLIB (TlsGet
.Services
.CertRevocationList
, TlsGetCertRevocationList
, (Data
, DataSize
), EFI_UNSUPPORTED
);
4401 const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto
= {
4403 CryptoServiceGetCryptoVersion
,
4405 CryptoServiceHmacMd5New
,
4406 CryptoServiceHmacMd5Free
,
4407 CryptoServiceHmacMd5SetKey
,
4408 CryptoServiceHmacMd5Duplicate
,
4409 CryptoServiceHmacMd5Update
,
4410 CryptoServiceHmacMd5Final
,
4412 CryptoServiceHmacSha1New
,
4413 CryptoServiceHmacSha1Free
,
4414 CryptoServiceHmacSha1SetKey
,
4415 CryptoServiceHmacSha1Duplicate
,
4416 CryptoServiceHmacSha1Update
,
4417 CryptoServiceHmacSha1Final
,
4419 CryptoServiceHmacSha256New
,
4420 CryptoServiceHmacSha256Free
,
4421 CryptoServiceHmacSha256SetKey
,
4422 CryptoServiceHmacSha256Duplicate
,
4423 CryptoServiceHmacSha256Update
,
4424 CryptoServiceHmacSha256Final
,
4426 CryptoServiceMd4GetContextSize
,
4427 CryptoServiceMd4Init
,
4428 CryptoServiceMd4Duplicate
,
4429 CryptoServiceMd4Update
,
4430 CryptoServiceMd4Final
,
4431 CryptoServiceMd4HashAll
,
4433 CryptoServiceMd5GetContextSize
,
4434 CryptoServiceMd5Init
,
4435 CryptoServiceMd5Duplicate
,
4436 CryptoServiceMd5Update
,
4437 CryptoServiceMd5Final
,
4438 CryptoServiceMd5HashAll
,
4440 CryptoServicePkcs1v2Encrypt
,
4441 CryptoServicePkcs5HashPassword
,
4442 CryptoServicePkcs7Verify
,
4443 CryptoServiceVerifyEKUsInPkcs7Signature
,
4444 CryptoServicePkcs7GetSigners
,
4445 CryptoServicePkcs7FreeSigners
,
4446 CryptoServicePkcs7Sign
,
4447 CryptoServicePkcs7GetAttachedContent
,
4448 CryptoServicePkcs7GetCertificatesList
,
4449 CryptoServiceAuthenticodeVerify
,
4450 CryptoServiceImageTimestampVerify
,
4453 CryptoServiceDhFree
,
4454 CryptoServiceDhGenerateParameter
,
4455 CryptoServiceDhSetParameter
,
4456 CryptoServiceDhGenerateKey
,
4457 CryptoServiceDhComputeKey
,
4459 CryptoServiceRandomSeed
,
4460 CryptoServiceRandomBytes
,
4462 CryptoServiceRsaPkcs1Verify
,
4463 CryptoServiceRsaNew
,
4464 CryptoServiceRsaFree
,
4465 CryptoServiceRsaSetKey
,
4466 CryptoServiceRsaGetKey
,
4467 CryptoServiceRsaGenerateKey
,
4468 CryptoServiceRsaCheckKey
,
4469 CryptoServiceRsaPkcs1Sign
,
4470 CryptoServiceRsaPkcs1Verify
,
4471 CryptoServiceRsaGetPrivateKeyFromPem
,
4472 CryptoServiceRsaGetPublicKeyFromX509
,
4474 CryptoServiceSha1GetContextSize
,
4475 CryptoServiceSha1Init
,
4476 CryptoServiceSha1Duplicate
,
4477 CryptoServiceSha1Update
,
4478 CryptoServiceSha1Final
,
4479 CryptoServiceSha1HashAll
,
4481 CryptoServiceSha256GetContextSize
,
4482 CryptoServiceSha256Init
,
4483 CryptoServiceSha256Duplicate
,
4484 CryptoServiceSha256Update
,
4485 CryptoServiceSha256Final
,
4486 CryptoServiceSha256HashAll
,
4488 CryptoServiceSha384GetContextSize
,
4489 CryptoServiceSha384Init
,
4490 CryptoServiceSha384Duplicate
,
4491 CryptoServiceSha384Update
,
4492 CryptoServiceSha384Final
,
4493 CryptoServiceSha384HashAll
,
4495 CryptoServiceSha512GetContextSize
,
4496 CryptoServiceSha512Init
,
4497 CryptoServiceSha512Duplicate
,
4498 CryptoServiceSha512Update
,
4499 CryptoServiceSha512Final
,
4500 CryptoServiceSha512HashAll
,
4502 CryptoServiceX509GetSubjectName
,
4503 CryptoServiceX509GetCommonName
,
4504 CryptoServiceX509GetOrganizationName
,
4505 CryptoServiceX509VerifyCert
,
4506 CryptoServiceX509ConstructCertificate
,
4507 CryptoServiceX509ConstructCertificateStack
,
4508 CryptoServiceX509Free
,
4509 CryptoServiceX509StackFree
,
4510 CryptoServiceX509GetTBSCert
,
4512 CryptoServiceTdesGetContextSize
,
4513 CryptoServiceTdesInit
,
4514 CryptoServiceTdesEcbEncrypt
,
4515 CryptoServiceTdesEcbDecrypt
,
4516 CryptoServiceTdesCbcEncrypt
,
4517 CryptoServiceTdesCbcDecrypt
,
4519 CryptoServiceAesGetContextSize
,
4520 CryptoServiceAesInit
,
4521 CryptoServiceAesEcbEncrypt
,
4522 CryptoServiceAesEcbDecrypt
,
4523 CryptoServiceAesCbcEncrypt
,
4524 CryptoServiceAesCbcDecrypt
,
4526 CryptoServiceArc4GetContextSize
,
4527 CryptoServiceArc4Init
,
4528 CryptoServiceArc4Encrypt
,
4529 CryptoServiceArc4Decrypt
,
4530 CryptoServiceArc4Reset
,
4532 CryptoServiceSm3GetContextSize
,
4533 CryptoServiceSm3Init
,
4534 CryptoServiceSm3Duplicate
,
4535 CryptoServiceSm3Update
,
4536 CryptoServiceSm3Final
,
4537 CryptoServiceSm3HashAll
,
4539 CryptoServiceHkdfSha256ExtractAndExpand
,
4540 /// X509 (Continued)
4541 CryptoServiceX509ConstructCertificateStackV
,
4543 CryptoServiceTlsInitialize
,
4544 CryptoServiceTlsCtxFree
,
4545 CryptoServiceTlsCtxNew
,
4546 CryptoServiceTlsFree
,
4547 CryptoServiceTlsNew
,
4548 CryptoServiceTlsInHandshake
,
4549 CryptoServiceTlsDoHandshake
,
4550 CryptoServiceTlsHandleAlert
,
4551 CryptoServiceTlsCloseNotify
,
4552 CryptoServiceTlsCtrlTrafficOut
,
4553 CryptoServiceTlsCtrlTrafficIn
,
4554 CryptoServiceTlsRead
,
4555 CryptoServiceTlsWrite
,
4557 CryptoServiceTlsSetVersion
,
4558 CryptoServiceTlsSetConnectionEnd
,
4559 CryptoServiceTlsSetCipherList
,
4560 CryptoServiceTlsSetCompressionMethod
,
4561 CryptoServiceTlsSetVerify
,
4562 CryptoServiceTlsSetVerifyHost
,
4563 CryptoServiceTlsSetSessionId
,
4564 CryptoServiceTlsSetCaCertificate
,
4565 CryptoServiceTlsSetHostPublicCert
,
4566 CryptoServiceTlsSetHostPrivateKey
,
4567 CryptoServiceTlsSetCertRevocationList
,
4569 CryptoServiceTlsGetVersion
,
4570 CryptoServiceTlsGetConnectionEnd
,
4571 CryptoServiceTlsGetCurrentCipher
,
4572 CryptoServiceTlsGetCurrentCompressionId
,
4573 CryptoServiceTlsGetVerify
,
4574 CryptoServiceTlsGetSessionId
,
4575 CryptoServiceTlsGetClientRandom
,
4576 CryptoServiceTlsGetServerRandom
,
4577 CryptoServiceTlsGetKeyMaterial
,
4578 CryptoServiceTlsGetCaCertificate
,
4579 CryptoServiceTlsGetHostPublicCert
,
4580 CryptoServiceTlsGetHostPrivateKey
,
4581 CryptoServiceTlsGetCertRevocationList