2 This Protocol provides Crypto services to DXE modules
4 Copyright (C) Microsoft Corporation. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __EDKII_CRYPTO_PROTOCOL_H__
10 #define __EDKII_CRYPTO_PROTOCOL_H__
13 #include <Library/BaseCryptLib.h>
14 #include <Library/PcdLib.h>
17 /// The version of the EDK II Crypto Protocol.
18 /// As APIs are added to BaseCryptLib, the EDK II Crypto Protocol is extended
19 /// with new APIs at the end of the EDK II Crypto Protocol structure. Each time
20 /// the EDK II Crypto Protocol is extended, this version define must be
23 #define EDKII_CRYPTO_VERSION 6
26 /// EDK II Crypto Protocol forward declaration
28 typedef struct _EDKII_CRYPTO_PROTOCOL EDKII_CRYPTO_PROTOCOL
;
31 Returns the version of the EDK II Crypto Protocol.
33 @return The version of the EDK II Crypto Protocol.
38 (EFIAPI
*EDKII_CRYPTO_GET_VERSION
) (
42 //=====================================================================================
43 // MAC (Message Authentication Code) Primitive
44 //=====================================================================================
46 Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use.
48 If this interface is not supported, then return NULL.
50 @return Pointer to the HMAC_CTX context that has been initialized.
51 If the allocations fails, HmacMd5New() returns NULL.
52 @retval NULL This interface is not supported.
57 (EFIAPI
*EDKII_CRYPTO_HMAC_MD5_NEW
) (
62 Release the specified HMAC_CTX context.
64 If this interface is not supported, then do nothing.
66 @param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released.
71 (EFIAPI
*EDKII_CRYPTO_HMAC_MD5_FREE
) (
76 Set user-supplied key for subsequent use. It must be done before any
77 calling to HmacMd5Update().
79 If HmacMd5Context is NULL, then return FALSE.
80 If this interface is not supported, then return FALSE.
82 @param[out] HmacMd5Context Pointer to HMAC-MD5 context.
83 @param[in] Key Pointer to the user-supplied key.
84 @param[in] KeySize Key size in bytes.
86 @retval TRUE HMAC-MD5 context initialization succeeded.
87 @retval FALSE HMAC-MD5 context initialization failed.
88 @retval FALSE This interface is not supported.
93 (EFIAPI
*EDKII_CRYPTO_HMAC_MD5_SET_KEY
) (
94 OUT VOID
*HmacMd5Context
,
100 Makes a copy of an existing HMAC-MD5 context.
102 If HmacMd5Context is NULL, then return FALSE.
103 If NewHmacMd5Context is NULL, then return FALSE.
104 If this interface is not supported, then return FALSE.
106 @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied.
107 @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context.
109 @retval TRUE HMAC-MD5 context copy succeeded.
110 @retval FALSE HMAC-MD5 context copy failed.
111 @retval FALSE This interface is not supported.
116 (EFIAPI
*EDKII_CRYPTO_HMAC_MD5_DUPLICATE
) (
117 IN CONST VOID
*HmacMd5Context
,
118 OUT VOID
*NewHmacMd5Context
122 Digests the input data and updates HMAC-MD5 context.
124 This function performs HMAC-MD5 digest on a data buffer of the specified size.
125 It can be called multiple times to compute the digest of long or discontinuous data streams.
126 HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by
127 HmacMd5Final(). Behavior with invalid context is undefined.
129 If HmacMd5Context is NULL, then return FALSE.
130 If this interface is not supported, then return FALSE.
132 @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
133 @param[in] Data Pointer to the buffer containing the data to be digested.
134 @param[in] DataSize Size of Data buffer in bytes.
136 @retval TRUE HMAC-MD5 data digest succeeded.
137 @retval FALSE HMAC-MD5 data digest failed.
138 @retval FALSE This interface is not supported.
143 (EFIAPI
*EDKII_CRYPTO_HMAC_MD5_UPDATE
) (
144 IN OUT VOID
*HmacMd5Context
,
151 Completes computation of the HMAC-MD5 digest value.
153 This function completes HMAC-MD5 hash computation and retrieves the digest value into
154 the specified memory. After this function has been called, the HMAC-MD5 context cannot
156 HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by
157 HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined.
159 If HmacMd5Context is NULL, then return FALSE.
160 If HmacValue is NULL, then return FALSE.
161 If this interface is not supported, then return FALSE.
163 @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.
164 @param[out] HmacValue Pointer to a buffer that receives the HMAC-MD5 digest
167 @retval TRUE HMAC-MD5 digest computation succeeded.
168 @retval FALSE HMAC-MD5 digest computation failed.
169 @retval FALSE This interface is not supported.
174 (EFIAPI
*EDKII_CRYPTO_HMAC_MD5_FINAL
) (
175 IN OUT VOID
*HmacMd5Context
,
181 Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use.
183 If this interface is not supported, then return NULL.
185 @return Pointer to the HMAC_CTX context that has been initialized.
186 If the allocations fails, HmacSha1New() returns NULL.
187 @return NULL This interface is not supported.
192 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA1_NEW
) (
197 Release the specified HMAC_CTX context.
199 If this interface is not supported, then do nothing.
201 @param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released.
206 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA1_FREE
) (
212 Set user-supplied key for subsequent use. It must be done before any
213 calling to HmacSha1Update().
215 If HmacSha1Context is NULL, then return FALSE.
216 If this interface is not supported, then return FALSE.
218 @param[out] HmacSha1Context Pointer to HMAC-SHA1 context.
219 @param[in] Key Pointer to the user-supplied key.
220 @param[in] KeySize Key size in bytes.
222 @retval TRUE The Key is set successfully.
223 @retval FALSE The Key is set unsuccessfully.
224 @retval FALSE This interface is not supported.
229 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA1_SET_KEY
) (
230 OUT VOID
*HmacSha1Context
,
237 Makes a copy of an existing HMAC-SHA1 context.
239 If HmacSha1Context is NULL, then return FALSE.
240 If NewHmacSha1Context is NULL, then return FALSE.
241 If this interface is not supported, then return FALSE.
243 @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied.
244 @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context.
246 @retval TRUE HMAC-SHA1 context copy succeeded.
247 @retval FALSE HMAC-SHA1 context copy failed.
248 @retval FALSE This interface is not supported.
253 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA1_DUPLICATE
) (
254 IN CONST VOID
*HmacSha1Context
,
255 OUT VOID
*NewHmacSha1Context
260 Digests the input data and updates HMAC-SHA1 context.
262 This function performs HMAC-SHA1 digest on a data buffer of the specified size.
263 It can be called multiple times to compute the digest of long or discontinuous data streams.
264 HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized by
265 HmacSha1Final(). Behavior with invalid context is undefined.
267 If HmacSha1Context is NULL, then return FALSE.
268 If this interface is not supported, then return FALSE.
270 @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
271 @param[in] Data Pointer to the buffer containing the data to be digested.
272 @param[in] DataSize Size of Data buffer in bytes.
274 @retval TRUE HMAC-SHA1 data digest succeeded.
275 @retval FALSE HMAC-SHA1 data digest failed.
276 @retval FALSE This interface is not supported.
281 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA1_UPDATE
) (
282 IN OUT VOID
*HmacSha1Context
,
289 Completes computation of the HMAC-SHA1 digest value.
291 This function completes HMAC-SHA1 hash computation and retrieves the digest value into
292 the specified memory. After this function has been called, the HMAC-SHA1 context cannot
294 HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized
295 by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined.
297 If HmacSha1Context is NULL, then return FALSE.
298 If HmacValue is NULL, then return FALSE.
299 If this interface is not supported, then return FALSE.
301 @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.
302 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest
305 @retval TRUE HMAC-SHA1 digest computation succeeded.
306 @retval FALSE HMAC-SHA1 digest computation failed.
307 @retval FALSE This interface is not supported.
312 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA1_FINAL
) (
313 IN OUT VOID
*HmacSha1Context
,
319 Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
321 @return Pointer to the HMAC_CTX context that has been initialized.
322 If the allocations fails, HmacSha256New() returns NULL.
327 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_NEW
) (
332 Release the specified HMAC_CTX context.
334 @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released.
339 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_FREE
) (
340 IN VOID
*HmacSha256Ctx
345 Set user-supplied key for subsequent use. It must be done before any
346 calling to HmacSha256Update().
348 If HmacSha256Context is NULL, then return FALSE.
349 If this interface is not supported, then return FALSE.
351 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.
352 @param[in] Key Pointer to the user-supplied key.
353 @param[in] KeySize Key size in bytes.
355 @retval TRUE The Key is set successfully.
356 @retval FALSE The Key is set unsuccessfully.
357 @retval FALSE This interface is not supported.
362 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_SET_KEY
) (
363 OUT VOID
*HmacSha256Context
,
369 Makes a copy of an existing HMAC-SHA256 context.
371 If HmacSha256Context is NULL, then return FALSE.
372 If NewHmacSha256Context is NULL, then return FALSE.
373 If this interface is not supported, then return FALSE.
375 @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied.
376 @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context.
378 @retval TRUE HMAC-SHA256 context copy succeeded.
379 @retval FALSE HMAC-SHA256 context copy failed.
380 @retval FALSE This interface is not supported.
385 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_DUPLICATE
) (
386 IN CONST VOID
*HmacSha256Context
,
387 OUT VOID
*NewHmacSha256Context
392 Digests the input data and updates HMAC-SHA256 context.
394 This function performs HMAC-SHA256 digest on a data buffer of the specified size.
395 It can be called multiple times to compute the digest of long or discontinuous data streams.
396 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
397 by HmacSha256Final(). Behavior with invalid context is undefined.
399 If HmacSha256Context is NULL, then return FALSE.
400 If this interface is not supported, then return FALSE.
402 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
403 @param[in] Data Pointer to the buffer containing the data to be digested.
404 @param[in] DataSize Size of Data buffer in bytes.
406 @retval TRUE HMAC-SHA256 data digest succeeded.
407 @retval FALSE HMAC-SHA256 data digest failed.
408 @retval FALSE This interface is not supported.
413 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_UPDATE
) (
414 IN OUT VOID
*HmacSha256Context
,
420 Completes computation of the HMAC-SHA256 digest value.
422 This function completes HMAC-SHA256 hash computation and retrieves the digest value into
423 the specified memory. After this function has been called, the HMAC-SHA256 context cannot
425 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
426 by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.
428 If HmacSha256Context is NULL, then return FALSE.
429 If HmacValue is NULL, then return FALSE.
430 If this interface is not supported, then return FALSE.
432 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
433 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest
436 @retval TRUE HMAC-SHA256 digest computation succeeded.
437 @retval FALSE HMAC-SHA256 digest computation failed.
438 @retval FALSE This interface is not supported.
443 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_FINAL
) (
444 IN OUT VOID
*HmacSha256Context
,
449 //=====================================================================================
450 // One-Way Cryptographic Hash Primitives
451 //=====================================================================================
454 MD4 is deprecated and unsupported any longer.
455 Keep the function field for binary compability.
460 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE
) (
467 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_INIT
) (
474 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE
) (
475 IN CONST VOID
*Md4Context
,
476 OUT VOID
*NewMd4Context
482 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_UPDATE
) (
483 IN OUT VOID
*Md4Context
,
491 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_FINAL
) (
492 IN OUT VOID
*Md4Context
,
499 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL
) (
505 // ----------------------------------------------------------------------------
508 Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
510 If this interface is not supported, then return zero.
512 @return The size, in bytes, of the context buffer required for MD5 hash operations.
513 @retval 0 This interface is not supported.
518 (EFIAPI
* EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE
)(
523 Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
526 If Md5Context is NULL, then return FALSE.
527 If this interface is not supported, then return FALSE.
529 @param[out] Md5Context Pointer to MD5 context being initialized.
531 @retval TRUE MD5 context initialization succeeded.
532 @retval FALSE MD5 context initialization failed.
533 @retval FALSE This interface is not supported.
538 (EFIAPI
* EDKII_CRYPTO_MD5_INIT
)(
539 OUT VOID
*Md5Context
);
542 Makes a copy of an existing MD5 context.
544 If Md5Context is NULL, then return FALSE.
545 If NewMd5Context is NULL, then return FALSE.
546 If this interface is not supported, then return FALSE.
548 @param[in] Md5Context Pointer to MD5 context being copied.
549 @param[out] NewMd5Context Pointer to new MD5 context.
551 @retval TRUE MD5 context copy succeeded.
552 @retval FALSE MD5 context copy failed.
553 @retval FALSE This interface is not supported.
558 (EFIAPI
* EDKII_CRYPTO_MD5_DUPLICATE
) (
559 IN CONST VOID
*Md5Context
,
560 OUT VOID
*NewMd5Context
);
564 Digests the input data and updates MD5 context.
566 This function performs MD5 digest on a data buffer of the specified size.
567 It can be called multiple times to compute the digest of long or discontinuous data streams.
568 MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
569 by Md5Final(). Behavior with invalid context is undefined.
571 If Md5Context is NULL, then return FALSE.
572 If this interface is not supported, then return FALSE.
574 @param[in, out] Md5Context Pointer to the MD5 context.
575 @param[in] Data Pointer to the buffer containing the data to be hashed.
576 @param[in] DataSize Size of Data buffer in bytes.
578 @retval TRUE MD5 data digest succeeded.
579 @retval FALSE MD5 data digest failed.
580 @retval FALSE This interface is not supported.
585 (EFIAPI
* EDKII_CRYPTO_MD5_UPDATE
)(
586 IN OUT VOID
*Md5Context
,
592 Completes computation of the MD5 digest value.
594 This function completes MD5 hash computation and retrieves the digest value into
595 the specified memory. After this function has been called, the MD5 context cannot
597 MD5 context should be already correctly initialized by Md5Init(), and should not be
598 finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
600 If Md5Context is NULL, then return FALSE.
601 If HashValue is NULL, then return FALSE.
602 If this interface is not supported, then return FALSE.
604 @param[in, out] Md5Context Pointer to the MD5 context.
605 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
608 @retval TRUE MD5 digest computation succeeded.
609 @retval FALSE MD5 digest computation failed.
610 @retval FALSE This interface is not supported.
615 (EFIAPI
* EDKII_CRYPTO_MD5_FINAL
)(
616 IN OUT VOID
*Md5Context
,
617 OUT UINT8
*HashValue
);
621 Computes the MD5 message digest of a input data buffer.
623 This function performs the MD5 message digest of a given data buffer, and places
624 the digest value into the specified memory.
626 If this interface is not supported, then return FALSE.
628 @param[in] Data Pointer to the buffer containing the data to be hashed.
629 @param[in] DataSize Size of Data buffer in bytes.
630 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
633 @retval TRUE MD5 digest computation succeeded.
634 @retval FALSE MD5 digest computation failed.
635 @retval FALSE This interface is not supported.
640 (EFIAPI
* EDKII_CRYPTO_MD5_HASH_ALL
)(
643 OUT UINT8
*HashValue
);
646 //=====================================================================================
648 //=====================================================================================
652 Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the encrypted message in
653 in a newly allocated buffer.
655 Things that can cause a failure include:
656 - X509 key size does not match any known key size.
657 - Fail to parse X509 certificate.
658 - Fail to allocate an intermediate buffer.
659 - NULL pointer provided for a non-optional parameter.
660 - Data size is too large for the provided key size (max size is a function of key size and hash digest size).
662 @param[in] PublicKey A pointer to the DER-encoded X509 certificate that will be used to encrypt the data.
663 @param[in] PublicKeySize Size of the X509 cert buffer.
664 @param[in] InData Data to be encrypted.
665 @param[in] InDataSize Size of the data buffer.
666 @param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer to be used when initializing the PRNG. NULL otherwise.
667 @param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer. 0 otherwise.
668 @param[out] EncryptedData Pointer to an allocated buffer containing the encrypted message.
669 @param[out] EncryptedDataSize Size of the encrypted message buffer.
671 @retval TRUE Encryption was successful.
672 @retval FALSE Encryption failed.
677 (EFIAPI
*EDKII_CRYPTO_PKCS1_ENCRYPT_V2
) (
678 IN CONST UINT8
*PublicKey
,
679 IN UINTN PublicKeySize
,
682 IN CONST UINT8
*PrngSeed OPTIONAL
,
683 IN UINTN PrngSeedSize OPTIONAL
,
684 OUT UINT8
**EncryptedData
,
685 OUT UINTN
*EncryptedDataSize
691 // ---------------------------------------------
695 Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0
696 password based encryption key derivation function PBKDF2, as specified in RFC 2898.
698 If Password or Salt or OutKey is NULL, then return FALSE.
699 If the hash algorithm could not be determined, then return FALSE.
700 If this interface is not supported, then return FALSE.
702 @param[in] PasswordLength Length of input password in bytes.
703 @param[in] Password Pointer to the array for the password.
704 @param[in] SaltLength Size of the Salt in bytes.
705 @param[in] Salt Pointer to the Salt.
706 @param[in] IterationCount Number of iterations to perform. Its value should be
707 greater than or equal to 1.
708 @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).
709 NOTE: DigestSize will be used to determine the hash algorithm.
710 Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.
711 @param[in] KeyLength Size of the derived key buffer in bytes.
712 @param[out] OutKey Pointer to the output derived key buffer.
714 @retval TRUE A key was derived successfully.
715 @retval FALSE One of the pointers was NULL or one of the sizes was too large.
716 @retval FALSE The hash algorithm could not be determined from the digest size.
717 @retval FALSE The key derivation operation failed.
718 @retval FALSE This interface is not supported.
723 (EFIAPI
*EDKII_CRYPTO_PKCS5_PW_HASH
) (
724 IN UINTN PasswordSize
,
725 IN CONST CHAR8
*Password
,
727 IN CONST UINT8
*Salt
,
728 IN UINTN IterationCount
,
736 // ---------------------------------------------
740 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
741 Cryptographic Message Syntax Standard". The input signed data could be wrapped
742 in a ContentInfo structure.
744 If P7Data, TrustedCert or InData is NULL, then return FALSE.
745 If P7Length, CertLength or DataLength overflow, then return FALSE.
746 If this interface is not supported, then return FALSE.
748 @param[in] P7Data Pointer to the PKCS#7 message to verify.
749 @param[in] P7Length Length of the PKCS#7 message in bytes.
750 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
751 is used for certificate chain verification.
752 @param[in] CertLength Length of the trusted certificate in bytes.
753 @param[in] InData Pointer to the content to be verified.
754 @param[in] DataLength Length of InData in bytes.
756 @retval TRUE The specified PKCS#7 signed data is valid.
757 @retval FALSE Invalid PKCS#7 signed data.
758 @retval FALSE This interface is not supported.
763 (EFIAPI
*EDKII_CRYPTO_PKCS7_VERIFY
) (
764 IN CONST UINT8
*P7Data
,
765 IN UINTN P7DataLength
,
766 IN CONST UINT8
*TrustedCert
,
767 IN UINTN TrustedCertLength
,
768 IN CONST UINT8
*Data
,
773 VerifyEKUsInPkcs7Signature()
775 This function receives a PKCS7 formatted signature, and then verifies that
776 the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity
777 leaf signing certificate.
779 Note that this function does not validate the certificate chain.
781 Applications for custom EKU's are quite flexible. For example, a policy EKU
782 may be present in an Issuing Certificate Authority (CA), and any sub-ordinate
783 certificate issued might also contain this EKU, thus constraining the
784 sub-ordinate certificate. Other applications might allow a certificate
785 embedded in a device to specify that other Object Identifiers (OIDs) are
786 present which contains binary data specifying custom capabilities that
787 the device is able to do.
789 @param[in] Pkcs7Signature - The PKCS#7 signed information content block. An array
790 containing the content block with both the signature,
791 the signer's certificate, and any necessary intermediate
794 @param[in] Pkcs7SignatureSize - Number of bytes in Pkcs7Signature.
796 @param[in] RequiredEKUs - Array of null-terminated strings listing OIDs of
797 required EKUs that must be present in the signature.
799 @param[in] RequiredEKUsSize - Number of elements in the RequiredEKUs string array.
801 @param[in] RequireAllPresent - If this is TRUE, then all of the specified EKU's
802 must be present in the leaf signer. If it is
803 FALSE, then we will succeed if we find any
804 of the specified EKU's.
806 @retval EFI_SUCCESS - The required EKUs were found in the signature.
807 @retval EFI_INVALID_PARAMETER - A parameter was invalid.
808 @retval EFI_NOT_FOUND - One or more EKU's were not found in the signature.
813 (EFIAPI
*EDKII_CRYPTO_PKCS7_VERIFY_EKU
) (
814 IN CONST UINT8
*Pkcs7Signature
,
815 IN CONST UINT32 SignatureSize
,
816 IN CONST CHAR8
*RequiredEKUs
[],
817 IN CONST UINT32 RequiredEKUsSize
,
818 IN BOOLEAN RequireAllPresent
822 Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
823 Cryptographic Message Syntax Standard". The input signed data could be wrapped
824 in a ContentInfo structure.
826 If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then
827 return FALSE. If P7Length overflow, then return FALSE.
828 If this interface is not supported, then return FALSE.
830 @param[in] P7Data Pointer to the PKCS#7 message to verify.
831 @param[in] P7Length Length of the PKCS#7 message in bytes.
832 @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
833 It's caller's responsibility to free the buffer with
835 This data structure is EFI_CERT_STACK type.
836 @param[out] StackLength Length of signer's certificates in bytes.
837 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
838 It's caller's responsibility to free the buffer with
840 @param[out] CertLength Length of the trusted certificate in bytes.
842 @retval TRUE The operation is finished successfully.
843 @retval FALSE Error occurs during the operation.
844 @retval FALSE This interface is not supported.
849 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_SIGNERS
) (
850 IN CONST UINT8
*P7Data
,
852 OUT UINT8
**CertStack
,
853 OUT UINTN
*StackLength
,
854 OUT UINT8
**TrustedCert
,
855 OUT UINTN
*CertLength
859 Wrap function to use free() to free allocated memory for certificates.
861 If this interface is not supported, then ASSERT().
863 @param[in] Certs Pointer to the certificates to be freed.
868 (EFIAPI
*EDKII_CRYPTO_PKCS7_FREE_SIGNERS
) (
873 Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
874 Syntax Standard, version 1.5". This interface is only intended to be used for
875 application to perform PKCS#7 functionality validation.
877 If this interface is not supported, then return FALSE.
879 @param[in] PrivateKey Pointer to the PEM-formatted private key data for
881 @param[in] PrivateKeySize Size of the PEM private key data in bytes.
882 @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
884 @param[in] InData Pointer to the content to be signed.
885 @param[in] InDataSize Size of InData in bytes.
886 @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
887 @param[in] OtherCerts Pointer to an optional additional set of certificates to
888 include in the PKCS#7 signedData (e.g. any intermediate
890 @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's
891 responsibility to free the buffer with FreePool().
892 @param[out] SignedDataSize Size of SignedData in bytes.
894 @retval TRUE PKCS#7 data signing succeeded.
895 @retval FALSE PKCS#7 data signing failed.
896 @retval FALSE This interface is not supported.
901 (EFIAPI
*EDKII_CRYPTO_PKCS7_SIGN
) (
902 IN CONST UINT8
*PrivateKey
,
903 IN UINTN PrivateKeySize
,
904 IN CONST UINT8
*KeyPassword
,
908 IN UINT8
*OtherCerts OPTIONAL
,
909 OUT UINT8
**SignedData
,
910 OUT UINTN
*SignedDataSize
914 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
915 data could be wrapped in a ContentInfo structure.
917 If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow,
918 then return FALSE. If the P7Data is not correctly formatted, then return FALSE.
920 Caution: This function may receive untrusted input. So this function will do
921 basic check for PKCS#7 data structure.
923 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
924 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
925 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
926 It's caller's responsibility to free the buffer with FreePool().
927 @param[out] ContentSize The size of the extracted content in bytes.
929 @retval TRUE The P7Data was correctly formatted for processing.
930 @retval FALSE The P7Data was not correctly formatted for processing.
936 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT
) (
937 IN CONST UINT8
*P7Data
,
940 OUT UINTN
*ContentSize
944 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
945 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
946 unchained to the signer's certificates.
947 The input signed data could be wrapped in a ContentInfo structure.
949 @param[in] P7Data Pointer to the PKCS#7 message.
950 @param[in] P7Length Length of the PKCS#7 message in bytes.
951 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
952 certificate. It's caller's responsibility to free the buffer
953 with Pkcs7FreeSigners().
954 This data structure is EFI_CERT_STACK type.
955 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
956 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
957 responsibility to free the buffer with Pkcs7FreeSigners().
958 This data structure is EFI_CERT_STACK type.
959 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
961 @retval TRUE The operation is finished successfully.
962 @retval FALSE Error occurs during the operation.
967 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST
) (
968 IN CONST UINT8
*P7Data
,
970 OUT UINT8
**SignerChainCerts
,
971 OUT UINTN
*ChainLength
,
972 OUT UINT8
**UnchainCerts
,
973 OUT UINTN
*UnchainLength
977 Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows
978 Authenticode Portable Executable Signature Format".
980 If AuthData is NULL, then return FALSE.
981 If ImageHash is NULL, then return FALSE.
982 If this interface is not supported, then return FALSE.
984 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
985 PE/COFF image to be verified.
986 @param[in] DataSize Size of the Authenticode Signature in bytes.
987 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
988 is used for certificate chain verification.
989 @param[in] CertSize Size of the trusted certificate in bytes.
990 @param[in] ImageHash Pointer to the original image file hash value. The procedure
991 for calculating the image hash value is described in Authenticode
993 @param[in] HashSize Size of Image hash value in bytes.
995 @retval TRUE The specified Authenticode Signature is valid.
996 @retval FALSE Invalid Authenticode Signature.
997 @retval FALSE This interface is not supported.
1002 (EFIAPI
*EDKII_CRYPTO_AUTHENTICODE_VERIFY
) (
1003 IN CONST UINT8
*AuthData
,
1005 IN CONST UINT8
*TrustedCert
,
1007 IN CONST UINT8
*ImageHash
,
1012 Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode
1015 If AuthData is NULL, then return FALSE.
1016 If this interface is not supported, then return FALSE.
1018 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
1019 PE/COFF image to be verified.
1020 @param[in] DataSize Size of the Authenticode Signature in bytes.
1021 @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which
1022 is used for TSA certificate chain verification.
1023 @param[in] CertSize Size of the trusted certificate in bytes.
1024 @param[out] SigningTime Return the time of timestamp generation time if the timestamp
1027 @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.
1028 @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.
1033 (EFIAPI
*EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY
) (
1034 IN CONST UINT8
*AuthData
,
1036 IN CONST UINT8
*TsaCert
,
1038 OUT EFI_TIME
*SigningTime
1042 //=====================================================================================
1043 // DH Key Exchange Primitive
1044 //=====================================================================================
1047 Allocates and Initializes one Diffie-Hellman Context for subsequent use.
1049 @return Pointer to the Diffie-Hellman Context that has been initialized.
1050 If the allocations fails, DhNew() returns NULL.
1051 If the interface is not supported, DhNew() returns NULL.
1056 (EFIAPI
*EDKII_CRYPTO_DH_NEW
) (
1061 Release the specified DH context.
1063 If the interface is not supported, then ASSERT().
1065 @param[in] DhContext Pointer to the DH context to be released.
1070 (EFIAPI
*EDKII_CRYPTO_DH_FREE
) (
1075 Generates DH parameter.
1077 Given generator g, and length of prime number p in bits, this function generates p,
1078 and sets DH context according to value of g and p.
1080 Before this function can be invoked, pseudorandom number generator must be correctly
1081 initialized by RandomSeed().
1083 If DhContext is NULL, then return FALSE.
1084 If Prime is NULL, then return FALSE.
1085 If this interface is not supported, then return FALSE.
1087 @param[in, out] DhContext Pointer to the DH context.
1088 @param[in] Generator Value of generator.
1089 @param[in] PrimeLength Length in bits of prime to be generated.
1090 @param[out] Prime Pointer to the buffer to receive the generated prime number.
1092 @retval TRUE DH parameter generation succeeded.
1093 @retval FALSE Value of Generator is not supported.
1094 @retval FALSE PRNG fails to generate random prime number with PrimeLength.
1095 @retval FALSE This interface is not supported.
1100 (EFIAPI
*EDKII_CRYPTO_DH_GENERATE_PARAMETER
) (
1101 IN OUT VOID
*DhContext
,
1103 IN UINTN PrimeLength
,
1108 Sets generator and prime parameters for DH.
1110 Given generator g, and prime number p, this function and sets DH
1111 context accordingly.
1113 If DhContext is NULL, then return FALSE.
1114 If Prime is NULL, then return FALSE.
1115 If this interface is not supported, then return FALSE.
1117 @param[in, out] DhContext Pointer to the DH context.
1118 @param[in] Generator Value of generator.
1119 @param[in] PrimeLength Length in bits of prime to be generated.
1120 @param[in] Prime Pointer to the prime number.
1122 @retval TRUE DH parameter setting succeeded.
1123 @retval FALSE Value of Generator is not supported.
1124 @retval FALSE Value of Generator is not suitable for the Prime.
1125 @retval FALSE Value of Prime is not a prime number.
1126 @retval FALSE Value of Prime is not a safe prime number.
1127 @retval FALSE This interface is not supported.
1132 (EFIAPI
*EDKII_CRYPTO_DH_SET_PARAMETER
) (
1133 IN OUT VOID
*DhContext
,
1135 IN UINTN PrimeLength
,
1136 IN CONST UINT8
*Prime
1140 Generates DH public key.
1142 This function generates random secret exponent, and computes the public key, which is
1143 returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.
1144 If the PublicKey buffer is too small to hold the public key, FALSE is returned and
1145 PublicKeySize is set to the required buffer size to obtain the public key.
1147 If DhContext is NULL, then return FALSE.
1148 If PublicKeySize is NULL, then return FALSE.
1149 If PublicKeySize is large enough but PublicKey is NULL, then return FALSE.
1150 If this interface is not supported, then return FALSE.
1152 @param[in, out] DhContext Pointer to the DH context.
1153 @param[out] PublicKey Pointer to the buffer to receive generated public key.
1154 @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.
1155 On output, the size of data returned in PublicKey buffer in bytes.
1157 @retval TRUE DH public key generation succeeded.
1158 @retval FALSE DH public key generation failed.
1159 @retval FALSE PublicKeySize is not large enough.
1160 @retval FALSE This interface is not supported.
1165 (EFIAPI
*EDKII_CRYPTO_DH_GENERATE_KEY
) (
1166 IN OUT VOID
*DhContext
,
1167 OUT UINT8
*PublicKey
,
1168 IN OUT UINTN
*PublicKeySize
1172 Computes exchanged common key.
1174 Given peer's public key, this function computes the exchanged common key, based on its own
1175 context including value of prime modulus and random secret exponent.
1177 If DhContext is NULL, then return FALSE.
1178 If PeerPublicKey is NULL, then return FALSE.
1179 If KeySize is NULL, then return FALSE.
1180 If Key is NULL, then return FALSE.
1181 If KeySize is not large enough, then return FALSE.
1182 If this interface is not supported, then return FALSE.
1184 @param[in, out] DhContext Pointer to the DH context.
1185 @param[in] PeerPublicKey Pointer to the peer's public key.
1186 @param[in] PeerPublicKeySize Size of peer's public key in bytes.
1187 @param[out] Key Pointer to the buffer to receive generated key.
1188 @param[in, out] KeySize On input, the size of Key buffer in bytes.
1189 On output, the size of data returned in Key buffer in bytes.
1191 @retval TRUE DH exchanged key generation succeeded.
1192 @retval FALSE DH exchanged key generation failed.
1193 @retval FALSE KeySize is not large enough.
1194 @retval FALSE This interface is not supported.
1199 (EFIAPI
*EDKII_CRYPTO_DH_COMPUTE_KEY
) (
1200 IN OUT VOID
*DhContext
,
1201 IN CONST UINT8
*PeerPublicKey
,
1202 IN UINTN PeerPublicKeySize
,
1204 IN OUT UINTN
*KeySize
1207 //=====================================================================================
1208 // Pseudo-Random Generation Primitive
1209 //=====================================================================================
1212 Sets up the seed value for the pseudorandom number generator.
1214 This function sets up the seed value for the pseudorandom number generator.
1215 If Seed is not NULL, then the seed passed in is used.
1216 If Seed is NULL, then default seed is used.
1217 If this interface is not supported, then return FALSE.
1219 @param[in] Seed Pointer to seed value.
1220 If NULL, default seed is used.
1221 @param[in] SeedSize Size of seed value.
1222 If Seed is NULL, this parameter is ignored.
1224 @retval TRUE Pseudorandom number generator has enough entropy for random generation.
1225 @retval FALSE Pseudorandom number generator does not have enough entropy for random generation.
1226 @retval FALSE This interface is not supported.
1231 (EFIAPI
*EDKII_CRYPTO_RANDOM_SEED
) (
1232 IN CONST UINT8
*Seed OPTIONAL
,
1237 Generates a pseudorandom byte stream of the specified size.
1239 If Output is NULL, then return FALSE.
1240 If this interface is not supported, then return FALSE.
1242 @param[out] Output Pointer to buffer to receive random value.
1243 @param[in] Size Size of random bytes to generate.
1245 @retval TRUE Pseudorandom byte stream generated successfully.
1246 @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.
1247 @retval FALSE This interface is not supported.
1252 (EFIAPI
*EDKII_CRYPTO_RANDOM_BYTES
) (
1258 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
1261 If RsaContext is NULL, then return FALSE.
1262 If MessageHash is NULL, then return FALSE.
1263 If Signature is NULL, then return FALSE.
1264 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
1266 @param[in] RsaContext Pointer to RSA context for signature verification.
1267 @param[in] MessageHash Pointer to octet message hash to be checked.
1268 @param[in] HashSize Size of the message hash in bytes.
1269 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
1270 @param[in] SigSize Size of signature in bytes.
1272 @retval TRUE Valid signature encoded in PKCS1-v1_5.
1273 @retval FALSE Invalid signature or invalid RSA context.
1278 (EFIAPI
*EDKII_CRYPTO_RSA_VERIFY_PKCS1
) (
1279 IN VOID
*RsaContext
,
1280 IN CONST UINT8
*MessageHash
,
1282 IN CONST UINT8
*Signature
,
1287 Retrieve the RSA Public Key from one DER-encoded X509 certificate.
1289 If Cert is NULL, then return FALSE.
1290 If RsaContext is NULL, then return FALSE.
1291 If this interface is not supported, then return FALSE.
1293 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1294 @param[in] CertSize Size of the X509 certificate in bytes.
1295 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
1296 RSA public key component. Use RsaFree() function to free the
1299 @retval TRUE RSA Public Key was retrieved successfully.
1300 @retval FALSE Fail to retrieve RSA public key from X509 certificate.
1301 @retval FALSE This interface is not supported.
1306 (EFIAPI
*EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509
) (
1307 IN CONST UINT8
*Cert
,
1309 OUT VOID
**RsaContext
1313 Allocates and initializes one RSA context for subsequent use.
1315 @return Pointer to the RSA context that has been initialized.
1316 If the allocations fails, RsaNew() returns NULL.
1321 (EFIAPI
*EDKII_CRYPTO_RSA_NEW
) (
1326 Release the specified RSA context.
1328 If RsaContext is NULL, then return FALSE.
1330 @param[in] RsaContext Pointer to the RSA context to be released.
1335 (EFIAPI
*EDKII_CRYPTO_RSA_FREE
) (
1340 Sets the tag-designated key component into the established RSA context.
1342 This function sets the tag-designated RSA key component into the established
1343 RSA context from the user-specified non-negative integer (octet string format
1344 represented in RSA PKCS#1).
1345 If BigNumber is NULL, then the specified key component in RSA context is cleared.
1347 If RsaContext is NULL, then return FALSE.
1349 @param[in, out] RsaContext Pointer to RSA context being set.
1350 @param[in] KeyTag Tag of RSA key component being set.
1351 @param[in] BigNumber Pointer to octet integer buffer.
1352 If NULL, then the specified key component in RSA
1354 @param[in] BnSize Size of big number buffer in bytes.
1355 If BigNumber is NULL, then it is ignored.
1357 @retval TRUE RSA key component was set successfully.
1358 @retval FALSE Invalid RSA key component tag.
1363 (EFIAPI
*EDKII_CRYPTO_RSA_SET_KEY
) (
1364 IN OUT VOID
*RsaContext
,
1365 IN RSA_KEY_TAG KeyTag
,
1366 IN CONST UINT8
*BigNumber
,
1371 Gets the tag-designated RSA key component from the established RSA context.
1373 This function retrieves the tag-designated RSA key component from the
1374 established RSA context as a non-negative integer (octet string format
1375 represented in RSA PKCS#1).
1376 If specified key component has not been set or has been cleared, then returned
1378 If the BigNumber buffer is too small to hold the contents of the key, FALSE
1379 is returned and BnSize is set to the required buffer size to obtain the key.
1381 If RsaContext is NULL, then return FALSE.
1382 If BnSize is NULL, then return FALSE.
1383 If BnSize is large enough but BigNumber is NULL, then return FALSE.
1384 If this interface is not supported, then return FALSE.
1386 @param[in, out] RsaContext Pointer to RSA context being set.
1387 @param[in] KeyTag Tag of RSA key component being set.
1388 @param[out] BigNumber Pointer to octet integer buffer.
1389 @param[in, out] BnSize On input, the size of big number buffer in bytes.
1390 On output, the size of data returned in big number buffer in bytes.
1392 @retval TRUE RSA key component was retrieved successfully.
1393 @retval FALSE Invalid RSA key component tag.
1394 @retval FALSE BnSize is too small.
1395 @retval FALSE This interface is not supported.
1400 (EFIAPI
*EDKII_CRYPTO_RSA_GET_KEY
) (
1401 IN OUT VOID
*RsaContext
,
1402 IN RSA_KEY_TAG KeyTag
,
1403 OUT UINT8
*BigNumber
,
1404 IN OUT UINTN
*BnSize
1408 Generates RSA key components.
1410 This function generates RSA key components. It takes RSA public exponent E and
1411 length in bits of RSA modulus N as input, and generates all key components.
1412 If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used.
1414 Before this function can be invoked, pseudorandom number generator must be correctly
1415 initialized by RandomSeed().
1417 If RsaContext is NULL, then return FALSE.
1418 If this interface is not supported, then return FALSE.
1420 @param[in, out] RsaContext Pointer to RSA context being set.
1421 @param[in] ModulusLength Length of RSA modulus N in bits.
1422 @param[in] PublicExponent Pointer to RSA public exponent.
1423 @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes.
1425 @retval TRUE RSA key component was generated successfully.
1426 @retval FALSE Invalid RSA key component tag.
1427 @retval FALSE This interface is not supported.
1432 (EFIAPI
*EDKII_CRYPTO_RSA_GENERATE_KEY
) (
1433 IN OUT VOID
*RsaContext
,
1434 IN UINTN ModulusLength
,
1435 IN CONST UINT8
*PublicExponent
,
1436 IN UINTN PublicExponentSize
1440 Validates key components of RSA context.
1441 NOTE: This function performs integrity checks on all the RSA key material, so
1442 the RSA key structure must contain all the private key data.
1444 This function validates key components of RSA context in following aspects:
1445 - Whether p is a prime
1446 - Whether q is a prime
1448 - Whether d*e = 1 mod lcm(p-1,q-1)
1450 If RsaContext is NULL, then return FALSE.
1451 If this interface is not supported, then return FALSE.
1453 @param[in] RsaContext Pointer to RSA context to check.
1455 @retval TRUE RSA key components are valid.
1456 @retval FALSE RSA key components are not valid.
1457 @retval FALSE This interface is not supported.
1462 (EFIAPI
*EDKII_CRYPTO_RSA_CHECK_KEY
) (
1467 Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.
1469 This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in
1471 If the Signature buffer is too small to hold the contents of signature, FALSE
1472 is returned and SigSize is set to the required buffer size to obtain the signature.
1474 If RsaContext is NULL, then return FALSE.
1475 If MessageHash is NULL, then return FALSE.
1476 If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.
1477 If SigSize is large enough but Signature is NULL, then return FALSE.
1478 If this interface is not supported, then return FALSE.
1480 @param[in] RsaContext Pointer to RSA context for signature generation.
1481 @param[in] MessageHash Pointer to octet message hash to be signed.
1482 @param[in] HashSize Size of the message hash in bytes.
1483 @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature.
1484 @param[in, out] SigSize On input, the size of Signature buffer in bytes.
1485 On output, the size of data returned in Signature buffer in bytes.
1487 @retval TRUE Signature successfully generated in PKCS1-v1_5.
1488 @retval FALSE Signature generation failed.
1489 @retval FALSE SigSize is too small.
1490 @retval FALSE This interface is not supported.
1495 (EFIAPI
*EDKII_CRYPTO_RSA_PKCS1_SIGN
) (
1496 IN VOID
*RsaContext
,
1497 IN CONST UINT8
*MessageHash
,
1499 OUT UINT8
*Signature
,
1500 IN OUT UINTN
*SigSize
1504 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
1507 If RsaContext is NULL, then return FALSE.
1508 If MessageHash is NULL, then return FALSE.
1509 If Signature is NULL, then return FALSE.
1510 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
1512 @param[in] RsaContext Pointer to RSA context for signature verification.
1513 @param[in] MessageHash Pointer to octet message hash to be checked.
1514 @param[in] HashSize Size of the message hash in bytes.
1515 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
1516 @param[in] SigSize Size of signature in bytes.
1518 @retval TRUE Valid signature encoded in PKCS1-v1_5.
1519 @retval FALSE Invalid signature or invalid RSA context.
1524 (EFIAPI
*EDKII_CRYPTO_RSA_PKCS1_VERIFY
) (
1525 IN VOID
*RsaContext
,
1526 IN CONST UINT8
*MessageHash
,
1528 IN CONST UINT8
*Signature
,
1533 Retrieve the RSA Private Key from the password-protected PEM key data.
1535 If PemData is NULL, then return FALSE.
1536 If RsaContext is NULL, then return FALSE.
1537 If this interface is not supported, then return FALSE.
1539 @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.
1540 @param[in] PemSize Size of the PEM key data in bytes.
1541 @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.
1542 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
1543 RSA private key component. Use RsaFree() function to free the
1546 @retval TRUE RSA Private Key was retrieved successfully.
1547 @retval FALSE Invalid PEM key data or incorrect password.
1548 @retval FALSE This interface is not supported.
1553 (EFIAPI
*EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM
) (
1554 IN CONST UINT8
*PemData
,
1556 IN CONST CHAR8
*Password
,
1557 OUT VOID
**RsaContext
1561 Retrieve the RSA Public Key from one DER-encoded X509 certificate.
1563 If Cert is NULL, then return FALSE.
1564 If RsaContext is NULL, then return FALSE.
1565 If this interface is not supported, then return FALSE.
1567 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1568 @param[in] CertSize Size of the X509 certificate in bytes.
1569 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
1570 RSA public key component. Use RsaFree() function to free the
1573 @retval TRUE RSA Public Key was retrieved successfully.
1574 @retval FALSE Fail to retrieve RSA public key from X509 certificate.
1575 @retval FALSE This interface is not supported.
1580 (EFIAPI
*EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509
) (
1581 IN CONST UINT8
*Cert
,
1583 OUT VOID
**RsaContext
1586 //----------------------------------------
1588 //----------------------------------------
1591 Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
1593 If this interface is not supported, then return zero.
1595 @return The size, in bytes, of the context buffer required for SHA-1 hash operations.
1596 @retval 0 This interface is not supported.
1601 (EFIAPI
*EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE
) (
1606 Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
1609 If Sha1Context is NULL, then return FALSE.
1610 If this interface is not supported, then return FALSE.
1612 @param[out] Sha1Context Pointer to SHA-1 context being initialized.
1614 @retval TRUE SHA-1 context initialization succeeded.
1615 @retval FALSE SHA-1 context initialization failed.
1616 @retval FALSE This interface is not supported.
1621 (EFIAPI
*EDKII_CRYPTO_SHA1_INIT
) (
1622 OUT VOID
*Sha1Context
1626 Makes a copy of an existing SHA-1 context.
1628 If Sha1Context is NULL, then return FALSE.
1629 If NewSha1Context is NULL, then return FALSE.
1630 If this interface is not supported, then return FALSE.
1632 @param[in] Sha1Context Pointer to SHA-1 context being copied.
1633 @param[out] NewSha1Context Pointer to new SHA-1 context.
1635 @retval TRUE SHA-1 context copy succeeded.
1636 @retval FALSE SHA-1 context copy failed.
1637 @retval FALSE This interface is not supported.
1642 (EFIAPI
*EDKII_CRYPTO_SHA1_DUPLICATE
) (
1643 IN CONST VOID
*Sha1Context
,
1644 OUT VOID
*NewSha1Context
1648 Digests the input data and updates SHA-1 context.
1650 This function performs SHA-1 digest on a data buffer of the specified size.
1651 It can be called multiple times to compute the digest of long or discontinuous data streams.
1652 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
1653 by Sha1Final(). Behavior with invalid context is undefined.
1655 If Sha1Context is NULL, then return FALSE.
1656 If this interface is not supported, then return FALSE.
1658 @param[in, out] Sha1Context Pointer to the SHA-1 context.
1659 @param[in] Data Pointer to the buffer containing the data to be hashed.
1660 @param[in] DataSize Size of Data buffer in bytes.
1662 @retval TRUE SHA-1 data digest succeeded.
1663 @retval FALSE SHA-1 data digest failed.
1664 @retval FALSE This interface is not supported.
1669 (EFIAPI
*EDKII_CRYPTO_SHA1_UPDATE
) (
1670 IN OUT VOID
*Sha1Context
,
1671 IN CONST VOID
*Data
,
1676 Completes computation of the SHA-1 digest value.
1678 This function completes SHA-1 hash computation and retrieves the digest value into
1679 the specified memory. After this function has been called, the SHA-1 context cannot
1681 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
1682 finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
1684 If Sha1Context is NULL, then return FALSE.
1685 If HashValue is NULL, then return FALSE.
1686 If this interface is not supported, then return FALSE.
1688 @param[in, out] Sha1Context Pointer to the SHA-1 context.
1689 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
1692 @retval TRUE SHA-1 digest computation succeeded.
1693 @retval FALSE SHA-1 digest computation failed.
1694 @retval FALSE This interface is not supported.
1699 (EFIAPI
*EDKII_CRYPTO_SHA1_FINAL
) (
1700 IN OUT VOID
*Sha1Context
,
1701 OUT UINT8
*HashValue
1705 Computes the SHA-1 message digest of a input data buffer.
1707 This function performs the SHA-1 message digest of a given data buffer, and places
1708 the digest value into the specified memory.
1710 If this interface is not supported, then return FALSE.
1712 @param[in] Data Pointer to the buffer containing the data to be hashed.
1713 @param[in] DataSize Size of Data buffer in bytes.
1714 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
1717 @retval TRUE SHA-1 digest computation succeeded.
1718 @retval FALSE SHA-1 digest computation failed.
1719 @retval FALSE This interface is not supported.
1724 (EFIAPI
*EDKII_CRYPTO_SHA1_HASH_ALL
) (
1725 IN CONST VOID
*Data
,
1727 OUT UINT8
*HashValue
1731 Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
1733 @return The size, in bytes, of the context buffer required for SHA-256 hash operations.
1738 (EFIAPI
*EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE
) (
1743 Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for
1746 If Sha256Context is NULL, then return FALSE.
1748 @param[out] Sha256Context Pointer to SHA-256 context being initialized.
1750 @retval TRUE SHA-256 context initialization succeeded.
1751 @retval FALSE SHA-256 context initialization failed.
1756 (EFIAPI
*EDKII_CRYPTO_SHA256_INIT
) (
1757 OUT VOID
*Sha256Context
1761 Makes a copy of an existing SHA-256 context.
1763 If Sha256Context is NULL, then return FALSE.
1764 If NewSha256Context is NULL, then return FALSE.
1765 If this interface is not supported, then return FALSE.
1767 @param[in] Sha256Context Pointer to SHA-256 context being copied.
1768 @param[out] NewSha256Context Pointer to new SHA-256 context.
1770 @retval TRUE SHA-256 context copy succeeded.
1771 @retval FALSE SHA-256 context copy failed.
1772 @retval FALSE This interface is not supported.
1777 (EFIAPI
*EDKII_CRYPTO_SHA256_DUPLICATE
) (
1778 IN CONST VOID
*Sha256Context
,
1779 OUT VOID
*NewSha256Context
1783 Digests the input data and updates SHA-256 context.
1785 This function performs SHA-256 digest on a data buffer of the specified size.
1786 It can be called multiple times to compute the digest of long or discontinuous data streams.
1787 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized
1788 by Sha256Final(). Behavior with invalid context is undefined.
1790 If Sha256Context is NULL, then return FALSE.
1792 @param[in, out] Sha256Context Pointer to the SHA-256 context.
1793 @param[in] Data Pointer to the buffer containing the data to be hashed.
1794 @param[in] DataSize Size of Data buffer in bytes.
1796 @retval TRUE SHA-256 data digest succeeded.
1797 @retval FALSE SHA-256 data digest failed.
1802 (EFIAPI
*EDKII_CRYPTO_SHA256_UPDATE
) (
1803 IN OUT VOID
*Sha256Context
,
1804 IN CONST VOID
*Data
,
1809 Completes computation of the SHA-256 digest value.
1811 This function completes SHA-256 hash computation and retrieves the digest value into
1812 the specified memory. After this function has been called, the SHA-256 context cannot
1814 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be
1815 finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.
1817 If Sha256Context is NULL, then return FALSE.
1818 If HashValue is NULL, then return FALSE.
1820 @param[in, out] Sha256Context Pointer to the SHA-256 context.
1821 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
1824 @retval TRUE SHA-256 digest computation succeeded.
1825 @retval FALSE SHA-256 digest computation failed.
1830 (EFIAPI
*EDKII_CRYPTO_SHA256_FINAL
) (
1831 IN OUT VOID
*Sha256Context
,
1832 OUT UINT8
*HashValue
1836 Computes the SHA-256 message digest of a input data buffer.
1838 This function performs the SHA-256 message digest of a given data buffer, and places
1839 the digest value into the specified memory.
1841 If this interface is not supported, then return FALSE.
1843 @param[in] Data Pointer to the buffer containing the data to be hashed.
1844 @param[in] DataSize Size of Data buffer in bytes.
1845 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
1848 @retval TRUE SHA-256 digest computation succeeded.
1849 @retval FALSE SHA-256 digest computation failed.
1850 @retval FALSE This interface is not supported.
1855 (EFIAPI
*EDKII_CRYPTO_SHA256_HASH_ALL
) (
1856 IN CONST VOID
*Data
,
1858 OUT UINT8
*HashValue
1863 Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
1864 If this interface is not supported, then return zero.
1866 @return The size, in bytes, of the context buffer required for SHA-384 hash operations.
1867 @retval 0 This interface is not supported.
1872 (EFIAPI
*EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE
) (
1878 Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for
1881 If Sha384Context is NULL, then return FALSE.
1883 @param[out] Sha384Context Pointer to SHA-384 context being initialized.
1885 @retval TRUE SHA-384 context initialization succeeded.
1886 @retval FALSE SHA-384 context initialization failed.
1891 (EFIAPI
*EDKII_CRYPTO_SHA384_INIT
) (
1892 OUT VOID
*Sha384Context
1897 Makes a copy of an existing SHA-384 context.
1899 If Sha384Context is NULL, then return FALSE.
1900 If NewSha384Context is NULL, then return FALSE.
1901 If this interface is not supported, then return FALSE.
1903 @param[in] Sha384Context Pointer to SHA-384 context being copied.
1904 @param[out] NewSha384Context Pointer to new SHA-384 context.
1906 @retval TRUE SHA-384 context copy succeeded.
1907 @retval FALSE SHA-384 context copy failed.
1908 @retval FALSE This interface is not supported.
1913 (EFIAPI
*EDKII_CRYPTO_SHA384_DUPLICATE
) (
1914 IN CONST VOID
*Sha384Context
,
1915 OUT VOID
*NewSha384Context
1920 Digests the input data and updates SHA-384 context.
1922 This function performs SHA-384 digest on a data buffer of the specified size.
1923 It can be called multiple times to compute the digest of long or discontinuous data streams.
1924 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized
1925 by Sha384Final(). Behavior with invalid context is undefined.
1927 If Sha384Context is NULL, then return FALSE.
1929 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1930 @param[in] Data Pointer to the buffer containing the data to be hashed.
1931 @param[in] DataSize Size of Data buffer in bytes.
1933 @retval TRUE SHA-384 data digest succeeded.
1934 @retval FALSE SHA-384 data digest failed.
1939 (EFIAPI
*EDKII_CRYPTO_SHA384_UPDATE
) (
1940 IN OUT VOID
*Sha384Context
,
1941 IN CONST VOID
*Data
,
1947 Completes computation of the SHA-384 digest value.
1949 This function completes SHA-384 hash computation and retrieves the digest value into
1950 the specified memory. After this function has been called, the SHA-384 context cannot
1952 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be
1953 finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.
1955 If Sha384Context is NULL, then return FALSE.
1956 If HashValue is NULL, then return FALSE.
1958 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1959 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1962 @retval TRUE SHA-384 digest computation succeeded.
1963 @retval FALSE SHA-384 digest computation failed.
1968 (EFIAPI
*EDKII_CRYPTO_SHA384_FINAL
) (
1969 IN OUT VOID
*Sha384Context
,
1970 OUT UINT8
*HashValue
1975 Computes the SHA-384 message digest of a input data buffer.
1977 This function performs the SHA-384 message digest of a given data buffer, and places
1978 the digest value into the specified memory.
1980 If this interface is not supported, then return FALSE.
1982 @param[in] Data Pointer to the buffer containing the data to be hashed.
1983 @param[in] DataSize Size of Data buffer in bytes.
1984 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1987 @retval TRUE SHA-384 digest computation succeeded.
1988 @retval FALSE SHA-384 digest computation failed.
1989 @retval FALSE This interface is not supported.
1994 (EFIAPI
*EDKII_CRYPTO_SHA384_HASH_ALL
) (
1995 IN CONST VOID
*Data
,
1997 OUT UINT8
*HashValue
2001 Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.
2003 @return The size, in bytes, of the context buffer required for SHA-512 hash operations.
2008 (EFIAPI
*EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE
) (
2014 Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for
2017 If Sha512Context is NULL, then return FALSE.
2019 @param[out] Sha512Context Pointer to SHA-512 context being initialized.
2021 @retval TRUE SHA-512 context initialization succeeded.
2022 @retval FALSE SHA-512 context initialization failed.
2027 (EFIAPI
*EDKII_CRYPTO_SHA512_INIT
) (
2028 OUT VOID
*Sha512Context
2033 Makes a copy of an existing SHA-512 context.
2035 If Sha512Context is NULL, then return FALSE.
2036 If NewSha512Context is NULL, then return FALSE.
2037 If this interface is not supported, then return FALSE.
2039 @param[in] Sha512Context Pointer to SHA-512 context being copied.
2040 @param[out] NewSha512Context Pointer to new SHA-512 context.
2042 @retval TRUE SHA-512 context copy succeeded.
2043 @retval FALSE SHA-512 context copy failed.
2044 @retval FALSE This interface is not supported.
2049 (EFIAPI
*EDKII_CRYPTO_SHA512_DUPLICATE
) (
2050 IN CONST VOID
*Sha512Context
,
2051 OUT VOID
*NewSha512Context
2055 Digests the input data and updates SHA-512 context.
2057 This function performs SHA-512 digest on a data buffer of the specified size.
2058 It can be called multiple times to compute the digest of long or discontinuous data streams.
2059 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized
2060 by Sha512Final(). Behavior with invalid context is undefined.
2062 If Sha512Context is NULL, then return FALSE.
2064 @param[in, out] Sha512Context Pointer to the SHA-512 context.
2065 @param[in] Data Pointer to the buffer containing the data to be hashed.
2066 @param[in] DataSize Size of Data buffer in bytes.
2068 @retval TRUE SHA-512 data digest succeeded.
2069 @retval FALSE SHA-512 data digest failed.
2074 (EFIAPI
*EDKII_CRYPTO_SHA512_UPDATE
) (
2075 IN OUT VOID
*Sha512Context
,
2076 IN CONST VOID
*Data
,
2082 Completes computation of the SHA-512 digest value.
2084 This function completes SHA-512 hash computation and retrieves the digest value into
2085 the specified memory. After this function has been called, the SHA-512 context cannot
2087 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be
2088 finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.
2090 If Sha512Context is NULL, then return FALSE.
2091 If HashValue is NULL, then return FALSE.
2093 @param[in, out] Sha512Context Pointer to the SHA-512 context.
2094 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
2097 @retval TRUE SHA-512 digest computation succeeded.
2098 @retval FALSE SHA-512 digest computation failed.
2103 (EFIAPI
*EDKII_CRYPTO_SHA512_FINAL
) (
2104 IN OUT VOID
*Sha512Context
,
2105 OUT UINT8
*HashValue
2109 Computes the SHA-512 message digest of a input data buffer.
2111 This function performs the SHA-512 message digest of a given data buffer, and places
2112 the digest value into the specified memory.
2114 If this interface is not supported, then return FALSE.
2116 @param[in] Data Pointer to the buffer containing the data to be hashed.
2117 @param[in] DataSize Size of Data buffer in bytes.
2118 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
2121 @retval TRUE SHA-512 digest computation succeeded.
2122 @retval FALSE SHA-512 digest computation failed.
2123 @retval FALSE This interface is not supported.
2128 (EFIAPI
*EDKII_CRYPTO_SHA512_HASH_ALL
) (
2129 IN CONST VOID
*Data
,
2131 OUT UINT8
*HashValue
2134 //----------------------------------------------------------------------------
2136 //----------------------------------------------------------------------------
2139 Retrieve the subject bytes from one X.509 certificate.
2141 If Cert is NULL, then return FALSE.
2142 If SubjectSize is NULL, then return FALSE.
2143 If this interface is not supported, then return FALSE.
2145 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2146 @param[in] CertSize Size of the X509 certificate in bytes.
2147 @param[out] CertSubject Pointer to the retrieved certificate subject bytes.
2148 @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,
2149 and the size of buffer returned CertSubject on output.
2151 @retval TRUE The certificate subject retrieved successfully.
2152 @retval FALSE Invalid certificate, or the SubjectSize is too small for the result.
2153 The SubjectSize will be updated with the required size.
2154 @retval FALSE This interface is not supported.
2159 (EFIAPI
*EDKII_CRYPTO_X509_GET_SUBJECT_NAME
) (
2160 IN CONST UINT8
*Cert
,
2162 OUT UINT8
*CertSubject
,
2163 IN OUT UINTN
*SubjectSize
2167 Retrieve the common name (CN) string from one X.509 certificate.
2169 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2170 @param[in] CertSize Size of the X509 certificate in bytes.
2171 @param[out] CommonName Buffer to contain the retrieved certificate common
2172 name string (UTF8). At most CommonNameSize bytes will be
2173 written and the string will be null terminated. May be
2174 NULL in order to determine the size buffer needed.
2175 @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,
2176 and the size of buffer returned CommonName on output.
2177 If CommonName is NULL then the amount of space needed
2178 in buffer (including the final null) is returned.
2180 @retval RETURN_SUCCESS The certificate CommonName retrieved successfully.
2181 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
2182 If CommonNameSize is NULL.
2183 If CommonName is not NULL and *CommonNameSize is 0.
2184 If Certificate is invalid.
2185 @retval RETURN_NOT_FOUND If no CommonName entry exists.
2186 @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size
2187 (including the final null) is returned in the
2188 CommonNameSize parameter.
2189 @retval RETURN_UNSUPPORTED The operation is not supported.
2194 (EFIAPI
*EDKII_CRYPTO_X509_GET_COMMON_NAME
) (
2195 IN CONST UINT8
*Cert
,
2197 OUT CHAR8
*CommonName
, OPTIONAL
2198 IN OUT UINTN
*CommonNameSize
2202 Retrieve the organization name (O) string from one X.509 certificate.
2204 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2205 @param[in] CertSize Size of the X509 certificate in bytes.
2206 @param[out] NameBuffer Buffer to contain the retrieved certificate organization
2207 name string. At most NameBufferSize bytes will be
2208 written and the string will be null terminated. May be
2209 NULL in order to determine the size buffer needed.
2210 @param[in,out] NameBufferSiz e The size in bytes of the Name buffer on input,
2211 and the size of buffer returned Name on output.
2212 If NameBuffer is NULL then the amount of space needed
2213 in buffer (including the final null) is returned.
2215 @retval RETURN_SUCCESS The certificate Organization Name retrieved successfully.
2216 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
2217 If NameBufferSize is NULL.
2218 If NameBuffer is not NULL and *CommonNameSize is 0.
2219 If Certificate is invalid.
2220 @retval RETURN_NOT_FOUND If no Organization Name entry exists.
2221 @retval RETURN_BUFFER_TOO_SMALL If the NameBuffer is NULL. The required buffer size
2222 (including the final null) is returned in the
2223 CommonNameSize parameter.
2224 @retval RETURN_UNSUPPORTED The operation is not supported.
2229 (EFIAPI
*EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME
) (
2230 IN CONST UINT8
*Cert
,
2232 OUT CHAR8
*NameBuffer
, OPTIONAL
2233 IN OUT UINTN
*NameBufferSize
2237 Verify one X509 certificate was issued by the trusted CA.
2239 If Cert is NULL, then return FALSE.
2240 If CACert is NULL, then return FALSE.
2241 If this interface is not supported, then return FALSE.
2243 @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.
2244 @param[in] CertSize Size of the X509 certificate in bytes.
2245 @param[in] CACert Pointer to the DER-encoded trusted CA certificate.
2246 @param[in] CACertSize Size of the CA Certificate in bytes.
2248 @retval TRUE The certificate was issued by the trusted CA.
2249 @retval FALSE Invalid certificate or the certificate was not issued by the given
2251 @retval FALSE This interface is not supported.
2256 (EFIAPI
*EDKII_CRYPTO_X509_VERIFY_CERT
) (
2257 IN CONST UINT8
*Cert
,
2259 IN CONST UINT8
*CACert
,
2264 Construct a X509 object from DER-encoded certificate data.
2266 If Cert is NULL, then return FALSE.
2267 If SingleX509Cert is NULL, then return FALSE.
2268 If this interface is not supported, then return FALSE.
2270 @param[in] Cert Pointer to the DER-encoded certificate data.
2271 @param[in] CertSize The size of certificate data in bytes.
2272 @param[out] SingleX509Cert The generated X509 object.
2274 @retval TRUE The X509 object generation succeeded.
2275 @retval FALSE The operation failed.
2276 @retval FALSE This interface is not supported.
2281 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE
) (
2282 IN CONST UINT8
*Cert
,
2284 OUT UINT8
**SingleX509Cert
2288 Construct a X509 stack object from a list of DER-encoded certificate data.
2290 If X509Stack is NULL, then return FALSE.
2291 If this interface is not supported, then return FALSE.
2293 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2294 On output, pointer to the X509 stack object with new
2295 inserted X509 certificate.
2296 @param ... A list of DER-encoded single certificate data followed
2297 by certificate size. A NULL terminates the list. The
2298 pairs are the arguments to X509ConstructCertificate().
2300 @retval TRUE The X509 stack construction succeeded.
2301 @retval FALSE The construction operation failed.
2302 @retval FALSE This interface is not supported.
2307 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK
) (
2308 IN OUT UINT8
**X509Stack
,
2313 Construct a X509 stack object from a list of DER-encoded certificate data.
2315 If X509Stack is NULL, then return FALSE.
2316 If this interface is not supported, then return FALSE.
2318 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2319 On output, pointer to the X509 stack object with new
2320 inserted X509 certificate.
2321 @param[in] Args VA_LIST marker for the variable argument list.
2322 A list of DER-encoded single certificate data followed
2323 by certificate size. A NULL terminates the list. The
2324 pairs are the arguments to X509ConstructCertificate().
2326 @retval TRUE The X509 stack construction succeeded.
2327 @retval FALSE The construction operation failed.
2328 @retval FALSE This interface is not supported.
2333 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V
) (
2334 IN OUT UINT8
**X509Stack
,
2339 Release the specified X509 object.
2341 If the interface is not supported, then ASSERT().
2343 @param[in] X509Cert Pointer to the X509 object to be released.
2348 (EFIAPI
*EDKII_CRYPTO_X509_FREE
) (
2353 Release the specified X509 stack object.
2355 If the interface is not supported, then ASSERT().
2357 @param[in] X509Stack Pointer to the X509 stack object to be released.
2362 (EFIAPI
*EDKII_CRYPTO_X509_STACK_FREE
) (
2367 Retrieve the TBSCertificate from one given X.509 certificate.
2369 @param[in] Cert Pointer to the given DER-encoded X509 certificate.
2370 @param[in] CertSize Size of the X509 certificate in bytes.
2371 @param[out] TBSCert DER-Encoded To-Be-Signed certificate.
2372 @param[out] TBSCertSize Size of the TBS certificate in bytes.
2374 If Cert is NULL, then return FALSE.
2375 If TBSCert is NULL, then return FALSE.
2376 If TBSCertSize is NULL, then return FALSE.
2377 If this interface is not supported, then return FALSE.
2379 @retval TRUE The TBSCertificate was retrieved successfully.
2380 @retval FALSE Invalid X.509 certificate.
2385 (EFIAPI
*EDKII_CRYPTO_X509_GET_TBS_CERT
) (
2386 IN CONST UINT8
*Cert
,
2388 OUT UINT8
**TBSCert
,
2389 OUT UINTN
*TBSCertSize
2394 //=====================================================================================
2395 // Symmetric Cryptography Primitive
2396 //=====================================================================================
2399 TDES is deprecated and unsupported any longer.
2400 Keep the function field for binary compability.
2405 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE
) (
2411 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_INIT
) (
2412 OUT VOID
*TdesContext
,
2413 IN CONST UINT8
*Key
,
2419 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT
) (
2420 IN VOID
*TdesContext
,
2421 IN CONST UINT8
*Input
,
2428 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT
) (
2429 IN VOID
*TdesContext
,
2430 IN CONST UINT8
*Input
,
2437 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT
) (
2438 IN VOID
*TdesContext
,
2439 IN CONST UINT8
*Input
,
2441 IN CONST UINT8
*Ivec
,
2447 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT
) (
2448 IN VOID
*TdesContext
,
2449 IN CONST UINT8
*Input
,
2451 IN CONST UINT8
*Ivec
,
2456 Retrieves the size, in bytes, of the context buffer required for AES operations.
2458 If this interface is not supported, then return zero.
2460 @return The size, in bytes, of the context buffer required for AES operations.
2461 @retval 0 This interface is not supported.
2466 (EFIAPI
*EDKII_CRYPTO_AES_GET_CONTEXT_SIZE
) (
2471 Initializes user-supplied memory as AES context for subsequent use.
2473 This function initializes user-supplied memory pointed by AesContext as AES context.
2474 In addition, it sets up all AES key materials for subsequent encryption and decryption
2476 There are 3 options for key length, 128 bits, 192 bits, and 256 bits.
2478 If AesContext is NULL, then return FALSE.
2479 If Key is NULL, then return FALSE.
2480 If KeyLength is not valid, then return FALSE.
2481 If this interface is not supported, then return FALSE.
2483 @param[out] AesContext Pointer to AES context being initialized.
2484 @param[in] Key Pointer to the user-supplied AES key.
2485 @param[in] KeyLength Length of AES key in bits.
2487 @retval TRUE AES context initialization succeeded.
2488 @retval FALSE AES context initialization failed.
2489 @retval FALSE This interface is not supported.
2494 (EFIAPI
*EDKII_CRYPTO_AES_INIT
) (
2495 OUT VOID
*AesContext
,
2496 IN CONST UINT8
*Key
,
2501 AES ECB Mode is deprecated and unsupported any longer.
2502 Keep the function field for binary compability.
2507 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT
) (
2508 IN VOID
*AesContext
,
2509 IN CONST UINT8
*Input
,
2516 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT
) (
2517 IN VOID
*AesContext
,
2518 IN CONST UINT8
*Input
,
2524 Performs AES encryption on a data buffer of the specified size in CBC mode.
2526 This function performs AES encryption on data buffer pointed by Input, of specified
2527 size of InputSize, in CBC mode.
2528 InputSize must be multiple of block size (16 bytes). This function does not perform
2529 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2530 Initialization vector should be one block size (16 bytes).
2531 AesContext should be already correctly initialized by AesInit(). Behavior with
2532 invalid AES context is undefined.
2534 If AesContext is NULL, then return FALSE.
2535 If Input is NULL, then return FALSE.
2536 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2537 If Ivec is NULL, then return FALSE.
2538 If Output is NULL, then return FALSE.
2539 If this interface is not supported, then return FALSE.
2541 @param[in] AesContext Pointer to the AES context.
2542 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2543 @param[in] InputSize Size of the Input buffer in bytes.
2544 @param[in] Ivec Pointer to initialization vector.
2545 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2547 @retval TRUE AES encryption succeeded.
2548 @retval FALSE AES encryption failed.
2549 @retval FALSE This interface is not supported.
2554 (EFIAPI
*EDKII_CRYPTO_AES_CBC_ENCRYPT
) (
2555 IN VOID
*AesContext
,
2556 IN CONST UINT8
*Input
,
2558 IN CONST UINT8
*Ivec
,
2563 Performs AES decryption on a data buffer of the specified size in CBC mode.
2565 This function performs AES decryption on data buffer pointed by Input, of specified
2566 size of InputSize, in CBC mode.
2567 InputSize must be multiple of block size (16 bytes). This function does not perform
2568 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2569 Initialization vector should be one block size (16 bytes).
2570 AesContext should be already correctly initialized by AesInit(). Behavior with
2571 invalid AES context is undefined.
2573 If AesContext is NULL, then return FALSE.
2574 If Input is NULL, then return FALSE.
2575 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2576 If Ivec is NULL, then return FALSE.
2577 If Output is NULL, then return FALSE.
2578 If this interface is not supported, then return FALSE.
2580 @param[in] AesContext Pointer to the AES context.
2581 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2582 @param[in] InputSize Size of the Input buffer in bytes.
2583 @param[in] Ivec Pointer to initialization vector.
2584 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2586 @retval TRUE AES decryption succeeded.
2587 @retval FALSE AES decryption failed.
2588 @retval FALSE This interface is not supported.
2593 (EFIAPI
*EDKII_CRYPTO_AES_CBC_DECRYPT
) (
2594 IN VOID
*AesContext
,
2595 IN CONST UINT8
*Input
,
2597 IN CONST UINT8
*Ivec
,
2602 ARC4 is deprecated and unsupported any longer.
2603 Keep the function field for binary compability.
2608 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE
) (
2614 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_INIT
) (
2615 OUT VOID
*Arc4Context
,
2616 IN CONST UINT8
*Key
,
2622 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT
) (
2623 IN OUT VOID
*Arc4Context
,
2624 IN CONST UINT8
*Input
,
2631 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT
) (
2632 IN OUT VOID
*Arc4Context
,
2640 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_RESET
) (
2641 IN OUT VOID
*Arc4Context
2646 Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
2648 If this interface is not supported, then return zero.
2650 @return The size, in bytes, of the context buffer required for SM3 hash operations.
2651 @retval 0 This interface is not supported.
2656 (EFIAPI
* EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE
)(
2661 Initializes user-supplied memory pointed by Sm3Context as SM3 hash context for
2664 If Sm3Context is NULL, then return FALSE.
2665 If this interface is not supported, then return FALSE.
2667 @param[out] Sm3Context Pointer to SM3 context being initialized.
2669 @retval TRUE SM3 context initialization succeeded.
2670 @retval FALSE SM3 context initialization failed.
2671 @retval FALSE This interface is not supported.
2676 (EFIAPI
* EDKII_CRYPTO_SM3_INIT
)(
2677 OUT VOID
*Sm3Context
);
2680 Makes a copy of an existing SM3 context.
2682 If Sm3Context is NULL, then return FALSE.
2683 If NewSm3Context is NULL, then return FALSE.
2684 If this interface is not supported, then return FALSE.
2686 @param[in] Sm3Context Pointer to SM3 context being copied.
2687 @param[out] NewSm3Context Pointer to new SM3 context.
2689 @retval TRUE SM3 context copy succeeded.
2690 @retval FALSE SM3 context copy failed.
2691 @retval FALSE This interface is not supported.
2696 (EFIAPI
* EDKII_CRYPTO_SM3_DUPLICATE
) (
2697 IN CONST VOID
*Sm3Context
,
2698 OUT VOID
*NewSm3Context
);
2702 Digests the input data and updates SM3 context.
2704 This function performs SM3 digest on a data buffer of the specified size.
2705 It can be called multiple times to compute the digest of long or discontinuous data streams.
2706 SM3 context should be already correctly initialized by Sm3Init(), and should not be finalized
2707 by Sm3Final(). Behavior with invalid context is undefined.
2709 If Sm3Context is NULL, then return FALSE.
2710 If this interface is not supported, then return FALSE.
2712 @param[in, out] Sm3Context Pointer to the SM3 context.
2713 @param[in] Data Pointer to the buffer containing the data to be hashed.
2714 @param[in] DataSize Size of Data buffer in bytes.
2716 @retval TRUE SM3 data digest succeeded.
2717 @retval FALSE SM3 data digest failed.
2718 @retval FALSE This interface is not supported.
2723 (EFIAPI
* EDKII_CRYPTO_SM3_UPDATE
)(
2724 IN OUT VOID
*Sm3Context
,
2725 IN CONST VOID
*Data
,
2730 Completes computation of the SM3 digest value.
2732 This function completes SM3 hash computation and retrieves the digest value into
2733 the specified memory. After this function has been called, the SM3 context cannot
2735 SM3 context should be already correctly initialized by Sm3Init(), and should not be
2736 finalized by Sm3Final(). Behavior with invalid SM3 context is undefined.
2738 If Sm3Context is NULL, then return FALSE.
2739 If HashValue is NULL, then return FALSE.
2740 If this interface is not supported, then return FALSE.
2742 @param[in, out] Sm3Context Pointer to the SM3 context.
2743 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
2746 @retval TRUE SM3 digest computation succeeded.
2747 @retval FALSE SM3 digest computation failed.
2748 @retval FALSE This interface is not supported.
2753 (EFIAPI
* EDKII_CRYPTO_SM3_FINAL
)(
2754 IN OUT VOID
*Sm3Context
,
2755 OUT UINT8
*HashValue
);
2759 Computes the SM3 message digest of a input data buffer.
2761 This function performs the SM3 message digest of a given data buffer, and places
2762 the digest value into the specified memory.
2764 If this interface is not supported, then return FALSE.
2766 @param[in] Data Pointer to the buffer containing the data to be hashed.
2767 @param[in] DataSize Size of Data buffer in bytes.
2768 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
2771 @retval TRUE SM3 digest computation succeeded.
2772 @retval FALSE SM3 digest computation failed.
2773 @retval FALSE This interface is not supported.
2778 (EFIAPI
* EDKII_CRYPTO_SM3_HASH_ALL
)(
2779 IN CONST VOID
*Data
,
2781 OUT UINT8
*HashValue
);
2785 Derive key data using HMAC-SHA256 based KDF.
2787 @param[in] Key Pointer to the user-supplied key.
2788 @param[in] KeySize Key size in bytes.
2789 @param[in] Salt Pointer to the salt(non-secret) value.
2790 @param[in] SaltSize Salt size in bytes.
2791 @param[in] Info Pointer to the application specific info.
2792 @param[in] InfoSize Info size in bytes.
2793 @param[out] Out Pointer to buffer to receive hkdf value.
2794 @param[in] OutSize Size of hkdf bytes to generate.
2796 @retval TRUE Hkdf generated successfully.
2797 @retval FALSE Hkdf generation failed.
2802 (EFIAPI
* EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND
)(
2803 IN CONST UINT8
*Key
,
2805 IN CONST UINT8
*Salt
,
2807 IN CONST UINT8
*Info
,
2814 Initializes the OpenSSL library.
2816 This function registers ciphers and digests used directly and indirectly
2817 by SSL/TLS, and initializes the readable error messages.
2818 This function must be called before any other action takes places.
2820 @retval TRUE The OpenSSL library has been initialized.
2821 @retval FALSE Failed to initialize the OpenSSL library.
2826 (EFIAPI
* EDKII_CRYPTO_TLS_INITIALIZE
)(
2831 Free an allocated SSL_CTX object.
2833 @param[in] TlsCtx Pointer to the SSL_CTX object to be released.
2838 (EFIAPI
* EDKII_CRYPTO_TLS_CTX_FREE
)(
2843 Creates a new SSL_CTX object as framework to establish TLS/SSL enabled
2846 @param[in] MajorVer Major Version of TLS/SSL Protocol.
2847 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
2849 @return Pointer to an allocated SSL_CTX object.
2850 If the creation failed, TlsCtxNew() returns NULL.
2855 (EFIAPI
* EDKII_CRYPTO_TLS_CTX_NEW
)(
2861 Free an allocated TLS object.
2863 This function removes the TLS object pointed to by Tls and frees up the
2864 allocated memory. If Tls is NULL, nothing is done.
2866 @param[in] Tls Pointer to the TLS object to be freed.
2871 (EFIAPI
* EDKII_CRYPTO_TLS_FREE
)(
2876 Create a new TLS object for a connection.
2878 This function creates a new TLS object for a connection. The new object
2879 inherits the setting of the underlying context TlsCtx: connection method,
2880 options, verification setting.
2882 @param[in] TlsCtx Pointer to the SSL_CTX object.
2884 @return Pointer to an allocated SSL object.
2885 If the creation failed, TlsNew() returns NULL.
2890 (EFIAPI
* EDKII_CRYPTO_TLS_NEW
)(
2895 Checks if the TLS handshake was done.
2897 This function will check if the specified TLS handshake was done.
2899 @param[in] Tls Pointer to the TLS object for handshake state checking.
2901 @retval TRUE The TLS handshake was done.
2902 @retval FALSE The TLS handshake was not done.
2907 (EFIAPI
* EDKII_CRYPTO_TLS_IN_HANDSHAKE
)(
2912 Perform a TLS/SSL handshake.
2914 This function will perform a TLS/SSL handshake.
2916 @param[in] Tls Pointer to the TLS object for handshake operation.
2917 @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.
2918 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
2920 @param[out] BufferOut Pointer to the buffer to hold the built packet.
2921 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
2922 the buffer size provided by the caller. On output, it
2923 is the buffer size in fact needed to contain the
2926 @retval EFI_SUCCESS The required TLS packet is built successfully.
2927 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2929 BufferIn is NULL but BufferInSize is NOT 0.
2930 BufferInSize is 0 but BufferIn is NOT NULL.
2931 BufferOutSize is NULL.
2932 BufferOut is NULL if *BufferOutSize is not zero.
2933 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
2934 @retval EFI_ABORTED Something wrong during handshake.
2939 (EFIAPI
* EDKII_CRYPTO_TLS_DO_HANDSHAKE
)(
2941 IN UINT8
*BufferIn
, OPTIONAL
2942 IN UINTN BufferInSize
, OPTIONAL
2943 OUT UINT8
*BufferOut
, OPTIONAL
2944 IN OUT UINTN
*BufferOutSize
2948 Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,
2949 TLS session has errors and the response packet needs to be Alert message based on error type.
2951 @param[in] Tls Pointer to the TLS object for state checking.
2952 @param[in] BufferIn Pointer to the most recently received TLS Alert packet.
2953 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
2955 @param[out] BufferOut Pointer to the buffer to hold the built packet.
2956 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
2957 the buffer size provided by the caller. On output, it
2958 is the buffer size in fact needed to contain the
2961 @retval EFI_SUCCESS The required TLS packet is built successfully.
2962 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2964 BufferIn is NULL but BufferInSize is NOT 0.
2965 BufferInSize is 0 but BufferIn is NOT NULL.
2966 BufferOutSize is NULL.
2967 BufferOut is NULL if *BufferOutSize is not zero.
2968 @retval EFI_ABORTED An error occurred.
2969 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
2974 (EFIAPI
* EDKII_CRYPTO_TLS_HANDLE_ALERT
)(
2976 IN UINT8
*BufferIn
, OPTIONAL
2977 IN UINTN BufferInSize
, OPTIONAL
2978 OUT UINT8
*BufferOut
, OPTIONAL
2979 IN OUT UINTN
*BufferOutSize
2983 Build the CloseNotify packet.
2985 @param[in] Tls Pointer to the TLS object for state checking.
2986 @param[in, out] Buffer Pointer to the buffer to hold the built packet.
2987 @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is
2988 the buffer size provided by the caller. On output, it
2989 is the buffer size in fact needed to contain the
2992 @retval EFI_SUCCESS The required TLS packet is built successfully.
2993 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2996 Buffer is NULL if *BufferSize is not zero.
2997 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.
3002 (EFIAPI
* EDKII_CRYPTO_TLS_CLOSE_NOTIFY
)(
3004 IN OUT UINT8
*Buffer
,
3005 IN OUT UINTN
*BufferSize
3009 Attempts to read bytes from one TLS object and places the data in Buffer.
3011 This function will attempt to read BufferSize bytes from the TLS object
3012 and places the data in Buffer.
3014 @param[in] Tls Pointer to the TLS object.
3015 @param[in,out] Buffer Pointer to the buffer to store the data.
3016 @param[in] BufferSize The size of Buffer in bytes.
3018 @retval >0 The amount of data successfully read from the TLS object.
3019 @retval <=0 No data was successfully read.
3024 (EFIAPI
* EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT
)(
3026 IN OUT VOID
*Buffer
,
3031 Attempts to write data from the buffer to TLS object.
3033 This function will attempt to write BufferSize bytes data from the Buffer
3036 @param[in] Tls Pointer to the TLS object.
3037 @param[in] Buffer Pointer to the data buffer.
3038 @param[in] BufferSize The size of Buffer in bytes.
3040 @retval >0 The amount of data successfully written to the TLS object.
3041 @retval <=0 No data was successfully written.
3046 (EFIAPI
* EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN
)(
3053 Attempts to read bytes from the specified TLS connection into the buffer.
3055 This function tries to read BufferSize bytes data from the specified TLS
3056 connection into the Buffer.
3058 @param[in] Tls Pointer to the TLS connection for data reading.
3059 @param[in,out] Buffer Pointer to the data buffer.
3060 @param[in] BufferSize The size of Buffer in bytes.
3062 @retval >0 The read operation was successful, and return value is the
3063 number of bytes actually read from the TLS connection.
3064 @retval <=0 The read operation was not successful.
3069 (EFIAPI
* EDKII_CRYPTO_TLS_READ
)(
3071 IN OUT VOID
*Buffer
,
3076 Attempts to write data to a TLS connection.
3078 This function tries to write BufferSize bytes data from the Buffer into the
3079 specified TLS connection.
3081 @param[in] Tls Pointer to the TLS connection for data writing.
3082 @param[in] Buffer Pointer to the data buffer.
3083 @param[in] BufferSize The size of Buffer in bytes.
3085 @retval >0 The write operation was successful, and return value is the
3086 number of bytes actually written to the TLS connection.
3087 @retval <=0 The write operation was not successful.
3092 (EFIAPI
* EDKII_CRYPTO_TLS_WRITE
)(
3099 Set a new TLS/SSL method for a particular TLS object.
3101 This function sets a new TLS/SSL method for a particular TLS object.
3103 @param[in] Tls Pointer to a TLS object.
3104 @param[in] MajorVer Major Version of TLS/SSL Protocol.
3105 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
3107 @retval EFI_SUCCESS The TLS/SSL method was set successfully.
3108 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3109 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.
3114 (EFIAPI
* EDKII_CRYPTO_TLS_SET_VERSION
)(
3121 Set TLS object to work in client or server mode.
3123 This function prepares a TLS object to work in client or server mode.
3125 @param[in] Tls Pointer to a TLS object.
3126 @param[in] IsServer Work in server mode.
3128 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.
3129 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3130 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.
3135 (EFIAPI
* EDKII_CRYPTO_TLS_SET_CONNECTION_END
)(
3141 Set the ciphers list to be used by the TLS object.
3143 This function sets the ciphers for use by a specified TLS object.
3145 @param[in] Tls Pointer to a TLS object.
3146 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16
3147 cipher identifier comes from the TLS Cipher Suite
3148 Registry of the IANA, interpreting Byte1 and Byte2
3149 in network (big endian) byte order.
3150 @param[in] CipherNum The number of cipher in the list.
3152 @retval EFI_SUCCESS The ciphers list was set successfully.
3153 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3154 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.
3155 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
3160 (EFIAPI
* EDKII_CRYPTO_TLS_SET_CIPHER_LIST
)(
3162 IN UINT16
*CipherId
,
3167 Set the compression method for TLS/SSL operations.
3169 This function handles TLS/SSL integrated compression methods.
3171 @param[in] CompMethod The compression method ID.
3173 @retval EFI_SUCCESS The compression method for the communication was
3175 @retval EFI_UNSUPPORTED Unsupported compression method.
3180 (EFIAPI
* EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD
)(
3185 Set peer certificate verification mode for the TLS connection.
3187 This function sets the verification mode flags for the TLS connection.
3189 @param[in] Tls Pointer to the TLS object.
3190 @param[in] VerifyMode A set of logically or'ed verification mode flags.
3195 (EFIAPI
* EDKII_CRYPTO_TLS_SET_VERIFY
)(
3197 IN UINT32 VerifyMode
3201 Set the specified host name to be verified.
3203 @param[in] Tls Pointer to the TLS object.
3204 @param[in] Flags The setting flags during the validation.
3205 @param[in] HostName The specified host name to be verified.
3207 @retval EFI_SUCCESS The HostName setting was set successfully.
3208 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3209 @retval EFI_ABORTED Invalid HostName setting.
3214 (EFIAPI
* EDKII_CRYPTO_TLS_SET_VERIFY_HOST
)(
3221 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
3223 This function sets a session ID to be used when the TLS/SSL connection is
3226 @param[in] Tls Pointer to the TLS object.
3227 @param[in] SessionId Session ID data used for session resumption.
3228 @param[in] SessionIdLen Length of Session ID in bytes.
3230 @retval EFI_SUCCESS Session ID was set successfully.
3231 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3232 @retval EFI_UNSUPPORTED No available session for ID setting.
3237 (EFIAPI
* EDKII_CRYPTO_TLS_SET_SESSIONID
)(
3239 IN UINT8
*SessionId
,
3240 IN UINT16 SessionIdLen
3244 Adds the CA to the cert store when requesting Server or Client authentication.
3246 This function adds the CA certificate to the list of CAs when requesting
3247 Server or Client authentication for the chosen TLS connection.
3249 @param[in] Tls Pointer to the TLS object.
3250 @param[in] Data Pointer to the data buffer of a DER-encoded binary
3251 X.509 certificate or PEM-encoded X.509 certificate.
3252 @param[in] DataSize The size of data buffer in bytes.
3254 @retval EFI_SUCCESS The operation succeeded.
3255 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3256 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
3257 @retval EFI_ABORTED Invalid X.509 certificate.
3262 (EFIAPI
* EDKII_CRYPTO_TLS_SET_CA_CERTIFICATE
)(
3269 Loads the local public certificate into the specified TLS object.
3271 This function loads the X.509 certificate into the specified TLS object
3272 for TLS negotiation.
3274 @param[in] Tls Pointer to the TLS object.
3275 @param[in] Data Pointer to the data buffer of a DER-encoded binary
3276 X.509 certificate or PEM-encoded X.509 certificate.
3277 @param[in] DataSize The size of data buffer in bytes.
3279 @retval EFI_SUCCESS The operation succeeded.
3280 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3281 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
3282 @retval EFI_ABORTED Invalid X.509 certificate.
3287 (EFIAPI
* EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT
)(
3294 Adds the local private key to the specified TLS object.
3296 This function adds the local private key (PEM-encoded RSA or PKCS#8 private
3297 key) into the specified TLS object for TLS negotiation.
3299 @param[in] Tls Pointer to the TLS object.
3300 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA
3301 or PKCS#8 private key.
3302 @param[in] DataSize The size of data buffer in bytes.
3304 @retval EFI_SUCCESS The operation succeeded.
3305 @retval EFI_UNSUPPORTED This function is not supported.
3306 @retval EFI_ABORTED Invalid private key data.
3311 (EFIAPI
* EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY
)(
3318 Adds the CA-supplied certificate revocation list for certificate validation.
3320 This function adds the CA-supplied certificate revocation list data for
3321 certificate validity checking.
3323 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
3324 @param[in] DataSize The size of data buffer in bytes.
3326 @retval EFI_SUCCESS The operation succeeded.
3327 @retval EFI_UNSUPPORTED This function is not supported.
3328 @retval EFI_ABORTED Invalid CRL data.
3333 (EFIAPI
* EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST
)(
3339 Gets the protocol version used by the specified TLS connection.
3341 This function returns the protocol version used by the specified TLS
3344 If Tls is NULL, then ASSERT().
3346 @param[in] Tls Pointer to the TLS object.
3348 @return The protocol version of the specified TLS connection.
3353 (EFIAPI
* EDKII_CRYPTO_TLS_GET_VERSION
)(
3358 Gets the connection end of the specified TLS connection.
3360 This function returns the connection end (as client or as server) used by
3361 the specified TLS connection.
3363 If Tls is NULL, then ASSERT().
3365 @param[in] Tls Pointer to the TLS object.
3367 @return The connection end used by the specified TLS connection.
3372 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CONNECTION_END
)(
3377 Gets the cipher suite used by the specified TLS connection.
3379 This function returns current cipher suite used by the specified
3382 @param[in] Tls Pointer to the TLS object.
3383 @param[in,out] CipherId The cipher suite used by the TLS object.
3385 @retval EFI_SUCCESS The cipher suite was returned successfully.
3386 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3387 @retval EFI_UNSUPPORTED Unsupported cipher suite.
3392 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER
)(
3394 IN OUT UINT16
*CipherId
3398 Gets the compression methods used by the specified TLS connection.
3400 This function returns current integrated compression methods used by
3401 the specified TLS connection.
3403 @param[in] Tls Pointer to the TLS object.
3404 @param[in,out] CompressionId The current compression method used by
3407 @retval EFI_SUCCESS The compression method was returned successfully.
3408 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3409 @retval EFI_ABORTED Invalid Compression method.
3410 @retval EFI_UNSUPPORTED This function is not supported.
3415 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID
)(
3417 IN OUT UINT8
*CompressionId
3421 Gets the verification mode currently set in the TLS connection.
3423 This function returns the peer verification mode currently set in the
3424 specified TLS connection.
3426 If Tls is NULL, then ASSERT().
3428 @param[in] Tls Pointer to the TLS object.
3430 @return The verification mode set in the specified TLS connection.
3435 (EFIAPI
* EDKII_CRYPTO_TLS_GET_VERIFY
)(
3440 Gets the session ID used by the specified TLS connection.
3442 This function returns the TLS/SSL session ID currently used by the
3443 specified TLS connection.
3445 @param[in] Tls Pointer to the TLS object.
3446 @param[in,out] SessionId Buffer to contain the returned session ID.
3447 @param[in,out] SessionIdLen The length of Session ID in bytes.
3449 @retval EFI_SUCCESS The Session ID was returned successfully.
3450 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3451 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
3456 (EFIAPI
* EDKII_CRYPTO_TLS_GET_SESSION_ID
)(
3458 IN OUT UINT8
*SessionId
,
3459 IN OUT UINT16
*SessionIdLen
3463 Gets the client random data used in the specified TLS connection.
3465 This function returns the TLS/SSL client random data currently used in
3466 the specified TLS connection.
3468 @param[in] Tls Pointer to the TLS object.
3469 @param[in,out] ClientRandom Buffer to contain the returned client
3470 random data (32 bytes).
3475 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM
)(
3477 IN OUT UINT8
*ClientRandom
3481 Gets the server random data used in the specified TLS connection.
3483 This function returns the TLS/SSL server random data currently used in
3484 the specified TLS connection.
3486 @param[in] Tls Pointer to the TLS object.
3487 @param[in,out] ServerRandom Buffer to contain the returned server
3488 random data (32 bytes).
3493 (EFIAPI
* EDKII_CRYPTO_TLS_GET_SERVER_RANDOM
)(
3495 IN OUT UINT8
*ServerRandom
3499 Gets the master key data used in the specified TLS connection.
3501 This function returns the TLS/SSL master key material currently used in
3502 the specified TLS connection.
3504 @param[in] Tls Pointer to the TLS object.
3505 @param[in,out] KeyMaterial Buffer to contain the returned key material.
3507 @retval EFI_SUCCESS Key material was returned successfully.
3508 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3509 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
3514 (EFIAPI
* EDKII_CRYPTO_TLS_GET_KEY_MATERIAL
)(
3516 IN OUT UINT8
*KeyMaterial
3520 Gets the CA Certificate from the cert store.
3522 This function returns the CA certificate for the chosen
3525 @param[in] Tls Pointer to the TLS object.
3526 @param[out] Data Pointer to the data buffer to receive the CA
3527 certificate data sent to the client.
3528 @param[in,out] DataSize The size of data buffer in bytes.
3530 @retval EFI_SUCCESS The operation succeeded.
3531 @retval EFI_UNSUPPORTED This function is not supported.
3532 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3537 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE
)(
3540 IN OUT UINTN
*DataSize
3544 Gets the local public Certificate set in the specified TLS object.
3546 This function returns the local public certificate which was currently set
3547 in the specified TLS object.
3549 @param[in] Tls Pointer to the TLS object.
3550 @param[out] Data Pointer to the data buffer to receive the local
3552 @param[in,out] DataSize The size of data buffer in bytes.
3554 @retval EFI_SUCCESS The operation succeeded.
3555 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3556 @retval EFI_NOT_FOUND The certificate is not found.
3557 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3562 (EFIAPI
* EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT
)(
3565 IN OUT UINTN
*DataSize
3569 Gets the local private key set in the specified TLS object.
3571 This function returns the local private key data which was currently set
3572 in the specified TLS object.
3574 @param[in] Tls Pointer to the TLS object.
3575 @param[out] Data Pointer to the data buffer to receive the local
3577 @param[in,out] DataSize The size of data buffer in bytes.
3579 @retval EFI_SUCCESS The operation succeeded.
3580 @retval EFI_UNSUPPORTED This function is not supported.
3581 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3586 (EFIAPI
* EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY
)(
3589 IN OUT UINTN
*DataSize
3593 Gets the CA-supplied certificate revocation list data set in the specified
3596 This function returns the CA-supplied certificate revocation list data which
3597 was currently set in the specified TLS object.
3599 @param[out] Data Pointer to the data buffer to receive the CRL data.
3600 @param[in,out] DataSize The size of data buffer in bytes.
3602 @retval EFI_SUCCESS The operation succeeded.
3603 @retval EFI_UNSUPPORTED This function is not supported.
3604 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3609 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST
)(
3611 IN OUT UINTN
*DataSize
3616 /// EDK II Crypto Protocol
3618 struct _EDKII_CRYPTO_PROTOCOL
{
3620 EDKII_CRYPTO_GET_VERSION GetVersion
;
3622 EDKII_CRYPTO_HMAC_MD5_NEW HmacMd5New
;
3623 EDKII_CRYPTO_HMAC_MD5_FREE HmacMd5Free
;
3624 EDKII_CRYPTO_HMAC_MD5_SET_KEY HmacMd5SetKey
;
3625 EDKII_CRYPTO_HMAC_MD5_DUPLICATE HmacMd5Duplicate
;
3626 EDKII_CRYPTO_HMAC_MD5_UPDATE HmacMd5Update
;
3627 EDKII_CRYPTO_HMAC_MD5_FINAL HmacMd5Final
;
3629 EDKII_CRYPTO_HMAC_SHA1_NEW HmacSha1New
;
3630 EDKII_CRYPTO_HMAC_SHA1_FREE HmacSha1Free
;
3631 EDKII_CRYPTO_HMAC_SHA1_SET_KEY HmacSha1SetKey
;
3632 EDKII_CRYPTO_HMAC_SHA1_DUPLICATE HmacSha1Duplicate
;
3633 EDKII_CRYPTO_HMAC_SHA1_UPDATE HmacSha1Update
;
3634 EDKII_CRYPTO_HMAC_SHA1_FINAL HmacSha1Final
;
3636 EDKII_CRYPTO_HMAC_SHA256_NEW HmacSha256New
;
3637 EDKII_CRYPTO_HMAC_SHA256_FREE HmacSha256Free
;
3638 EDKII_CRYPTO_HMAC_SHA256_SET_KEY HmacSha256SetKey
;
3639 EDKII_CRYPTO_HMAC_SHA256_DUPLICATE HmacSha256Duplicate
;
3640 EDKII_CRYPTO_HMAC_SHA256_UPDATE HmacSha256Update
;
3641 EDKII_CRYPTO_HMAC_SHA256_FINAL HmacSha256Final
;
3642 /// Md4 - deprecated and unsupported
3643 DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE DeprecatedMd4GetContextSize
;
3644 DEPRECATED_EDKII_CRYPTO_MD4_INIT DeprecatedMd4Init
;
3645 DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE DeprecatedMd4Duplicate
;
3646 DEPRECATED_EDKII_CRYPTO_MD4_UPDATE DeprecatedMd4Update
;
3647 DEPRECATED_EDKII_CRYPTO_MD4_FINAL DeprecatedMd4Final
;
3648 DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL DeprecatedMd4HashAll
;
3650 EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE Md5GetContextSize
;
3651 EDKII_CRYPTO_MD5_INIT Md5Init
;
3652 EDKII_CRYPTO_MD5_DUPLICATE Md5Duplicate
;
3653 EDKII_CRYPTO_MD5_UPDATE Md5Update
;
3654 EDKII_CRYPTO_MD5_FINAL Md5Final
;
3655 EDKII_CRYPTO_MD5_HASH_ALL Md5HashAll
;
3657 EDKII_CRYPTO_PKCS1_ENCRYPT_V2 Pkcs1v2Encrypt
;
3658 EDKII_CRYPTO_PKCS5_PW_HASH Pkcs5HashPassword
;
3659 EDKII_CRYPTO_PKCS7_VERIFY Pkcs7Verify
;
3660 EDKII_CRYPTO_PKCS7_VERIFY_EKU VerifyEKUsInPkcs7Signature
;
3661 EDKII_CRYPTO_PKCS7_GET_SIGNERS Pkcs7GetSigners
;
3662 EDKII_CRYPTO_PKCS7_FREE_SIGNERS Pkcs7FreeSigners
;
3663 EDKII_CRYPTO_PKCS7_SIGN Pkcs7Sign
;
3664 EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT Pkcs7GetAttachedContent
;
3665 EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST Pkcs7GetCertificatesList
;
3666 EDKII_CRYPTO_AUTHENTICODE_VERIFY AuthenticodeVerify
;
3667 EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY ImageTimestampVerify
;
3669 EDKII_CRYPTO_DH_NEW DhNew
;
3670 EDKII_CRYPTO_DH_FREE DhFree
;
3671 EDKII_CRYPTO_DH_GENERATE_PARAMETER DhGenerateParameter
;
3672 EDKII_CRYPTO_DH_SET_PARAMETER DhSetParameter
;
3673 EDKII_CRYPTO_DH_GENERATE_KEY DhGenerateKey
;
3674 EDKII_CRYPTO_DH_COMPUTE_KEY DhComputeKey
;
3676 EDKII_CRYPTO_RANDOM_SEED RandomSeed
;
3677 EDKII_CRYPTO_RANDOM_BYTES RandomBytes
;
3679 EDKII_CRYPTO_RSA_VERIFY_PKCS1 RsaVerifyPkcs1
;
3680 EDKII_CRYPTO_RSA_NEW RsaNew
;
3681 EDKII_CRYPTO_RSA_FREE RsaFree
;
3682 EDKII_CRYPTO_RSA_SET_KEY RsaSetKey
;
3683 EDKII_CRYPTO_RSA_GET_KEY RsaGetKey
;
3684 EDKII_CRYPTO_RSA_GENERATE_KEY RsaGenerateKey
;
3685 EDKII_CRYPTO_RSA_CHECK_KEY RsaCheckKey
;
3686 EDKII_CRYPTO_RSA_PKCS1_SIGN RsaPkcs1Sign
;
3687 EDKII_CRYPTO_RSA_PKCS1_VERIFY RsaPkcs1Verify
;
3688 EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM RsaGetPrivateKeyFromPem
;
3689 EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509 RsaGetPublicKeyFromX509
;
3691 EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE Sha1GetContextSize
;
3692 EDKII_CRYPTO_SHA1_INIT Sha1Init
;
3693 EDKII_CRYPTO_SHA1_DUPLICATE Sha1Duplicate
;
3694 EDKII_CRYPTO_SHA1_UPDATE Sha1Update
;
3695 EDKII_CRYPTO_SHA1_FINAL Sha1Final
;
3696 EDKII_CRYPTO_SHA1_HASH_ALL Sha1HashAll
;
3698 EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE Sha256GetContextSize
;
3699 EDKII_CRYPTO_SHA256_INIT Sha256Init
;
3700 EDKII_CRYPTO_SHA256_DUPLICATE Sha256Duplicate
;
3701 EDKII_CRYPTO_SHA256_UPDATE Sha256Update
;
3702 EDKII_CRYPTO_SHA256_FINAL Sha256Final
;
3703 EDKII_CRYPTO_SHA256_HASH_ALL Sha256HashAll
;
3705 EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE Sha384GetContextSize
;
3706 EDKII_CRYPTO_SHA384_INIT Sha384Init
;
3707 EDKII_CRYPTO_SHA384_DUPLICATE Sha384Duplicate
;
3708 EDKII_CRYPTO_SHA384_UPDATE Sha384Update
;
3709 EDKII_CRYPTO_SHA384_FINAL Sha384Final
;
3710 EDKII_CRYPTO_SHA384_HASH_ALL Sha384HashAll
;
3712 EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE Sha512GetContextSize
;
3713 EDKII_CRYPTO_SHA512_INIT Sha512Init
;
3714 EDKII_CRYPTO_SHA512_DUPLICATE Sha512Duplicate
;
3715 EDKII_CRYPTO_SHA512_UPDATE Sha512Update
;
3716 EDKII_CRYPTO_SHA512_FINAL Sha512Final
;
3717 EDKII_CRYPTO_SHA512_HASH_ALL Sha512HashAll
;
3719 EDKII_CRYPTO_X509_GET_SUBJECT_NAME X509GetSubjectName
;
3720 EDKII_CRYPTO_X509_GET_COMMON_NAME X509GetCommonName
;
3721 EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME X509GetOrganizationName
;
3722 EDKII_CRYPTO_X509_VERIFY_CERT X509VerifyCert
;
3723 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE X509ConstructCertificate
;
3724 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK X509ConstructCertificateStack
;
3725 EDKII_CRYPTO_X509_FREE X509Free
;
3726 EDKII_CRYPTO_X509_STACK_FREE X509StackFree
;
3727 EDKII_CRYPTO_X509_GET_TBS_CERT X509GetTBSCert
;
3728 /// TDES - deprecated and unsupported
3729 DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE DeprecatedTdesGetContextSize
;
3730 DEPRECATED_EDKII_CRYPTO_TDES_INIT DeprecatedTdesInit
;
3731 DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT DeprecatedTdesEcbEncrypt
;
3732 DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT DeprecatedTdesEcbDecrypt
;
3733 DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT DeprecatedTdesCbcEncrypt
;
3734 DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT DeprecatedTdesCbcDecrypt
;
3735 /// AES - ECB Mode is deprecated and unsupported
3736 EDKII_CRYPTO_AES_GET_CONTEXT_SIZE AesGetContextSize
;
3737 EDKII_CRYPTO_AES_INIT AesInit
;
3738 DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT DeprecatedAesEcbEncrypt
;
3739 DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT DeprecatedAesEcbDecrypt
;
3740 EDKII_CRYPTO_AES_CBC_ENCRYPT AesCbcEncrypt
;
3741 EDKII_CRYPTO_AES_CBC_DECRYPT AesCbcDecrypt
;
3742 /// Arc4 - deprecated and unsupported
3743 DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE DeprecatedArc4GetContextSize
;
3744 DEPRECATED_EDKII_CRYPTO_ARC4_INIT DeprecatedArc4Init
;
3745 DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT DeprecatedArc4Encrypt
;
3746 DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT DeprecatedArc4Decrypt
;
3747 DEPRECATED_EDKII_CRYPTO_ARC4_RESET DeprecatedArc4Reset
;
3749 EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE Sm3GetContextSize
;
3750 EDKII_CRYPTO_SM3_INIT Sm3Init
;
3751 EDKII_CRYPTO_SM3_DUPLICATE Sm3Duplicate
;
3752 EDKII_CRYPTO_SM3_UPDATE Sm3Update
;
3753 EDKII_CRYPTO_SM3_FINAL Sm3Final
;
3754 EDKII_CRYPTO_SM3_HASH_ALL Sm3HashAll
;
3756 EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND HkdfSha256ExtractAndExpand
;
3757 /// X509 (Continued)
3758 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V X509ConstructCertificateStackV
;
3760 EDKII_CRYPTO_TLS_INITIALIZE TlsInitialize
;
3761 EDKII_CRYPTO_TLS_CTX_FREE TlsCtxFree
;
3762 EDKII_CRYPTO_TLS_CTX_NEW TlsCtxNew
;
3763 EDKII_CRYPTO_TLS_FREE TlsFree
;
3764 EDKII_CRYPTO_TLS_NEW TlsNew
;
3765 EDKII_CRYPTO_TLS_IN_HANDSHAKE TlsInHandshake
;
3766 EDKII_CRYPTO_TLS_DO_HANDSHAKE TlsDoHandshake
;
3767 EDKII_CRYPTO_TLS_HANDLE_ALERT TlsHandleAlert
;
3768 EDKII_CRYPTO_TLS_CLOSE_NOTIFY TlsCloseNotify
;
3769 EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT TlsCtrlTrafficOut
;
3770 EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN TlsCtrlTrafficIn
;
3771 EDKII_CRYPTO_TLS_READ TlsRead
;
3772 EDKII_CRYPTO_TLS_WRITE TlsWrite
;
3774 EDKII_CRYPTO_TLS_SET_VERSION TlsSetVersion
;
3775 EDKII_CRYPTO_TLS_SET_CONNECTION_END TlsSetConnectionEnd
;
3776 EDKII_CRYPTO_TLS_SET_CIPHER_LIST TlsSetCipherList
;
3777 EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD TlsSetCompressionMethod
;
3778 EDKII_CRYPTO_TLS_SET_VERIFY TlsSetVerify
;
3779 EDKII_CRYPTO_TLS_SET_VERIFY_HOST TlsSetVerifyHost
;
3780 EDKII_CRYPTO_TLS_SET_SESSIONID TlsSetSessionId
;
3781 EDKII_CRYPTO_TLS_SET_CA_CERTIFICATE TlsSetCaCertificate
;
3782 EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT TlsSetHostPublicCert
;
3783 EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY TlsSetHostPrivateKey
;
3784 EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST TlsSetCertRevocationList
;
3786 EDKII_CRYPTO_TLS_GET_VERSION TlsGetVersion
;
3787 EDKII_CRYPTO_TLS_GET_CONNECTION_END TlsGetConnectionEnd
;
3788 EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER TlsGetCurrentCipher
;
3789 EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID TlsGetCurrentCompressionId
;
3790 EDKII_CRYPTO_TLS_GET_VERIFY TlsGetVerify
;
3791 EDKII_CRYPTO_TLS_GET_SESSION_ID TlsGetSessionId
;
3792 EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM TlsGetClientRandom
;
3793 EDKII_CRYPTO_TLS_GET_SERVER_RANDOM TlsGetServerRandom
;
3794 EDKII_CRYPTO_TLS_GET_KEY_MATERIAL TlsGetKeyMaterial
;
3795 EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE TlsGetCaCertificate
;
3796 EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT TlsGetHostPublicCert
;
3797 EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY TlsGetHostPrivateKey
;
3798 EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST TlsGetCertRevocationList
;
3801 extern GUID gEdkiiCryptoProtocolGuid
;