2 This Protocol provides Crypto services to DXE modules
4 Copyright (C) Microsoft Corporation. All rights reserved.
5 Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __EDKII_CRYPTO_PROTOCOL_H__
11 #define __EDKII_CRYPTO_PROTOCOL_H__
14 #include <Library/BaseCryptLib.h>
15 #include <Library/PcdLib.h>
18 /// The version of the EDK II Crypto Protocol.
19 /// As APIs are added to BaseCryptLib, the EDK II Crypto Protocol is extended
20 /// with new APIs at the end of the EDK II Crypto Protocol structure. Each time
21 /// the EDK II Crypto Protocol is extended, this version define must be
24 #define EDKII_CRYPTO_VERSION 7
27 /// EDK II Crypto Protocol forward declaration
29 typedef struct _EDKII_CRYPTO_PROTOCOL EDKII_CRYPTO_PROTOCOL
;
32 Returns the version of the EDK II Crypto Protocol.
34 @return The version of the EDK II Crypto Protocol.
39 (EFIAPI
*EDKII_CRYPTO_GET_VERSION
)(
43 // =====================================================================================
44 // MAC (Message Authentication Code) Primitive
45 // =====================================================================================
48 HMAC MD5 is deprecated and unsupported any longer.
49 Keep the function field for binary compability.
54 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_NEW
)(
60 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FREE
)(
66 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_SET_KEY
)(
67 OUT VOID
*HmacMd5Context
,
74 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_DUPLICATE
)(
75 IN CONST VOID
*HmacMd5Context
,
76 OUT VOID
*NewHmacMd5Context
81 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_UPDATE
)(
82 IN OUT VOID
*HmacMd5Context
,
89 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FINAL
)(
90 IN OUT VOID
*HmacMd5Context
,
95 HMAC SHA1 is deprecated and unsupported any longer.
96 Keep the function field for binary compability.
101 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_NEW
)(
107 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FREE
)(
113 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_SET_KEY
)(
114 OUT VOID
*HmacSha1Context
,
121 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_DUPLICATE
)(
122 IN CONST VOID
*HmacSha1Context
,
123 OUT VOID
*NewHmacSha1Context
128 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_UPDATE
)(
129 IN OUT VOID
*HmacSha1Context
,
136 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FINAL
)(
137 IN OUT VOID
*HmacSha1Context
,
142 Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
144 @return Pointer to the HMAC_CTX context that has been initialized.
145 If the allocations fails, HmacSha256New() returns NULL.
150 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_NEW
)(
155 Release the specified HMAC_CTX context.
157 @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released.
162 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_FREE
)(
163 IN VOID
*HmacSha256Ctx
167 Set user-supplied key for subsequent use. It must be done before any
168 calling to HmacSha256Update().
170 If HmacSha256Context is NULL, then return FALSE.
171 If this interface is not supported, then return FALSE.
173 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.
174 @param[in] Key Pointer to the user-supplied key.
175 @param[in] KeySize Key size in bytes.
177 @retval TRUE The Key is set successfully.
178 @retval FALSE The Key is set unsuccessfully.
179 @retval FALSE This interface is not supported.
184 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_SET_KEY
)(
185 OUT VOID
*HmacSha256Context
,
191 Makes a copy of an existing HMAC-SHA256 context.
193 If HmacSha256Context is NULL, then return FALSE.
194 If NewHmacSha256Context is NULL, then return FALSE.
195 If this interface is not supported, then return FALSE.
197 @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied.
198 @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context.
200 @retval TRUE HMAC-SHA256 context copy succeeded.
201 @retval FALSE HMAC-SHA256 context copy failed.
202 @retval FALSE This interface is not supported.
207 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_DUPLICATE
)(
208 IN CONST VOID
*HmacSha256Context
,
209 OUT VOID
*NewHmacSha256Context
213 Digests the input data and updates HMAC-SHA256 context.
215 This function performs HMAC-SHA256 digest on a data buffer of the specified size.
216 It can be called multiple times to compute the digest of long or discontinuous data streams.
217 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
218 by HmacSha256Final(). Behavior with invalid context is undefined.
220 If HmacSha256Context is NULL, then return FALSE.
221 If this interface is not supported, then return FALSE.
223 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
224 @param[in] Data Pointer to the buffer containing the data to be digested.
225 @param[in] DataSize Size of Data buffer in bytes.
227 @retval TRUE HMAC-SHA256 data digest succeeded.
228 @retval FALSE HMAC-SHA256 data digest failed.
229 @retval FALSE This interface is not supported.
234 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_UPDATE
)(
235 IN OUT VOID
*HmacSha256Context
,
241 Completes computation of the HMAC-SHA256 digest value.
243 This function completes HMAC-SHA256 hash computation and retrieves the digest value into
244 the specified memory. After this function has been called, the HMAC-SHA256 context cannot
246 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
247 by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.
249 If HmacSha256Context is NULL, then return FALSE.
250 If HmacValue is NULL, then return FALSE.
251 If this interface is not supported, then return FALSE.
253 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
254 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest
257 @retval TRUE HMAC-SHA256 digest computation succeeded.
258 @retval FALSE HMAC-SHA256 digest computation failed.
259 @retval FALSE This interface is not supported.
264 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_FINAL
)(
265 IN OUT VOID
*HmacSha256Context
,
269 // =====================================================================================
270 // One-Way Cryptographic Hash Primitives
271 // =====================================================================================
274 MD4 is deprecated and unsupported any longer.
275 Keep the function field for binary compability.
280 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE
)(
286 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_INIT
)(
292 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE
)(
293 IN CONST VOID
*Md4Context
,
294 OUT VOID
*NewMd4Context
299 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_UPDATE
)(
300 IN OUT VOID
*Md4Context
,
307 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_FINAL
)(
308 IN OUT VOID
*Md4Context
,
314 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL
)(
320 // ----------------------------------------------------------------------------
323 Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
325 If this interface is not supported, then return zero.
327 @return The size, in bytes, of the context buffer required for MD5 hash operations.
328 @retval 0 This interface is not supported.
333 (EFIAPI
*EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE
)(
338 Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
341 If Md5Context is NULL, then return FALSE.
342 If this interface is not supported, then return FALSE.
344 @param[out] Md5Context Pointer to MD5 context being initialized.
346 @retval TRUE MD5 context initialization succeeded.
347 @retval FALSE MD5 context initialization failed.
348 @retval FALSE This interface is not supported.
353 (EFIAPI
*EDKII_CRYPTO_MD5_INIT
)(
358 Makes a copy of an existing MD5 context.
360 If Md5Context is NULL, then return FALSE.
361 If NewMd5Context is NULL, then return FALSE.
362 If this interface is not supported, then return FALSE.
364 @param[in] Md5Context Pointer to MD5 context being copied.
365 @param[out] NewMd5Context Pointer to new MD5 context.
367 @retval TRUE MD5 context copy succeeded.
368 @retval FALSE MD5 context copy failed.
369 @retval FALSE This interface is not supported.
374 (EFIAPI
*EDKII_CRYPTO_MD5_DUPLICATE
)(
375 IN CONST VOID
*Md5Context
,
376 OUT VOID
*NewMd5Context
380 Digests the input data and updates MD5 context.
382 This function performs MD5 digest on a data buffer of the specified size.
383 It can be called multiple times to compute the digest of long or discontinuous data streams.
384 MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
385 by Md5Final(). Behavior with invalid context is undefined.
387 If Md5Context is NULL, then return FALSE.
388 If this interface is not supported, then return FALSE.
390 @param[in, out] Md5Context Pointer to the MD5 context.
391 @param[in] Data Pointer to the buffer containing the data to be hashed.
392 @param[in] DataSize Size of Data buffer in bytes.
394 @retval TRUE MD5 data digest succeeded.
395 @retval FALSE MD5 data digest failed.
396 @retval FALSE This interface is not supported.
401 (EFIAPI
*EDKII_CRYPTO_MD5_UPDATE
)(
402 IN OUT VOID
*Md5Context
,
408 Completes computation of the MD5 digest value.
410 This function completes MD5 hash computation and retrieves the digest value into
411 the specified memory. After this function has been called, the MD5 context cannot
413 MD5 context should be already correctly initialized by Md5Init(), and should not be
414 finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
416 If Md5Context is NULL, then return FALSE.
417 If HashValue is NULL, then return FALSE.
418 If this interface is not supported, then return FALSE.
420 @param[in, out] Md5Context Pointer to the MD5 context.
421 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
424 @retval TRUE MD5 digest computation succeeded.
425 @retval FALSE MD5 digest computation failed.
426 @retval FALSE This interface is not supported.
431 (EFIAPI
*EDKII_CRYPTO_MD5_FINAL
)(
432 IN OUT VOID
*Md5Context
,
437 Computes the MD5 message digest of a input data buffer.
439 This function performs the MD5 message digest of a given data buffer, and places
440 the digest value into the specified memory.
442 If this interface is not supported, then return FALSE.
444 @param[in] Data Pointer to the buffer containing the data to be hashed.
445 @param[in] DataSize Size of Data buffer in bytes.
446 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
449 @retval TRUE MD5 digest computation succeeded.
450 @retval FALSE MD5 digest computation failed.
451 @retval FALSE This interface is not supported.
456 (EFIAPI
*EDKII_CRYPTO_MD5_HASH_ALL
)(
462 // =====================================================================================
464 // =====================================================================================
467 Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the encrypted message in
468 in a newly allocated buffer.
470 Things that can cause a failure include:
471 - X509 key size does not match any known key size.
472 - Fail to parse X509 certificate.
473 - Fail to allocate an intermediate buffer.
474 - NULL pointer provided for a non-optional parameter.
475 - Data size is too large for the provided key size (max size is a function of key size and hash digest size).
477 @param[in] PublicKey A pointer to the DER-encoded X509 certificate that will be used to encrypt the data.
478 @param[in] PublicKeySize Size of the X509 cert buffer.
479 @param[in] InData Data to be encrypted.
480 @param[in] InDataSize Size of the data buffer.
481 @param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer to be used when initializing the PRNG. NULL otherwise.
482 @param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer. 0 otherwise.
483 @param[out] EncryptedData Pointer to an allocated buffer containing the encrypted message.
484 @param[out] EncryptedDataSize Size of the encrypted message buffer.
486 @retval TRUE Encryption was successful.
487 @retval FALSE Encryption failed.
492 (EFIAPI
*EDKII_CRYPTO_PKCS1_ENCRYPT_V2
)(
493 IN CONST UINT8
*PublicKey
,
494 IN UINTN PublicKeySize
,
497 IN CONST UINT8
*PrngSeed OPTIONAL
,
498 IN UINTN PrngSeedSize OPTIONAL
,
499 OUT UINT8
**EncryptedData
,
500 OUT UINTN
*EncryptedDataSize
503 // ---------------------------------------------
507 Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0
508 password based encryption key derivation function PBKDF2, as specified in RFC 2898.
510 If Password or Salt or OutKey is NULL, then return FALSE.
511 If the hash algorithm could not be determined, then return FALSE.
512 If this interface is not supported, then return FALSE.
514 @param[in] PasswordLength Length of input password in bytes.
515 @param[in] Password Pointer to the array for the password.
516 @param[in] SaltLength Size of the Salt in bytes.
517 @param[in] Salt Pointer to the Salt.
518 @param[in] IterationCount Number of iterations to perform. Its value should be
519 greater than or equal to 1.
520 @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).
521 NOTE: DigestSize will be used to determine the hash algorithm.
522 Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.
523 @param[in] KeyLength Size of the derived key buffer in bytes.
524 @param[out] OutKey Pointer to the output derived key buffer.
526 @retval TRUE A key was derived successfully.
527 @retval FALSE One of the pointers was NULL or one of the sizes was too large.
528 @retval FALSE The hash algorithm could not be determined from the digest size.
529 @retval FALSE The key derivation operation failed.
530 @retval FALSE This interface is not supported.
535 (EFIAPI
*EDKII_CRYPTO_PKCS5_PW_HASH
)(
536 IN UINTN PasswordSize
,
537 IN CONST CHAR8
*Password
,
539 IN CONST UINT8
*Salt
,
540 IN UINTN IterationCount
,
546 // ---------------------------------------------
550 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
551 Cryptographic Message Syntax Standard". The input signed data could be wrapped
552 in a ContentInfo structure.
554 If P7Data, TrustedCert or InData is NULL, then return FALSE.
555 If P7Length, CertLength or DataLength overflow, then return FALSE.
556 If this interface is not supported, then return FALSE.
558 @param[in] P7Data Pointer to the PKCS#7 message to verify.
559 @param[in] P7Length Length of the PKCS#7 message in bytes.
560 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
561 is used for certificate chain verification.
562 @param[in] CertLength Length of the trusted certificate in bytes.
563 @param[in] InData Pointer to the content to be verified.
564 @param[in] DataLength Length of InData in bytes.
566 @retval TRUE The specified PKCS#7 signed data is valid.
567 @retval FALSE Invalid PKCS#7 signed data.
568 @retval FALSE This interface is not supported.
573 (EFIAPI
*EDKII_CRYPTO_PKCS7_VERIFY
)(
574 IN CONST UINT8
*P7Data
,
575 IN UINTN P7DataLength
,
576 IN CONST UINT8
*TrustedCert
,
577 IN UINTN TrustedCertLength
,
578 IN CONST UINT8
*Data
,
583 VerifyEKUsInPkcs7Signature()
585 This function receives a PKCS7 formatted signature, and then verifies that
586 the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity
587 leaf signing certificate.
589 Note that this function does not validate the certificate chain.
591 Applications for custom EKU's are quite flexible. For example, a policy EKU
592 may be present in an Issuing Certificate Authority (CA), and any sub-ordinate
593 certificate issued might also contain this EKU, thus constraining the
594 sub-ordinate certificate. Other applications might allow a certificate
595 embedded in a device to specify that other Object Identifiers (OIDs) are
596 present which contains binary data specifying custom capabilities that
597 the device is able to do.
599 @param[in] Pkcs7Signature - The PKCS#7 signed information content block. An array
600 containing the content block with both the signature,
601 the signer's certificate, and any necessary intermediate
604 @param[in] Pkcs7SignatureSize - Number of bytes in Pkcs7Signature.
606 @param[in] RequiredEKUs - Array of null-terminated strings listing OIDs of
607 required EKUs that must be present in the signature.
609 @param[in] RequiredEKUsSize - Number of elements in the RequiredEKUs string array.
611 @param[in] RequireAllPresent - If this is TRUE, then all of the specified EKU's
612 must be present in the leaf signer. If it is
613 FALSE, then we will succeed if we find any
614 of the specified EKU's.
616 @retval EFI_SUCCESS - The required EKUs were found in the signature.
617 @retval EFI_INVALID_PARAMETER - A parameter was invalid.
618 @retval EFI_NOT_FOUND - One or more EKU's were not found in the signature.
623 (EFIAPI
*EDKII_CRYPTO_PKCS7_VERIFY_EKU
)(
624 IN CONST UINT8
*Pkcs7Signature
,
625 IN CONST UINT32 SignatureSize
,
626 IN CONST CHAR8
*RequiredEKUs
[],
627 IN CONST UINT32 RequiredEKUsSize
,
628 IN BOOLEAN RequireAllPresent
632 Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
633 Cryptographic Message Syntax Standard". The input signed data could be wrapped
634 in a ContentInfo structure.
636 If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then
637 return FALSE. If P7Length overflow, then return FALSE.
638 If this interface is not supported, then return FALSE.
640 @param[in] P7Data Pointer to the PKCS#7 message to verify.
641 @param[in] P7Length Length of the PKCS#7 message in bytes.
642 @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
643 It's caller's responsibility to free the buffer with
645 This data structure is EFI_CERT_STACK type.
646 @param[out] StackLength Length of signer's certificates in bytes.
647 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
648 It's caller's responsibility to free the buffer with
650 @param[out] CertLength Length of the trusted certificate in bytes.
652 @retval TRUE The operation is finished successfully.
653 @retval FALSE Error occurs during the operation.
654 @retval FALSE This interface is not supported.
659 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_SIGNERS
)(
660 IN CONST UINT8
*P7Data
,
662 OUT UINT8
**CertStack
,
663 OUT UINTN
*StackLength
,
664 OUT UINT8
**TrustedCert
,
665 OUT UINTN
*CertLength
669 Wrap function to use free() to free allocated memory for certificates.
671 If this interface is not supported, then ASSERT().
673 @param[in] Certs Pointer to the certificates to be freed.
678 (EFIAPI
*EDKII_CRYPTO_PKCS7_FREE_SIGNERS
)(
683 Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
684 Syntax Standard, version 1.5". This interface is only intended to be used for
685 application to perform PKCS#7 functionality validation.
687 If this interface is not supported, then return FALSE.
689 @param[in] PrivateKey Pointer to the PEM-formatted private key data for
691 @param[in] PrivateKeySize Size of the PEM private key data in bytes.
692 @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
694 @param[in] InData Pointer to the content to be signed.
695 @param[in] InDataSize Size of InData in bytes.
696 @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
697 @param[in] OtherCerts Pointer to an optional additional set of certificates to
698 include in the PKCS#7 signedData (e.g. any intermediate
700 @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's
701 responsibility to free the buffer with FreePool().
702 @param[out] SignedDataSize Size of SignedData in bytes.
704 @retval TRUE PKCS#7 data signing succeeded.
705 @retval FALSE PKCS#7 data signing failed.
706 @retval FALSE This interface is not supported.
711 (EFIAPI
*EDKII_CRYPTO_PKCS7_SIGN
)(
712 IN CONST UINT8
*PrivateKey
,
713 IN UINTN PrivateKeySize
,
714 IN CONST UINT8
*KeyPassword
,
718 IN UINT8
*OtherCerts OPTIONAL
,
719 OUT UINT8
**SignedData
,
720 OUT UINTN
*SignedDataSize
724 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
725 data could be wrapped in a ContentInfo structure.
727 If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow,
728 then return FALSE. If the P7Data is not correctly formatted, then return FALSE.
730 Caution: This function may receive untrusted input. So this function will do
731 basic check for PKCS#7 data structure.
733 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
734 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
735 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
736 It's caller's responsibility to free the buffer with FreePool().
737 @param[out] ContentSize The size of the extracted content in bytes.
739 @retval TRUE The P7Data was correctly formatted for processing.
740 @retval FALSE The P7Data was not correctly formatted for processing.
746 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT
)(
747 IN CONST UINT8
*P7Data
,
750 OUT UINTN
*ContentSize
754 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
755 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
756 unchained to the signer's certificates.
757 The input signed data could be wrapped in a ContentInfo structure.
759 @param[in] P7Data Pointer to the PKCS#7 message.
760 @param[in] P7Length Length of the PKCS#7 message in bytes.
761 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
762 certificate. It's caller's responsibility to free the buffer
763 with Pkcs7FreeSigners().
764 This data structure is EFI_CERT_STACK type.
765 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
766 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
767 responsibility to free the buffer with Pkcs7FreeSigners().
768 This data structure is EFI_CERT_STACK type.
769 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
771 @retval TRUE The operation is finished successfully.
772 @retval FALSE Error occurs during the operation.
777 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST
)(
778 IN CONST UINT8
*P7Data
,
780 OUT UINT8
**SignerChainCerts
,
781 OUT UINTN
*ChainLength
,
782 OUT UINT8
**UnchainCerts
,
783 OUT UINTN
*UnchainLength
787 Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows
788 Authenticode Portable Executable Signature Format".
790 If AuthData is NULL, then return FALSE.
791 If ImageHash is NULL, then return FALSE.
792 If this interface is not supported, then return FALSE.
794 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
795 PE/COFF image to be verified.
796 @param[in] DataSize Size of the Authenticode Signature in bytes.
797 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
798 is used for certificate chain verification.
799 @param[in] CertSize Size of the trusted certificate in bytes.
800 @param[in] ImageHash Pointer to the original image file hash value. The procedure
801 for calculating the image hash value is described in Authenticode
803 @param[in] HashSize Size of Image hash value in bytes.
805 @retval TRUE The specified Authenticode Signature is valid.
806 @retval FALSE Invalid Authenticode Signature.
807 @retval FALSE This interface is not supported.
812 (EFIAPI
*EDKII_CRYPTO_AUTHENTICODE_VERIFY
)(
813 IN CONST UINT8
*AuthData
,
815 IN CONST UINT8
*TrustedCert
,
817 IN CONST UINT8
*ImageHash
,
822 Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode
825 If AuthData is NULL, then return FALSE.
826 If this interface is not supported, then return FALSE.
828 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
829 PE/COFF image to be verified.
830 @param[in] DataSize Size of the Authenticode Signature in bytes.
831 @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which
832 is used for TSA certificate chain verification.
833 @param[in] CertSize Size of the trusted certificate in bytes.
834 @param[out] SigningTime Return the time of timestamp generation time if the timestamp
837 @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.
838 @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.
843 (EFIAPI
*EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY
)(
844 IN CONST UINT8
*AuthData
,
846 IN CONST UINT8
*TsaCert
,
848 OUT EFI_TIME
*SigningTime
851 // =====================================================================================
852 // DH Key Exchange Primitive
853 // =====================================================================================
856 Allocates and Initializes one Diffie-Hellman Context for subsequent use.
858 @return Pointer to the Diffie-Hellman Context that has been initialized.
859 If the allocations fails, DhNew() returns NULL.
860 If the interface is not supported, DhNew() returns NULL.
865 (EFIAPI
*EDKII_CRYPTO_DH_NEW
)(
870 Release the specified DH context.
872 If the interface is not supported, then ASSERT().
874 @param[in] DhContext Pointer to the DH context to be released.
879 (EFIAPI
*EDKII_CRYPTO_DH_FREE
)(
884 Generates DH parameter.
886 Given generator g, and length of prime number p in bits, this function generates p,
887 and sets DH context according to value of g and p.
889 Before this function can be invoked, pseudorandom number generator must be correctly
890 initialized by RandomSeed().
892 If DhContext is NULL, then return FALSE.
893 If Prime is NULL, then return FALSE.
894 If this interface is not supported, then return FALSE.
896 @param[in, out] DhContext Pointer to the DH context.
897 @param[in] Generator Value of generator.
898 @param[in] PrimeLength Length in bits of prime to be generated.
899 @param[out] Prime Pointer to the buffer to receive the generated prime number.
901 @retval TRUE DH parameter generation succeeded.
902 @retval FALSE Value of Generator is not supported.
903 @retval FALSE PRNG fails to generate random prime number with PrimeLength.
904 @retval FALSE This interface is not supported.
909 (EFIAPI
*EDKII_CRYPTO_DH_GENERATE_PARAMETER
)(
910 IN OUT VOID
*DhContext
,
912 IN UINTN PrimeLength
,
917 Sets generator and prime parameters for DH.
919 Given generator g, and prime number p, this function and sets DH
922 If DhContext is NULL, then return FALSE.
923 If Prime is NULL, then return FALSE.
924 If this interface is not supported, then return FALSE.
926 @param[in, out] DhContext Pointer to the DH context.
927 @param[in] Generator Value of generator.
928 @param[in] PrimeLength Length in bits of prime to be generated.
929 @param[in] Prime Pointer to the prime number.
931 @retval TRUE DH parameter setting succeeded.
932 @retval FALSE Value of Generator is not supported.
933 @retval FALSE Value of Generator is not suitable for the Prime.
934 @retval FALSE Value of Prime is not a prime number.
935 @retval FALSE Value of Prime is not a safe prime number.
936 @retval FALSE This interface is not supported.
941 (EFIAPI
*EDKII_CRYPTO_DH_SET_PARAMETER
)(
942 IN OUT VOID
*DhContext
,
944 IN UINTN PrimeLength
,
945 IN CONST UINT8
*Prime
949 Generates DH public key.
951 This function generates random secret exponent, and computes the public key, which is
952 returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.
953 If the PublicKey buffer is too small to hold the public key, FALSE is returned and
954 PublicKeySize is set to the required buffer size to obtain the public key.
956 If DhContext is NULL, then return FALSE.
957 If PublicKeySize is NULL, then return FALSE.
958 If PublicKeySize is large enough but PublicKey is NULL, then return FALSE.
959 If this interface is not supported, then return FALSE.
961 @param[in, out] DhContext Pointer to the DH context.
962 @param[out] PublicKey Pointer to the buffer to receive generated public key.
963 @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.
964 On output, the size of data returned in PublicKey buffer in bytes.
966 @retval TRUE DH public key generation succeeded.
967 @retval FALSE DH public key generation failed.
968 @retval FALSE PublicKeySize is not large enough.
969 @retval FALSE This interface is not supported.
974 (EFIAPI
*EDKII_CRYPTO_DH_GENERATE_KEY
)(
975 IN OUT VOID
*DhContext
,
976 OUT UINT8
*PublicKey
,
977 IN OUT UINTN
*PublicKeySize
981 Computes exchanged common key.
983 Given peer's public key, this function computes the exchanged common key, based on its own
984 context including value of prime modulus and random secret exponent.
986 If DhContext is NULL, then return FALSE.
987 If PeerPublicKey is NULL, then return FALSE.
988 If KeySize is NULL, then return FALSE.
989 If Key is NULL, then return FALSE.
990 If KeySize is not large enough, then return FALSE.
991 If this interface is not supported, then return FALSE.
993 @param[in, out] DhContext Pointer to the DH context.
994 @param[in] PeerPublicKey Pointer to the peer's public key.
995 @param[in] PeerPublicKeySize Size of peer's public key in bytes.
996 @param[out] Key Pointer to the buffer to receive generated key.
997 @param[in, out] KeySize On input, the size of Key buffer in bytes.
998 On output, the size of data returned in Key buffer in bytes.
1000 @retval TRUE DH exchanged key generation succeeded.
1001 @retval FALSE DH exchanged key generation failed.
1002 @retval FALSE KeySize is not large enough.
1003 @retval FALSE This interface is not supported.
1008 (EFIAPI
*EDKII_CRYPTO_DH_COMPUTE_KEY
)(
1009 IN OUT VOID
*DhContext
,
1010 IN CONST UINT8
*PeerPublicKey
,
1011 IN UINTN PeerPublicKeySize
,
1013 IN OUT UINTN
*KeySize
1016 // =====================================================================================
1017 // Pseudo-Random Generation Primitive
1018 // =====================================================================================
1021 Sets up the seed value for the pseudorandom number generator.
1023 This function sets up the seed value for the pseudorandom number generator.
1024 If Seed is not NULL, then the seed passed in is used.
1025 If Seed is NULL, then default seed is used.
1026 If this interface is not supported, then return FALSE.
1028 @param[in] Seed Pointer to seed value.
1029 If NULL, default seed is used.
1030 @param[in] SeedSize Size of seed value.
1031 If Seed is NULL, this parameter is ignored.
1033 @retval TRUE Pseudorandom number generator has enough entropy for random generation.
1034 @retval FALSE Pseudorandom number generator does not have enough entropy for random generation.
1035 @retval FALSE This interface is not supported.
1040 (EFIAPI
*EDKII_CRYPTO_RANDOM_SEED
)(
1041 IN CONST UINT8
*Seed OPTIONAL
,
1046 Generates a pseudorandom byte stream of the specified size.
1048 If Output is NULL, then return FALSE.
1049 If this interface is not supported, then return FALSE.
1051 @param[out] Output Pointer to buffer to receive random value.
1052 @param[in] Size Size of random bytes to generate.
1054 @retval TRUE Pseudorandom byte stream generated successfully.
1055 @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.
1056 @retval FALSE This interface is not supported.
1061 (EFIAPI
*EDKII_CRYPTO_RANDOM_BYTES
)(
1067 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
1070 If RsaContext is NULL, then return FALSE.
1071 If MessageHash is NULL, then return FALSE.
1072 If Signature is NULL, then return FALSE.
1073 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
1075 @param[in] RsaContext Pointer to RSA context for signature verification.
1076 @param[in] MessageHash Pointer to octet message hash to be checked.
1077 @param[in] HashSize Size of the message hash in bytes.
1078 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
1079 @param[in] SigSize Size of signature in bytes.
1081 @retval TRUE Valid signature encoded in PKCS1-v1_5.
1082 @retval FALSE Invalid signature or invalid RSA context.
1087 (EFIAPI
*EDKII_CRYPTO_RSA_VERIFY_PKCS1
)(
1088 IN VOID
*RsaContext
,
1089 IN CONST UINT8
*MessageHash
,
1091 IN CONST UINT8
*Signature
,
1096 Allocates and initializes one RSA context for subsequent use.
1098 @return Pointer to the RSA context that has been initialized.
1099 If the allocations fails, RsaNew() returns NULL.
1104 (EFIAPI
*EDKII_CRYPTO_RSA_NEW
)(
1109 Release the specified RSA context.
1111 If RsaContext is NULL, then return FALSE.
1113 @param[in] RsaContext Pointer to the RSA context to be released.
1118 (EFIAPI
*EDKII_CRYPTO_RSA_FREE
)(
1123 Sets the tag-designated key component into the established RSA context.
1125 This function sets the tag-designated RSA key component into the established
1126 RSA context from the user-specified non-negative integer (octet string format
1127 represented in RSA PKCS#1).
1128 If BigNumber is NULL, then the specified key component in RSA context is cleared.
1130 If RsaContext is NULL, then return FALSE.
1132 @param[in, out] RsaContext Pointer to RSA context being set.
1133 @param[in] KeyTag Tag of RSA key component being set.
1134 @param[in] BigNumber Pointer to octet integer buffer.
1135 If NULL, then the specified key component in RSA
1137 @param[in] BnSize Size of big number buffer in bytes.
1138 If BigNumber is NULL, then it is ignored.
1140 @retval TRUE RSA key component was set successfully.
1141 @retval FALSE Invalid RSA key component tag.
1146 (EFIAPI
*EDKII_CRYPTO_RSA_SET_KEY
)(
1147 IN OUT VOID
*RsaContext
,
1148 IN RSA_KEY_TAG KeyTag
,
1149 IN CONST UINT8
*BigNumber
,
1154 Gets the tag-designated RSA key component from the established RSA context.
1156 This function retrieves the tag-designated RSA key component from the
1157 established RSA context as a non-negative integer (octet string format
1158 represented in RSA PKCS#1).
1159 If specified key component has not been set or has been cleared, then returned
1161 If the BigNumber buffer is too small to hold the contents of the key, FALSE
1162 is returned and BnSize is set to the required buffer size to obtain the key.
1164 If RsaContext is NULL, then return FALSE.
1165 If BnSize is NULL, then return FALSE.
1166 If BnSize is large enough but BigNumber is NULL, then return FALSE.
1167 If this interface is not supported, then return FALSE.
1169 @param[in, out] RsaContext Pointer to RSA context being set.
1170 @param[in] KeyTag Tag of RSA key component being set.
1171 @param[out] BigNumber Pointer to octet integer buffer.
1172 @param[in, out] BnSize On input, the size of big number buffer in bytes.
1173 On output, the size of data returned in big number buffer in bytes.
1175 @retval TRUE RSA key component was retrieved successfully.
1176 @retval FALSE Invalid RSA key component tag.
1177 @retval FALSE BnSize is too small.
1178 @retval FALSE This interface is not supported.
1183 (EFIAPI
*EDKII_CRYPTO_RSA_GET_KEY
)(
1184 IN OUT VOID
*RsaContext
,
1185 IN RSA_KEY_TAG KeyTag
,
1186 OUT UINT8
*BigNumber
,
1187 IN OUT UINTN
*BnSize
1191 Generates RSA key components.
1193 This function generates RSA key components. It takes RSA public exponent E and
1194 length in bits of RSA modulus N as input, and generates all key components.
1195 If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used.
1197 Before this function can be invoked, pseudorandom number generator must be correctly
1198 initialized by RandomSeed().
1200 If RsaContext is NULL, then return FALSE.
1201 If this interface is not supported, then return FALSE.
1203 @param[in, out] RsaContext Pointer to RSA context being set.
1204 @param[in] ModulusLength Length of RSA modulus N in bits.
1205 @param[in] PublicExponent Pointer to RSA public exponent.
1206 @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes.
1208 @retval TRUE RSA key component was generated successfully.
1209 @retval FALSE Invalid RSA key component tag.
1210 @retval FALSE This interface is not supported.
1215 (EFIAPI
*EDKII_CRYPTO_RSA_GENERATE_KEY
)(
1216 IN OUT VOID
*RsaContext
,
1217 IN UINTN ModulusLength
,
1218 IN CONST UINT8
*PublicExponent
,
1219 IN UINTN PublicExponentSize
1223 Validates key components of RSA context.
1224 NOTE: This function performs integrity checks on all the RSA key material, so
1225 the RSA key structure must contain all the private key data.
1227 This function validates key components of RSA context in following aspects:
1228 - Whether p is a prime
1229 - Whether q is a prime
1231 - Whether d*e = 1 mod lcm(p-1,q-1)
1233 If RsaContext is NULL, then return FALSE.
1234 If this interface is not supported, then return FALSE.
1236 @param[in] RsaContext Pointer to RSA context to check.
1238 @retval TRUE RSA key components are valid.
1239 @retval FALSE RSA key components are not valid.
1240 @retval FALSE This interface is not supported.
1245 (EFIAPI
*EDKII_CRYPTO_RSA_CHECK_KEY
)(
1250 Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.
1252 This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in
1254 If the Signature buffer is too small to hold the contents of signature, FALSE
1255 is returned and SigSize is set to the required buffer size to obtain the signature.
1257 If RsaContext is NULL, then return FALSE.
1258 If MessageHash is NULL, then return FALSE.
1259 If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.
1260 If SigSize is large enough but Signature is NULL, then return FALSE.
1261 If this interface is not supported, then return FALSE.
1263 @param[in] RsaContext Pointer to RSA context for signature generation.
1264 @param[in] MessageHash Pointer to octet message hash to be signed.
1265 @param[in] HashSize Size of the message hash in bytes.
1266 @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature.
1267 @param[in, out] SigSize On input, the size of Signature buffer in bytes.
1268 On output, the size of data returned in Signature buffer in bytes.
1270 @retval TRUE Signature successfully generated in PKCS1-v1_5.
1271 @retval FALSE Signature generation failed.
1272 @retval FALSE SigSize is too small.
1273 @retval FALSE This interface is not supported.
1278 (EFIAPI
*EDKII_CRYPTO_RSA_PKCS1_SIGN
)(
1279 IN VOID
*RsaContext
,
1280 IN CONST UINT8
*MessageHash
,
1282 OUT UINT8
*Signature
,
1283 IN OUT UINTN
*SigSize
1287 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
1290 If RsaContext is NULL, then return FALSE.
1291 If MessageHash is NULL, then return FALSE.
1292 If Signature is NULL, then return FALSE.
1293 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
1295 @param[in] RsaContext Pointer to RSA context for signature verification.
1296 @param[in] MessageHash Pointer to octet message hash to be checked.
1297 @param[in] HashSize Size of the message hash in bytes.
1298 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
1299 @param[in] SigSize Size of signature in bytes.
1301 @retval TRUE Valid signature encoded in PKCS1-v1_5.
1302 @retval FALSE Invalid signature or invalid RSA context.
1307 (EFIAPI
*EDKII_CRYPTO_RSA_PKCS1_VERIFY
)(
1308 IN VOID
*RsaContext
,
1309 IN CONST UINT8
*MessageHash
,
1311 IN CONST UINT8
*Signature
,
1316 Retrieve the RSA Private Key from the password-protected PEM key data.
1318 If PemData is NULL, then return FALSE.
1319 If RsaContext is NULL, then return FALSE.
1320 If this interface is not supported, then return FALSE.
1322 @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.
1323 @param[in] PemSize Size of the PEM key data in bytes.
1324 @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.
1325 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
1326 RSA private key component. Use RsaFree() function to free the
1329 @retval TRUE RSA Private Key was retrieved successfully.
1330 @retval FALSE Invalid PEM key data or incorrect password.
1331 @retval FALSE This interface is not supported.
1336 (EFIAPI
*EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM
)(
1337 IN CONST UINT8
*PemData
,
1339 IN CONST CHAR8
*Password
,
1340 OUT VOID
**RsaContext
1344 Retrieve the RSA Public Key from one DER-encoded X509 certificate.
1346 If Cert is NULL, then return FALSE.
1347 If RsaContext is NULL, then return FALSE.
1348 If this interface is not supported, then return FALSE.
1350 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1351 @param[in] CertSize Size of the X509 certificate in bytes.
1352 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
1353 RSA public key component. Use RsaFree() function to free the
1356 @retval TRUE RSA Public Key was retrieved successfully.
1357 @retval FALSE Fail to retrieve RSA public key from X509 certificate.
1358 @retval FALSE This interface is not supported.
1363 (EFIAPI
*EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509
)(
1364 IN CONST UINT8
*Cert
,
1366 OUT VOID
**RsaContext
1369 // ----------------------------------------
1371 // ----------------------------------------
1374 Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
1376 If this interface is not supported, then return zero.
1378 @return The size, in bytes, of the context buffer required for SHA-1 hash operations.
1379 @retval 0 This interface is not supported.
1384 (EFIAPI
*EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE
)(
1389 Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
1392 If Sha1Context is NULL, then return FALSE.
1393 If this interface is not supported, then return FALSE.
1395 @param[out] Sha1Context Pointer to SHA-1 context being initialized.
1397 @retval TRUE SHA-1 context initialization succeeded.
1398 @retval FALSE SHA-1 context initialization failed.
1399 @retval FALSE This interface is not supported.
1404 (EFIAPI
*EDKII_CRYPTO_SHA1_INIT
)(
1405 OUT VOID
*Sha1Context
1409 Makes a copy of an existing SHA-1 context.
1411 If Sha1Context is NULL, then return FALSE.
1412 If NewSha1Context is NULL, then return FALSE.
1413 If this interface is not supported, then return FALSE.
1415 @param[in] Sha1Context Pointer to SHA-1 context being copied.
1416 @param[out] NewSha1Context Pointer to new SHA-1 context.
1418 @retval TRUE SHA-1 context copy succeeded.
1419 @retval FALSE SHA-1 context copy failed.
1420 @retval FALSE This interface is not supported.
1425 (EFIAPI
*EDKII_CRYPTO_SHA1_DUPLICATE
)(
1426 IN CONST VOID
*Sha1Context
,
1427 OUT VOID
*NewSha1Context
1431 Digests the input data and updates SHA-1 context.
1433 This function performs SHA-1 digest on a data buffer of the specified size.
1434 It can be called multiple times to compute the digest of long or discontinuous data streams.
1435 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
1436 by Sha1Final(). Behavior with invalid context is undefined.
1438 If Sha1Context is NULL, then return FALSE.
1439 If this interface is not supported, then return FALSE.
1441 @param[in, out] Sha1Context Pointer to the SHA-1 context.
1442 @param[in] Data Pointer to the buffer containing the data to be hashed.
1443 @param[in] DataSize Size of Data buffer in bytes.
1445 @retval TRUE SHA-1 data digest succeeded.
1446 @retval FALSE SHA-1 data digest failed.
1447 @retval FALSE This interface is not supported.
1452 (EFIAPI
*EDKII_CRYPTO_SHA1_UPDATE
)(
1453 IN OUT VOID
*Sha1Context
,
1454 IN CONST VOID
*Data
,
1459 Completes computation of the SHA-1 digest value.
1461 This function completes SHA-1 hash computation and retrieves the digest value into
1462 the specified memory. After this function has been called, the SHA-1 context cannot
1464 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
1465 finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
1467 If Sha1Context is NULL, then return FALSE.
1468 If HashValue is NULL, then return FALSE.
1469 If this interface is not supported, then return FALSE.
1471 @param[in, out] Sha1Context Pointer to the SHA-1 context.
1472 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
1475 @retval TRUE SHA-1 digest computation succeeded.
1476 @retval FALSE SHA-1 digest computation failed.
1477 @retval FALSE This interface is not supported.
1482 (EFIAPI
*EDKII_CRYPTO_SHA1_FINAL
)(
1483 IN OUT VOID
*Sha1Context
,
1484 OUT UINT8
*HashValue
1488 Computes the SHA-1 message digest of a input data buffer.
1490 This function performs the SHA-1 message digest of a given data buffer, and places
1491 the digest value into the specified memory.
1493 If this interface is not supported, then return FALSE.
1495 @param[in] Data Pointer to the buffer containing the data to be hashed.
1496 @param[in] DataSize Size of Data buffer in bytes.
1497 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
1500 @retval TRUE SHA-1 digest computation succeeded.
1501 @retval FALSE SHA-1 digest computation failed.
1502 @retval FALSE This interface is not supported.
1507 (EFIAPI
*EDKII_CRYPTO_SHA1_HASH_ALL
)(
1508 IN CONST VOID
*Data
,
1510 OUT UINT8
*HashValue
1514 Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
1516 @return The size, in bytes, of the context buffer required for SHA-256 hash operations.
1521 (EFIAPI
*EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE
)(
1526 Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for
1529 If Sha256Context is NULL, then return FALSE.
1531 @param[out] Sha256Context Pointer to SHA-256 context being initialized.
1533 @retval TRUE SHA-256 context initialization succeeded.
1534 @retval FALSE SHA-256 context initialization failed.
1539 (EFIAPI
*EDKII_CRYPTO_SHA256_INIT
)(
1540 OUT VOID
*Sha256Context
1544 Makes a copy of an existing SHA-256 context.
1546 If Sha256Context is NULL, then return FALSE.
1547 If NewSha256Context is NULL, then return FALSE.
1548 If this interface is not supported, then return FALSE.
1550 @param[in] Sha256Context Pointer to SHA-256 context being copied.
1551 @param[out] NewSha256Context Pointer to new SHA-256 context.
1553 @retval TRUE SHA-256 context copy succeeded.
1554 @retval FALSE SHA-256 context copy failed.
1555 @retval FALSE This interface is not supported.
1560 (EFIAPI
*EDKII_CRYPTO_SHA256_DUPLICATE
)(
1561 IN CONST VOID
*Sha256Context
,
1562 OUT VOID
*NewSha256Context
1566 Digests the input data and updates SHA-256 context.
1568 This function performs SHA-256 digest on a data buffer of the specified size.
1569 It can be called multiple times to compute the digest of long or discontinuous data streams.
1570 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized
1571 by Sha256Final(). Behavior with invalid context is undefined.
1573 If Sha256Context is NULL, then return FALSE.
1575 @param[in, out] Sha256Context Pointer to the SHA-256 context.
1576 @param[in] Data Pointer to the buffer containing the data to be hashed.
1577 @param[in] DataSize Size of Data buffer in bytes.
1579 @retval TRUE SHA-256 data digest succeeded.
1580 @retval FALSE SHA-256 data digest failed.
1585 (EFIAPI
*EDKII_CRYPTO_SHA256_UPDATE
)(
1586 IN OUT VOID
*Sha256Context
,
1587 IN CONST VOID
*Data
,
1592 Completes computation of the SHA-256 digest value.
1594 This function completes SHA-256 hash computation and retrieves the digest value into
1595 the specified memory. After this function has been called, the SHA-256 context cannot
1597 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be
1598 finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.
1600 If Sha256Context is NULL, then return FALSE.
1601 If HashValue is NULL, then return FALSE.
1603 @param[in, out] Sha256Context Pointer to the SHA-256 context.
1604 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
1607 @retval TRUE SHA-256 digest computation succeeded.
1608 @retval FALSE SHA-256 digest computation failed.
1613 (EFIAPI
*EDKII_CRYPTO_SHA256_FINAL
)(
1614 IN OUT VOID
*Sha256Context
,
1615 OUT UINT8
*HashValue
1619 Computes the SHA-256 message digest of a input data buffer.
1621 This function performs the SHA-256 message digest of a given data buffer, and places
1622 the digest value into the specified memory.
1624 If this interface is not supported, then return FALSE.
1626 @param[in] Data Pointer to the buffer containing the data to be hashed.
1627 @param[in] DataSize Size of Data buffer in bytes.
1628 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
1631 @retval TRUE SHA-256 digest computation succeeded.
1632 @retval FALSE SHA-256 digest computation failed.
1633 @retval FALSE This interface is not supported.
1638 (EFIAPI
*EDKII_CRYPTO_SHA256_HASH_ALL
)(
1639 IN CONST VOID
*Data
,
1641 OUT UINT8
*HashValue
1645 Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
1646 If this interface is not supported, then return zero.
1648 @return The size, in bytes, of the context buffer required for SHA-384 hash operations.
1649 @retval 0 This interface is not supported.
1654 (EFIAPI
*EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE
)(
1659 Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for
1662 If Sha384Context is NULL, then return FALSE.
1664 @param[out] Sha384Context Pointer to SHA-384 context being initialized.
1666 @retval TRUE SHA-384 context initialization succeeded.
1667 @retval FALSE SHA-384 context initialization failed.
1672 (EFIAPI
*EDKII_CRYPTO_SHA384_INIT
)(
1673 OUT VOID
*Sha384Context
1677 Makes a copy of an existing SHA-384 context.
1679 If Sha384Context is NULL, then return FALSE.
1680 If NewSha384Context is NULL, then return FALSE.
1681 If this interface is not supported, then return FALSE.
1683 @param[in] Sha384Context Pointer to SHA-384 context being copied.
1684 @param[out] NewSha384Context Pointer to new SHA-384 context.
1686 @retval TRUE SHA-384 context copy succeeded.
1687 @retval FALSE SHA-384 context copy failed.
1688 @retval FALSE This interface is not supported.
1693 (EFIAPI
*EDKII_CRYPTO_SHA384_DUPLICATE
)(
1694 IN CONST VOID
*Sha384Context
,
1695 OUT VOID
*NewSha384Context
1699 Digests the input data and updates SHA-384 context.
1701 This function performs SHA-384 digest on a data buffer of the specified size.
1702 It can be called multiple times to compute the digest of long or discontinuous data streams.
1703 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized
1704 by Sha384Final(). Behavior with invalid context is undefined.
1706 If Sha384Context is NULL, then return FALSE.
1708 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1709 @param[in] Data Pointer to the buffer containing the data to be hashed.
1710 @param[in] DataSize Size of Data buffer in bytes.
1712 @retval TRUE SHA-384 data digest succeeded.
1713 @retval FALSE SHA-384 data digest failed.
1718 (EFIAPI
*EDKII_CRYPTO_SHA384_UPDATE
)(
1719 IN OUT VOID
*Sha384Context
,
1720 IN CONST VOID
*Data
,
1725 Completes computation of the SHA-384 digest value.
1727 This function completes SHA-384 hash computation and retrieves the digest value into
1728 the specified memory. After this function has been called, the SHA-384 context cannot
1730 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be
1731 finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.
1733 If Sha384Context is NULL, then return FALSE.
1734 If HashValue is NULL, then return FALSE.
1736 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1737 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1740 @retval TRUE SHA-384 digest computation succeeded.
1741 @retval FALSE SHA-384 digest computation failed.
1746 (EFIAPI
*EDKII_CRYPTO_SHA384_FINAL
)(
1747 IN OUT VOID
*Sha384Context
,
1748 OUT UINT8
*HashValue
1752 Computes the SHA-384 message digest of a input data buffer.
1754 This function performs the SHA-384 message digest of a given data buffer, and places
1755 the digest value into the specified memory.
1757 If this interface is not supported, then return FALSE.
1759 @param[in] Data Pointer to the buffer containing the data to be hashed.
1760 @param[in] DataSize Size of Data buffer in bytes.
1761 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1764 @retval TRUE SHA-384 digest computation succeeded.
1765 @retval FALSE SHA-384 digest computation failed.
1766 @retval FALSE This interface is not supported.
1771 (EFIAPI
*EDKII_CRYPTO_SHA384_HASH_ALL
)(
1772 IN CONST VOID
*Data
,
1774 OUT UINT8
*HashValue
1778 Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.
1780 @return The size, in bytes, of the context buffer required for SHA-512 hash operations.
1785 (EFIAPI
*EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE
)(
1790 Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for
1793 If Sha512Context is NULL, then return FALSE.
1795 @param[out] Sha512Context Pointer to SHA-512 context being initialized.
1797 @retval TRUE SHA-512 context initialization succeeded.
1798 @retval FALSE SHA-512 context initialization failed.
1803 (EFIAPI
*EDKII_CRYPTO_SHA512_INIT
)(
1804 OUT VOID
*Sha512Context
1808 Makes a copy of an existing SHA-512 context.
1810 If Sha512Context is NULL, then return FALSE.
1811 If NewSha512Context is NULL, then return FALSE.
1812 If this interface is not supported, then return FALSE.
1814 @param[in] Sha512Context Pointer to SHA-512 context being copied.
1815 @param[out] NewSha512Context Pointer to new SHA-512 context.
1817 @retval TRUE SHA-512 context copy succeeded.
1818 @retval FALSE SHA-512 context copy failed.
1819 @retval FALSE This interface is not supported.
1824 (EFIAPI
*EDKII_CRYPTO_SHA512_DUPLICATE
)(
1825 IN CONST VOID
*Sha512Context
,
1826 OUT VOID
*NewSha512Context
1830 Digests the input data and updates SHA-512 context.
1832 This function performs SHA-512 digest on a data buffer of the specified size.
1833 It can be called multiple times to compute the digest of long or discontinuous data streams.
1834 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized
1835 by Sha512Final(). Behavior with invalid context is undefined.
1837 If Sha512Context is NULL, then return FALSE.
1839 @param[in, out] Sha512Context Pointer to the SHA-512 context.
1840 @param[in] Data Pointer to the buffer containing the data to be hashed.
1841 @param[in] DataSize Size of Data buffer in bytes.
1843 @retval TRUE SHA-512 data digest succeeded.
1844 @retval FALSE SHA-512 data digest failed.
1849 (EFIAPI
*EDKII_CRYPTO_SHA512_UPDATE
)(
1850 IN OUT VOID
*Sha512Context
,
1851 IN CONST VOID
*Data
,
1856 Completes computation of the SHA-512 digest value.
1858 This function completes SHA-512 hash computation and retrieves the digest value into
1859 the specified memory. After this function has been called, the SHA-512 context cannot
1861 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be
1862 finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.
1864 If Sha512Context is NULL, then return FALSE.
1865 If HashValue is NULL, then return FALSE.
1867 @param[in, out] Sha512Context Pointer to the SHA-512 context.
1868 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
1871 @retval TRUE SHA-512 digest computation succeeded.
1872 @retval FALSE SHA-512 digest computation failed.
1877 (EFIAPI
*EDKII_CRYPTO_SHA512_FINAL
)(
1878 IN OUT VOID
*Sha512Context
,
1879 OUT UINT8
*HashValue
1883 Computes the SHA-512 message digest of a input data buffer.
1885 This function performs the SHA-512 message digest of a given data buffer, and places
1886 the digest value into the specified memory.
1888 If this interface is not supported, then return FALSE.
1890 @param[in] Data Pointer to the buffer containing the data to be hashed.
1891 @param[in] DataSize Size of Data buffer in bytes.
1892 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
1895 @retval TRUE SHA-512 digest computation succeeded.
1896 @retval FALSE SHA-512 digest computation failed.
1897 @retval FALSE This interface is not supported.
1902 (EFIAPI
*EDKII_CRYPTO_SHA512_HASH_ALL
)(
1903 IN CONST VOID
*Data
,
1905 OUT UINT8
*HashValue
1908 // ----------------------------------------------------------------------------
1910 // ----------------------------------------------------------------------------
1913 Retrieve the subject bytes from one X.509 certificate.
1915 If Cert is NULL, then return FALSE.
1916 If SubjectSize is NULL, then return FALSE.
1917 If this interface is not supported, then return FALSE.
1919 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1920 @param[in] CertSize Size of the X509 certificate in bytes.
1921 @param[out] CertSubject Pointer to the retrieved certificate subject bytes.
1922 @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,
1923 and the size of buffer returned CertSubject on output.
1925 @retval TRUE The certificate subject retrieved successfully.
1926 @retval FALSE Invalid certificate, or the SubjectSize is too small for the result.
1927 The SubjectSize will be updated with the required size.
1928 @retval FALSE This interface is not supported.
1933 (EFIAPI
*EDKII_CRYPTO_X509_GET_SUBJECT_NAME
)(
1934 IN CONST UINT8
*Cert
,
1936 OUT UINT8
*CertSubject
,
1937 IN OUT UINTN
*SubjectSize
1941 Retrieve the common name (CN) string from one X.509 certificate.
1943 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1944 @param[in] CertSize Size of the X509 certificate in bytes.
1945 @param[out] CommonName Buffer to contain the retrieved certificate common
1946 name string (UTF8). At most CommonNameSize bytes will be
1947 written and the string will be null terminated. May be
1948 NULL in order to determine the size buffer needed.
1949 @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,
1950 and the size of buffer returned CommonName on output.
1951 If CommonName is NULL then the amount of space needed
1952 in buffer (including the final null) is returned.
1954 @retval RETURN_SUCCESS The certificate CommonName retrieved successfully.
1955 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
1956 If CommonNameSize is NULL.
1957 If CommonName is not NULL and *CommonNameSize is 0.
1958 If Certificate is invalid.
1959 @retval RETURN_NOT_FOUND If no CommonName entry exists.
1960 @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size
1961 (including the final null) is returned in the
1962 CommonNameSize parameter.
1963 @retval RETURN_UNSUPPORTED The operation is not supported.
1968 (EFIAPI
*EDKII_CRYPTO_X509_GET_COMMON_NAME
)(
1969 IN CONST UINT8
*Cert
,
1971 OUT CHAR8
*CommonName OPTIONAL
,
1972 IN OUT UINTN
*CommonNameSize
1976 Retrieve the organization name (O) string from one X.509 certificate.
1978 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1979 @param[in] CertSize Size of the X509 certificate in bytes.
1980 @param[out] NameBuffer Buffer to contain the retrieved certificate organization
1981 name string. At most NameBufferSize bytes will be
1982 written and the string will be null terminated. May be
1983 NULL in order to determine the size buffer needed.
1984 @param[in,out] NameBufferSiz e The size in bytes of the Name buffer on input,
1985 and the size of buffer returned Name on output.
1986 If NameBuffer is NULL then the amount of space needed
1987 in buffer (including the final null) is returned.
1989 @retval RETURN_SUCCESS The certificate Organization Name retrieved successfully.
1990 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
1991 If NameBufferSize is NULL.
1992 If NameBuffer is not NULL and *CommonNameSize is 0.
1993 If Certificate is invalid.
1994 @retval RETURN_NOT_FOUND If no Organization Name entry exists.
1995 @retval RETURN_BUFFER_TOO_SMALL If the NameBuffer is NULL. The required buffer size
1996 (including the final null) is returned in the
1997 CommonNameSize parameter.
1998 @retval RETURN_UNSUPPORTED The operation is not supported.
2003 (EFIAPI
*EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME
)(
2004 IN CONST UINT8
*Cert
,
2006 OUT CHAR8
*NameBuffer OPTIONAL
,
2007 IN OUT UINTN
*NameBufferSize
2011 Verify one X509 certificate was issued by the trusted CA.
2013 If Cert is NULL, then return FALSE.
2014 If CACert is NULL, then return FALSE.
2015 If this interface is not supported, then return FALSE.
2017 @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.
2018 @param[in] CertSize Size of the X509 certificate in bytes.
2019 @param[in] CACert Pointer to the DER-encoded trusted CA certificate.
2020 @param[in] CACertSize Size of the CA Certificate in bytes.
2022 @retval TRUE The certificate was issued by the trusted CA.
2023 @retval FALSE Invalid certificate or the certificate was not issued by the given
2025 @retval FALSE This interface is not supported.
2030 (EFIAPI
*EDKII_CRYPTO_X509_VERIFY_CERT
)(
2031 IN CONST UINT8
*Cert
,
2033 IN CONST UINT8
*CACert
,
2038 Construct a X509 object from DER-encoded certificate data.
2040 If Cert is NULL, then return FALSE.
2041 If SingleX509Cert is NULL, then return FALSE.
2042 If this interface is not supported, then return FALSE.
2044 @param[in] Cert Pointer to the DER-encoded certificate data.
2045 @param[in] CertSize The size of certificate data in bytes.
2046 @param[out] SingleX509Cert The generated X509 object.
2048 @retval TRUE The X509 object generation succeeded.
2049 @retval FALSE The operation failed.
2050 @retval FALSE This interface is not supported.
2055 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE
)(
2056 IN CONST UINT8
*Cert
,
2058 OUT UINT8
**SingleX509Cert
2062 Construct a X509 stack object from a list of DER-encoded certificate data.
2064 If X509Stack is NULL, then return FALSE.
2065 If this interface is not supported, then return FALSE.
2067 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2068 On output, pointer to the X509 stack object with new
2069 inserted X509 certificate.
2070 @param ... A list of DER-encoded single certificate data followed
2071 by certificate size. A NULL terminates the list. The
2072 pairs are the arguments to X509ConstructCertificate().
2074 @retval TRUE The X509 stack construction succeeded.
2075 @retval FALSE The construction operation failed.
2076 @retval FALSE This interface is not supported.
2081 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK
)(
2082 IN OUT UINT8
**X509Stack
,
2087 Construct a X509 stack object from a list of DER-encoded certificate data.
2089 If X509Stack is NULL, then return FALSE.
2090 If this interface is not supported, then return FALSE.
2092 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2093 On output, pointer to the X509 stack object with new
2094 inserted X509 certificate.
2095 @param[in] Args VA_LIST marker for the variable argument list.
2096 A list of DER-encoded single certificate data followed
2097 by certificate size. A NULL terminates the list. The
2098 pairs are the arguments to X509ConstructCertificate().
2100 @retval TRUE The X509 stack construction succeeded.
2101 @retval FALSE The construction operation failed.
2102 @retval FALSE This interface is not supported.
2107 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V
)(
2108 IN OUT UINT8
**X509Stack
,
2113 Release the specified X509 object.
2115 If the interface is not supported, then ASSERT().
2117 @param[in] X509Cert Pointer to the X509 object to be released.
2122 (EFIAPI
*EDKII_CRYPTO_X509_FREE
)(
2127 Release the specified X509 stack object.
2129 If the interface is not supported, then ASSERT().
2131 @param[in] X509Stack Pointer to the X509 stack object to be released.
2136 (EFIAPI
*EDKII_CRYPTO_X509_STACK_FREE
)(
2141 Retrieve the TBSCertificate from one given X.509 certificate.
2143 @param[in] Cert Pointer to the given DER-encoded X509 certificate.
2144 @param[in] CertSize Size of the X509 certificate in bytes.
2145 @param[out] TBSCert DER-Encoded To-Be-Signed certificate.
2146 @param[out] TBSCertSize Size of the TBS certificate in bytes.
2148 If Cert is NULL, then return FALSE.
2149 If TBSCert is NULL, then return FALSE.
2150 If TBSCertSize is NULL, then return FALSE.
2151 If this interface is not supported, then return FALSE.
2153 @retval TRUE The TBSCertificate was retrieved successfully.
2154 @retval FALSE Invalid X.509 certificate.
2159 (EFIAPI
*EDKII_CRYPTO_X509_GET_TBS_CERT
)(
2160 IN CONST UINT8
*Cert
,
2162 OUT UINT8
**TBSCert
,
2163 OUT UINTN
*TBSCertSize
2166 // =====================================================================================
2167 // Symmetric Cryptography Primitive
2168 // =====================================================================================
2171 TDES is deprecated and unsupported any longer.
2172 Keep the function field for binary compability.
2177 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE
)(
2183 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_INIT
)(
2184 OUT VOID
*TdesContext
,
2185 IN CONST UINT8
*Key
,
2191 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT
)(
2192 IN VOID
*TdesContext
,
2193 IN CONST UINT8
*Input
,
2200 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT
)(
2201 IN VOID
*TdesContext
,
2202 IN CONST UINT8
*Input
,
2209 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT
)(
2210 IN VOID
*TdesContext
,
2211 IN CONST UINT8
*Input
,
2213 IN CONST UINT8
*Ivec
,
2219 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT
)(
2220 IN VOID
*TdesContext
,
2221 IN CONST UINT8
*Input
,
2223 IN CONST UINT8
*Ivec
,
2228 Retrieves the size, in bytes, of the context buffer required for AES operations.
2230 If this interface is not supported, then return zero.
2232 @return The size, in bytes, of the context buffer required for AES operations.
2233 @retval 0 This interface is not supported.
2238 (EFIAPI
*EDKII_CRYPTO_AES_GET_CONTEXT_SIZE
)(
2243 Initializes user-supplied memory as AES context for subsequent use.
2245 This function initializes user-supplied memory pointed by AesContext as AES context.
2246 In addition, it sets up all AES key materials for subsequent encryption and decryption
2248 There are 3 options for key length, 128 bits, 192 bits, and 256 bits.
2250 If AesContext is NULL, then return FALSE.
2251 If Key is NULL, then return FALSE.
2252 If KeyLength is not valid, then return FALSE.
2253 If this interface is not supported, then return FALSE.
2255 @param[out] AesContext Pointer to AES context being initialized.
2256 @param[in] Key Pointer to the user-supplied AES key.
2257 @param[in] KeyLength Length of AES key in bits.
2259 @retval TRUE AES context initialization succeeded.
2260 @retval FALSE AES context initialization failed.
2261 @retval FALSE This interface is not supported.
2266 (EFIAPI
*EDKII_CRYPTO_AES_INIT
)(
2267 OUT VOID
*AesContext
,
2268 IN CONST UINT8
*Key
,
2273 AES ECB Mode is deprecated and unsupported any longer.
2274 Keep the function field for binary compability.
2279 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT
)(
2280 IN VOID
*AesContext
,
2281 IN CONST UINT8
*Input
,
2288 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT
)(
2289 IN VOID
*AesContext
,
2290 IN CONST UINT8
*Input
,
2296 Performs AES encryption on a data buffer of the specified size in CBC mode.
2298 This function performs AES encryption on data buffer pointed by Input, of specified
2299 size of InputSize, in CBC mode.
2300 InputSize must be multiple of block size (16 bytes). This function does not perform
2301 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2302 Initialization vector should be one block size (16 bytes).
2303 AesContext should be already correctly initialized by AesInit(). Behavior with
2304 invalid AES context is undefined.
2306 If AesContext is NULL, then return FALSE.
2307 If Input is NULL, then return FALSE.
2308 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2309 If Ivec is NULL, then return FALSE.
2310 If Output is NULL, then return FALSE.
2311 If this interface is not supported, then return FALSE.
2313 @param[in] AesContext Pointer to the AES context.
2314 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2315 @param[in] InputSize Size of the Input buffer in bytes.
2316 @param[in] Ivec Pointer to initialization vector.
2317 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2319 @retval TRUE AES encryption succeeded.
2320 @retval FALSE AES encryption failed.
2321 @retval FALSE This interface is not supported.
2326 (EFIAPI
*EDKII_CRYPTO_AES_CBC_ENCRYPT
)(
2327 IN VOID
*AesContext
,
2328 IN CONST UINT8
*Input
,
2330 IN CONST UINT8
*Ivec
,
2335 Performs AES decryption on a data buffer of the specified size in CBC mode.
2337 This function performs AES decryption on data buffer pointed by Input, of specified
2338 size of InputSize, in CBC mode.
2339 InputSize must be multiple of block size (16 bytes). This function does not perform
2340 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2341 Initialization vector should be one block size (16 bytes).
2342 AesContext should be already correctly initialized by AesInit(). Behavior with
2343 invalid AES context is undefined.
2345 If AesContext is NULL, then return FALSE.
2346 If Input is NULL, then return FALSE.
2347 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2348 If Ivec is NULL, then return FALSE.
2349 If Output is NULL, then return FALSE.
2350 If this interface is not supported, then return FALSE.
2352 @param[in] AesContext Pointer to the AES context.
2353 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2354 @param[in] InputSize Size of the Input buffer in bytes.
2355 @param[in] Ivec Pointer to initialization vector.
2356 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2358 @retval TRUE AES decryption succeeded.
2359 @retval FALSE AES decryption failed.
2360 @retval FALSE This interface is not supported.
2365 (EFIAPI
*EDKII_CRYPTO_AES_CBC_DECRYPT
)(
2366 IN VOID
*AesContext
,
2367 IN CONST UINT8
*Input
,
2369 IN CONST UINT8
*Ivec
,
2374 ARC4 is deprecated and unsupported any longer.
2375 Keep the function field for binary compability.
2380 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE
)(
2386 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_INIT
)(
2387 OUT VOID
*Arc4Context
,
2388 IN CONST UINT8
*Key
,
2394 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT
)(
2395 IN OUT VOID
*Arc4Context
,
2396 IN CONST UINT8
*Input
,
2403 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT
)(
2404 IN OUT VOID
*Arc4Context
,
2412 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_RESET
)(
2413 IN OUT VOID
*Arc4Context
2417 Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
2419 If this interface is not supported, then return zero.
2421 @return The size, in bytes, of the context buffer required for SM3 hash operations.
2422 @retval 0 This interface is not supported.
2427 (EFIAPI
*EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE
)(
2432 Initializes user-supplied memory pointed by Sm3Context as SM3 hash context for
2435 If Sm3Context is NULL, then return FALSE.
2436 If this interface is not supported, then return FALSE.
2438 @param[out] Sm3Context Pointer to SM3 context being initialized.
2440 @retval TRUE SM3 context initialization succeeded.
2441 @retval FALSE SM3 context initialization failed.
2442 @retval FALSE This interface is not supported.
2447 (EFIAPI
*EDKII_CRYPTO_SM3_INIT
)(
2448 OUT VOID
*Sm3Context
2452 Makes a copy of an existing SM3 context.
2454 If Sm3Context is NULL, then return FALSE.
2455 If NewSm3Context is NULL, then return FALSE.
2456 If this interface is not supported, then return FALSE.
2458 @param[in] Sm3Context Pointer to SM3 context being copied.
2459 @param[out] NewSm3Context Pointer to new SM3 context.
2461 @retval TRUE SM3 context copy succeeded.
2462 @retval FALSE SM3 context copy failed.
2463 @retval FALSE This interface is not supported.
2468 (EFIAPI
*EDKII_CRYPTO_SM3_DUPLICATE
)(
2469 IN CONST VOID
*Sm3Context
,
2470 OUT VOID
*NewSm3Context
2474 Digests the input data and updates SM3 context.
2476 This function performs SM3 digest on a data buffer of the specified size.
2477 It can be called multiple times to compute the digest of long or discontinuous data streams.
2478 SM3 context should be already correctly initialized by Sm3Init(), and should not be finalized
2479 by Sm3Final(). Behavior with invalid context is undefined.
2481 If Sm3Context is NULL, then return FALSE.
2482 If this interface is not supported, then return FALSE.
2484 @param[in, out] Sm3Context Pointer to the SM3 context.
2485 @param[in] Data Pointer to the buffer containing the data to be hashed.
2486 @param[in] DataSize Size of Data buffer in bytes.
2488 @retval TRUE SM3 data digest succeeded.
2489 @retval FALSE SM3 data digest failed.
2490 @retval FALSE This interface is not supported.
2495 (EFIAPI
*EDKII_CRYPTO_SM3_UPDATE
)(
2496 IN OUT VOID
*Sm3Context
,
2497 IN CONST VOID
*Data
,
2502 Completes computation of the SM3 digest value.
2504 This function completes SM3 hash computation and retrieves the digest value into
2505 the specified memory. After this function has been called, the SM3 context cannot
2507 SM3 context should be already correctly initialized by Sm3Init(), and should not be
2508 finalized by Sm3Final(). Behavior with invalid SM3 context is undefined.
2510 If Sm3Context is NULL, then return FALSE.
2511 If HashValue is NULL, then return FALSE.
2512 If this interface is not supported, then return FALSE.
2514 @param[in, out] Sm3Context Pointer to the SM3 context.
2515 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
2518 @retval TRUE SM3 digest computation succeeded.
2519 @retval FALSE SM3 digest computation failed.
2520 @retval FALSE This interface is not supported.
2525 (EFIAPI
*EDKII_CRYPTO_SM3_FINAL
)(
2526 IN OUT VOID
*Sm3Context
,
2527 OUT UINT8
*HashValue
2531 Computes the SM3 message digest of a input data buffer.
2533 This function performs the SM3 message digest of a given data buffer, and places
2534 the digest value into the specified memory.
2536 If this interface is not supported, then return FALSE.
2538 @param[in] Data Pointer to the buffer containing the data to be hashed.
2539 @param[in] DataSize Size of Data buffer in bytes.
2540 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
2543 @retval TRUE SM3 digest computation succeeded.
2544 @retval FALSE SM3 digest computation failed.
2545 @retval FALSE This interface is not supported.
2550 (EFIAPI
*EDKII_CRYPTO_SM3_HASH_ALL
)(
2551 IN CONST VOID
*Data
,
2553 OUT UINT8
*HashValue
2557 Derive key data using HMAC-SHA256 based KDF.
2559 @param[in] Key Pointer to the user-supplied key.
2560 @param[in] KeySize Key size in bytes.
2561 @param[in] Salt Pointer to the salt(non-secret) value.
2562 @param[in] SaltSize Salt size in bytes.
2563 @param[in] Info Pointer to the application specific info.
2564 @param[in] InfoSize Info size in bytes.
2565 @param[out] Out Pointer to buffer to receive hkdf value.
2566 @param[in] OutSize Size of hkdf bytes to generate.
2568 @retval TRUE Hkdf generated successfully.
2569 @retval FALSE Hkdf generation failed.
2574 (EFIAPI
*EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND
)(
2575 IN CONST UINT8
*Key
,
2577 IN CONST UINT8
*Salt
,
2579 IN CONST UINT8
*Info
,
2586 Initializes the OpenSSL library.
2588 This function registers ciphers and digests used directly and indirectly
2589 by SSL/TLS, and initializes the readable error messages.
2590 This function must be called before any other action takes places.
2592 @retval TRUE The OpenSSL library has been initialized.
2593 @retval FALSE Failed to initialize the OpenSSL library.
2598 (EFIAPI
*EDKII_CRYPTO_TLS_INITIALIZE
)(
2603 Free an allocated SSL_CTX object.
2605 @param[in] TlsCtx Pointer to the SSL_CTX object to be released.
2610 (EFIAPI
*EDKII_CRYPTO_TLS_CTX_FREE
)(
2615 Creates a new SSL_CTX object as framework to establish TLS/SSL enabled
2618 @param[in] MajorVer Major Version of TLS/SSL Protocol.
2619 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
2621 @return Pointer to an allocated SSL_CTX object.
2622 If the creation failed, TlsCtxNew() returns NULL.
2627 (EFIAPI
*EDKII_CRYPTO_TLS_CTX_NEW
)(
2633 Free an allocated TLS object.
2635 This function removes the TLS object pointed to by Tls and frees up the
2636 allocated memory. If Tls is NULL, nothing is done.
2638 @param[in] Tls Pointer to the TLS object to be freed.
2643 (EFIAPI
*EDKII_CRYPTO_TLS_FREE
)(
2648 Create a new TLS object for a connection.
2650 This function creates a new TLS object for a connection. The new object
2651 inherits the setting of the underlying context TlsCtx: connection method,
2652 options, verification setting.
2654 @param[in] TlsCtx Pointer to the SSL_CTX object.
2656 @return Pointer to an allocated SSL object.
2657 If the creation failed, TlsNew() returns NULL.
2662 (EFIAPI
*EDKII_CRYPTO_TLS_NEW
)(
2667 Checks if the TLS handshake was done.
2669 This function will check if the specified TLS handshake was done.
2671 @param[in] Tls Pointer to the TLS object for handshake state checking.
2673 @retval TRUE The TLS handshake was done.
2674 @retval FALSE The TLS handshake was not done.
2679 (EFIAPI
*EDKII_CRYPTO_TLS_IN_HANDSHAKE
)(
2684 Perform a TLS/SSL handshake.
2686 This function will perform a TLS/SSL handshake.
2688 @param[in] Tls Pointer to the TLS object for handshake operation.
2689 @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.
2690 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
2692 @param[out] BufferOut Pointer to the buffer to hold the built packet.
2693 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
2694 the buffer size provided by the caller. On output, it
2695 is the buffer size in fact needed to contain the
2698 @retval EFI_SUCCESS The required TLS packet is built successfully.
2699 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2701 BufferIn is NULL but BufferInSize is NOT 0.
2702 BufferInSize is 0 but BufferIn is NOT NULL.
2703 BufferOutSize is NULL.
2704 BufferOut is NULL if *BufferOutSize is not zero.
2705 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
2706 @retval EFI_ABORTED Something wrong during handshake.
2711 (EFIAPI
*EDKII_CRYPTO_TLS_DO_HANDSHAKE
)(
2713 IN UINT8
*BufferIn OPTIONAL
,
2714 IN UINTN BufferInSize OPTIONAL
,
2715 OUT UINT8
*BufferOut OPTIONAL
,
2716 IN OUT UINTN
*BufferOutSize
2720 Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,
2721 TLS session has errors and the response packet needs to be Alert message based on error type.
2723 @param[in] Tls Pointer to the TLS object for state checking.
2724 @param[in] BufferIn Pointer to the most recently received TLS Alert packet.
2725 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
2727 @param[out] BufferOut Pointer to the buffer to hold the built packet.
2728 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
2729 the buffer size provided by the caller. On output, it
2730 is the buffer size in fact needed to contain the
2733 @retval EFI_SUCCESS The required TLS packet is built successfully.
2734 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2736 BufferIn is NULL but BufferInSize is NOT 0.
2737 BufferInSize is 0 but BufferIn is NOT NULL.
2738 BufferOutSize is NULL.
2739 BufferOut is NULL if *BufferOutSize is not zero.
2740 @retval EFI_ABORTED An error occurred.
2741 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
2746 (EFIAPI
*EDKII_CRYPTO_TLS_HANDLE_ALERT
)(
2748 IN UINT8
*BufferIn OPTIONAL
,
2749 IN UINTN BufferInSize OPTIONAL
,
2750 OUT UINT8
*BufferOut OPTIONAL
,
2751 IN OUT UINTN
*BufferOutSize
2755 Build the CloseNotify packet.
2757 @param[in] Tls Pointer to the TLS object for state checking.
2758 @param[in, out] Buffer Pointer to the buffer to hold the built packet.
2759 @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is
2760 the buffer size provided by the caller. On output, it
2761 is the buffer size in fact needed to contain the
2764 @retval EFI_SUCCESS The required TLS packet is built successfully.
2765 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2768 Buffer is NULL if *BufferSize is not zero.
2769 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.
2774 (EFIAPI
*EDKII_CRYPTO_TLS_CLOSE_NOTIFY
)(
2776 IN OUT UINT8
*Buffer
,
2777 IN OUT UINTN
*BufferSize
2781 Attempts to read bytes from one TLS object and places the data in Buffer.
2783 This function will attempt to read BufferSize bytes from the TLS object
2784 and places the data in Buffer.
2786 @param[in] Tls Pointer to the TLS object.
2787 @param[in,out] Buffer Pointer to the buffer to store the data.
2788 @param[in] BufferSize The size of Buffer in bytes.
2790 @retval >0 The amount of data successfully read from the TLS object.
2791 @retval <=0 No data was successfully read.
2796 (EFIAPI
*EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT
)(
2798 IN OUT VOID
*Buffer
,
2803 Attempts to write data from the buffer to TLS object.
2805 This function will attempt to write BufferSize bytes data from the Buffer
2808 @param[in] Tls Pointer to the TLS object.
2809 @param[in] Buffer Pointer to the data buffer.
2810 @param[in] BufferSize The size of Buffer in bytes.
2812 @retval >0 The amount of data successfully written to the TLS object.
2813 @retval <=0 No data was successfully written.
2818 (EFIAPI
*EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN
)(
2825 Attempts to read bytes from the specified TLS connection into the buffer.
2827 This function tries to read BufferSize bytes data from the specified TLS
2828 connection into the Buffer.
2830 @param[in] Tls Pointer to the TLS connection for data reading.
2831 @param[in,out] Buffer Pointer to the data buffer.
2832 @param[in] BufferSize The size of Buffer in bytes.
2834 @retval >0 The read operation was successful, and return value is the
2835 number of bytes actually read from the TLS connection.
2836 @retval <=0 The read operation was not successful.
2841 (EFIAPI
*EDKII_CRYPTO_TLS_READ
)(
2843 IN OUT VOID
*Buffer
,
2848 Attempts to write data to a TLS connection.
2850 This function tries to write BufferSize bytes data from the Buffer into the
2851 specified TLS connection.
2853 @param[in] Tls Pointer to the TLS connection for data writing.
2854 @param[in] Buffer Pointer to the data buffer.
2855 @param[in] BufferSize The size of Buffer in bytes.
2857 @retval >0 The write operation was successful, and return value is the
2858 number of bytes actually written to the TLS connection.
2859 @retval <=0 The write operation was not successful.
2864 (EFIAPI
*EDKII_CRYPTO_TLS_WRITE
)(
2871 Set a new TLS/SSL method for a particular TLS object.
2873 This function sets a new TLS/SSL method for a particular TLS object.
2875 @param[in] Tls Pointer to a TLS object.
2876 @param[in] MajorVer Major Version of TLS/SSL Protocol.
2877 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
2879 @retval EFI_SUCCESS The TLS/SSL method was set successfully.
2880 @retval EFI_INVALID_PARAMETER The parameter is invalid.
2881 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.
2886 (EFIAPI
*EDKII_CRYPTO_TLS_SET_VERSION
)(
2893 Set TLS object to work in client or server mode.
2895 This function prepares a TLS object to work in client or server mode.
2897 @param[in] Tls Pointer to a TLS object.
2898 @param[in] IsServer Work in server mode.
2900 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.
2901 @retval EFI_INVALID_PARAMETER The parameter is invalid.
2902 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.
2907 (EFIAPI
*EDKII_CRYPTO_TLS_SET_CONNECTION_END
)(
2913 Set the ciphers list to be used by the TLS object.
2915 This function sets the ciphers for use by a specified TLS object.
2917 @param[in] Tls Pointer to a TLS object.
2918 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16
2919 cipher identifier comes from the TLS Cipher Suite
2920 Registry of the IANA, interpreting Byte1 and Byte2
2921 in network (big endian) byte order.
2922 @param[in] CipherNum The number of cipher in the list.
2924 @retval EFI_SUCCESS The ciphers list was set successfully.
2925 @retval EFI_INVALID_PARAMETER The parameter is invalid.
2926 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.
2927 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2932 (EFIAPI
*EDKII_CRYPTO_TLS_SET_CIPHER_LIST
)(
2934 IN UINT16
*CipherId
,
2939 Set the compression method for TLS/SSL operations.
2941 This function handles TLS/SSL integrated compression methods.
2943 @param[in] CompMethod The compression method ID.
2945 @retval EFI_SUCCESS The compression method for the communication was
2947 @retval EFI_UNSUPPORTED Unsupported compression method.
2952 (EFIAPI
*EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD
)(
2957 Set peer certificate verification mode for the TLS connection.
2959 This function sets the verification mode flags for the TLS connection.
2961 @param[in] Tls Pointer to the TLS object.
2962 @param[in] VerifyMode A set of logically or'ed verification mode flags.
2967 (EFIAPI
*EDKII_CRYPTO_TLS_SET_VERIFY
)(
2969 IN UINT32 VerifyMode
2973 Set the specified host name to be verified.
2975 @param[in] Tls Pointer to the TLS object.
2976 @param[in] Flags The setting flags during the validation.
2977 @param[in] HostName The specified host name to be verified.
2979 @retval EFI_SUCCESS The HostName setting was set successfully.
2980 @retval EFI_INVALID_PARAMETER The parameter is invalid.
2981 @retval EFI_ABORTED Invalid HostName setting.
2986 (EFIAPI
*EDKII_CRYPTO_TLS_SET_VERIFY_HOST
)(
2993 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
2995 This function sets a session ID to be used when the TLS/SSL connection is
2998 @param[in] Tls Pointer to the TLS object.
2999 @param[in] SessionId Session ID data used for session resumption.
3000 @param[in] SessionIdLen Length of Session ID in bytes.
3002 @retval EFI_SUCCESS Session ID was set successfully.
3003 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3004 @retval EFI_UNSUPPORTED No available session for ID setting.
3009 (EFIAPI
*EDKII_CRYPTO_TLS_SET_SESSIONID
)(
3011 IN UINT8
*SessionId
,
3012 IN UINT16 SessionIdLen
3016 Adds the CA to the cert store when requesting Server or Client authentication.
3018 This function adds the CA certificate to the list of CAs when requesting
3019 Server or Client authentication for the chosen TLS connection.
3021 @param[in] Tls Pointer to the TLS object.
3022 @param[in] Data Pointer to the data buffer of a DER-encoded binary
3023 X.509 certificate or PEM-encoded X.509 certificate.
3024 @param[in] DataSize The size of data buffer in bytes.
3026 @retval EFI_SUCCESS The operation succeeded.
3027 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3028 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
3029 @retval EFI_ABORTED Invalid X.509 certificate.
3034 (EFIAPI
*EDKII_CRYPTO_TLS_SET_CA_CERTIFICATE
)(
3041 Loads the local public certificate into the specified TLS object.
3043 This function loads the X.509 certificate into the specified TLS object
3044 for TLS negotiation.
3046 @param[in] Tls Pointer to the TLS object.
3047 @param[in] Data Pointer to the data buffer of a DER-encoded binary
3048 X.509 certificate or PEM-encoded X.509 certificate.
3049 @param[in] DataSize The size of data buffer in bytes.
3051 @retval EFI_SUCCESS The operation succeeded.
3052 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3053 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
3054 @retval EFI_ABORTED Invalid X.509 certificate.
3059 (EFIAPI
*EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT
)(
3066 Adds the local private key to the specified TLS object.
3068 This function adds the local private key (PEM-encoded RSA or PKCS#8 private
3069 key) into the specified TLS object for TLS negotiation.
3071 @param[in] Tls Pointer to the TLS object.
3072 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA
3073 or PKCS#8 private key.
3074 @param[in] DataSize The size of data buffer in bytes.
3076 @retval EFI_SUCCESS The operation succeeded.
3077 @retval EFI_UNSUPPORTED This function is not supported.
3078 @retval EFI_ABORTED Invalid private key data.
3083 (EFIAPI
*EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY
)(
3090 Adds the CA-supplied certificate revocation list for certificate validation.
3092 This function adds the CA-supplied certificate revocation list data for
3093 certificate validity checking.
3095 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
3096 @param[in] DataSize The size of data buffer in bytes.
3098 @retval EFI_SUCCESS The operation succeeded.
3099 @retval EFI_UNSUPPORTED This function is not supported.
3100 @retval EFI_ABORTED Invalid CRL data.
3105 (EFIAPI
*EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST
)(
3111 Gets the protocol version used by the specified TLS connection.
3113 This function returns the protocol version used by the specified TLS
3116 If Tls is NULL, then ASSERT().
3118 @param[in] Tls Pointer to the TLS object.
3120 @return The protocol version of the specified TLS connection.
3125 (EFIAPI
*EDKII_CRYPTO_TLS_GET_VERSION
)(
3130 Gets the connection end of the specified TLS connection.
3132 This function returns the connection end (as client or as server) used by
3133 the specified TLS connection.
3135 If Tls is NULL, then ASSERT().
3137 @param[in] Tls Pointer to the TLS object.
3139 @return The connection end used by the specified TLS connection.
3144 (EFIAPI
*EDKII_CRYPTO_TLS_GET_CONNECTION_END
)(
3149 Gets the cipher suite used by the specified TLS connection.
3151 This function returns current cipher suite used by the specified
3154 @param[in] Tls Pointer to the TLS object.
3155 @param[in,out] CipherId The cipher suite used by the TLS object.
3157 @retval EFI_SUCCESS The cipher suite was returned successfully.
3158 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3159 @retval EFI_UNSUPPORTED Unsupported cipher suite.
3164 (EFIAPI
*EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER
)(
3166 IN OUT UINT16
*CipherId
3170 Gets the compression methods used by the specified TLS connection.
3172 This function returns current integrated compression methods used by
3173 the specified TLS connection.
3175 @param[in] Tls Pointer to the TLS object.
3176 @param[in,out] CompressionId The current compression method used by
3179 @retval EFI_SUCCESS The compression method was returned successfully.
3180 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3181 @retval EFI_ABORTED Invalid Compression method.
3182 @retval EFI_UNSUPPORTED This function is not supported.
3187 (EFIAPI
*EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID
)(
3189 IN OUT UINT8
*CompressionId
3193 Gets the verification mode currently set in the TLS connection.
3195 This function returns the peer verification mode currently set in the
3196 specified TLS connection.
3198 If Tls is NULL, then ASSERT().
3200 @param[in] Tls Pointer to the TLS object.
3202 @return The verification mode set in the specified TLS connection.
3207 (EFIAPI
*EDKII_CRYPTO_TLS_GET_VERIFY
)(
3212 Gets the session ID used by the specified TLS connection.
3214 This function returns the TLS/SSL session ID currently used by the
3215 specified TLS connection.
3217 @param[in] Tls Pointer to the TLS object.
3218 @param[in,out] SessionId Buffer to contain the returned session ID.
3219 @param[in,out] SessionIdLen The length of Session ID in bytes.
3221 @retval EFI_SUCCESS The Session ID was returned successfully.
3222 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3223 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
3228 (EFIAPI
*EDKII_CRYPTO_TLS_GET_SESSION_ID
)(
3230 IN OUT UINT8
*SessionId
,
3231 IN OUT UINT16
*SessionIdLen
3235 Gets the client random data used in the specified TLS connection.
3237 This function returns the TLS/SSL client random data currently used in
3238 the specified TLS connection.
3240 @param[in] Tls Pointer to the TLS object.
3241 @param[in,out] ClientRandom Buffer to contain the returned client
3242 random data (32 bytes).
3247 (EFIAPI
*EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM
)(
3249 IN OUT UINT8
*ClientRandom
3253 Gets the server random data used in the specified TLS connection.
3255 This function returns the TLS/SSL server random data currently used in
3256 the specified TLS connection.
3258 @param[in] Tls Pointer to the TLS object.
3259 @param[in,out] ServerRandom Buffer to contain the returned server
3260 random data (32 bytes).
3265 (EFIAPI
*EDKII_CRYPTO_TLS_GET_SERVER_RANDOM
)(
3267 IN OUT UINT8
*ServerRandom
3271 Gets the master key data used in the specified TLS connection.
3273 This function returns the TLS/SSL master key material currently used in
3274 the specified TLS connection.
3276 @param[in] Tls Pointer to the TLS object.
3277 @param[in,out] KeyMaterial Buffer to contain the returned key material.
3279 @retval EFI_SUCCESS Key material was returned successfully.
3280 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3281 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
3286 (EFIAPI
*EDKII_CRYPTO_TLS_GET_KEY_MATERIAL
)(
3288 IN OUT UINT8
*KeyMaterial
3292 Gets the CA Certificate from the cert store.
3294 This function returns the CA certificate for the chosen
3297 @param[in] Tls Pointer to the TLS object.
3298 @param[out] Data Pointer to the data buffer to receive the CA
3299 certificate data sent to the client.
3300 @param[in,out] DataSize The size of data buffer in bytes.
3302 @retval EFI_SUCCESS The operation succeeded.
3303 @retval EFI_UNSUPPORTED This function is not supported.
3304 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3309 (EFIAPI
*EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE
)(
3312 IN OUT UINTN
*DataSize
3316 Gets the local public Certificate set in the specified TLS object.
3318 This function returns the local public certificate which was currently set
3319 in the specified TLS object.
3321 @param[in] Tls Pointer to the TLS object.
3322 @param[out] Data Pointer to the data buffer to receive the local
3324 @param[in,out] DataSize The size of data buffer in bytes.
3326 @retval EFI_SUCCESS The operation succeeded.
3327 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3328 @retval EFI_NOT_FOUND The certificate is not found.
3329 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3334 (EFIAPI
*EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT
)(
3337 IN OUT UINTN
*DataSize
3341 Gets the local private key set in the specified TLS object.
3343 This function returns the local private key data which was currently set
3344 in the specified TLS object.
3346 @param[in] Tls Pointer to the TLS object.
3347 @param[out] Data Pointer to the data buffer to receive the local
3349 @param[in,out] DataSize The size of data buffer in bytes.
3351 @retval EFI_SUCCESS The operation succeeded.
3352 @retval EFI_UNSUPPORTED This function is not supported.
3353 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3358 (EFIAPI
*EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY
)(
3361 IN OUT UINTN
*DataSize
3365 Gets the CA-supplied certificate revocation list data set in the specified
3368 This function returns the CA-supplied certificate revocation list data which
3369 was currently set in the specified TLS object.
3371 @param[out] Data Pointer to the data buffer to receive the CRL data.
3372 @param[in,out] DataSize The size of data buffer in bytes.
3374 @retval EFI_SUCCESS The operation succeeded.
3375 @retval EFI_UNSUPPORTED This function is not supported.
3376 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3381 (EFIAPI
*EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST
)(
3383 IN OUT UINTN
*DataSize
3387 Carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme.
3389 This function carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme defined in
3391 Mask generation function is the same as the message digest algorithm.
3392 If the Signature buffer is too small to hold the contents of signature, FALSE
3393 is returned and SigSize is set to the required buffer size to obtain the signature.
3395 If RsaContext is NULL, then return FALSE.
3396 If Message is NULL, then return FALSE.
3397 If MsgSize is zero or > INT_MAX, then return FALSE.
3398 If DigestLen is NOT 32, 48 or 64, return FALSE.
3399 If SaltLen is not equal to DigestLen, then return FALSE.
3400 If SigSize is large enough but Signature is NULL, then return FALSE.
3401 If this interface is not supported, then return FALSE.
3403 @param[in] RsaContext Pointer to RSA context for signature generation.
3404 @param[in] Message Pointer to octet message to be signed.
3405 @param[in] MsgSize Size of the message in bytes.
3406 @param[in] DigestLen Length of the digest in bytes to be used for RSA signature operation.
3407 @param[in] SaltLen Length of the salt in bytes to be used for PSS encoding.
3408 @param[out] Signature Pointer to buffer to receive RSA PSS signature.
3409 @param[in, out] SigSize On input, the size of Signature buffer in bytes.
3410 On output, the size of data returned in Signature buffer in bytes.
3412 @retval TRUE Signature successfully generated in RSASSA-PSS.
3413 @retval FALSE Signature generation failed.
3414 @retval FALSE SigSize is too small.
3415 @retval FALSE This interface is not supported.
3420 (EFIAPI
*EDKII_CRYPTO_RSA_PSS_SIGN
)(
3421 IN VOID
*RsaContext
,
3422 IN CONST UINT8
*Message
,
3424 IN UINT16 DigestLen
,
3426 OUT UINT8
*Signature
,
3427 IN OUT UINTN
*SigSize
3431 Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017.
3432 Implementation determines salt length automatically from the signature encoding.
3433 Mask generation function is the same as the message digest algorithm.
3434 Salt length should be equal to digest length.
3436 @param[in] RsaContext Pointer to RSA context for signature verification.
3437 @param[in] Message Pointer to octet message to be verified.
3438 @param[in] MsgSize Size of the message in bytes.
3439 @param[in] Signature Pointer to RSASSA-PSS signature to be verified.
3440 @param[in] SigSize Size of signature in bytes.
3441 @param[in] DigestLen Length of digest for RSA operation.
3442 @param[in] SaltLen Salt length for PSS encoding.
3444 @retval TRUE Valid signature encoded in RSASSA-PSS.
3445 @retval FALSE Invalid signature or invalid RSA context.
3450 (EFIAPI
*EDKII_CRYPTO_RSA_PSS_VERIFY
)(
3451 IN VOID
*RsaContext
,
3452 IN CONST UINT8
*Message
,
3454 IN CONST UINT8
*Signature
,
3456 IN UINT16 DigestLen
,
3461 /// EDK II Crypto Protocol
3463 struct _EDKII_CRYPTO_PROTOCOL
{
3465 EDKII_CRYPTO_GET_VERSION GetVersion
;
3466 /// HMAC MD5 - deprecated and unsupported
3467 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_NEW DeprecatedHmacMd5New
;
3468 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FREE DeprecatedHmacMd5Free
;
3469 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_SET_KEY DeprecatedHmacMd5SetKey
;
3470 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_DUPLICATE DeprecatedHmacMd5Duplicate
;
3471 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_UPDATE DeprecatedHmacMd5Update
;
3472 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FINAL DeprecatedHmacMd5Final
;
3473 /// HMAC SHA1 - deprecated and unsupported
3474 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_NEW DeprecatedHmacSha1New
;
3475 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FREE DeprecatedHmacSha1Free
;
3476 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_SET_KEY DeprecatedHmacSha1SetKey
;
3477 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_DUPLICATE DeprecatedHmacSha1Duplicate
;
3478 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_UPDATE DeprecatedHmacSha1Update
;
3479 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FINAL DeprecatedHmacSha1Final
;
3481 EDKII_CRYPTO_HMAC_SHA256_NEW HmacSha256New
;
3482 EDKII_CRYPTO_HMAC_SHA256_FREE HmacSha256Free
;
3483 EDKII_CRYPTO_HMAC_SHA256_SET_KEY HmacSha256SetKey
;
3484 EDKII_CRYPTO_HMAC_SHA256_DUPLICATE HmacSha256Duplicate
;
3485 EDKII_CRYPTO_HMAC_SHA256_UPDATE HmacSha256Update
;
3486 EDKII_CRYPTO_HMAC_SHA256_FINAL HmacSha256Final
;
3487 /// Md4 - deprecated and unsupported
3488 DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE DeprecatedMd4GetContextSize
;
3489 DEPRECATED_EDKII_CRYPTO_MD4_INIT DeprecatedMd4Init
;
3490 DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE DeprecatedMd4Duplicate
;
3491 DEPRECATED_EDKII_CRYPTO_MD4_UPDATE DeprecatedMd4Update
;
3492 DEPRECATED_EDKII_CRYPTO_MD4_FINAL DeprecatedMd4Final
;
3493 DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL DeprecatedMd4HashAll
;
3495 EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE Md5GetContextSize
;
3496 EDKII_CRYPTO_MD5_INIT Md5Init
;
3497 EDKII_CRYPTO_MD5_DUPLICATE Md5Duplicate
;
3498 EDKII_CRYPTO_MD5_UPDATE Md5Update
;
3499 EDKII_CRYPTO_MD5_FINAL Md5Final
;
3500 EDKII_CRYPTO_MD5_HASH_ALL Md5HashAll
;
3502 EDKII_CRYPTO_PKCS1_ENCRYPT_V2 Pkcs1v2Encrypt
;
3503 EDKII_CRYPTO_PKCS5_PW_HASH Pkcs5HashPassword
;
3504 EDKII_CRYPTO_PKCS7_VERIFY Pkcs7Verify
;
3505 EDKII_CRYPTO_PKCS7_VERIFY_EKU VerifyEKUsInPkcs7Signature
;
3506 EDKII_CRYPTO_PKCS7_GET_SIGNERS Pkcs7GetSigners
;
3507 EDKII_CRYPTO_PKCS7_FREE_SIGNERS Pkcs7FreeSigners
;
3508 EDKII_CRYPTO_PKCS7_SIGN Pkcs7Sign
;
3509 EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT Pkcs7GetAttachedContent
;
3510 EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST Pkcs7GetCertificatesList
;
3511 EDKII_CRYPTO_AUTHENTICODE_VERIFY AuthenticodeVerify
;
3512 EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY ImageTimestampVerify
;
3514 EDKII_CRYPTO_DH_NEW DhNew
;
3515 EDKII_CRYPTO_DH_FREE DhFree
;
3516 EDKII_CRYPTO_DH_GENERATE_PARAMETER DhGenerateParameter
;
3517 EDKII_CRYPTO_DH_SET_PARAMETER DhSetParameter
;
3518 EDKII_CRYPTO_DH_GENERATE_KEY DhGenerateKey
;
3519 EDKII_CRYPTO_DH_COMPUTE_KEY DhComputeKey
;
3521 EDKII_CRYPTO_RANDOM_SEED RandomSeed
;
3522 EDKII_CRYPTO_RANDOM_BYTES RandomBytes
;
3524 EDKII_CRYPTO_RSA_VERIFY_PKCS1 RsaVerifyPkcs1
;
3525 EDKII_CRYPTO_RSA_NEW RsaNew
;
3526 EDKII_CRYPTO_RSA_FREE RsaFree
;
3527 EDKII_CRYPTO_RSA_SET_KEY RsaSetKey
;
3528 EDKII_CRYPTO_RSA_GET_KEY RsaGetKey
;
3529 EDKII_CRYPTO_RSA_GENERATE_KEY RsaGenerateKey
;
3530 EDKII_CRYPTO_RSA_CHECK_KEY RsaCheckKey
;
3531 EDKII_CRYPTO_RSA_PKCS1_SIGN RsaPkcs1Sign
;
3532 EDKII_CRYPTO_RSA_PKCS1_VERIFY RsaPkcs1Verify
;
3533 EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM RsaGetPrivateKeyFromPem
;
3534 EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509 RsaGetPublicKeyFromX509
;
3536 EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE Sha1GetContextSize
;
3537 EDKII_CRYPTO_SHA1_INIT Sha1Init
;
3538 EDKII_CRYPTO_SHA1_DUPLICATE Sha1Duplicate
;
3539 EDKII_CRYPTO_SHA1_UPDATE Sha1Update
;
3540 EDKII_CRYPTO_SHA1_FINAL Sha1Final
;
3541 EDKII_CRYPTO_SHA1_HASH_ALL Sha1HashAll
;
3543 EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE Sha256GetContextSize
;
3544 EDKII_CRYPTO_SHA256_INIT Sha256Init
;
3545 EDKII_CRYPTO_SHA256_DUPLICATE Sha256Duplicate
;
3546 EDKII_CRYPTO_SHA256_UPDATE Sha256Update
;
3547 EDKII_CRYPTO_SHA256_FINAL Sha256Final
;
3548 EDKII_CRYPTO_SHA256_HASH_ALL Sha256HashAll
;
3550 EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE Sha384GetContextSize
;
3551 EDKII_CRYPTO_SHA384_INIT Sha384Init
;
3552 EDKII_CRYPTO_SHA384_DUPLICATE Sha384Duplicate
;
3553 EDKII_CRYPTO_SHA384_UPDATE Sha384Update
;
3554 EDKII_CRYPTO_SHA384_FINAL Sha384Final
;
3555 EDKII_CRYPTO_SHA384_HASH_ALL Sha384HashAll
;
3557 EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE Sha512GetContextSize
;
3558 EDKII_CRYPTO_SHA512_INIT Sha512Init
;
3559 EDKII_CRYPTO_SHA512_DUPLICATE Sha512Duplicate
;
3560 EDKII_CRYPTO_SHA512_UPDATE Sha512Update
;
3561 EDKII_CRYPTO_SHA512_FINAL Sha512Final
;
3562 EDKII_CRYPTO_SHA512_HASH_ALL Sha512HashAll
;
3564 EDKII_CRYPTO_X509_GET_SUBJECT_NAME X509GetSubjectName
;
3565 EDKII_CRYPTO_X509_GET_COMMON_NAME X509GetCommonName
;
3566 EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME X509GetOrganizationName
;
3567 EDKII_CRYPTO_X509_VERIFY_CERT X509VerifyCert
;
3568 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE X509ConstructCertificate
;
3569 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK X509ConstructCertificateStack
;
3570 EDKII_CRYPTO_X509_FREE X509Free
;
3571 EDKII_CRYPTO_X509_STACK_FREE X509StackFree
;
3572 EDKII_CRYPTO_X509_GET_TBS_CERT X509GetTBSCert
;
3573 /// TDES - deprecated and unsupported
3574 DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE DeprecatedTdesGetContextSize
;
3575 DEPRECATED_EDKII_CRYPTO_TDES_INIT DeprecatedTdesInit
;
3576 DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT DeprecatedTdesEcbEncrypt
;
3577 DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT DeprecatedTdesEcbDecrypt
;
3578 DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT DeprecatedTdesCbcEncrypt
;
3579 DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT DeprecatedTdesCbcDecrypt
;
3580 /// AES - ECB Mode is deprecated and unsupported
3581 EDKII_CRYPTO_AES_GET_CONTEXT_SIZE AesGetContextSize
;
3582 EDKII_CRYPTO_AES_INIT AesInit
;
3583 DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT DeprecatedAesEcbEncrypt
;
3584 DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT DeprecatedAesEcbDecrypt
;
3585 EDKII_CRYPTO_AES_CBC_ENCRYPT AesCbcEncrypt
;
3586 EDKII_CRYPTO_AES_CBC_DECRYPT AesCbcDecrypt
;
3587 /// Arc4 - deprecated and unsupported
3588 DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE DeprecatedArc4GetContextSize
;
3589 DEPRECATED_EDKII_CRYPTO_ARC4_INIT DeprecatedArc4Init
;
3590 DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT DeprecatedArc4Encrypt
;
3591 DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT DeprecatedArc4Decrypt
;
3592 DEPRECATED_EDKII_CRYPTO_ARC4_RESET DeprecatedArc4Reset
;
3594 EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE Sm3GetContextSize
;
3595 EDKII_CRYPTO_SM3_INIT Sm3Init
;
3596 EDKII_CRYPTO_SM3_DUPLICATE Sm3Duplicate
;
3597 EDKII_CRYPTO_SM3_UPDATE Sm3Update
;
3598 EDKII_CRYPTO_SM3_FINAL Sm3Final
;
3599 EDKII_CRYPTO_SM3_HASH_ALL Sm3HashAll
;
3601 EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND HkdfSha256ExtractAndExpand
;
3602 /// X509 (Continued)
3603 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V X509ConstructCertificateStackV
;
3605 EDKII_CRYPTO_TLS_INITIALIZE TlsInitialize
;
3606 EDKII_CRYPTO_TLS_CTX_FREE TlsCtxFree
;
3607 EDKII_CRYPTO_TLS_CTX_NEW TlsCtxNew
;
3608 EDKII_CRYPTO_TLS_FREE TlsFree
;
3609 EDKII_CRYPTO_TLS_NEW TlsNew
;
3610 EDKII_CRYPTO_TLS_IN_HANDSHAKE TlsInHandshake
;
3611 EDKII_CRYPTO_TLS_DO_HANDSHAKE TlsDoHandshake
;
3612 EDKII_CRYPTO_TLS_HANDLE_ALERT TlsHandleAlert
;
3613 EDKII_CRYPTO_TLS_CLOSE_NOTIFY TlsCloseNotify
;
3614 EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT TlsCtrlTrafficOut
;
3615 EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN TlsCtrlTrafficIn
;
3616 EDKII_CRYPTO_TLS_READ TlsRead
;
3617 EDKII_CRYPTO_TLS_WRITE TlsWrite
;
3619 EDKII_CRYPTO_TLS_SET_VERSION TlsSetVersion
;
3620 EDKII_CRYPTO_TLS_SET_CONNECTION_END TlsSetConnectionEnd
;
3621 EDKII_CRYPTO_TLS_SET_CIPHER_LIST TlsSetCipherList
;
3622 EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD TlsSetCompressionMethod
;
3623 EDKII_CRYPTO_TLS_SET_VERIFY TlsSetVerify
;
3624 EDKII_CRYPTO_TLS_SET_VERIFY_HOST TlsSetVerifyHost
;
3625 EDKII_CRYPTO_TLS_SET_SESSIONID TlsSetSessionId
;
3626 EDKII_CRYPTO_TLS_SET_CA_CERTIFICATE TlsSetCaCertificate
;
3627 EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT TlsSetHostPublicCert
;
3628 EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY TlsSetHostPrivateKey
;
3629 EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST TlsSetCertRevocationList
;
3631 EDKII_CRYPTO_TLS_GET_VERSION TlsGetVersion
;
3632 EDKII_CRYPTO_TLS_GET_CONNECTION_END TlsGetConnectionEnd
;
3633 EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER TlsGetCurrentCipher
;
3634 EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID TlsGetCurrentCompressionId
;
3635 EDKII_CRYPTO_TLS_GET_VERIFY TlsGetVerify
;
3636 EDKII_CRYPTO_TLS_GET_SESSION_ID TlsGetSessionId
;
3637 EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM TlsGetClientRandom
;
3638 EDKII_CRYPTO_TLS_GET_SERVER_RANDOM TlsGetServerRandom
;
3639 EDKII_CRYPTO_TLS_GET_KEY_MATERIAL TlsGetKeyMaterial
;
3640 EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE TlsGetCaCertificate
;
3641 EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT TlsGetHostPublicCert
;
3642 EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY TlsGetHostPrivateKey
;
3643 EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST TlsGetCertRevocationList
;
3645 EDKII_CRYPTO_RSA_PSS_SIGN RsaPssSign
;
3646 EDKII_CRYPTO_RSA_PSS_VERIFY RsaPssVerify
;
3649 extern GUID gEdkiiCryptoProtocolGuid
;