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 : (BaseCryptLibServiceNotEnabled (#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 : BaseCryptLibServiceNotEnabled (#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 BaseCryptLibServiceNotEnabled (
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 Internal worker function that prints a debug message and asserts if a call is
91 made to a BaseCryptLib function that is deprecated and unsupported any longer.
93 @param[in] FunctionName Null-terminated ASCII string that is the name of an
94 EDK II Crypto service.
99 BaseCryptLibServiceDeprecated (
100 IN CONST CHAR8
*FunctionName
103 DEBUG ((DEBUG_ERROR
, "[%a] Function %a() is deprecated and unsupported any longer\n", gEfiCallerBaseName
, FunctionName
));
104 ASSERT_EFI_ERROR (EFI_UNSUPPORTED
);
108 Returns the version of the EDK II Crypto Protocol.
110 @return The version of the EDK II Crypto Protocol.
115 CryptoServiceGetCryptoVersion (
119 return EDKII_CRYPTO_VERSION
;
122 //=====================================================================================
123 // One-Way Cryptographic Hash Primitives
124 //=====================================================================================
127 MD4 is deprecated and unsupported any longer.
128 Keep the function field for binary compability.
130 @retval 0 This interface is not supported.
135 DeprecatedCryptoServiceMd4GetContextSize (
139 return BaseCryptLibServiceDeprecated ("Md4GetContextSize"), 0;
143 MD4 is deprecated and unsupported any longer.
144 Keep the function field for binary compability.
146 @param[out] Md4Context Pointer to MD4 context being initialized.
148 @retval FALSE This interface is not supported.
153 DeprecatedCryptoServiceMd4Init (
157 return BaseCryptLibServiceDeprecated ("Md4Init"), FALSE
;
161 MD4 is deprecated and unsupported any longer.
162 Keep the function field for binary compability.
164 @param[in] Md4Context Pointer to MD4 context being copied.
165 @param[out] NewMd4Context Pointer to new MD4 context.
167 @retval FALSE This interface is not supported.
172 DeprecatedCryptoServiceMd4Duplicate (
173 IN CONST VOID
*Md4Context
,
174 OUT VOID
*NewMd4Context
177 return BaseCryptLibServiceDeprecated ("Md4Duplicate"), FALSE
;
181 MD4 is deprecated and unsupported any longer.
182 Keep the function field for binary compability.
184 @param[in, out] Md4Context Pointer to the MD4 context.
185 @param[in] Data Pointer to the buffer containing the data to be hashed.
186 @param[in] DataSize Size of Data buffer in bytes.
188 @retval FALSE This interface is not supported.
193 DeprecatedCryptoServiceMd4Update (
194 IN OUT VOID
*Md4Context
,
199 return BaseCryptLibServiceDeprecated ("Md4Update"), FALSE
;
203 MD4 is deprecated and unsupported any longer.
204 Keep the function field for binary compability.
206 @param[in, out] Md4Context Pointer to the MD4 context.
207 @param[out] HashValue Pointer to a buffer that receives the MD4 digest
210 @retval FALSE This interface is not supported.
215 DeprecatedCryptoServiceMd4Final (
216 IN OUT VOID
*Md4Context
,
220 return BaseCryptLibServiceDeprecated ("Md4Final"), FALSE
;
224 MD4 is deprecated and unsupported any longer.
225 Keep the function field for binary compability.
227 @param[in] Data Pointer to the buffer containing the data to be hashed.
228 @param[in] DataSize Size of Data buffer in bytes.
229 @param[out] HashValue Pointer to a buffer that receives the MD4 digest
232 @retval FALSE This interface is not supported.
237 DeprecatedCryptoServiceMd4HashAll (
243 return BaseCryptLibServiceDeprecated ("Md4HashAll"), FALSE
;
246 #ifndef ENABLE_MD5_DEPRECATED_INTERFACES
248 Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
250 If this interface is not supported, then return zero.
252 @retval 0 This interface is not supported.
257 DeprecatedCryptoServiceMd5GetContextSize (
261 return BaseCryptLibServiceDeprecated ("Md5GetContextSize"), 0;
265 Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
268 If Md5Context is NULL, then return FALSE.
269 If this interface is not supported, then return FALSE.
271 @param[out] Md5Context Pointer to MD5 context being initialized.
273 @retval FALSE This interface is not supported.
278 DeprecatedCryptoServiceMd5Init (
282 return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE
;
286 Makes a copy of an existing MD5 context.
288 If Md5Context is NULL, then return FALSE.
289 If NewMd5Context is NULL, then return FALSE.
290 If this interface is not supported, then return FALSE.
292 @param[in] Md5Context Pointer to MD5 context being copied.
293 @param[out] NewMd5Context Pointer to new MD5 context.
295 @retval FALSE This interface is not supported.
300 DeprecatedCryptoServiceMd5Duplicate (
301 IN CONST VOID
*Md5Context
,
302 OUT VOID
*NewMd5Context
305 return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE
;
309 Digests the input data and updates MD5 context.
311 This function performs MD5 digest on a data buffer of the specified size.
312 It can be called multiple times to compute the digest of long or discontinuous data streams.
313 MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
314 by Md5Final(). Behavior with invalid context is undefined.
316 If Md5Context is NULL, then return FALSE.
317 If this interface is not supported, then return FALSE.
319 @param[in, out] Md5Context Pointer to the MD5 context.
320 @param[in] Data Pointer to the buffer containing the data to be hashed.
321 @param[in] DataSize Size of Data buffer in bytes.
323 @retval FALSE This interface is not supported.
328 DeprecatedCryptoServiceMd5Update (
329 IN OUT VOID
*Md5Context
,
334 return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE
;
338 Completes computation of the MD5 digest value.
340 This function completes MD5 hash computation and retrieves the digest value into
341 the specified memory. After this function has been called, the MD5 context cannot
343 MD5 context should be already correctly initialized by Md5Init(), and should not be
344 finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
346 If Md5Context is NULL, then return FALSE.
347 If HashValue is NULL, then return FALSE.
348 If this interface is not supported, then return FALSE.
350 @param[in, out] Md5Context Pointer to the MD5 context.
351 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
354 @retval FALSE This interface is not supported.
359 DeprecatedCryptoServiceMd5Final (
360 IN OUT VOID
*Md5Context
,
364 return BaseCryptLibServiceDeprecated ("Md5Final"), FALSE
;
368 Computes the MD5 message digest of a input data buffer.
370 This function performs the MD5 message digest of a given data buffer, and places
371 the digest value into the specified memory.
373 If this interface is not supported, then return FALSE.
375 @param[in] Data Pointer to the buffer containing the data to be hashed.
376 @param[in] DataSize Size of Data buffer in bytes.
377 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
380 @retval FALSE This interface is not supported.
385 DeprecatedCryptoServiceMd5HashAll (
391 return BaseCryptLibServiceDeprecated ("Md5HashAll"), FALSE
;
395 Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
397 If this interface is not supported, then return zero.
399 @return The size, in bytes, of the context buffer required for MD5 hash operations.
400 @retval 0 This interface is not supported.
405 CryptoServiceMd5GetContextSize (
409 return CALL_BASECRYPTLIB (Md5
.Services
.GetContextSize
, Md5GetContextSize
, (), 0);
413 Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
416 If Md5Context is NULL, then return FALSE.
417 If this interface is not supported, then return FALSE.
419 @param[out] Md5Context Pointer to MD5 context being initialized.
421 @retval TRUE MD5 context initialization succeeded.
422 @retval FALSE MD5 context initialization failed.
423 @retval FALSE This interface is not supported.
428 CryptoServiceMd5Init (
432 return CALL_BASECRYPTLIB (Md5
.Services
.Init
, Md5Init
, (Md5Context
), FALSE
);
436 Makes a copy of an existing MD5 context.
438 If Md5Context is NULL, then return FALSE.
439 If NewMd5Context is NULL, then return FALSE.
440 If this interface is not supported, then return FALSE.
442 @param[in] Md5Context Pointer to MD5 context being copied.
443 @param[out] NewMd5Context Pointer to new MD5 context.
445 @retval TRUE MD5 context copy succeeded.
446 @retval FALSE MD5 context copy failed.
447 @retval FALSE This interface is not supported.
452 CryptoServiceMd5Duplicate (
453 IN CONST VOID
*Md5Context
,
454 OUT VOID
*NewMd5Context
457 return CALL_BASECRYPTLIB (Md5
.Services
.Duplicate
, Md5Duplicate
, (Md5Context
, NewMd5Context
), FALSE
);
461 Digests the input data and updates MD5 context.
463 This function performs MD5 digest on a data buffer of the specified size.
464 It can be called multiple times to compute the digest of long or discontinuous data streams.
465 MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
466 by Md5Final(). Behavior with invalid context is undefined.
468 If Md5Context is NULL, then return FALSE.
469 If this interface is not supported, then return FALSE.
471 @param[in, out] Md5Context Pointer to the MD5 context.
472 @param[in] Data Pointer to the buffer containing the data to be hashed.
473 @param[in] DataSize Size of Data buffer in bytes.
475 @retval TRUE MD5 data digest succeeded.
476 @retval FALSE MD5 data digest failed.
477 @retval FALSE This interface is not supported.
482 CryptoServiceMd5Update (
483 IN OUT VOID
*Md5Context
,
488 return CALL_BASECRYPTLIB (Md5
.Services
.Update
, Md5Update
, (Md5Context
, Data
, DataSize
), FALSE
);
492 Completes computation of the MD5 digest value.
494 This function completes MD5 hash computation and retrieves the digest value into
495 the specified memory. After this function has been called, the MD5 context cannot
497 MD5 context should be already correctly initialized by Md5Init(), and should not be
498 finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
500 If Md5Context is NULL, then return FALSE.
501 If HashValue is NULL, then return FALSE.
502 If this interface is not supported, then return FALSE.
504 @param[in, out] Md5Context Pointer to the MD5 context.
505 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
508 @retval TRUE MD5 digest computation succeeded.
509 @retval FALSE MD5 digest computation failed.
510 @retval FALSE This interface is not supported.
515 CryptoServiceMd5Final (
516 IN OUT VOID
*Md5Context
,
520 return CALL_BASECRYPTLIB (Md5
.Services
.Final
, Md5Final
, (Md5Context
, HashValue
), FALSE
);
524 Computes the MD5 message digest of a input data buffer.
526 This function performs the MD5 message digest of a given data buffer, and places
527 the digest value into the specified memory.
529 If this interface is not supported, then return FALSE.
531 @param[in] Data Pointer to the buffer containing the data to be hashed.
532 @param[in] DataSize Size of Data buffer in bytes.
533 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
536 @retval TRUE MD5 digest computation succeeded.
537 @retval FALSE MD5 digest computation failed.
538 @retval FALSE This interface is not supported.
543 CryptoServiceMd5HashAll (
549 return CALL_BASECRYPTLIB (Md5
.Services
.HashAll
, Md5HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
553 #ifdef DISABLE_SHA1_DEPRECATED_INTERFACES
555 Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
557 If this interface is not supported, then return zero.
559 @retval 0 This interface is not supported.
564 DeprecatedCryptoServiceSha1GetContextSize (
568 return BaseCryptLibServiceDeprecated ("Sha1GetContextSize"), 0;
572 Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
575 If Sha1Context is NULL, then return FALSE.
576 If this interface is not supported, then return FALSE.
578 @param[out] Sha1Context Pointer to SHA-1 context being initialized.
580 @retval TRUE SHA-1 context initialization succeeded.
581 @retval FALSE SHA-1 context initialization failed.
582 @retval FALSE This interface is not supported.
587 DeprecatedCryptoServiceSha1Init (
588 OUT VOID
*Sha1Context
591 return BaseCryptLibServiceDeprecated ("Sha1Init"), FALSE
;
595 Makes a copy of an existing SHA-1 context.
597 If Sha1Context is NULL, then return FALSE.
598 If NewSha1Context is NULL, then return FALSE.
599 If this interface is not supported, then return FALSE.
601 @param[in] Sha1Context Pointer to SHA-1 context being copied.
602 @param[out] NewSha1Context Pointer to new SHA-1 context.
604 @retval FALSE This interface is not supported.
609 DeprecatedCryptoServiceSha1Duplicate (
610 IN CONST VOID
*Sha1Context
,
611 OUT VOID
*NewSha1Context
614 return BaseCryptLibServiceDeprecated ("Sha1Duplicate"), FALSE
;
618 Digests the input data and updates SHA-1 context.
620 This function performs SHA-1 digest on a data buffer of the specified size.
621 It can be called multiple times to compute the digest of long or discontinuous data streams.
622 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
623 by Sha1Final(). Behavior with invalid context is undefined.
625 If Sha1Context is NULL, then return FALSE.
626 If this interface is not supported, then return FALSE.
628 @param[in, out] Sha1Context Pointer to the SHA-1 context.
629 @param[in] Data Pointer to the buffer containing the data to be hashed.
630 @param[in] DataSize Size of Data buffer in bytes.
632 @retval FALSE This interface is not supported.
637 DeprecatedCryptoServiceSha1Update (
638 IN OUT VOID
*Sha1Context
,
643 return BaseCryptLibServiceDeprecated ("Sha1Update"), FALSE
;
647 Completes computation of the SHA-1 digest value.
649 This function completes SHA-1 hash computation and retrieves the digest value into
650 the specified memory. After this function has been called, the SHA-1 context cannot
652 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
653 finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
655 If Sha1Context is NULL, then return FALSE.
656 If HashValue is NULL, then return FALSE.
657 If this interface is not supported, then return FALSE.
659 @param[in, out] Sha1Context Pointer to the SHA-1 context.
660 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
663 @retval FALSE This interface is not supported.
668 DeprecatedCryptoServiceSha1Final (
669 IN OUT VOID
*Sha1Context
,
673 return BaseCryptLibServiceDeprecated ("Sha1Final"), FALSE
;
677 Computes the SHA-1 message digest of a input data buffer.
679 This function performs the SHA-1 message digest of a given data buffer, and places
680 the digest value into the specified memory.
682 If this interface is not supported, then return FALSE.
684 @param[in] Data Pointer to the buffer containing the data to be hashed.
685 @param[in] DataSize Size of Data buffer in bytes.
686 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
689 @retval FALSE This interface is not supported.
694 DeprecatedCryptoServiceSha1HashAll (
700 return BaseCryptLibServiceDeprecated ("Sha1HashAll"), FALSE
;
704 Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
706 If this interface is not supported, then return zero.
708 @return The size, in bytes, of the context buffer required for SHA-1 hash operations.
709 @retval 0 This interface is not supported.
714 CryptoServiceSha1GetContextSize (
718 return CALL_BASECRYPTLIB (Sha1
.Services
.GetContextSize
, Sha1GetContextSize
, (), 0);
722 Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
725 If Sha1Context is NULL, then return FALSE.
726 If this interface is not supported, then return FALSE.
728 @param[out] Sha1Context Pointer to SHA-1 context being initialized.
730 @retval TRUE SHA-1 context initialization succeeded.
731 @retval FALSE SHA-1 context initialization failed.
732 @retval FALSE This interface is not supported.
737 CryptoServiceSha1Init (
738 OUT VOID
*Sha1Context
741 return CALL_BASECRYPTLIB (Sha1
.Services
.Init
, Sha1Init
, (Sha1Context
), FALSE
);
745 Makes a copy of an existing SHA-1 context.
747 If Sha1Context is NULL, then return FALSE.
748 If NewSha1Context is NULL, then return FALSE.
749 If this interface is not supported, then return FALSE.
751 @param[in] Sha1Context Pointer to SHA-1 context being copied.
752 @param[out] NewSha1Context Pointer to new SHA-1 context.
754 @retval TRUE SHA-1 context copy succeeded.
755 @retval FALSE SHA-1 context copy failed.
756 @retval FALSE This interface is not supported.
761 CryptoServiceSha1Duplicate (
762 IN CONST VOID
*Sha1Context
,
763 OUT VOID
*NewSha1Context
766 return CALL_BASECRYPTLIB (Sha1
.Services
.Duplicate
, Sha1Duplicate
, (Sha1Context
, NewSha1Context
), FALSE
);
770 Digests the input data and updates SHA-1 context.
772 This function performs SHA-1 digest on a data buffer of the specified size.
773 It can be called multiple times to compute the digest of long or discontinuous data streams.
774 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
775 by Sha1Final(). Behavior with invalid context is undefined.
777 If Sha1Context is NULL, then return FALSE.
778 If this interface is not supported, then return FALSE.
780 @param[in, out] Sha1Context Pointer to the SHA-1 context.
781 @param[in] Data Pointer to the buffer containing the data to be hashed.
782 @param[in] DataSize Size of Data buffer in bytes.
784 @retval TRUE SHA-1 data digest succeeded.
785 @retval FALSE SHA-1 data digest failed.
786 @retval FALSE This interface is not supported.
791 CryptoServiceSha1Update (
792 IN OUT VOID
*Sha1Context
,
797 return CALL_BASECRYPTLIB (Sha1
.Services
.Update
, Sha1Update
, (Sha1Context
, Data
, DataSize
), FALSE
);
801 Completes computation of the SHA-1 digest value.
803 This function completes SHA-1 hash computation and retrieves the digest value into
804 the specified memory. After this function has been called, the SHA-1 context cannot
806 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
807 finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
809 If Sha1Context is NULL, then return FALSE.
810 If HashValue is NULL, then return FALSE.
811 If this interface is not supported, then return FALSE.
813 @param[in, out] Sha1Context Pointer to the SHA-1 context.
814 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
817 @retval TRUE SHA-1 digest computation succeeded.
818 @retval FALSE SHA-1 digest computation failed.
819 @retval FALSE This interface is not supported.
824 CryptoServiceSha1Final (
825 IN OUT VOID
*Sha1Context
,
829 return CALL_BASECRYPTLIB (Sha1
.Services
.Final
, Sha1Final
, (Sha1Context
, HashValue
), FALSE
);
833 Computes the SHA-1 message digest of a input data buffer.
835 This function performs the SHA-1 message digest of a given data buffer, and places
836 the digest value into the specified memory.
838 If this interface is not supported, then return FALSE.
840 @param[in] Data Pointer to the buffer containing the data to be hashed.
841 @param[in] DataSize Size of Data buffer in bytes.
842 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
845 @retval TRUE SHA-1 digest computation succeeded.
846 @retval FALSE SHA-1 digest computation failed.
847 @retval FALSE This interface is not supported.
852 CryptoServiceSha1HashAll (
858 return CALL_BASECRYPTLIB (Sha1
.Services
.HashAll
, Sha1HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
863 Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
865 @return The size, in bytes, of the context buffer required for SHA-256 hash operations.
870 CryptoServiceSha256GetContextSize (
874 return CALL_BASECRYPTLIB (Sha256
.Services
.GetContextSize
, Sha256GetContextSize
, (), 0);
878 Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for
881 If Sha256Context is NULL, then return FALSE.
883 @param[out] Sha256Context Pointer to SHA-256 context being initialized.
885 @retval TRUE SHA-256 context initialization succeeded.
886 @retval FALSE SHA-256 context initialization failed.
891 CryptoServiceSha256Init (
892 OUT VOID
*Sha256Context
895 return CALL_BASECRYPTLIB (Sha256
.Services
.Init
, Sha256Init
, (Sha256Context
), FALSE
);
899 Makes a copy of an existing SHA-256 context.
901 If Sha256Context is NULL, then return FALSE.
902 If NewSha256Context is NULL, then return FALSE.
903 If this interface is not supported, then return FALSE.
905 @param[in] Sha256Context Pointer to SHA-256 context being copied.
906 @param[out] NewSha256Context Pointer to new SHA-256 context.
908 @retval TRUE SHA-256 context copy succeeded.
909 @retval FALSE SHA-256 context copy failed.
910 @retval FALSE This interface is not supported.
915 CryptoServiceSha256Duplicate (
916 IN CONST VOID
*Sha256Context
,
917 OUT VOID
*NewSha256Context
920 return CALL_BASECRYPTLIB (Sha256
.Services
.Duplicate
, Sha256Duplicate
, (Sha256Context
, NewSha256Context
), FALSE
);
924 Digests the input data and updates SHA-256 context.
926 This function performs SHA-256 digest on a data buffer of the specified size.
927 It can be called multiple times to compute the digest of long or discontinuous data streams.
928 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized
929 by Sha256Final(). Behavior with invalid context is undefined.
931 If Sha256Context is NULL, then return FALSE.
933 @param[in, out] Sha256Context Pointer to the SHA-256 context.
934 @param[in] Data Pointer to the buffer containing the data to be hashed.
935 @param[in] DataSize Size of Data buffer in bytes.
937 @retval TRUE SHA-256 data digest succeeded.
938 @retval FALSE SHA-256 data digest failed.
943 CryptoServiceSha256Update (
944 IN OUT VOID
*Sha256Context
,
949 return CALL_BASECRYPTLIB (Sha256
.Services
.Update
, Sha256Update
, (Sha256Context
, Data
, DataSize
), FALSE
);
953 Completes computation of the SHA-256 digest value.
955 This function completes SHA-256 hash computation and retrieves the digest value into
956 the specified memory. After this function has been called, the SHA-256 context cannot
958 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be
959 finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.
961 If Sha256Context is NULL, then return FALSE.
962 If HashValue is NULL, then return FALSE.
964 @param[in, out] Sha256Context Pointer to the SHA-256 context.
965 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
968 @retval TRUE SHA-256 digest computation succeeded.
969 @retval FALSE SHA-256 digest computation failed.
974 CryptoServiceSha256Final (
975 IN OUT VOID
*Sha256Context
,
979 return CALL_BASECRYPTLIB (Sha256
.Services
.Final
, Sha256Final
, (Sha256Context
, HashValue
), FALSE
);
983 Computes the SHA-256 message digest of a input data buffer.
985 This function performs the SHA-256 message digest of a given data buffer, and places
986 the digest value into the specified memory.
988 If this interface is not supported, then return FALSE.
990 @param[in] Data Pointer to the buffer containing the data to be hashed.
991 @param[in] DataSize Size of Data buffer in bytes.
992 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
995 @retval TRUE SHA-256 digest computation succeeded.
996 @retval FALSE SHA-256 digest computation failed.
997 @retval FALSE This interface is not supported.
1002 CryptoServiceSha256HashAll (
1003 IN CONST VOID
*Data
,
1005 OUT UINT8
*HashValue
1008 return CALL_BASECRYPTLIB (Sha256
.Services
.HashAll
, Sha256HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
1012 Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
1014 @return The size, in bytes, of the context buffer required for SHA-384 hash operations.
1019 CryptoServiceSha384GetContextSize (
1023 return CALL_BASECRYPTLIB (Sha384
.Services
.GetContextSize
, Sha384GetContextSize
, (), 0);
1027 Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for
1030 If Sha384Context is NULL, then return FALSE.
1032 @param[out] Sha384Context Pointer to SHA-384 context being initialized.
1034 @retval TRUE SHA-384 context initialization succeeded.
1035 @retval FALSE SHA-384 context initialization failed.
1040 CryptoServiceSha384Init (
1041 OUT VOID
*Sha384Context
1044 return CALL_BASECRYPTLIB (Sha384
.Services
.Init
, Sha384Init
, (Sha384Context
), FALSE
);
1048 Makes a copy of an existing SHA-384 context.
1050 If Sha384Context is NULL, then return FALSE.
1051 If NewSha384Context is NULL, then return FALSE.
1052 If this interface is not supported, then return FALSE.
1054 @param[in] Sha384Context Pointer to SHA-384 context being copied.
1055 @param[out] NewSha384Context Pointer to new SHA-384 context.
1057 @retval TRUE SHA-384 context copy succeeded.
1058 @retval FALSE SHA-384 context copy failed.
1059 @retval FALSE This interface is not supported.
1064 CryptoServiceSha384Duplicate (
1065 IN CONST VOID
*Sha384Context
,
1066 OUT VOID
*NewSha384Context
1069 return CALL_BASECRYPTLIB (Sha384
.Services
.Duplicate
, Sha384Duplicate
, (Sha384Context
, NewSha384Context
), FALSE
);
1073 Digests the input data and updates SHA-384 context.
1075 This function performs SHA-384 digest on a data buffer of the specified size.
1076 It can be called multiple times to compute the digest of long or discontinuous data streams.
1077 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized
1078 by Sha384Final(). Behavior with invalid context is undefined.
1080 If Sha384Context is NULL, then return FALSE.
1082 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1083 @param[in] Data Pointer to the buffer containing the data to be hashed.
1084 @param[in] DataSize Size of Data buffer in bytes.
1086 @retval TRUE SHA-384 data digest succeeded.
1087 @retval FALSE SHA-384 data digest failed.
1092 CryptoServiceSha384Update (
1093 IN OUT VOID
*Sha384Context
,
1094 IN CONST VOID
*Data
,
1098 return CALL_BASECRYPTLIB (Sha384
.Services
.Update
, Sha384Update
, (Sha384Context
, Data
, DataSize
), FALSE
);
1102 Completes computation of the SHA-384 digest value.
1104 This function completes SHA-384 hash computation and retrieves the digest value into
1105 the specified memory. After this function has been called, the SHA-384 context cannot
1107 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be
1108 finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.
1110 If Sha384Context is NULL, then return FALSE.
1111 If HashValue is NULL, then return FALSE.
1113 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1114 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1117 @retval TRUE SHA-384 digest computation succeeded.
1118 @retval FALSE SHA-384 digest computation failed.
1123 CryptoServiceSha384Final (
1124 IN OUT VOID
*Sha384Context
,
1125 OUT UINT8
*HashValue
1128 return CALL_BASECRYPTLIB (Sha384
.Services
.Final
, Sha384Final
, (Sha384Context
, HashValue
), FALSE
);
1132 Computes the SHA-384 message digest of a input data buffer.
1134 This function performs the SHA-384 message digest of a given data buffer, and places
1135 the digest value into the specified memory.
1137 If this interface is not supported, then return FALSE.
1139 @param[in] Data Pointer to the buffer containing the data to be hashed.
1140 @param[in] DataSize Size of Data buffer in bytes.
1141 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1144 @retval TRUE SHA-384 digest computation succeeded.
1145 @retval FALSE SHA-384 digest computation failed.
1146 @retval FALSE This interface is not supported.
1151 CryptoServiceSha384HashAll (
1152 IN CONST VOID
*Data
,
1154 OUT UINT8
*HashValue
1157 return CALL_BASECRYPTLIB (Sha384
.Services
.HashAll
, Sha384HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
1161 Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.
1163 @return The size, in bytes, of the context buffer required for SHA-512 hash operations.
1168 CryptoServiceSha512GetContextSize (
1172 return CALL_BASECRYPTLIB (Sha512
.Services
.GetContextSize
, Sha512GetContextSize
, (), 0);
1176 Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for
1179 If Sha512Context is NULL, then return FALSE.
1181 @param[out] Sha512Context Pointer to SHA-512 context being initialized.
1183 @retval TRUE SHA-512 context initialization succeeded.
1184 @retval FALSE SHA-512 context initialization failed.
1189 CryptoServiceSha512Init (
1190 OUT VOID
*Sha512Context
1193 return CALL_BASECRYPTLIB (Sha512
.Services
.Init
, Sha512Init
, (Sha512Context
), FALSE
);
1197 Makes a copy of an existing SHA-512 context.
1199 If Sha512Context is NULL, then return FALSE.
1200 If NewSha512Context is NULL, then return FALSE.
1201 If this interface is not supported, then return FALSE.
1203 @param[in] Sha512Context Pointer to SHA-512 context being copied.
1204 @param[out] NewSha512Context Pointer to new SHA-512 context.
1206 @retval TRUE SHA-512 context copy succeeded.
1207 @retval FALSE SHA-512 context copy failed.
1208 @retval FALSE This interface is not supported.
1213 CryptoServiceSha512Duplicate (
1214 IN CONST VOID
*Sha512Context
,
1215 OUT VOID
*NewSha512Context
1218 return CALL_BASECRYPTLIB (Sha512
.Services
.Duplicate
, Sha512Duplicate
, (Sha512Context
, NewSha512Context
), FALSE
);
1222 Digests the input data and updates SHA-512 context.
1224 This function performs SHA-512 digest on a data buffer of the specified size.
1225 It can be called multiple times to compute the digest of long or discontinuous data streams.
1226 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized
1227 by Sha512Final(). Behavior with invalid context is undefined.
1229 If Sha512Context is NULL, then return FALSE.
1231 @param[in, out] Sha512Context Pointer to the SHA-512 context.
1232 @param[in] Data Pointer to the buffer containing the data to be hashed.
1233 @param[in] DataSize Size of Data buffer in bytes.
1235 @retval TRUE SHA-512 data digest succeeded.
1236 @retval FALSE SHA-512 data digest failed.
1241 CryptoServiceSha512Update (
1242 IN OUT VOID
*Sha512Context
,
1243 IN CONST VOID
*Data
,
1247 return CALL_BASECRYPTLIB (Sha512
.Services
.Update
, Sha512Update
, (Sha512Context
, Data
, DataSize
), FALSE
);
1251 Completes computation of the SHA-512 digest value.
1253 This function completes SHA-512 hash computation and retrieves the digest value into
1254 the specified memory. After this function has been called, the SHA-512 context cannot
1256 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be
1257 finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.
1259 If Sha512Context is NULL, then return FALSE.
1260 If HashValue is NULL, then return FALSE.
1262 @param[in, out] Sha512Context Pointer to the SHA-512 context.
1263 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
1266 @retval TRUE SHA-512 digest computation succeeded.
1267 @retval FALSE SHA-512 digest computation failed.
1272 CryptoServiceSha512Final (
1273 IN OUT VOID
*Sha512Context
,
1274 OUT UINT8
*HashValue
1277 return CALL_BASECRYPTLIB (Sha512
.Services
.Final
, Sha512Final
, (Sha512Context
, HashValue
), FALSE
);
1281 Computes the SHA-512 message digest of a input data buffer.
1283 This function performs the SHA-512 message digest of a given data buffer, and places
1284 the digest value into the specified memory.
1286 If this interface is not supported, then return FALSE.
1288 @param[in] Data Pointer to the buffer containing the data to be hashed.
1289 @param[in] DataSize Size of Data buffer in bytes.
1290 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
1293 @retval TRUE SHA-512 digest computation succeeded.
1294 @retval FALSE SHA-512 digest computation failed.
1295 @retval FALSE This interface is not supported.
1300 CryptoServiceSha512HashAll (
1301 IN CONST VOID
*Data
,
1303 OUT UINT8
*HashValue
1306 return CALL_BASECRYPTLIB (Sha512
.Services
.HashAll
, Sha512HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
1310 Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
1312 @return The size, in bytes, of the context buffer required for SM3 hash operations.
1317 CryptoServiceSm3GetContextSize (
1321 return CALL_BASECRYPTLIB (Sm3
.Services
.GetContextSize
, Sm3GetContextSize
, (), 0);
1325 Initializes user-supplied memory pointed by Sm3Context as SM3 hash context for
1328 If Sm3Context is NULL, then return FALSE.
1330 @param[out] Sm3Context Pointer to SM3 context being initialized.
1332 @retval TRUE SM3 context initialization succeeded.
1333 @retval FALSE SM3 context initialization failed.
1338 CryptoServiceSm3Init (
1339 OUT VOID
*Sm3Context
1342 return CALL_BASECRYPTLIB (Sm3
.Services
.Init
, Sm3Init
, (Sm3Context
), FALSE
);
1346 Makes a copy of an existing SM3 context.
1348 If Sm3Context is NULL, then return FALSE.
1349 If NewSm3Context is NULL, then return FALSE.
1350 If this interface is not supported, then return FALSE.
1352 @param[in] Sm3Context Pointer to SM3 context being copied.
1353 @param[out] NewSm3Context Pointer to new SM3 context.
1355 @retval TRUE SM3 context copy succeeded.
1356 @retval FALSE SM3 context copy failed.
1357 @retval FALSE This interface is not supported.
1362 CryptoServiceSm3Duplicate (
1363 IN CONST VOID
*Sm3Context
,
1364 OUT VOID
*NewSm3Context
1367 return CALL_BASECRYPTLIB (Sm3
.Services
.Duplicate
, Sm3Duplicate
, (Sm3Context
, NewSm3Context
), FALSE
);
1371 Digests the input data and updates SM3 context.
1373 This function performs SM3 digest on a data buffer of the specified size.
1374 It can be called multiple times to compute the digest of long or discontinuous data streams.
1375 SM3 context should be already correctly initialized by Sm3Init(), and should not be finalized
1376 by Sm3Final(). Behavior with invalid context is undefined.
1378 If Sm3Context is NULL, then return FALSE.
1380 @param[in, out] Sm3Context Pointer to the SM3 context.
1381 @param[in] Data Pointer to the buffer containing the data to be hashed.
1382 @param[in] DataSize Size of Data buffer in bytes.
1384 @retval TRUE SM3 data digest succeeded.
1385 @retval FALSE SM3 data digest failed.
1390 CryptoServiceSm3Update (
1391 IN OUT VOID
*Sm3Context
,
1392 IN CONST VOID
*Data
,
1396 return CALL_BASECRYPTLIB (Sm3
.Services
.Update
, Sm3Update
, (Sm3Context
, Data
, DataSize
), FALSE
);
1400 Completes computation of the SM3 digest value.
1402 This function completes SM3 hash computation and retrieves the digest value into
1403 the specified memory. After this function has been called, the SM3 context cannot
1405 SM3 context should be already correctly initialized by Sm3Init(), and should not be
1406 finalized by Sm3Final(). Behavior with invalid SM3 context is undefined.
1408 If Sm3Context is NULL, then return FALSE.
1409 If HashValue is NULL, then return FALSE.
1411 @param[in, out] Sm3Context Pointer to the SM3 context.
1412 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
1415 @retval TRUE SM3 digest computation succeeded.
1416 @retval FALSE SM3 digest computation failed.
1421 CryptoServiceSm3Final (
1422 IN OUT VOID
*Sm3Context
,
1423 OUT UINT8
*HashValue
1426 return CALL_BASECRYPTLIB (Sm3
.Services
.Final
, Sm3Final
, (Sm3Context
, HashValue
), FALSE
);
1430 Computes the SM3 message digest of a input data buffer.
1432 This function performs the SM3 message digest of a given data buffer, and places
1433 the digest value into the specified memory.
1435 If this interface is not supported, then return FALSE.
1437 @param[in] Data Pointer to the buffer containing the data to be hashed.
1438 @param[in] DataSize Size of Data buffer in bytes.
1439 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
1442 @retval TRUE SM3 digest computation succeeded.
1443 @retval FALSE SM3 digest computation failed.
1444 @retval FALSE This interface is not supported.
1449 CryptoServiceSm3HashAll (
1450 IN CONST VOID
*Data
,
1452 OUT UINT8
*HashValue
1455 return CALL_BASECRYPTLIB (Sm3
.Services
.HashAll
, Sm3HashAll
, (Data
, DataSize
, HashValue
), FALSE
);
1458 //=====================================================================================
1459 // MAC (Message Authentication Code) Primitive
1460 //=====================================================================================
1463 HMAC MD5 is deprecated and unsupported any longer.
1464 Keep the function field for binary compability.
1466 @retval NULL This interface is not supported.
1471 DeprecatedCryptoServiceHmacMd5New (
1475 return BaseCryptLibServiceDeprecated ("HmacMd5New"), NULL
;
1479 HMAC MD5 is deprecated and unsupported any longer.
1480 Keep the function field for binary compability.
1482 @param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released.
1487 DeprecatedCryptoServiceHmacMd5Free (
1491 BaseCryptLibServiceDeprecated ("HmacMd5Free");
1495 HMAC MD5 is deprecated and unsupported any longer.
1496 Keep the function field for binary compability.
1498 @param[out] HmacMd5Context Pointer to HMAC-MD5 context.
1499 @param[in] Key Pointer to the user-supplied key.
1500 @param[in] KeySize Key size in bytes.
1502 @retval FALSE This interface is not supported.
1507 DeprecatedCryptoServiceHmacMd5SetKey (
1508 OUT VOID
*HmacMd5Context
,
1509 IN CONST UINT8
*Key
,
1513 return BaseCryptLibServiceDeprecated ("HmacMd5SetKey"), FALSE
;
1517 HMAC MD5 is deprecated and unsupported any longer.
1518 Keep the function field for binary compability.
1520 @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied.
1521 @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context.
1523 @retval FALSE This interface is not supported.
1528 DeprecatedCryptoServiceHmacMd5Duplicate (
1529 IN CONST VOID
*HmacMd5Context
,
1530 OUT VOID
*NewHmacMd5Context
1533 return BaseCryptLibServiceDeprecated ("HmacMd5Duplicate"), FALSE
;
1537 HMAC MD5 is deprecated and unsupported any longer.
1538 Keep the function field for binary compability.
1540 @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
1541 @param[in] Data Pointer to the buffer containing the data to be digested.
1542 @param[in] DataSize Size of Data buffer in bytes.
1544 @retval FALSE This interface is not supported.
1549 DeprecatedCryptoServiceHmacMd5Update (
1550 IN OUT VOID
*HmacMd5Context
,
1551 IN CONST VOID
*Data
,
1555 return BaseCryptLibServiceDeprecated ("HmacMd5Update"), FALSE
;
1559 HMAC MD5 is deprecated and unsupported any longer.
1560 Keep the function field for binary compability.
1562 @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
1563 @param[out] HmacValue Pointer to a buffer that receives the HMAC-MD5 digest
1566 @retval FALSE This interface is not supported.
1571 DeprecatedCryptoServiceHmacMd5Final (
1572 IN OUT VOID
*HmacMd5Context
,
1573 OUT UINT8
*HmacValue
1576 return BaseCryptLibServiceDeprecated ("HmacMd5Final"), FALSE
;
1580 HMAC SHA1 is deprecated and unsupported any longer.
1581 Keep the function field for binary compability.
1583 @return NULL This interface is not supported.
1588 DeprecatedCryptoServiceHmacSha1New (
1592 return BaseCryptLibServiceDeprecated ("HmacSha1New"), NULL
;
1596 HMAC SHA1 is deprecated and unsupported any longer.
1597 Keep the function field for binary compability.
1599 @param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released.
1604 DeprecatedCryptoServiceHmacSha1Free (
1605 IN VOID
*HmacSha1Ctx
1608 BaseCryptLibServiceDeprecated ("HmacSha1Free");
1612 HMAC SHA1 is deprecated and unsupported any longer.
1613 Keep the function field for binary compability.
1615 @param[out] HmacSha1Context Pointer to HMAC-SHA1 context.
1616 @param[in] Key Pointer to the user-supplied key.
1617 @param[in] KeySize Key size in bytes.
1619 @retval FALSE This interface is not supported.
1624 DeprecatedCryptoServiceHmacSha1SetKey (
1625 OUT VOID
*HmacSha1Context
,
1626 IN CONST UINT8
*Key
,
1630 return BaseCryptLibServiceDeprecated ("HmacSha1SetKey"), FALSE
;
1634 HMAC SHA1 is deprecated and unsupported any longer.
1635 Keep the function field for binary compability.
1637 @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied.
1638 @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context.
1640 @retval FALSE This interface is not supported.
1645 DeprecatedCryptoServiceHmacSha1Duplicate (
1646 IN CONST VOID
*HmacSha1Context
,
1647 OUT VOID
*NewHmacSha1Context
1650 return BaseCryptLibServiceDeprecated ("HmacSha1Duplicate"), FALSE
;
1654 HMAC SHA1 is deprecated and unsupported any longer.
1655 Keep the function field for binary compability.
1657 @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
1658 @param[in] Data Pointer to the buffer containing the data to be digested.
1659 @param[in] DataSize Size of Data buffer in bytes.
1661 @retval FALSE This interface is not supported.
1666 DeprecatedCryptoServiceHmacSha1Update (
1667 IN OUT VOID
*HmacSha1Context
,
1668 IN CONST VOID
*Data
,
1672 return BaseCryptLibServiceDeprecated ("HmacSha1Update"), FALSE
;
1676 HMAC SHA1 is deprecated and unsupported any longer.
1677 Keep the function field for binary compability.
1679 @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
1680 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest
1683 @retval FALSE This interface is not supported.
1688 DeprecatedCryptoServiceHmacSha1Final (
1689 IN OUT VOID
*HmacSha1Context
,
1690 OUT UINT8
*HmacValue
1693 return BaseCryptLibServiceDeprecated ("HmacSha1Final"), FALSE
;
1697 Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
1699 @return Pointer to the HMAC_CTX context that has been initialized.
1700 If the allocations fails, HmacSha256New() returns NULL.
1705 CryptoServiceHmacSha256New (
1709 return CALL_BASECRYPTLIB (HmacSha256
.Services
.New
, HmacSha256New
, (), NULL
);
1713 Release the specified HMAC_CTX context.
1715 @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released.
1720 CryptoServiceHmacSha256Free (
1721 IN VOID
*HmacSha256Ctx
1724 CALL_VOID_BASECRYPTLIB (HmacSha256
.Services
.Free
, HmacSha256Free
, (HmacSha256Ctx
));
1728 Set user-supplied key for subsequent use. It must be done before any
1729 calling to HmacSha256Update().
1731 If HmacSha256Context is NULL, then return FALSE.
1732 If this interface is not supported, then return FALSE.
1734 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.
1735 @param[in] Key Pointer to the user-supplied key.
1736 @param[in] KeySize Key size in bytes.
1738 @retval TRUE The Key is set successfully.
1739 @retval FALSE The Key is set unsuccessfully.
1740 @retval FALSE This interface is not supported.
1745 CryptoServiceHmacSha256SetKey (
1746 OUT VOID
*HmacSha256Context
,
1747 IN CONST UINT8
*Key
,
1751 return CALL_BASECRYPTLIB (HmacSha256
.Services
.SetKey
, HmacSha256SetKey
, (HmacSha256Context
, Key
, KeySize
), FALSE
);
1755 Makes a copy of an existing HMAC-SHA256 context.
1757 If HmacSha256Context is NULL, then return FALSE.
1758 If NewHmacSha256Context is NULL, then return FALSE.
1759 If this interface is not supported, then return FALSE.
1761 @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied.
1762 @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context.
1764 @retval TRUE HMAC-SHA256 context copy succeeded.
1765 @retval FALSE HMAC-SHA256 context copy failed.
1766 @retval FALSE This interface is not supported.
1771 CryptoServiceHmacSha256Duplicate (
1772 IN CONST VOID
*HmacSha256Context
,
1773 OUT VOID
*NewHmacSha256Context
1776 return CALL_BASECRYPTLIB (HmacSha256
.Services
.Duplicate
, HmacSha256Duplicate
, (HmacSha256Context
, NewHmacSha256Context
), FALSE
);
1780 Digests the input data and updates HMAC-SHA256 context.
1782 This function performs HMAC-SHA256 digest on a data buffer of the specified size.
1783 It can be called multiple times to compute the digest of long or discontinuous data streams.
1784 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
1785 by HmacSha256Final(). Behavior with invalid context is undefined.
1787 If HmacSha256Context is NULL, then return FALSE.
1788 If this interface is not supported, then return FALSE.
1790 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
1791 @param[in] Data Pointer to the buffer containing the data to be digested.
1792 @param[in] DataSize Size of Data buffer in bytes.
1794 @retval TRUE HMAC-SHA256 data digest succeeded.
1795 @retval FALSE HMAC-SHA256 data digest failed.
1796 @retval FALSE This interface is not supported.
1801 CryptoServiceHmacSha256Update (
1802 IN OUT VOID
*HmacSha256Context
,
1803 IN CONST VOID
*Data
,
1807 return CALL_BASECRYPTLIB (HmacSha256
.Services
.Update
, HmacSha256Update
, (HmacSha256Context
, Data
, DataSize
), FALSE
);
1811 Completes computation of the HMAC-SHA256 digest value.
1813 This function completes HMAC-SHA256 hash computation and retrieves the digest value into
1814 the specified memory. After this function has been called, the HMAC-SHA256 context cannot
1816 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
1817 by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.
1819 If HmacSha256Context is NULL, then return FALSE.
1820 If HmacValue is NULL, then return FALSE.
1821 If this interface is not supported, then return FALSE.
1823 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
1824 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest
1827 @retval TRUE HMAC-SHA256 digest computation succeeded.
1828 @retval FALSE HMAC-SHA256 digest computation failed.
1829 @retval FALSE This interface is not supported.
1834 CryptoServiceHmacSha256Final (
1835 IN OUT VOID
*HmacSha256Context
,
1836 OUT UINT8
*HmacValue
1839 return CALL_BASECRYPTLIB (HmacSha256
.Services
.Final
, HmacSha256Final
, (HmacSha256Context
, HmacValue
), FALSE
);
1842 //=====================================================================================
1843 // Symmetric Cryptography Primitive
1844 //=====================================================================================
1847 TDES is deprecated and unsupported any longer.
1848 Keep the function field for binary compability.
1850 @retval 0 This interface is not supported.
1855 DeprecatedCryptoServiceTdesGetContextSize (
1859 return BaseCryptLibServiceDeprecated ("TdesGetContextSize"), 0;
1863 TDES is deprecated and unsupported any longer.
1864 Keep the function field for binary compability.
1866 @param[out] TdesContext Pointer to TDES context being initialized.
1867 @param[in] Key Pointer to the user-supplied TDES key.
1868 @param[in] KeyLength Length of TDES key in bits.
1870 @retval FALSE This interface is not supported.
1875 DeprecatedCryptoServiceTdesInit (
1876 OUT VOID
*TdesContext
,
1877 IN CONST UINT8
*Key
,
1881 return BaseCryptLibServiceDeprecated ("TdesInit"), FALSE
;
1885 TDES is deprecated and unsupported any longer.
1886 Keep the function field for binary compability.
1888 @param[in] TdesContext Pointer to the TDES context.
1889 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1890 @param[in] InputSize Size of the Input buffer in bytes.
1891 @param[out] Output Pointer to a buffer that receives the TDES encryption output.
1893 @retval FALSE This interface is not supported.
1898 DeprecatedCryptoServiceTdesEcbEncrypt (
1899 IN VOID
*TdesContext
,
1900 IN CONST UINT8
*Input
,
1905 return BaseCryptLibServiceDeprecated ("TdesEcbEncrypt"), FALSE
;
1909 TDES is deprecated and unsupported any longer.
1910 Keep the function field for binary compability.
1912 @param[in] TdesContext Pointer to the TDES context.
1913 @param[in] Input Pointer to the buffer containing the data to be decrypted.
1914 @param[in] InputSize Size of the Input buffer in bytes.
1915 @param[out] Output Pointer to a buffer that receives the TDES decryption output.
1917 @retval FALSE This interface is not supported.
1922 DeprecatedCryptoServiceTdesEcbDecrypt (
1923 IN VOID
*TdesContext
,
1924 IN CONST UINT8
*Input
,
1929 return BaseCryptLibServiceDeprecated ("TdesEcbDecrypt"), FALSE
;
1933 TDES is deprecated and unsupported any longer.
1934 Keep the function field for binary compability.
1936 @param[in] TdesContext Pointer to the TDES context.
1937 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1938 @param[in] InputSize Size of the Input buffer in bytes.
1939 @param[in] Ivec Pointer to initialization vector.
1940 @param[out] Output Pointer to a buffer that receives the TDES encryption output.
1942 @retval FALSE This interface is not supported.
1947 DeprecatedCryptoServiceTdesCbcEncrypt (
1948 IN VOID
*TdesContext
,
1949 IN CONST UINT8
*Input
,
1951 IN CONST UINT8
*Ivec
,
1955 return BaseCryptLibServiceDeprecated ("TdesCbcEncrypt"), FALSE
;
1959 TDES is deprecated and unsupported any longer.
1960 Keep the function field for binary compability.
1962 @param[in] TdesContext Pointer to the TDES context.
1963 @param[in] Input Pointer to the buffer containing the data to be encrypted.
1964 @param[in] InputSize Size of the Input buffer in bytes.
1965 @param[in] Ivec Pointer to initialization vector.
1966 @param[out] Output Pointer to a buffer that receives the TDES encryption output.
1968 @retval FALSE This interface is not supported.
1973 DeprecatedCryptoServiceTdesCbcDecrypt (
1974 IN VOID
*TdesContext
,
1975 IN CONST UINT8
*Input
,
1977 IN CONST UINT8
*Ivec
,
1981 return BaseCryptLibServiceDeprecated ("TdesCbcDecrypt"), FALSE
;
1985 Retrieves the size, in bytes, of the context buffer required for AES operations.
1987 If this interface is not supported, then return zero.
1989 @return The size, in bytes, of the context buffer required for AES operations.
1990 @retval 0 This interface is not supported.
1995 CryptoServiceAesGetContextSize (
1999 return CALL_BASECRYPTLIB (Aes
.Services
.GetContextSize
, AesGetContextSize
, (), 0);
2003 Initializes user-supplied memory as AES context for subsequent use.
2005 This function initializes user-supplied memory pointed by AesContext as AES context.
2006 In addition, it sets up all AES key materials for subsequent encryption and decryption
2008 There are 3 options for key length, 128 bits, 192 bits, and 256 bits.
2010 If AesContext is NULL, then return FALSE.
2011 If Key is NULL, then return FALSE.
2012 If KeyLength is not valid, then return FALSE.
2013 If this interface is not supported, then return FALSE.
2015 @param[out] AesContext Pointer to AES context being initialized.
2016 @param[in] Key Pointer to the user-supplied AES key.
2017 @param[in] KeyLength Length of AES key in bits.
2019 @retval TRUE AES context initialization succeeded.
2020 @retval FALSE AES context initialization failed.
2021 @retval FALSE This interface is not supported.
2026 CryptoServiceAesInit (
2027 OUT VOID
*AesContext
,
2028 IN CONST UINT8
*Key
,
2032 return CALL_BASECRYPTLIB (Aes
.Services
.Init
, AesInit
, (AesContext
, Key
, KeyLength
), FALSE
);
2036 AES ECB Mode is deprecated and unsupported any longer.
2037 Keep the function field for binary compability.
2039 @param[in] AesContext Pointer to the AES context.
2040 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2041 @param[in] InputSize Size of the Input buffer in bytes.
2042 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2044 @retval FALSE This interface is not supported.
2049 DeprecatedCryptoServiceAesEcbEncrypt (
2050 IN VOID
*AesContext
,
2051 IN CONST UINT8
*Input
,
2056 return BaseCryptLibServiceDeprecated ("AesEcbEncrypt"), FALSE
;
2060 AES ECB Mode is deprecated and unsupported any longer.
2061 Keep the function field for binary compability.
2063 @param[in] AesContext Pointer to the AES context.
2064 @param[in] Input Pointer to the buffer containing the data to be decrypted.
2065 @param[in] InputSize Size of the Input buffer in bytes.
2066 @param[out] Output Pointer to a buffer that receives the AES decryption output.
2068 @retval FALSE This interface is not supported.
2073 DeprecatedCryptoServiceAesEcbDecrypt (
2074 IN VOID
*AesContext
,
2075 IN CONST UINT8
*Input
,
2080 return BaseCryptLibServiceDeprecated ("AesEcbDecrypt"), FALSE
;
2084 Performs AES encryption on a data buffer of the specified size in CBC mode.
2086 This function performs AES encryption on data buffer pointed by Input, of specified
2087 size of InputSize, in CBC mode.
2088 InputSize must be multiple of block size (16 bytes). This function does not perform
2089 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2090 Initialization vector should be one block size (16 bytes).
2091 AesContext should be already correctly initialized by AesInit(). Behavior with
2092 invalid AES context is undefined.
2094 If AesContext is NULL, then return FALSE.
2095 If Input is NULL, then return FALSE.
2096 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2097 If Ivec is NULL, then return FALSE.
2098 If Output is NULL, then return FALSE.
2099 If this interface is not supported, then return FALSE.
2101 @param[in] AesContext Pointer to the AES context.
2102 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2103 @param[in] InputSize Size of the Input buffer in bytes.
2104 @param[in] Ivec Pointer to initialization vector.
2105 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2107 @retval TRUE AES encryption succeeded.
2108 @retval FALSE AES encryption failed.
2109 @retval FALSE This interface is not supported.
2114 CryptoServiceAesCbcEncrypt (
2115 IN VOID
*AesContext
,
2116 IN CONST UINT8
*Input
,
2118 IN CONST UINT8
*Ivec
,
2122 return CALL_BASECRYPTLIB (Aes
.Services
.CbcEncrypt
, AesCbcEncrypt
, (AesContext
, Input
, InputSize
, Ivec
, Output
), FALSE
);
2126 Performs AES decryption on a data buffer of the specified size in CBC mode.
2128 This function performs AES decryption on data buffer pointed by Input, of specified
2129 size of InputSize, in CBC mode.
2130 InputSize must be multiple of block size (16 bytes). This function does not perform
2131 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2132 Initialization vector should be one block size (16 bytes).
2133 AesContext should be already correctly initialized by AesInit(). Behavior with
2134 invalid AES context is undefined.
2136 If AesContext is NULL, then return FALSE.
2137 If Input is NULL, then return FALSE.
2138 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2139 If Ivec is NULL, then return FALSE.
2140 If Output is NULL, then return FALSE.
2141 If this interface is not supported, then return FALSE.
2143 @param[in] AesContext Pointer to the AES context.
2144 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2145 @param[in] InputSize Size of the Input buffer in bytes.
2146 @param[in] Ivec Pointer to initialization vector.
2147 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2149 @retval TRUE AES decryption succeeded.
2150 @retval FALSE AES decryption failed.
2151 @retval FALSE This interface is not supported.
2156 CryptoServiceAesCbcDecrypt (
2157 IN VOID
*AesContext
,
2158 IN CONST UINT8
*Input
,
2160 IN CONST UINT8
*Ivec
,
2164 return CALL_BASECRYPTLIB (Aes
.Services
.CbcDecrypt
, AesCbcDecrypt
, (AesContext
, Input
, InputSize
, Ivec
, Output
), FALSE
);
2168 ARC4 is deprecated and unsupported any longer.
2169 Keep the function field for binary compability.
2171 @retval 0 This interface is not supported.
2176 DeprecatedCryptoServiceArc4GetContextSize (
2180 return BaseCryptLibServiceDeprecated ("Arc4GetContextSize"), 0;
2184 ARC4 is deprecated and unsupported any longer.
2185 Keep the function field for binary compability.
2187 @param[out] Arc4Context Pointer to ARC4 context being initialized.
2188 @param[in] Key Pointer to the user-supplied ARC4 key.
2189 @param[in] KeySize Size of ARC4 key in bytes.
2191 @retval FALSE This interface is not supported.
2196 DeprecatedCryptoServiceArc4Init (
2197 OUT VOID
*Arc4Context
,
2198 IN CONST UINT8
*Key
,
2202 return BaseCryptLibServiceDeprecated ("Arc4Init"), FALSE
;
2206 ARC4 is deprecated and unsupported any longer.
2207 Keep the function field for binary compability.
2209 @param[in, out] Arc4Context Pointer to the ARC4 context.
2210 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2211 @param[in] InputSize Size of the Input buffer in bytes.
2212 @param[out] Output Pointer to a buffer that receives the ARC4 encryption output.
2214 @retval FALSE This interface is not supported.
2219 DeprecatedCryptoServiceArc4Encrypt (
2220 IN OUT VOID
*Arc4Context
,
2221 IN CONST UINT8
*Input
,
2226 return BaseCryptLibServiceDeprecated ("Arc4Encrypt"), FALSE
;
2230 ARC4 is deprecated and unsupported any longer.
2231 Keep the function field for binary compability.
2233 @param[in, out] Arc4Context Pointer to the ARC4 context.
2234 @param[in] Input Pointer to the buffer containing the data to be decrypted.
2235 @param[in] InputSize Size of the Input buffer in bytes.
2236 @param[out] Output Pointer to a buffer that receives the ARC4 decryption output.
2238 @retval FALSE This interface is not supported.
2243 DeprecatedCryptoServiceArc4Decrypt (
2244 IN OUT VOID
*Arc4Context
,
2250 return BaseCryptLibServiceDeprecated ("Arc4Decrypt"), FALSE
;
2254 ARC4 is deprecated and unsupported any longer.
2255 Keep the function field for binary compability.
2257 @param[in, out] Arc4Context Pointer to the ARC4 context.
2259 @retval FALSE This interface is not supported.
2264 DeprecatedCryptoServiceArc4Reset (
2265 IN OUT VOID
*Arc4Context
2268 return BaseCryptLibServiceDeprecated ("Arc4Reset"), FALSE
;
2271 //=====================================================================================
2272 // Asymmetric Cryptography Primitive
2273 //=====================================================================================
2276 Allocates and initializes one RSA context for subsequent use.
2278 @return Pointer to the RSA context that has been initialized.
2279 If the allocations fails, RsaNew() returns NULL.
2284 CryptoServiceRsaNew (
2288 return CALL_BASECRYPTLIB (Rsa
.Services
.New
, RsaNew
, (), NULL
);
2292 Release the specified RSA context.
2294 If RsaContext is NULL, then return FALSE.
2296 @param[in] RsaContext Pointer to the RSA context to be released.
2301 CryptoServiceRsaFree (
2305 CALL_VOID_BASECRYPTLIB (Rsa
.Services
.Free
, RsaFree
, (RsaContext
));
2309 Sets the tag-designated key component into the established RSA context.
2311 This function sets the tag-designated RSA key component into the established
2312 RSA context from the user-specified non-negative integer (octet string format
2313 represented in RSA PKCS#1).
2314 If BigNumber is NULL, then the specified key component in RSA context is cleared.
2316 If RsaContext is NULL, then return FALSE.
2318 @param[in, out] RsaContext Pointer to RSA context being set.
2319 @param[in] KeyTag Tag of RSA key component being set.
2320 @param[in] BigNumber Pointer to octet integer buffer.
2321 If NULL, then the specified key component in RSA
2323 @param[in] BnSize Size of big number buffer in bytes.
2324 If BigNumber is NULL, then it is ignored.
2326 @retval TRUE RSA key component was set successfully.
2327 @retval FALSE Invalid RSA key component tag.
2332 CryptoServiceRsaSetKey (
2333 IN OUT VOID
*RsaContext
,
2334 IN RSA_KEY_TAG KeyTag
,
2335 IN CONST UINT8
*BigNumber
,
2339 return CALL_BASECRYPTLIB (Rsa
.Services
.SetKey
, RsaSetKey
, (RsaContext
, KeyTag
, BigNumber
, BnSize
), FALSE
);
2343 Gets the tag-designated RSA key component from the established RSA context.
2345 This function retrieves the tag-designated RSA key component from the
2346 established RSA context as a non-negative integer (octet string format
2347 represented in RSA PKCS#1).
2348 If specified key component has not been set or has been cleared, then returned
2350 If the BigNumber buffer is too small to hold the contents of the key, FALSE
2351 is returned and BnSize is set to the required buffer size to obtain the key.
2353 If RsaContext is NULL, then return FALSE.
2354 If BnSize is NULL, then return FALSE.
2355 If BnSize is large enough but BigNumber is NULL, then return FALSE.
2356 If this interface is not supported, then return FALSE.
2358 @param[in, out] RsaContext Pointer to RSA context being set.
2359 @param[in] KeyTag Tag of RSA key component being set.
2360 @param[out] BigNumber Pointer to octet integer buffer.
2361 @param[in, out] BnSize On input, the size of big number buffer in bytes.
2362 On output, the size of data returned in big number buffer in bytes.
2364 @retval TRUE RSA key component was retrieved successfully.
2365 @retval FALSE Invalid RSA key component tag.
2366 @retval FALSE BnSize is too small.
2367 @retval FALSE This interface is not supported.
2372 CryptoServiceRsaGetKey (
2373 IN OUT VOID
*RsaContext
,
2374 IN RSA_KEY_TAG KeyTag
,
2375 OUT UINT8
*BigNumber
,
2376 IN OUT UINTN
*BnSize
2379 return CALL_BASECRYPTLIB (Rsa
.Services
.GetKey
, RsaGetKey
, (RsaContext
, KeyTag
, BigNumber
, BnSize
), FALSE
);
2383 Generates RSA key components.
2385 This function generates RSA key components. It takes RSA public exponent E and
2386 length in bits of RSA modulus N as input, and generates all key components.
2387 If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used.
2389 Before this function can be invoked, pseudorandom number generator must be correctly
2390 initialized by RandomSeed().
2392 If RsaContext is NULL, then return FALSE.
2393 If this interface is not supported, then return FALSE.
2395 @param[in, out] RsaContext Pointer to RSA context being set.
2396 @param[in] ModulusLength Length of RSA modulus N in bits.
2397 @param[in] PublicExponent Pointer to RSA public exponent.
2398 @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes.
2400 @retval TRUE RSA key component was generated successfully.
2401 @retval FALSE Invalid RSA key component tag.
2402 @retval FALSE This interface is not supported.
2407 CryptoServiceRsaGenerateKey (
2408 IN OUT VOID
*RsaContext
,
2409 IN UINTN ModulusLength
,
2410 IN CONST UINT8
*PublicExponent
,
2411 IN UINTN PublicExponentSize
2414 return CALL_BASECRYPTLIB (Rsa
.Services
.GenerateKey
, RsaGenerateKey
, (RsaContext
, ModulusLength
, PublicExponent
, PublicExponentSize
), FALSE
);
2418 Validates key components of RSA context.
2419 NOTE: This function performs integrity checks on all the RSA key material, so
2420 the RSA key structure must contain all the private key data.
2422 This function validates key components of RSA context in following aspects:
2423 - Whether p is a prime
2424 - Whether q is a prime
2426 - Whether d*e = 1 mod lcm(p-1,q-1)
2428 If RsaContext is NULL, then return FALSE.
2429 If this interface is not supported, then return FALSE.
2431 @param[in] RsaContext Pointer to RSA context to check.
2433 @retval TRUE RSA key components are valid.
2434 @retval FALSE RSA key components are not valid.
2435 @retval FALSE This interface is not supported.
2440 CryptoServiceRsaCheckKey (
2444 return CALL_BASECRYPTLIB (Rsa
.Services
.CheckKey
, RsaCheckKey
, (RsaContext
), FALSE
);
2448 Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.
2450 This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in
2452 If the Signature buffer is too small to hold the contents of signature, FALSE
2453 is returned and SigSize is set to the required buffer size to obtain the signature.
2455 If RsaContext is NULL, then return FALSE.
2456 If MessageHash is NULL, then return FALSE.
2457 If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.
2458 If SigSize is large enough but Signature is NULL, then return FALSE.
2459 If this interface is not supported, then return FALSE.
2461 @param[in] RsaContext Pointer to RSA context for signature generation.
2462 @param[in] MessageHash Pointer to octet message hash to be signed.
2463 @param[in] HashSize Size of the message hash in bytes.
2464 @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature.
2465 @param[in, out] SigSize On input, the size of Signature buffer in bytes.
2466 On output, the size of data returned in Signature buffer in bytes.
2468 @retval TRUE Signature successfully generated in PKCS1-v1_5.
2469 @retval FALSE Signature generation failed.
2470 @retval FALSE SigSize is too small.
2471 @retval FALSE This interface is not supported.
2476 CryptoServiceRsaPkcs1Sign (
2477 IN VOID
*RsaContext
,
2478 IN CONST UINT8
*MessageHash
,
2480 OUT UINT8
*Signature
,
2481 IN OUT UINTN
*SigSize
2484 return CALL_BASECRYPTLIB (Rsa
.Services
.Pkcs1Sign
, RsaPkcs1Sign
, (RsaContext
, MessageHash
, HashSize
, Signature
, SigSize
), FALSE
);
2488 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
2491 If RsaContext is NULL, then return FALSE.
2492 If MessageHash is NULL, then return FALSE.
2493 If Signature is NULL, then return FALSE.
2494 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
2496 @param[in] RsaContext Pointer to RSA context for signature verification.
2497 @param[in] MessageHash Pointer to octet message hash to be checked.
2498 @param[in] HashSize Size of the message hash in bytes.
2499 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
2500 @param[in] SigSize Size of signature in bytes.
2502 @retval TRUE Valid signature encoded in PKCS1-v1_5.
2503 @retval FALSE Invalid signature or invalid RSA context.
2508 CryptoServiceRsaPkcs1Verify (
2509 IN VOID
*RsaContext
,
2510 IN CONST UINT8
*MessageHash
,
2512 IN CONST UINT8
*Signature
,
2516 return CALL_BASECRYPTLIB (Rsa
.Services
.Pkcs1Verify
, RsaPkcs1Verify
, (RsaContext
, MessageHash
, HashSize
, Signature
, SigSize
), FALSE
);
2520 Retrieve the RSA Private Key from the password-protected PEM key data.
2522 If PemData is NULL, then return FALSE.
2523 If RsaContext is NULL, then return FALSE.
2524 If this interface is not supported, then return FALSE.
2526 @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.
2527 @param[in] PemSize Size of the PEM key data in bytes.
2528 @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.
2529 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
2530 RSA private key component. Use RsaFree() function to free the
2533 @retval TRUE RSA Private Key was retrieved successfully.
2534 @retval FALSE Invalid PEM key data or incorrect password.
2535 @retval FALSE This interface is not supported.
2540 CryptoServiceRsaGetPrivateKeyFromPem (
2541 IN CONST UINT8
*PemData
,
2543 IN CONST CHAR8
*Password
,
2544 OUT VOID
**RsaContext
2547 return CALL_BASECRYPTLIB (Rsa
.Services
.GetPrivateKeyFromPem
, RsaGetPrivateKeyFromPem
, (PemData
, PemSize
, Password
, RsaContext
), FALSE
);
2551 Retrieve the RSA Public Key from one DER-encoded X509 certificate.
2553 If Cert is NULL, then return FALSE.
2554 If RsaContext is NULL, then return FALSE.
2555 If this interface is not supported, then return FALSE.
2557 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2558 @param[in] CertSize Size of the X509 certificate in bytes.
2559 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
2560 RSA public key component. Use RsaFree() function to free the
2563 @retval TRUE RSA Public Key was retrieved successfully.
2564 @retval FALSE Fail to retrieve RSA public key from X509 certificate.
2565 @retval FALSE This interface is not supported.
2570 CryptoServiceRsaGetPublicKeyFromX509 (
2571 IN CONST UINT8
*Cert
,
2573 OUT VOID
**RsaContext
2576 return CALL_BASECRYPTLIB (Rsa
.Services
.GetPublicKeyFromX509
, RsaGetPublicKeyFromX509
, (Cert
, CertSize
, RsaContext
), FALSE
);
2580 Retrieve the subject bytes from one X.509 certificate.
2582 If Cert is NULL, then return FALSE.
2583 If SubjectSize is NULL, then return FALSE.
2584 If this interface is not supported, then return FALSE.
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] CertSubject Pointer to the retrieved certificate subject bytes.
2589 @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,
2590 and the size of buffer returned CertSubject on output.
2592 @retval TRUE The certificate subject retrieved successfully.
2593 @retval FALSE Invalid certificate, or the SubjectSize is too small for the result.
2594 The SubjectSize will be updated with the required size.
2595 @retval FALSE This interface is not supported.
2600 CryptoServiceX509GetSubjectName (
2601 IN CONST UINT8
*Cert
,
2603 OUT UINT8
*CertSubject
,
2604 IN OUT UINTN
*SubjectSize
2607 return CALL_BASECRYPTLIB (X509
.Services
.GetSubjectName
, X509GetSubjectName
, (Cert
, CertSize
, CertSubject
, SubjectSize
), FALSE
);
2611 Retrieve the common name (CN) string from one X.509 certificate.
2613 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2614 @param[in] CertSize Size of the X509 certificate in bytes.
2615 @param[out] CommonName Buffer to contain the retrieved certificate common
2616 name string (UTF8). At most CommonNameSize bytes will be
2617 written and the string will be null terminated. May be
2618 NULL in order to determine the size buffer needed.
2619 @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,
2620 and the size of buffer returned CommonName on output.
2621 If CommonName is NULL then the amount of space needed
2622 in buffer (including the final null) is returned.
2624 @retval RETURN_SUCCESS The certificate CommonName retrieved successfully.
2625 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
2626 If CommonNameSize is NULL.
2627 If CommonName is not NULL and *CommonNameSize is 0.
2628 If Certificate is invalid.
2629 @retval RETURN_NOT_FOUND If no CommonName entry exists.
2630 @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size
2631 (including the final null) is returned in the
2632 CommonNameSize parameter.
2633 @retval RETURN_UNSUPPORTED The operation is not supported.
2638 CryptoServiceX509GetCommonName (
2639 IN CONST UINT8
*Cert
,
2641 OUT CHAR8
*CommonName
, OPTIONAL
2642 IN OUT UINTN
*CommonNameSize
2645 return CALL_BASECRYPTLIB (X509
.Services
.GetCommonName
, X509GetCommonName
, (Cert
, CertSize
, CommonName
, CommonNameSize
), RETURN_UNSUPPORTED
);
2649 Retrieve the organization name (O) string from one X.509 certificate.
2651 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2652 @param[in] CertSize Size of the X509 certificate in bytes.
2653 @param[out] NameBuffer Buffer to contain the retrieved certificate organization
2654 name string. At most NameBufferSize bytes will be
2655 written and the string will be null terminated. May be
2656 NULL in order to determine the size buffer needed.
2657 @param[in,out] NameBufferSize The size in bytes of the Name buffer on input,
2658 and the size of buffer returned Name on output.
2659 If NameBuffer is NULL then the amount of space needed
2660 in buffer (including the final null) is returned.
2662 @retval RETURN_SUCCESS The certificate Organization Name retrieved successfully.
2663 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
2664 If NameBufferSize is NULL.
2665 If NameBuffer is not NULL and *CommonNameSize is 0.
2666 If Certificate is invalid.
2667 @retval RETURN_NOT_FOUND If no Organization Name entry exists.
2668 @retval RETURN_BUFFER_TOO_SMALL If the NameBuffer is NULL. The required buffer size
2669 (including the final null) is returned in the
2670 CommonNameSize parameter.
2671 @retval RETURN_UNSUPPORTED The operation is not supported.
2676 CryptoServiceX509GetOrganizationName (
2677 IN CONST UINT8
*Cert
,
2679 OUT CHAR8
*NameBuffer
, OPTIONAL
2680 IN OUT UINTN
*NameBufferSize
2683 return CALL_BASECRYPTLIB (X509
.Services
.GetOrganizationName
, X509GetOrganizationName
, (Cert
, CertSize
, NameBuffer
, NameBufferSize
), RETURN_UNSUPPORTED
);
2687 Verify one X509 certificate was issued by the trusted CA.
2689 If Cert is NULL, then return FALSE.
2690 If CACert is NULL, then return FALSE.
2691 If this interface is not supported, then return FALSE.
2693 @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.
2694 @param[in] CertSize Size of the X509 certificate in bytes.
2695 @param[in] CACert Pointer to the DER-encoded trusted CA certificate.
2696 @param[in] CACertSize Size of the CA Certificate in bytes.
2698 @retval TRUE The certificate was issued by the trusted CA.
2699 @retval FALSE Invalid certificate or the certificate was not issued by the given
2701 @retval FALSE This interface is not supported.
2706 CryptoServiceX509VerifyCert (
2707 IN CONST UINT8
*Cert
,
2709 IN CONST UINT8
*CACert
,
2713 return CALL_BASECRYPTLIB (X509
.Services
.VerifyCert
, X509VerifyCert
, (Cert
, CertSize
, CACert
, CACertSize
), FALSE
);
2717 Construct a X509 object from DER-encoded certificate data.
2719 If Cert is NULL, then return FALSE.
2720 If SingleX509Cert is NULL, then return FALSE.
2721 If this interface is not supported, then return FALSE.
2723 @param[in] Cert Pointer to the DER-encoded certificate data.
2724 @param[in] CertSize The size of certificate data in bytes.
2725 @param[out] SingleX509Cert The generated X509 object.
2727 @retval TRUE The X509 object generation succeeded.
2728 @retval FALSE The operation failed.
2729 @retval FALSE This interface is not supported.
2734 CryptoServiceX509ConstructCertificate (
2735 IN CONST UINT8
*Cert
,
2737 OUT UINT8
**SingleX509Cert
2740 return CALL_BASECRYPTLIB (X509
.Services
.ConstructCertificate
, X509ConstructCertificate
, (Cert
, CertSize
, SingleX509Cert
), FALSE
);
2744 Construct a X509 stack object from a list of DER-encoded certificate data.
2746 If X509Stack is NULL, then return FALSE.
2747 If this interface is not supported, then return FALSE.
2749 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2750 On output, pointer to the X509 stack object with new
2751 inserted X509 certificate.
2752 @param[in] Args VA_LIST marker for the variable argument list.
2753 A list of DER-encoded single certificate data followed
2754 by certificate size. A NULL terminates the list. The
2755 pairs are the arguments to X509ConstructCertificate().
2757 @retval TRUE The X509 stack construction succeeded.
2758 @retval FALSE The construction operation failed.
2759 @retval FALSE This interface is not supported.
2764 CryptoServiceX509ConstructCertificateStackV (
2765 IN OUT UINT8
**X509Stack
,
2769 return CALL_BASECRYPTLIB (X509
.Services
.ConstructCertificateStackV
, X509ConstructCertificateStackV
, (X509Stack
, Args
), FALSE
);
2773 Construct a X509 stack object from a list of DER-encoded certificate data.
2775 If X509Stack is NULL, then return FALSE.
2776 If this interface is not supported, then return FALSE.
2778 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2779 On output, pointer to the X509 stack object with new
2780 inserted X509 certificate.
2781 @param ... A list of DER-encoded single certificate data followed
2782 by certificate size. A NULL terminates the list. The
2783 pairs are the arguments to X509ConstructCertificate().
2785 @retval TRUE The X509 stack construction succeeded.
2786 @retval FALSE The construction operation failed.
2787 @retval FALSE This interface is not supported.
2792 CryptoServiceX509ConstructCertificateStack (
2793 IN OUT UINT8
**X509Stack
,
2800 VA_START (Args
, X509Stack
);
2801 Result
= CryptoServiceX509ConstructCertificateStackV (X509Stack
, Args
);
2807 Release the specified X509 object.
2809 If the interface is not supported, then ASSERT().
2811 @param[in] X509Cert Pointer to the X509 object to be released.
2816 CryptoServiceX509Free (
2820 CALL_VOID_BASECRYPTLIB (X509
.Services
.Free
, X509Free
, (X509Cert
));
2824 Release the specified X509 stack object.
2826 If the interface is not supported, then ASSERT().
2828 @param[in] X509Stack Pointer to the X509 stack object to be released.
2833 CryptoServiceX509StackFree (
2837 CALL_VOID_BASECRYPTLIB (X509
.Services
.StackFree
, X509StackFree
, (X509Stack
));
2841 Retrieve the TBSCertificate from one given X.509 certificate.
2843 @param[in] Cert Pointer to the given DER-encoded X509 certificate.
2844 @param[in] CertSize Size of the X509 certificate in bytes.
2845 @param[out] TBSCert DER-Encoded To-Be-Signed certificate.
2846 @param[out] TBSCertSize Size of the TBS certificate in bytes.
2848 If Cert is NULL, then return FALSE.
2849 If TBSCert is NULL, then return FALSE.
2850 If TBSCertSize is NULL, then return FALSE.
2851 If this interface is not supported, then return FALSE.
2853 @retval TRUE The TBSCertificate was retrieved successfully.
2854 @retval FALSE Invalid X.509 certificate.
2859 CryptoServiceX509GetTBSCert (
2860 IN CONST UINT8
*Cert
,
2862 OUT UINT8
**TBSCert
,
2863 OUT UINTN
*TBSCertSize
2866 return CALL_BASECRYPTLIB (X509
.Services
.GetTBSCert
, X509GetTBSCert
, (Cert
, CertSize
, TBSCert
, TBSCertSize
), FALSE
);
2870 Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0
2871 password based encryption key derivation function PBKDF2, as specified in RFC 2898.
2873 If Password or Salt or OutKey is NULL, then return FALSE.
2874 If the hash algorithm could not be determined, then return FALSE.
2875 If this interface is not supported, then return FALSE.
2877 @param[in] PasswordLength Length of input password in bytes.
2878 @param[in] Password Pointer to the array for the password.
2879 @param[in] SaltLength Size of the Salt in bytes.
2880 @param[in] Salt Pointer to the Salt.
2881 @param[in] IterationCount Number of iterations to perform. Its value should be
2882 greater than or equal to 1.
2883 @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).
2884 NOTE: DigestSize will be used to determine the hash algorithm.
2885 Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.
2886 @param[in] KeyLength Size of the derived key buffer in bytes.
2887 @param[out] OutKey Pointer to the output derived key buffer.
2889 @retval TRUE A key was derived successfully.
2890 @retval FALSE One of the pointers was NULL or one of the sizes was too large.
2891 @retval FALSE The hash algorithm could not be determined from the digest size.
2892 @retval FALSE The key derivation operation failed.
2893 @retval FALSE This interface is not supported.
2898 CryptoServicePkcs5HashPassword (
2899 IN UINTN PasswordLength
,
2900 IN CONST CHAR8
*Password
,
2901 IN UINTN SaltLength
,
2902 IN CONST UINT8
*Salt
,
2903 IN UINTN IterationCount
,
2904 IN UINTN DigestSize
,
2909 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs5HashPassword
, Pkcs5HashPassword
, (PasswordLength
, Password
, SaltLength
, Salt
, IterationCount
, DigestSize
, KeyLength
, OutKey
), FALSE
);
2913 Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
2914 encrypted message in a newly allocated buffer.
2916 Things that can cause a failure include:
2917 - X509 key size does not match any known key size.
2918 - Fail to parse X509 certificate.
2919 - Fail to allocate an intermediate buffer.
2920 - Null pointer provided for a non-optional parameter.
2921 - Data size is too large for the provided key size (max size is a function of key size
2922 and hash digest size).
2924 @param[in] PublicKey A pointer to the DER-encoded X509 certificate that
2925 will be used to encrypt the data.
2926 @param[in] PublicKeySize Size of the X509 cert buffer.
2927 @param[in] InData Data to be encrypted.
2928 @param[in] InDataSize Size of the data buffer.
2929 @param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
2930 to be used when initializing the PRNG. NULL otherwise.
2931 @param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
2933 @param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
2935 @param[out] EncryptedDataSize Size of the encrypted message buffer.
2937 @retval TRUE Encryption was successful.
2938 @retval FALSE Encryption failed.
2943 CryptoServicePkcs1v2Encrypt (
2944 IN CONST UINT8
*PublicKey
,
2945 IN UINTN PublicKeySize
,
2947 IN UINTN InDataSize
,
2948 IN CONST UINT8
*PrngSeed
, OPTIONAL
2949 IN UINTN PrngSeedSize
, OPTIONAL
2950 OUT UINT8
**EncryptedData
,
2951 OUT UINTN
*EncryptedDataSize
2954 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs1v2Encrypt
, Pkcs1v2Encrypt
, (PublicKey
, PublicKeySize
, InData
, InDataSize
, PrngSeed
, PrngSeedSize
, EncryptedData
, EncryptedDataSize
), FALSE
);
2958 Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
2959 Cryptographic Message Syntax Standard". The input signed data could be wrapped
2960 in a ContentInfo structure.
2962 If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then
2963 return FALSE. If P7Length overflow, then return FALSE.
2964 If this interface is not supported, then return FALSE.
2966 @param[in] P7Data Pointer to the PKCS#7 message to verify.
2967 @param[in] P7Length Length of the PKCS#7 message in bytes.
2968 @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
2969 It's caller's responsibility to free the buffer with
2971 This data structure is EFI_CERT_STACK type.
2972 @param[out] StackLength Length of signer's certificates in bytes.
2973 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
2974 It's caller's responsibility to free the buffer with
2976 @param[out] CertLength Length of the trusted certificate in bytes.
2978 @retval TRUE The operation is finished successfully.
2979 @retval FALSE Error occurs during the operation.
2980 @retval FALSE This interface is not supported.
2985 CryptoServicePkcs7GetSigners (
2986 IN CONST UINT8
*P7Data
,
2988 OUT UINT8
**CertStack
,
2989 OUT UINTN
*StackLength
,
2990 OUT UINT8
**TrustedCert
,
2991 OUT UINTN
*CertLength
2994 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7GetSigners
, Pkcs7GetSigners
, (P7Data
, P7Length
, CertStack
, StackLength
, TrustedCert
, CertLength
), FALSE
);
2998 Wrap function to use free() to free allocated memory for certificates.
3000 If this interface is not supported, then ASSERT().
3002 @param[in] Certs Pointer to the certificates to be freed.
3007 CryptoServicePkcs7FreeSigners (
3011 CALL_VOID_BASECRYPTLIB (Pkcs
.Services
.Pkcs7FreeSigners
, Pkcs7FreeSigners
, (Certs
));
3015 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
3016 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
3017 unchained to the signer's certificates.
3018 The input signed data could be wrapped in a ContentInfo structure.
3020 @param[in] P7Data Pointer to the PKCS#7 message.
3021 @param[in] P7Length Length of the PKCS#7 message in bytes.
3022 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
3023 certificate. It's caller's responsibility to free the buffer
3024 with Pkcs7FreeSigners().
3025 This data structure is EFI_CERT_STACK type.
3026 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
3027 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
3028 responsibility to free the buffer with Pkcs7FreeSigners().
3029 This data structure is EFI_CERT_STACK type.
3030 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
3032 @retval TRUE The operation is finished successfully.
3033 @retval FALSE Error occurs during the operation.
3038 CryptoServicePkcs7GetCertificatesList (
3039 IN CONST UINT8
*P7Data
,
3041 OUT UINT8
**SignerChainCerts
,
3042 OUT UINTN
*ChainLength
,
3043 OUT UINT8
**UnchainCerts
,
3044 OUT UINTN
*UnchainLength
3047 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7GetCertificatesList
, Pkcs7GetCertificatesList
, (P7Data
, P7Length
, SignerChainCerts
, ChainLength
, UnchainCerts
, UnchainLength
), FALSE
);
3051 Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
3052 Syntax Standard, version 1.5". This interface is only intended to be used for
3053 application to perform PKCS#7 functionality validation.
3055 If this interface is not supported, then return FALSE.
3057 @param[in] PrivateKey Pointer to the PEM-formatted private key data for
3059 @param[in] PrivateKeySize Size of the PEM private key data in bytes.
3060 @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
3062 @param[in] InData Pointer to the content to be signed.
3063 @param[in] InDataSize Size of InData in bytes.
3064 @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
3065 @param[in] OtherCerts Pointer to an optional additional set of certificates to
3066 include in the PKCS#7 signedData (e.g. any intermediate
3068 @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's
3069 responsibility to free the buffer with FreePool().
3070 @param[out] SignedDataSize Size of SignedData in bytes.
3072 @retval TRUE PKCS#7 data signing succeeded.
3073 @retval FALSE PKCS#7 data signing failed.
3074 @retval FALSE This interface is not supported.
3079 CryptoServicePkcs7Sign (
3080 IN CONST UINT8
*PrivateKey
,
3081 IN UINTN PrivateKeySize
,
3082 IN CONST UINT8
*KeyPassword
,
3084 IN UINTN InDataSize
,
3086 IN UINT8
*OtherCerts OPTIONAL
,
3087 OUT UINT8
**SignedData
,
3088 OUT UINTN
*SignedDataSize
3091 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7Sign
, Pkcs7Sign
, (PrivateKey
, PrivateKeySize
, KeyPassword
, InData
, InDataSize
, SignCert
, OtherCerts
, SignedData
, SignedDataSize
), FALSE
);
3095 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
3096 Cryptographic Message Syntax Standard". The input signed data could be wrapped
3097 in a ContentInfo structure.
3099 If P7Data, TrustedCert or InData is NULL, then return FALSE.
3100 If P7Length, CertLength or DataLength overflow, then return FALSE.
3101 If this interface is not supported, then return FALSE.
3103 @param[in] P7Data Pointer to the PKCS#7 message to verify.
3104 @param[in] P7Length Length of the PKCS#7 message in bytes.
3105 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
3106 is used for certificate chain verification.
3107 @param[in] CertLength Length of the trusted certificate in bytes.
3108 @param[in] InData Pointer to the content to be verified.
3109 @param[in] DataLength Length of InData in bytes.
3111 @retval TRUE The specified PKCS#7 signed data is valid.
3112 @retval FALSE Invalid PKCS#7 signed data.
3113 @retval FALSE This interface is not supported.
3118 CryptoServicePkcs7Verify (
3119 IN CONST UINT8
*P7Data
,
3121 IN CONST UINT8
*TrustedCert
,
3122 IN UINTN CertLength
,
3123 IN CONST UINT8
*InData
,
3127 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7Verify
, Pkcs7Verify
, (P7Data
, P7Length
, TrustedCert
, CertLength
, InData
, DataLength
), FALSE
);
3131 This function receives a PKCS7 formatted signature, and then verifies that
3132 the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity
3133 leaf signing certificate.
3134 Note that this function does not validate the certificate chain.
3136 Applications for custom EKU's are quite flexible. For example, a policy EKU
3137 may be present in an Issuing Certificate Authority (CA), and any sub-ordinate
3138 certificate issued might also contain this EKU, thus constraining the
3139 sub-ordinate certificate. Other applications might allow a certificate
3140 embedded in a device to specify that other Object Identifiers (OIDs) are
3141 present which contains binary data specifying custom capabilities that
3142 the device is able to do.
3144 @param[in] Pkcs7Signature The PKCS#7 signed information content block. An array
3145 containing the content block with both the signature,
3146 the signer's certificate, and any necessary intermediate
3148 @param[in] Pkcs7SignatureSize Number of bytes in Pkcs7Signature.
3149 @param[in] RequiredEKUs Array of null-terminated strings listing OIDs of
3150 required EKUs that must be present in the signature.
3151 @param[in] RequiredEKUsSize Number of elements in the RequiredEKUs string array.
3152 @param[in] RequireAllPresent If this is TRUE, then all of the specified EKU's
3153 must be present in the leaf signer. If it is
3154 FALSE, then we will succeed if we find any
3155 of the specified EKU's.
3157 @retval EFI_SUCCESS The required EKUs were found in the signature.
3158 @retval EFI_INVALID_PARAMETER A parameter was invalid.
3159 @retval EFI_NOT_FOUND One or more EKU's were not found in the signature.
3164 CryptoServiceVerifyEKUsInPkcs7Signature (
3165 IN CONST UINT8
*Pkcs7Signature
,
3166 IN CONST UINT32 SignatureSize
,
3167 IN CONST CHAR8
*RequiredEKUs
[],
3168 IN CONST UINT32 RequiredEKUsSize
,
3169 IN BOOLEAN RequireAllPresent
3172 return CALL_BASECRYPTLIB (Pkcs
.Services
.VerifyEKUsInPkcs7Signature
, VerifyEKUsInPkcs7Signature
, (Pkcs7Signature
, SignatureSize
, RequiredEKUs
, RequiredEKUsSize
, RequireAllPresent
), FALSE
);
3177 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
3178 data could be wrapped in a ContentInfo structure.
3180 If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow,
3181 then return FALSE. If the P7Data is not correctly formatted, then return FALSE.
3183 Caution: This function may receive untrusted input. So this function will do
3184 basic check for PKCS#7 data structure.
3186 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
3187 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
3188 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
3189 It's caller's responsibility to free the buffer with FreePool().
3190 @param[out] ContentSize The size of the extracted content in bytes.
3192 @retval TRUE The P7Data was correctly formatted for processing.
3193 @retval FALSE The P7Data was not correctly formatted for processing.
3198 CryptoServicePkcs7GetAttachedContent (
3199 IN CONST UINT8
*P7Data
,
3202 OUT UINTN
*ContentSize
3205 return CALL_BASECRYPTLIB (Pkcs
.Services
.Pkcs7GetAttachedContent
, Pkcs7GetAttachedContent
, (P7Data
, P7Length
, Content
, ContentSize
), FALSE
);
3209 Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows
3210 Authenticode Portable Executable Signature Format".
3212 If AuthData is NULL, then return FALSE.
3213 If ImageHash is NULL, then return FALSE.
3214 If this interface is not supported, then return FALSE.
3216 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
3217 PE/COFF image to be verified.
3218 @param[in] DataSize Size of the Authenticode Signature in bytes.
3219 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
3220 is used for certificate chain verification.
3221 @param[in] CertSize Size of the trusted certificate in bytes.
3222 @param[in] ImageHash Pointer to the original image file hash value. The procedure
3223 for calculating the image hash value is described in Authenticode
3225 @param[in] HashSize Size of Image hash value in bytes.
3227 @retval TRUE The specified Authenticode Signature is valid.
3228 @retval FALSE Invalid Authenticode Signature.
3229 @retval FALSE This interface is not supported.
3234 CryptoServiceAuthenticodeVerify (
3235 IN CONST UINT8
*AuthData
,
3237 IN CONST UINT8
*TrustedCert
,
3239 IN CONST UINT8
*ImageHash
,
3243 return CALL_BASECRYPTLIB (Pkcs
.Services
.AuthenticodeVerify
, AuthenticodeVerify
, (AuthData
, DataSize
, TrustedCert
, CertSize
, ImageHash
, HashSize
), FALSE
);
3247 Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode
3250 If AuthData is NULL, then return FALSE.
3251 If this interface is not supported, then return FALSE.
3253 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
3254 PE/COFF image to be verified.
3255 @param[in] DataSize Size of the Authenticode Signature in bytes.
3256 @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which
3257 is used for TSA certificate chain verification.
3258 @param[in] CertSize Size of the trusted certificate in bytes.
3259 @param[out] SigningTime Return the time of timestamp generation time if the timestamp
3262 @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.
3263 @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.
3268 CryptoServiceImageTimestampVerify (
3269 IN CONST UINT8
*AuthData
,
3271 IN CONST UINT8
*TsaCert
,
3273 OUT EFI_TIME
*SigningTime
3276 return CALL_BASECRYPTLIB (Pkcs
.Services
.ImageTimestampVerify
, ImageTimestampVerify
, (AuthData
, DataSize
, TsaCert
, CertSize
, SigningTime
), FALSE
);
3279 //=====================================================================================
3280 // DH Key Exchange Primitive
3281 //=====================================================================================
3284 Allocates and Initializes one Diffie-Hellman Context for subsequent use.
3286 @return Pointer to the Diffie-Hellman Context that has been initialized.
3287 If the allocations fails, DhNew() returns NULL.
3288 If the interface is not supported, DhNew() returns NULL.
3293 CryptoServiceDhNew (
3297 return CALL_BASECRYPTLIB (Dh
.Services
.New
, DhNew
, (), NULL
);
3301 Release the specified DH context.
3303 If the interface is not supported, then ASSERT().
3305 @param[in] DhContext Pointer to the DH context to be released.
3310 CryptoServiceDhFree (
3314 CALL_VOID_BASECRYPTLIB (Dh
.Services
.Free
, DhFree
, (DhContext
));
3318 Generates DH parameter.
3320 Given generator g, and length of prime number p in bits, this function generates p,
3321 and sets DH context according to value of g and p.
3323 Before this function can be invoked, pseudorandom number generator must be correctly
3324 initialized by RandomSeed().
3326 If DhContext is NULL, then return FALSE.
3327 If Prime is NULL, then return FALSE.
3328 If this interface is not supported, then return FALSE.
3330 @param[in, out] DhContext Pointer to the DH context.
3331 @param[in] Generator Value of generator.
3332 @param[in] PrimeLength Length in bits of prime to be generated.
3333 @param[out] Prime Pointer to the buffer to receive the generated prime number.
3335 @retval TRUE DH parameter generation succeeded.
3336 @retval FALSE Value of Generator is not supported.
3337 @retval FALSE PRNG fails to generate random prime number with PrimeLength.
3338 @retval FALSE This interface is not supported.
3343 CryptoServiceDhGenerateParameter (
3344 IN OUT VOID
*DhContext
,
3346 IN UINTN PrimeLength
,
3350 return CALL_BASECRYPTLIB (Dh
.Services
.GenerateParameter
, DhGenerateParameter
, (DhContext
, Generator
, PrimeLength
, Prime
), FALSE
);
3354 Sets generator and prime parameters for DH.
3356 Given generator g, and prime number p, this function and sets DH
3357 context accordingly.
3359 If DhContext is NULL, then return FALSE.
3360 If Prime is NULL, then return FALSE.
3361 If this interface is not supported, then return FALSE.
3363 @param[in, out] DhContext Pointer to the DH context.
3364 @param[in] Generator Value of generator.
3365 @param[in] PrimeLength Length in bits of prime to be generated.
3366 @param[in] Prime Pointer to the prime number.
3368 @retval TRUE DH parameter setting succeeded.
3369 @retval FALSE Value of Generator is not supported.
3370 @retval FALSE Value of Generator is not suitable for the Prime.
3371 @retval FALSE Value of Prime is not a prime number.
3372 @retval FALSE Value of Prime is not a safe prime number.
3373 @retval FALSE This interface is not supported.
3378 CryptoServiceDhSetParameter (
3379 IN OUT VOID
*DhContext
,
3381 IN UINTN PrimeLength
,
3382 IN CONST UINT8
*Prime
3385 return CALL_BASECRYPTLIB (Dh
.Services
.SetParameter
, DhSetParameter
, (DhContext
, Generator
, PrimeLength
, Prime
), FALSE
);
3389 Generates DH public key.
3391 This function generates random secret exponent, and computes the public key, which is
3392 returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.
3393 If the PublicKey buffer is too small to hold the public key, FALSE is returned and
3394 PublicKeySize is set to the required buffer size to obtain the public key.
3396 If DhContext is NULL, then return FALSE.
3397 If PublicKeySize is NULL, then return FALSE.
3398 If PublicKeySize is large enough but PublicKey is NULL, then return FALSE.
3399 If this interface is not supported, then return FALSE.
3401 @param[in, out] DhContext Pointer to the DH context.
3402 @param[out] PublicKey Pointer to the buffer to receive generated public key.
3403 @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.
3404 On output, the size of data returned in PublicKey buffer in bytes.
3406 @retval TRUE DH public key generation succeeded.
3407 @retval FALSE DH public key generation failed.
3408 @retval FALSE PublicKeySize is not large enough.
3409 @retval FALSE This interface is not supported.
3414 CryptoServiceDhGenerateKey (
3415 IN OUT VOID
*DhContext
,
3416 OUT UINT8
*PublicKey
,
3417 IN OUT UINTN
*PublicKeySize
3420 return CALL_BASECRYPTLIB (Dh
.Services
.GenerateKey
, DhGenerateKey
, (DhContext
, PublicKey
, PublicKeySize
), FALSE
);
3424 Computes exchanged common key.
3426 Given peer's public key, this function computes the exchanged common key, based on its own
3427 context including value of prime modulus and random secret exponent.
3429 If DhContext is NULL, then return FALSE.
3430 If PeerPublicKey is NULL, then return FALSE.
3431 If KeySize is NULL, then return FALSE.
3432 If Key is NULL, then return FALSE.
3433 If KeySize is not large enough, then return FALSE.
3434 If this interface is not supported, then return FALSE.
3436 @param[in, out] DhContext Pointer to the DH context.
3437 @param[in] PeerPublicKey Pointer to the peer's public key.
3438 @param[in] PeerPublicKeySize Size of peer's public key in bytes.
3439 @param[out] Key Pointer to the buffer to receive generated key.
3440 @param[in, out] KeySize On input, the size of Key buffer in bytes.
3441 On output, the size of data returned in Key buffer in bytes.
3443 @retval TRUE DH exchanged key generation succeeded.
3444 @retval FALSE DH exchanged key generation failed.
3445 @retval FALSE KeySize is not large enough.
3446 @retval FALSE This interface is not supported.
3451 CryptoServiceDhComputeKey (
3452 IN OUT VOID
*DhContext
,
3453 IN CONST UINT8
*PeerPublicKey
,
3454 IN UINTN PeerPublicKeySize
,
3456 IN OUT UINTN
*KeySize
3459 return CALL_BASECRYPTLIB (Dh
.Services
.ComputeKey
, DhComputeKey
, (DhContext
, PeerPublicKey
, PeerPublicKeySize
, Key
, KeySize
), FALSE
);
3462 //=====================================================================================
3463 // Pseudo-Random Generation Primitive
3464 //=====================================================================================
3467 Sets up the seed value for the pseudorandom number generator.
3469 This function sets up the seed value for the pseudorandom number generator.
3470 If Seed is not NULL, then the seed passed in is used.
3471 If Seed is NULL, then default seed is used.
3472 If this interface is not supported, then return FALSE.
3474 @param[in] Seed Pointer to seed value.
3475 If NULL, default seed is used.
3476 @param[in] SeedSize Size of seed value.
3477 If Seed is NULL, this parameter is ignored.
3479 @retval TRUE Pseudorandom number generator has enough entropy for random generation.
3480 @retval FALSE Pseudorandom number generator does not have enough entropy for random generation.
3481 @retval FALSE This interface is not supported.
3486 CryptoServiceRandomSeed (
3487 IN CONST UINT8
*Seed OPTIONAL
,
3491 return CALL_BASECRYPTLIB (Random
.Services
.Seed
, RandomSeed
, (Seed
, SeedSize
), FALSE
);
3495 Generates a pseudorandom byte stream of the specified size.
3497 If Output is NULL, then return FALSE.
3498 If this interface is not supported, then return FALSE.
3500 @param[out] Output Pointer to buffer to receive random value.
3501 @param[in] Size Size of random bytes to generate.
3503 @retval TRUE Pseudorandom byte stream generated successfully.
3504 @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.
3505 @retval FALSE This interface is not supported.
3510 CryptoServiceRandomBytes (
3515 return CALL_BASECRYPTLIB (Random
.Services
.Bytes
, RandomBytes
, (Output
, Size
), FALSE
);
3518 //=====================================================================================
3519 // Key Derivation Function Primitive
3520 //=====================================================================================
3523 Derive key data using HMAC-SHA256 based KDF.
3525 @param[in] Key Pointer to the user-supplied key.
3526 @param[in] KeySize Key size in bytes.
3527 @param[in] Salt Pointer to the salt(non-secret) value.
3528 @param[in] SaltSize Salt size in bytes.
3529 @param[in] Info Pointer to the application specific info.
3530 @param[in] InfoSize Info size in bytes.
3531 @param[out] Out Pointer to buffer to receive hkdf value.
3532 @param[in] OutSize Size of hkdf bytes to generate.
3534 @retval TRUE Hkdf generated successfully.
3535 @retval FALSE Hkdf generation failed.
3540 CryptoServiceHkdfSha256ExtractAndExpand (
3541 IN CONST UINT8
*Key
,
3543 IN CONST UINT8
*Salt
,
3545 IN CONST UINT8
*Info
,
3551 return CALL_BASECRYPTLIB (Hkdf
.Services
.Sha256ExtractAndExpand
, HkdfSha256ExtractAndExpand
, (Key
, KeySize
, Salt
, SaltSize
, Info
, InfoSize
, Out
, OutSize
), FALSE
);
3555 Initializes the OpenSSL library.
3557 This function registers ciphers and digests used directly and indirectly
3558 by SSL/TLS, and initializes the readable error messages.
3559 This function must be called before any other action takes places.
3561 @retval TRUE The OpenSSL library has been initialized.
3562 @retval FALSE Failed to initialize the OpenSSL library.
3567 CryptoServiceTlsInitialize (
3571 return CALL_BASECRYPTLIB (Tls
.Services
.Initialize
, TlsInitialize
, (), FALSE
);
3575 Free an allocated SSL_CTX object.
3577 @param[in] TlsCtx Pointer to the SSL_CTX object to be released.
3582 CryptoServiceTlsCtxFree (
3586 CALL_VOID_BASECRYPTLIB (Tls
.Services
.CtxFree
, TlsCtxFree
, (TlsCtx
));
3590 Creates a new SSL_CTX object as framework to establish TLS/SSL enabled
3593 @param[in] MajorVer Major Version of TLS/SSL Protocol.
3594 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
3596 @return Pointer to an allocated SSL_CTX object.
3597 If the creation failed, TlsCtxNew() returns NULL.
3602 CryptoServiceTlsCtxNew (
3607 return CALL_BASECRYPTLIB (Tls
.Services
.CtxNew
, TlsCtxNew
, (MajorVer
, MinorVer
), NULL
);
3611 Free an allocated TLS object.
3613 This function removes the TLS object pointed to by Tls and frees up the
3614 allocated memory. If Tls is NULL, nothing is done.
3616 @param[in] Tls Pointer to the TLS object to be freed.
3621 CryptoServiceTlsFree (
3625 CALL_VOID_BASECRYPTLIB (Tls
.Services
.Free
, TlsFree
, (Tls
));
3629 Create a new TLS object for a connection.
3631 This function creates a new TLS object for a connection. The new object
3632 inherits the setting of the underlying context TlsCtx: connection method,
3633 options, verification setting.
3635 @param[in] TlsCtx Pointer to the SSL_CTX object.
3637 @return Pointer to an allocated SSL object.
3638 If the creation failed, TlsNew() returns NULL.
3643 CryptoServiceTlsNew (
3647 return CALL_BASECRYPTLIB (Tls
.Services
.New
, TlsNew
, (TlsCtx
), NULL
);
3651 Checks if the TLS handshake was done.
3653 This function will check if the specified TLS handshake was done.
3655 @param[in] Tls Pointer to the TLS object for handshake state checking.
3657 @retval TRUE The TLS handshake was done.
3658 @retval FALSE The TLS handshake was not done.
3663 CryptoServiceTlsInHandshake (
3667 return CALL_BASECRYPTLIB (Tls
.Services
.InHandshake
, TlsInHandshake
, (Tls
), FALSE
);
3671 Perform a TLS/SSL handshake.
3673 This function will perform a TLS/SSL handshake.
3675 @param[in] Tls Pointer to the TLS object for handshake operation.
3676 @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.
3677 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
3679 @param[out] BufferOut Pointer to the buffer to hold the built packet.
3680 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
3681 the buffer size provided by the caller. On output, it
3682 is the buffer size in fact needed to contain the
3685 @retval EFI_SUCCESS The required TLS packet is built successfully.
3686 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
3688 BufferIn is NULL but BufferInSize is NOT 0.
3689 BufferInSize is 0 but BufferIn is NOT NULL.
3690 BufferOutSize is NULL.
3691 BufferOut is NULL if *BufferOutSize is not zero.
3692 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
3693 @retval EFI_ABORTED Something wrong during handshake.
3698 CryptoServiceTlsDoHandshake (
3700 IN UINT8
*BufferIn
, OPTIONAL
3701 IN UINTN BufferInSize
, OPTIONAL
3702 OUT UINT8
*BufferOut
, OPTIONAL
3703 IN OUT UINTN
*BufferOutSize
3706 return CALL_BASECRYPTLIB (Tls
.Services
.DoHandshake
, TlsDoHandshake
, (Tls
, BufferIn
, BufferInSize
, BufferOut
, BufferOutSize
), EFI_UNSUPPORTED
);
3710 Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,
3711 TLS session has errors and the response packet needs to be Alert message based on error type.
3713 @param[in] Tls Pointer to the TLS object for state checking.
3714 @param[in] BufferIn Pointer to the most recently received TLS Alert packet.
3715 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
3717 @param[out] BufferOut Pointer to the buffer to hold the built packet.
3718 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
3719 the buffer size provided by the caller. On output, it
3720 is the buffer size in fact needed to contain the
3723 @retval EFI_SUCCESS The required TLS packet is built successfully.
3724 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
3726 BufferIn is NULL but BufferInSize is NOT 0.
3727 BufferInSize is 0 but BufferIn is NOT NULL.
3728 BufferOutSize is NULL.
3729 BufferOut is NULL if *BufferOutSize is not zero.
3730 @retval EFI_ABORTED An error occurred.
3731 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
3736 CryptoServiceTlsHandleAlert (
3738 IN UINT8
*BufferIn
, OPTIONAL
3739 IN UINTN BufferInSize
, OPTIONAL
3740 OUT UINT8
*BufferOut
, OPTIONAL
3741 IN OUT UINTN
*BufferOutSize
3744 return CALL_BASECRYPTLIB (Tls
.Services
.HandleAlert
, TlsHandleAlert
, (Tls
, BufferIn
, BufferInSize
, BufferOut
, BufferOutSize
), EFI_UNSUPPORTED
);
3748 Build the CloseNotify packet.
3750 @param[in] Tls Pointer to the TLS object for state checking.
3751 @param[in, out] Buffer Pointer to the buffer to hold the built packet.
3752 @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is
3753 the buffer size provided by the caller. On output, it
3754 is the buffer size in fact needed to contain the
3757 @retval EFI_SUCCESS The required TLS packet is built successfully.
3758 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
3761 Buffer is NULL if *BufferSize is not zero.
3762 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.
3767 CryptoServiceTlsCloseNotify (
3769 IN OUT UINT8
*Buffer
,
3770 IN OUT UINTN
*BufferSize
3773 return CALL_BASECRYPTLIB (Tls
.Services
.CloseNotify
, TlsCloseNotify
, (Tls
, Buffer
, BufferSize
), EFI_UNSUPPORTED
);
3777 Attempts to read bytes from one TLS object and places the data in Buffer.
3779 This function will attempt to read BufferSize bytes from the TLS object
3780 and places the data in Buffer.
3782 @param[in] Tls Pointer to the TLS object.
3783 @param[in,out] Buffer Pointer to the buffer to store the data.
3784 @param[in] BufferSize The size of Buffer in bytes.
3786 @retval >0 The amount of data successfully read from the TLS object.
3787 @retval <=0 No data was successfully read.
3792 CryptoServiceTlsCtrlTrafficOut (
3794 IN OUT VOID
*Buffer
,
3798 return CALL_BASECRYPTLIB (Tls
.Services
.CtrlTrafficOut
, TlsCtrlTrafficOut
, (Tls
, Buffer
, BufferSize
), 0);
3802 Attempts to write data from the buffer to TLS object.
3804 This function will attempt to write BufferSize bytes data from the Buffer
3807 @param[in] Tls Pointer to the TLS object.
3808 @param[in] Buffer Pointer to the data buffer.
3809 @param[in] BufferSize The size of Buffer in bytes.
3811 @retval >0 The amount of data successfully written to the TLS object.
3812 @retval <=0 No data was successfully written.
3817 CryptoServiceTlsCtrlTrafficIn (
3823 return CALL_BASECRYPTLIB (Tls
.Services
.CtrlTrafficIn
, TlsCtrlTrafficIn
, (Tls
, Buffer
, BufferSize
), 0);
3827 Attempts to read bytes from the specified TLS connection into the buffer.
3829 This function tries to read BufferSize bytes data from the specified TLS
3830 connection into the Buffer.
3832 @param[in] Tls Pointer to the TLS connection for data reading.
3833 @param[in,out] Buffer Pointer to the data buffer.
3834 @param[in] BufferSize The size of Buffer in bytes.
3836 @retval >0 The read operation was successful, and return value is the
3837 number of bytes actually read from the TLS connection.
3838 @retval <=0 The read operation was not successful.
3843 CryptoServiceTlsRead (
3845 IN OUT VOID
*Buffer
,
3849 return CALL_BASECRYPTLIB (Tls
.Services
.Read
, TlsRead
, (Tls
, Buffer
, BufferSize
), 0);
3853 Attempts to write data to a TLS connection.
3855 This function tries to write BufferSize bytes data from the Buffer into the
3856 specified TLS connection.
3858 @param[in] Tls Pointer to the TLS connection for data writing.
3859 @param[in] Buffer Pointer to the data buffer.
3860 @param[in] BufferSize The size of Buffer in bytes.
3862 @retval >0 The write operation was successful, and return value is the
3863 number of bytes actually written to the TLS connection.
3864 @retval <=0 The write operation was not successful.
3869 CryptoServiceTlsWrite (
3875 return CALL_BASECRYPTLIB (Tls
.Services
.Write
, TlsWrite
, (Tls
, Buffer
, BufferSize
), 0);
3879 Set a new TLS/SSL method for a particular TLS object.
3881 This function sets a new TLS/SSL method for a particular TLS object.
3883 @param[in] Tls Pointer to a TLS object.
3884 @param[in] MajorVer Major Version of TLS/SSL Protocol.
3885 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
3887 @retval EFI_SUCCESS The TLS/SSL method was set successfully.
3888 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3889 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.
3894 CryptoServiceTlsSetVersion (
3900 return CALL_BASECRYPTLIB (TlsSet
.Services
.Version
, TlsSetVersion
, (Tls
, MajorVer
, MinorVer
), EFI_UNSUPPORTED
);
3904 Set TLS object to work in client or server mode.
3906 This function prepares a TLS object to work in client or server mode.
3908 @param[in] Tls Pointer to a TLS object.
3909 @param[in] IsServer Work in server mode.
3911 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.
3912 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3913 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.
3918 CryptoServiceTlsSetConnectionEnd (
3923 return CALL_BASECRYPTLIB (TlsSet
.Services
.ConnectionEnd
, TlsSetConnectionEnd
, (Tls
, IsServer
), EFI_UNSUPPORTED
);
3927 Set the ciphers list to be used by the TLS object.
3929 This function sets the ciphers for use by a specified TLS object.
3931 @param[in] Tls Pointer to a TLS object.
3932 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16
3933 cipher identifier comes from the TLS Cipher Suite
3934 Registry of the IANA, interpreting Byte1 and Byte2
3935 in network (big endian) byte order.
3936 @param[in] CipherNum The number of cipher in the list.
3938 @retval EFI_SUCCESS The ciphers list was set successfully.
3939 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3940 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.
3941 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
3946 CryptoServiceTlsSetCipherList (
3948 IN UINT16
*CipherId
,
3952 return CALL_BASECRYPTLIB (TlsSet
.Services
.CipherList
, TlsSetCipherList
, (Tls
, CipherId
, CipherNum
), EFI_UNSUPPORTED
);
3956 Set the compression method for TLS/SSL operations.
3958 This function handles TLS/SSL integrated compression methods.
3960 @param[in] CompMethod The compression method ID.
3962 @retval EFI_SUCCESS The compression method for the communication was
3964 @retval EFI_UNSUPPORTED Unsupported compression method.
3969 CryptoServiceTlsSetCompressionMethod (
3973 return CALL_BASECRYPTLIB (TlsSet
.Services
.CompressionMethod
, TlsSetCompressionMethod
, (CompMethod
), EFI_UNSUPPORTED
);
3977 Set peer certificate verification mode for the TLS connection.
3979 This function sets the verification mode flags for the TLS connection.
3981 @param[in] Tls Pointer to the TLS object.
3982 @param[in] VerifyMode A set of logically or'ed verification mode flags.
3987 CryptoServiceTlsSetVerify (
3989 IN UINT32 VerifyMode
3992 CALL_VOID_BASECRYPTLIB (TlsSet
.Services
.Verify
, TlsSetVerify
, (Tls
, VerifyMode
));
3996 Set the specified host name to be verified.
3998 @param[in] Tls Pointer to the TLS object.
3999 @param[in] Flags The setting flags during the validation.
4000 @param[in] HostName The specified host name to be verified.
4002 @retval EFI_SUCCESS The HostName setting was set successfully.
4003 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4004 @retval EFI_ABORTED Invalid HostName setting.
4009 CryptoServiceTlsSetVerifyHost (
4015 return CALL_BASECRYPTLIB (TlsSet
.Services
.VerifyHost
, TlsSetVerifyHost
, (Tls
, Flags
, HostName
), EFI_UNSUPPORTED
);
4019 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
4021 This function sets a session ID to be used when the TLS/SSL connection is
4024 @param[in] Tls Pointer to the TLS object.
4025 @param[in] SessionId Session ID data used for session resumption.
4026 @param[in] SessionIdLen Length of Session ID in bytes.
4028 @retval EFI_SUCCESS Session ID was set successfully.
4029 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4030 @retval EFI_UNSUPPORTED No available session for ID setting.
4035 CryptoServiceTlsSetSessionId (
4037 IN UINT8
*SessionId
,
4038 IN UINT16 SessionIdLen
4041 return CALL_BASECRYPTLIB (TlsSet
.Services
.SessionId
, TlsSetSessionId
, (Tls
, SessionId
, SessionIdLen
), EFI_UNSUPPORTED
);
4045 Adds the CA to the cert store when requesting Server or Client authentication.
4047 This function adds the CA certificate to the list of CAs when requesting
4048 Server or Client authentication for the chosen TLS connection.
4050 @param[in] Tls Pointer to the TLS object.
4051 @param[in] Data Pointer to the data buffer of a DER-encoded binary
4052 X.509 certificate or PEM-encoded X.509 certificate.
4053 @param[in] DataSize The size of data buffer in bytes.
4055 @retval EFI_SUCCESS The operation succeeded.
4056 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4057 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
4058 @retval EFI_ABORTED Invalid X.509 certificate.
4063 CryptoServiceTlsSetCaCertificate (
4069 return CALL_BASECRYPTLIB (TlsSet
.Services
.CaCertificate
, TlsSetCaCertificate
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4073 Loads the local public certificate into the specified TLS object.
4075 This function loads the X.509 certificate into the specified TLS object
4076 for TLS negotiation.
4078 @param[in] Tls Pointer to the TLS object.
4079 @param[in] Data Pointer to the data buffer of a DER-encoded binary
4080 X.509 certificate or PEM-encoded X.509 certificate.
4081 @param[in] DataSize The size of data buffer in bytes.
4083 @retval EFI_SUCCESS The operation succeeded.
4084 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4085 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
4086 @retval EFI_ABORTED Invalid X.509 certificate.
4091 CryptoServiceTlsSetHostPublicCert (
4097 return CALL_BASECRYPTLIB (TlsSet
.Services
.HostPublicCert
, TlsSetHostPublicCert
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4101 Adds the local private key to the specified TLS object.
4103 This function adds the local private key (PEM-encoded RSA or PKCS#8 private
4104 key) into the specified TLS object for TLS negotiation.
4106 @param[in] Tls Pointer to the TLS object.
4107 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA
4108 or PKCS#8 private key.
4109 @param[in] DataSize The size of data buffer in bytes.
4111 @retval EFI_SUCCESS The operation succeeded.
4112 @retval EFI_UNSUPPORTED This function is not supported.
4113 @retval EFI_ABORTED Invalid private key data.
4118 CryptoServiceTlsSetHostPrivateKey (
4124 return CALL_BASECRYPTLIB (TlsSet
.Services
.HostPrivateKey
, TlsSetHostPrivateKey
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4128 Adds the CA-supplied certificate revocation list for certificate validation.
4130 This function adds the CA-supplied certificate revocation list data for
4131 certificate validity checking.
4133 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
4134 @param[in] DataSize The size of data buffer in bytes.
4136 @retval EFI_SUCCESS The operation succeeded.
4137 @retval EFI_UNSUPPORTED This function is not supported.
4138 @retval EFI_ABORTED Invalid CRL data.
4143 CryptoServiceTlsSetCertRevocationList (
4148 return CALL_BASECRYPTLIB (TlsSet
.Services
.CertRevocationList
, TlsSetCertRevocationList
, (Data
, DataSize
), EFI_UNSUPPORTED
);
4152 Gets the protocol version used by the specified TLS connection.
4154 This function returns the protocol version used by the specified TLS
4157 If Tls is NULL, then ASSERT().
4159 @param[in] Tls Pointer to the TLS object.
4161 @return The protocol version of the specified TLS connection.
4166 CryptoServiceTlsGetVersion (
4170 return CALL_BASECRYPTLIB (TlsGet
.Services
.Version
, TlsGetVersion
, (Tls
), 0);
4174 Gets the connection end of the specified TLS connection.
4176 This function returns the connection end (as client or as server) used by
4177 the specified TLS connection.
4179 If Tls is NULL, then ASSERT().
4181 @param[in] Tls Pointer to the TLS object.
4183 @return The connection end used by the specified TLS connection.
4188 CryptoServiceTlsGetConnectionEnd (
4192 return CALL_BASECRYPTLIB (TlsGet
.Services
.ConnectionEnd
, TlsGetConnectionEnd
, (Tls
), 0);
4196 Gets the cipher suite used by the specified TLS connection.
4198 This function returns current cipher suite used by the specified
4201 @param[in] Tls Pointer to the TLS object.
4202 @param[in,out] CipherId The cipher suite used by the TLS object.
4204 @retval EFI_SUCCESS The cipher suite was returned successfully.
4205 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4206 @retval EFI_UNSUPPORTED Unsupported cipher suite.
4211 CryptoServiceTlsGetCurrentCipher (
4213 IN OUT UINT16
*CipherId
4216 return CALL_BASECRYPTLIB (TlsGet
.Services
.CurrentCipher
, TlsGetCurrentCipher
, (Tls
, CipherId
), EFI_UNSUPPORTED
);
4220 Gets the compression methods used by the specified TLS connection.
4222 This function returns current integrated compression methods used by
4223 the specified TLS connection.
4225 @param[in] Tls Pointer to the TLS object.
4226 @param[in,out] CompressionId The current compression method used by
4229 @retval EFI_SUCCESS The compression method was returned successfully.
4230 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4231 @retval EFI_ABORTED Invalid Compression method.
4232 @retval EFI_UNSUPPORTED This function is not supported.
4237 CryptoServiceTlsGetCurrentCompressionId (
4239 IN OUT UINT8
*CompressionId
4242 return CALL_BASECRYPTLIB (TlsGet
.Services
.CurrentCompressionId
, TlsGetCurrentCompressionId
, (Tls
, CompressionId
), EFI_UNSUPPORTED
);
4246 Gets the verification mode currently set in the TLS connection.
4248 This function returns the peer verification mode currently set in the
4249 specified TLS connection.
4251 If Tls is NULL, then ASSERT().
4253 @param[in] Tls Pointer to the TLS object.
4255 @return The verification mode set in the specified TLS connection.
4260 CryptoServiceTlsGetVerify (
4264 return CALL_BASECRYPTLIB (TlsGet
.Services
.Verify
, TlsGetVerify
, (Tls
), 0);
4268 Gets the session ID used by the specified TLS connection.
4270 This function returns the TLS/SSL session ID currently used by the
4271 specified TLS connection.
4273 @param[in] Tls Pointer to the TLS object.
4274 @param[in,out] SessionId Buffer to contain the returned session ID.
4275 @param[in,out] SessionIdLen The length of Session ID in bytes.
4277 @retval EFI_SUCCESS The Session ID was returned successfully.
4278 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4279 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
4284 CryptoServiceTlsGetSessionId (
4286 IN OUT UINT8
*SessionId
,
4287 IN OUT UINT16
*SessionIdLen
4290 return CALL_BASECRYPTLIB (TlsGet
.Services
.SessionId
, TlsGetSessionId
, (Tls
, SessionId
, SessionIdLen
), EFI_UNSUPPORTED
);
4294 Gets the client random data used in the specified TLS connection.
4296 This function returns the TLS/SSL client random data currently used in
4297 the specified TLS connection.
4299 @param[in] Tls Pointer to the TLS object.
4300 @param[in,out] ClientRandom Buffer to contain the returned client
4301 random data (32 bytes).
4306 CryptoServiceTlsGetClientRandom (
4308 IN OUT UINT8
*ClientRandom
4311 CALL_VOID_BASECRYPTLIB (TlsGet
.Services
.ClientRandom
, TlsGetClientRandom
, (Tls
, ClientRandom
));
4315 Gets the server random data used in the specified TLS connection.
4317 This function returns the TLS/SSL server random data currently used in
4318 the specified TLS connection.
4320 @param[in] Tls Pointer to the TLS object.
4321 @param[in,out] ServerRandom Buffer to contain the returned server
4322 random data (32 bytes).
4327 CryptoServiceTlsGetServerRandom (
4329 IN OUT UINT8
*ServerRandom
4332 CALL_VOID_BASECRYPTLIB (TlsGet
.Services
.ServerRandom
, TlsGetServerRandom
, (Tls
, ServerRandom
));
4336 Gets the master key data used in the specified TLS connection.
4338 This function returns the TLS/SSL master key material currently used in
4339 the specified TLS connection.
4341 @param[in] Tls Pointer to the TLS object.
4342 @param[in,out] KeyMaterial Buffer to contain the returned key material.
4344 @retval EFI_SUCCESS Key material was returned successfully.
4345 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4346 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
4351 CryptoServiceTlsGetKeyMaterial (
4353 IN OUT UINT8
*KeyMaterial
4356 return CALL_BASECRYPTLIB (TlsGet
.Services
.KeyMaterial
, TlsGetKeyMaterial
, (Tls
, KeyMaterial
), EFI_UNSUPPORTED
);
4360 Gets the CA Certificate from the cert store.
4362 This function returns the CA certificate for the chosen
4365 @param[in] Tls Pointer to the TLS object.
4366 @param[out] Data Pointer to the data buffer to receive the CA
4367 certificate data sent to the client.
4368 @param[in,out] DataSize The size of data buffer in bytes.
4370 @retval EFI_SUCCESS The operation succeeded.
4371 @retval EFI_UNSUPPORTED This function is not supported.
4372 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4377 CryptoServiceTlsGetCaCertificate (
4380 IN OUT UINTN
*DataSize
4383 return CALL_BASECRYPTLIB (TlsGet
.Services
.CaCertificate
, TlsGetCaCertificate
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4387 Gets the local public Certificate set in the specified TLS object.
4389 This function returns the local public certificate which was currently set
4390 in the specified TLS object.
4392 @param[in] Tls Pointer to the TLS object.
4393 @param[out] Data Pointer to the data buffer to receive the local
4395 @param[in,out] DataSize The size of data buffer in bytes.
4397 @retval EFI_SUCCESS The operation succeeded.
4398 @retval EFI_INVALID_PARAMETER The parameter is invalid.
4399 @retval EFI_NOT_FOUND The certificate is not found.
4400 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4405 CryptoServiceTlsGetHostPublicCert (
4408 IN OUT UINTN
*DataSize
4411 return CALL_BASECRYPTLIB (TlsGet
.Services
.HostPublicCert
, TlsGetHostPublicCert
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4415 Gets the local private key set in the specified TLS object.
4417 This function returns the local private key data which was currently set
4418 in the specified TLS object.
4420 @param[in] Tls Pointer to the TLS object.
4421 @param[out] Data Pointer to the data buffer to receive the local
4423 @param[in,out] DataSize The size of data buffer in bytes.
4425 @retval EFI_SUCCESS The operation succeeded.
4426 @retval EFI_UNSUPPORTED This function is not supported.
4427 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4432 CryptoServiceTlsGetHostPrivateKey (
4435 IN OUT UINTN
*DataSize
4438 return CALL_BASECRYPTLIB (TlsGet
.Services
.HostPrivateKey
, TlsGetHostPrivateKey
, (Tls
, Data
, DataSize
), EFI_UNSUPPORTED
);
4442 Gets the CA-supplied certificate revocation list data set in the specified
4445 This function returns the CA-supplied certificate revocation list data which
4446 was currently set in the specified TLS object.
4448 @param[out] Data Pointer to the data buffer to receive the CRL data.
4449 @param[in,out] DataSize The size of data buffer in bytes.
4451 @retval EFI_SUCCESS The operation succeeded.
4452 @retval EFI_UNSUPPORTED This function is not supported.
4453 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
4458 CryptoServiceTlsGetCertRevocationList (
4460 IN OUT UINTN
*DataSize
4463 return CALL_BASECRYPTLIB (TlsGet
.Services
.CertRevocationList
, TlsGetCertRevocationList
, (Data
, DataSize
), EFI_UNSUPPORTED
);
4466 const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto
= {
4468 CryptoServiceGetCryptoVersion
,
4469 /// HMAC MD5 - deprecated and unsupported
4470 DeprecatedCryptoServiceHmacMd5New
,
4471 DeprecatedCryptoServiceHmacMd5Free
,
4472 DeprecatedCryptoServiceHmacMd5SetKey
,
4473 DeprecatedCryptoServiceHmacMd5Duplicate
,
4474 DeprecatedCryptoServiceHmacMd5Update
,
4475 DeprecatedCryptoServiceHmacMd5Final
,
4476 /// HMAC SHA1 - deprecated and unsupported
4477 DeprecatedCryptoServiceHmacSha1New
,
4478 DeprecatedCryptoServiceHmacSha1Free
,
4479 DeprecatedCryptoServiceHmacSha1SetKey
,
4480 DeprecatedCryptoServiceHmacSha1Duplicate
,
4481 DeprecatedCryptoServiceHmacSha1Update
,
4482 DeprecatedCryptoServiceHmacSha1Final
,
4484 CryptoServiceHmacSha256New
,
4485 CryptoServiceHmacSha256Free
,
4486 CryptoServiceHmacSha256SetKey
,
4487 CryptoServiceHmacSha256Duplicate
,
4488 CryptoServiceHmacSha256Update
,
4489 CryptoServiceHmacSha256Final
,
4490 /// Md4 - deprecated and unsupported
4491 DeprecatedCryptoServiceMd4GetContextSize
,
4492 DeprecatedCryptoServiceMd4Init
,
4493 DeprecatedCryptoServiceMd4Duplicate
,
4494 DeprecatedCryptoServiceMd4Update
,
4495 DeprecatedCryptoServiceMd4Final
,
4496 DeprecatedCryptoServiceMd4HashAll
,
4497 #ifndef ENABLE_MD5_DEPRECATED_INTERFACES
4498 /// Md5 - deprecated and unsupported
4499 DeprecatedCryptoServiceMd5GetContextSize
,
4500 DeprecatedCryptoServiceMd5Init
,
4501 DeprecatedCryptoServiceMd5Duplicate
,
4502 DeprecatedCryptoServiceMd5Update
,
4503 DeprecatedCryptoServiceMd5Final
,
4504 DeprecatedCryptoServiceMd5HashAll
,
4507 CryptoServiceMd5GetContextSize
,
4508 CryptoServiceMd5Init
,
4509 CryptoServiceMd5Duplicate
,
4510 CryptoServiceMd5Update
,
4511 CryptoServiceMd5Final
,
4512 CryptoServiceMd5HashAll
,
4515 CryptoServicePkcs1v2Encrypt
,
4516 CryptoServicePkcs5HashPassword
,
4517 CryptoServicePkcs7Verify
,
4518 CryptoServiceVerifyEKUsInPkcs7Signature
,
4519 CryptoServicePkcs7GetSigners
,
4520 CryptoServicePkcs7FreeSigners
,
4521 CryptoServicePkcs7Sign
,
4522 CryptoServicePkcs7GetAttachedContent
,
4523 CryptoServicePkcs7GetCertificatesList
,
4524 CryptoServiceAuthenticodeVerify
,
4525 CryptoServiceImageTimestampVerify
,
4528 CryptoServiceDhFree
,
4529 CryptoServiceDhGenerateParameter
,
4530 CryptoServiceDhSetParameter
,
4531 CryptoServiceDhGenerateKey
,
4532 CryptoServiceDhComputeKey
,
4534 CryptoServiceRandomSeed
,
4535 CryptoServiceRandomBytes
,
4537 CryptoServiceRsaPkcs1Verify
,
4538 CryptoServiceRsaNew
,
4539 CryptoServiceRsaFree
,
4540 CryptoServiceRsaSetKey
,
4541 CryptoServiceRsaGetKey
,
4542 CryptoServiceRsaGenerateKey
,
4543 CryptoServiceRsaCheckKey
,
4544 CryptoServiceRsaPkcs1Sign
,
4545 CryptoServiceRsaPkcs1Verify
,
4546 CryptoServiceRsaGetPrivateKeyFromPem
,
4547 CryptoServiceRsaGetPublicKeyFromX509
,
4548 #ifdef DISABLE_SHA1_DEPRECATED_INTERFACES
4549 /// Sha1 - deprecated and unsupported
4550 DeprecatedCryptoServiceSha1GetContextSize
,
4551 DeprecatedCryptoServiceSha1Init
,
4552 DeprecatedCryptoServiceSha1Duplicate
,
4553 DeprecatedCryptoServiceSha1Update
,
4554 DeprecatedCryptoServiceSha1Final
,
4555 DeprecatedCryptoServiceSha1HashAll
,
4558 CryptoServiceSha1GetContextSize
,
4559 CryptoServiceSha1Init
,
4560 CryptoServiceSha1Duplicate
,
4561 CryptoServiceSha1Update
,
4562 CryptoServiceSha1Final
,
4563 CryptoServiceSha1HashAll
,
4566 CryptoServiceSha256GetContextSize
,
4567 CryptoServiceSha256Init
,
4568 CryptoServiceSha256Duplicate
,
4569 CryptoServiceSha256Update
,
4570 CryptoServiceSha256Final
,
4571 CryptoServiceSha256HashAll
,
4573 CryptoServiceSha384GetContextSize
,
4574 CryptoServiceSha384Init
,
4575 CryptoServiceSha384Duplicate
,
4576 CryptoServiceSha384Update
,
4577 CryptoServiceSha384Final
,
4578 CryptoServiceSha384HashAll
,
4580 CryptoServiceSha512GetContextSize
,
4581 CryptoServiceSha512Init
,
4582 CryptoServiceSha512Duplicate
,
4583 CryptoServiceSha512Update
,
4584 CryptoServiceSha512Final
,
4585 CryptoServiceSha512HashAll
,
4587 CryptoServiceX509GetSubjectName
,
4588 CryptoServiceX509GetCommonName
,
4589 CryptoServiceX509GetOrganizationName
,
4590 CryptoServiceX509VerifyCert
,
4591 CryptoServiceX509ConstructCertificate
,
4592 CryptoServiceX509ConstructCertificateStack
,
4593 CryptoServiceX509Free
,
4594 CryptoServiceX509StackFree
,
4595 CryptoServiceX509GetTBSCert
,
4596 /// TDES - deprecated and unsupported
4597 DeprecatedCryptoServiceTdesGetContextSize
,
4598 DeprecatedCryptoServiceTdesInit
,
4599 DeprecatedCryptoServiceTdesEcbEncrypt
,
4600 DeprecatedCryptoServiceTdesEcbDecrypt
,
4601 DeprecatedCryptoServiceTdesCbcEncrypt
,
4602 DeprecatedCryptoServiceTdesCbcDecrypt
,
4603 /// AES - ECB mode is deprecated and unsupported
4604 CryptoServiceAesGetContextSize
,
4605 CryptoServiceAesInit
,
4606 DeprecatedCryptoServiceAesEcbEncrypt
,
4607 DeprecatedCryptoServiceAesEcbDecrypt
,
4608 CryptoServiceAesCbcEncrypt
,
4609 CryptoServiceAesCbcDecrypt
,
4610 /// Arc4 - deprecated and unsupported
4611 DeprecatedCryptoServiceArc4GetContextSize
,
4612 DeprecatedCryptoServiceArc4Init
,
4613 DeprecatedCryptoServiceArc4Encrypt
,
4614 DeprecatedCryptoServiceArc4Decrypt
,
4615 DeprecatedCryptoServiceArc4Reset
,
4617 CryptoServiceSm3GetContextSize
,
4618 CryptoServiceSm3Init
,
4619 CryptoServiceSm3Duplicate
,
4620 CryptoServiceSm3Update
,
4621 CryptoServiceSm3Final
,
4622 CryptoServiceSm3HashAll
,
4624 CryptoServiceHkdfSha256ExtractAndExpand
,
4625 /// X509 (Continued)
4626 CryptoServiceX509ConstructCertificateStackV
,
4628 CryptoServiceTlsInitialize
,
4629 CryptoServiceTlsCtxFree
,
4630 CryptoServiceTlsCtxNew
,
4631 CryptoServiceTlsFree
,
4632 CryptoServiceTlsNew
,
4633 CryptoServiceTlsInHandshake
,
4634 CryptoServiceTlsDoHandshake
,
4635 CryptoServiceTlsHandleAlert
,
4636 CryptoServiceTlsCloseNotify
,
4637 CryptoServiceTlsCtrlTrafficOut
,
4638 CryptoServiceTlsCtrlTrafficIn
,
4639 CryptoServiceTlsRead
,
4640 CryptoServiceTlsWrite
,
4642 CryptoServiceTlsSetVersion
,
4643 CryptoServiceTlsSetConnectionEnd
,
4644 CryptoServiceTlsSetCipherList
,
4645 CryptoServiceTlsSetCompressionMethod
,
4646 CryptoServiceTlsSetVerify
,
4647 CryptoServiceTlsSetVerifyHost
,
4648 CryptoServiceTlsSetSessionId
,
4649 CryptoServiceTlsSetCaCertificate
,
4650 CryptoServiceTlsSetHostPublicCert
,
4651 CryptoServiceTlsSetHostPrivateKey
,
4652 CryptoServiceTlsSetCertRevocationList
,
4654 CryptoServiceTlsGetVersion
,
4655 CryptoServiceTlsGetConnectionEnd
,
4656 CryptoServiceTlsGetCurrentCipher
,
4657 CryptoServiceTlsGetCurrentCompressionId
,
4658 CryptoServiceTlsGetVerify
,
4659 CryptoServiceTlsGetSessionId
,
4660 CryptoServiceTlsGetClientRandom
,
4661 CryptoServiceTlsGetServerRandom
,
4662 CryptoServiceTlsGetKeyMaterial
,
4663 CryptoServiceTlsGetCaCertificate
,
4664 CryptoServiceTlsGetHostPublicCert
,
4665 CryptoServiceTlsGetHostPrivateKey
,
4666 CryptoServiceTlsGetCertRevocationList