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 //=====================================================================================
47 HMAC MD5 is deprecated and unsupported any longer.
48 Keep the function field for binary compability.
53 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_NEW
) (
59 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FREE
) (
65 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_SET_KEY
) (
66 OUT VOID
*HmacMd5Context
,
73 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_DUPLICATE
) (
74 IN CONST VOID
*HmacMd5Context
,
75 OUT VOID
*NewHmacMd5Context
80 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_UPDATE
) (
81 IN OUT VOID
*HmacMd5Context
,
88 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FINAL
) (
89 IN OUT VOID
*HmacMd5Context
,
94 HMAC SHA1 is deprecated and unsupported any longer.
95 Keep the function field for binary compability.
100 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_NEW
) (
106 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FREE
) (
112 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_SET_KEY
) (
113 OUT VOID
*HmacSha1Context
,
120 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_DUPLICATE
) (
121 IN CONST VOID
*HmacSha1Context
,
122 OUT VOID
*NewHmacSha1Context
127 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_UPDATE
) (
128 IN OUT VOID
*HmacSha1Context
,
135 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FINAL
) (
136 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
168 Set user-supplied key for subsequent use. It must be done before any
169 calling to HmacSha256Update().
171 If HmacSha256Context is NULL, then return FALSE.
172 If this interface is not supported, then return FALSE.
174 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.
175 @param[in] Key Pointer to the user-supplied key.
176 @param[in] KeySize Key size in bytes.
178 @retval TRUE The Key is set successfully.
179 @retval FALSE The Key is set unsuccessfully.
180 @retval FALSE This interface is not supported.
185 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_SET_KEY
) (
186 OUT VOID
*HmacSha256Context
,
192 Makes a copy of an existing HMAC-SHA256 context.
194 If HmacSha256Context is NULL, then return FALSE.
195 If NewHmacSha256Context is NULL, then return FALSE.
196 If this interface is not supported, then return FALSE.
198 @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied.
199 @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context.
201 @retval TRUE HMAC-SHA256 context copy succeeded.
202 @retval FALSE HMAC-SHA256 context copy failed.
203 @retval FALSE This interface is not supported.
208 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_DUPLICATE
) (
209 IN CONST VOID
*HmacSha256Context
,
210 OUT VOID
*NewHmacSha256Context
215 Digests the input data and updates HMAC-SHA256 context.
217 This function performs HMAC-SHA256 digest on a data buffer of the specified size.
218 It can be called multiple times to compute the digest of long or discontinuous data streams.
219 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
220 by HmacSha256Final(). Behavior with invalid context is undefined.
222 If HmacSha256Context is NULL, then return FALSE.
223 If this interface is not supported, then return FALSE.
225 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
226 @param[in] Data Pointer to the buffer containing the data to be digested.
227 @param[in] DataSize Size of Data buffer in bytes.
229 @retval TRUE HMAC-SHA256 data digest succeeded.
230 @retval FALSE HMAC-SHA256 data digest failed.
231 @retval FALSE This interface is not supported.
236 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_UPDATE
) (
237 IN OUT VOID
*HmacSha256Context
,
243 Completes computation of the HMAC-SHA256 digest value.
245 This function completes HMAC-SHA256 hash computation and retrieves the digest value into
246 the specified memory. After this function has been called, the HMAC-SHA256 context cannot
248 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized
249 by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.
251 If HmacSha256Context is NULL, then return FALSE.
252 If HmacValue is NULL, then return FALSE.
253 If this interface is not supported, then return FALSE.
255 @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.
256 @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest
259 @retval TRUE HMAC-SHA256 digest computation succeeded.
260 @retval FALSE HMAC-SHA256 digest computation failed.
261 @retval FALSE This interface is not supported.
266 (EFIAPI
*EDKII_CRYPTO_HMAC_SHA256_FINAL
) (
267 IN OUT VOID
*HmacSha256Context
,
272 //=====================================================================================
273 // One-Way Cryptographic Hash Primitives
274 //=====================================================================================
277 MD4 is deprecated and unsupported any longer.
278 Keep the function field for binary compability.
283 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE
) (
290 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_INIT
) (
297 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE
) (
298 IN CONST VOID
*Md4Context
,
299 OUT VOID
*NewMd4Context
305 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_UPDATE
) (
306 IN OUT VOID
*Md4Context
,
314 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_FINAL
) (
315 IN OUT VOID
*Md4Context
,
322 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL
) (
328 // ----------------------------------------------------------------------------
331 Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
333 If this interface is not supported, then return zero.
335 @return The size, in bytes, of the context buffer required for MD5 hash operations.
336 @retval 0 This interface is not supported.
341 (EFIAPI
* EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE
)(
346 Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
349 If Md5Context is NULL, then return FALSE.
350 If this interface is not supported, then return FALSE.
352 @param[out] Md5Context Pointer to MD5 context being initialized.
354 @retval TRUE MD5 context initialization succeeded.
355 @retval FALSE MD5 context initialization failed.
356 @retval FALSE This interface is not supported.
361 (EFIAPI
* EDKII_CRYPTO_MD5_INIT
)(
362 OUT VOID
*Md5Context
);
365 Makes a copy of an existing MD5 context.
367 If Md5Context is NULL, then return FALSE.
368 If NewMd5Context is NULL, then return FALSE.
369 If this interface is not supported, then return FALSE.
371 @param[in] Md5Context Pointer to MD5 context being copied.
372 @param[out] NewMd5Context Pointer to new MD5 context.
374 @retval TRUE MD5 context copy succeeded.
375 @retval FALSE MD5 context copy failed.
376 @retval FALSE This interface is not supported.
381 (EFIAPI
* EDKII_CRYPTO_MD5_DUPLICATE
) (
382 IN CONST VOID
*Md5Context
,
383 OUT VOID
*NewMd5Context
);
387 Digests the input data and updates MD5 context.
389 This function performs MD5 digest on a data buffer of the specified size.
390 It can be called multiple times to compute the digest of long or discontinuous data streams.
391 MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
392 by Md5Final(). Behavior with invalid context is undefined.
394 If Md5Context is NULL, then return FALSE.
395 If this interface is not supported, then return FALSE.
397 @param[in, out] Md5Context Pointer to the MD5 context.
398 @param[in] Data Pointer to the buffer containing the data to be hashed.
399 @param[in] DataSize Size of Data buffer in bytes.
401 @retval TRUE MD5 data digest succeeded.
402 @retval FALSE MD5 data digest failed.
403 @retval FALSE This interface is not supported.
408 (EFIAPI
* EDKII_CRYPTO_MD5_UPDATE
)(
409 IN OUT VOID
*Md5Context
,
415 Completes computation of the MD5 digest value.
417 This function completes MD5 hash computation and retrieves the digest value into
418 the specified memory. After this function has been called, the MD5 context cannot
420 MD5 context should be already correctly initialized by Md5Init(), and should not be
421 finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
423 If Md5Context is NULL, then return FALSE.
424 If HashValue is NULL, then return FALSE.
425 If this interface is not supported, then return FALSE.
427 @param[in, out] Md5Context Pointer to the MD5 context.
428 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
431 @retval TRUE MD5 digest computation succeeded.
432 @retval FALSE MD5 digest computation failed.
433 @retval FALSE This interface is not supported.
438 (EFIAPI
* EDKII_CRYPTO_MD5_FINAL
)(
439 IN OUT VOID
*Md5Context
,
440 OUT UINT8
*HashValue
);
444 Computes the MD5 message digest of a input data buffer.
446 This function performs the MD5 message digest of a given data buffer, and places
447 the digest value into the specified memory.
449 If this interface is not supported, then return FALSE.
451 @param[in] Data Pointer to the buffer containing the data to be hashed.
452 @param[in] DataSize Size of Data buffer in bytes.
453 @param[out] HashValue Pointer to a buffer that receives the MD5 digest
456 @retval TRUE MD5 digest computation succeeded.
457 @retval FALSE MD5 digest computation failed.
458 @retval FALSE This interface is not supported.
463 (EFIAPI
* EDKII_CRYPTO_MD5_HASH_ALL
)(
466 OUT UINT8
*HashValue
);
469 //=====================================================================================
471 //=====================================================================================
475 Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the encrypted message in
476 in a newly allocated buffer.
478 Things that can cause a failure include:
479 - X509 key size does not match any known key size.
480 - Fail to parse X509 certificate.
481 - Fail to allocate an intermediate buffer.
482 - NULL pointer provided for a non-optional parameter.
483 - Data size is too large for the provided key size (max size is a function of key size and hash digest size).
485 @param[in] PublicKey A pointer to the DER-encoded X509 certificate that will be used to encrypt the data.
486 @param[in] PublicKeySize Size of the X509 cert buffer.
487 @param[in] InData Data to be encrypted.
488 @param[in] InDataSize Size of the data buffer.
489 @param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer to be used when initializing the PRNG. NULL otherwise.
490 @param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer. 0 otherwise.
491 @param[out] EncryptedData Pointer to an allocated buffer containing the encrypted message.
492 @param[out] EncryptedDataSize Size of the encrypted message buffer.
494 @retval TRUE Encryption was successful.
495 @retval FALSE Encryption failed.
500 (EFIAPI
*EDKII_CRYPTO_PKCS1_ENCRYPT_V2
) (
501 IN CONST UINT8
*PublicKey
,
502 IN UINTN PublicKeySize
,
505 IN CONST UINT8
*PrngSeed OPTIONAL
,
506 IN UINTN PrngSeedSize OPTIONAL
,
507 OUT UINT8
**EncryptedData
,
508 OUT UINTN
*EncryptedDataSize
514 // ---------------------------------------------
518 Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0
519 password based encryption key derivation function PBKDF2, as specified in RFC 2898.
521 If Password or Salt or OutKey is NULL, then return FALSE.
522 If the hash algorithm could not be determined, then return FALSE.
523 If this interface is not supported, then return FALSE.
525 @param[in] PasswordLength Length of input password in bytes.
526 @param[in] Password Pointer to the array for the password.
527 @param[in] SaltLength Size of the Salt in bytes.
528 @param[in] Salt Pointer to the Salt.
529 @param[in] IterationCount Number of iterations to perform. Its value should be
530 greater than or equal to 1.
531 @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).
532 NOTE: DigestSize will be used to determine the hash algorithm.
533 Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.
534 @param[in] KeyLength Size of the derived key buffer in bytes.
535 @param[out] OutKey Pointer to the output derived key buffer.
537 @retval TRUE A key was derived successfully.
538 @retval FALSE One of the pointers was NULL or one of the sizes was too large.
539 @retval FALSE The hash algorithm could not be determined from the digest size.
540 @retval FALSE The key derivation operation failed.
541 @retval FALSE This interface is not supported.
546 (EFIAPI
*EDKII_CRYPTO_PKCS5_PW_HASH
) (
547 IN UINTN PasswordSize
,
548 IN CONST CHAR8
*Password
,
550 IN CONST UINT8
*Salt
,
551 IN UINTN IterationCount
,
559 // ---------------------------------------------
563 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
564 Cryptographic Message Syntax Standard". The input signed data could be wrapped
565 in a ContentInfo structure.
567 If P7Data, TrustedCert or InData is NULL, then return FALSE.
568 If P7Length, CertLength or DataLength overflow, then return FALSE.
569 If this interface is not supported, then return FALSE.
571 @param[in] P7Data Pointer to the PKCS#7 message to verify.
572 @param[in] P7Length Length of the PKCS#7 message in bytes.
573 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
574 is used for certificate chain verification.
575 @param[in] CertLength Length of the trusted certificate in bytes.
576 @param[in] InData Pointer to the content to be verified.
577 @param[in] DataLength Length of InData in bytes.
579 @retval TRUE The specified PKCS#7 signed data is valid.
580 @retval FALSE Invalid PKCS#7 signed data.
581 @retval FALSE This interface is not supported.
586 (EFIAPI
*EDKII_CRYPTO_PKCS7_VERIFY
) (
587 IN CONST UINT8
*P7Data
,
588 IN UINTN P7DataLength
,
589 IN CONST UINT8
*TrustedCert
,
590 IN UINTN TrustedCertLength
,
591 IN CONST UINT8
*Data
,
596 VerifyEKUsInPkcs7Signature()
598 This function receives a PKCS7 formatted signature, and then verifies that
599 the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity
600 leaf signing certificate.
602 Note that this function does not validate the certificate chain.
604 Applications for custom EKU's are quite flexible. For example, a policy EKU
605 may be present in an Issuing Certificate Authority (CA), and any sub-ordinate
606 certificate issued might also contain this EKU, thus constraining the
607 sub-ordinate certificate. Other applications might allow a certificate
608 embedded in a device to specify that other Object Identifiers (OIDs) are
609 present which contains binary data specifying custom capabilities that
610 the device is able to do.
612 @param[in] Pkcs7Signature - The PKCS#7 signed information content block. An array
613 containing the content block with both the signature,
614 the signer's certificate, and any necessary intermediate
617 @param[in] Pkcs7SignatureSize - Number of bytes in Pkcs7Signature.
619 @param[in] RequiredEKUs - Array of null-terminated strings listing OIDs of
620 required EKUs that must be present in the signature.
622 @param[in] RequiredEKUsSize - Number of elements in the RequiredEKUs string array.
624 @param[in] RequireAllPresent - If this is TRUE, then all of the specified EKU's
625 must be present in the leaf signer. If it is
626 FALSE, then we will succeed if we find any
627 of the specified EKU's.
629 @retval EFI_SUCCESS - The required EKUs were found in the signature.
630 @retval EFI_INVALID_PARAMETER - A parameter was invalid.
631 @retval EFI_NOT_FOUND - One or more EKU's were not found in the signature.
636 (EFIAPI
*EDKII_CRYPTO_PKCS7_VERIFY_EKU
) (
637 IN CONST UINT8
*Pkcs7Signature
,
638 IN CONST UINT32 SignatureSize
,
639 IN CONST CHAR8
*RequiredEKUs
[],
640 IN CONST UINT32 RequiredEKUsSize
,
641 IN BOOLEAN RequireAllPresent
645 Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
646 Cryptographic Message Syntax Standard". The input signed data could be wrapped
647 in a ContentInfo structure.
649 If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then
650 return FALSE. If P7Length overflow, then return FALSE.
651 If this interface is not supported, then return FALSE.
653 @param[in] P7Data Pointer to the PKCS#7 message to verify.
654 @param[in] P7Length Length of the PKCS#7 message in bytes.
655 @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
656 It's caller's responsibility to free the buffer with
658 This data structure is EFI_CERT_STACK type.
659 @param[out] StackLength Length of signer's certificates in bytes.
660 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
661 It's caller's responsibility to free the buffer with
663 @param[out] CertLength Length of the trusted certificate in bytes.
665 @retval TRUE The operation is finished successfully.
666 @retval FALSE Error occurs during the operation.
667 @retval FALSE This interface is not supported.
672 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_SIGNERS
) (
673 IN CONST UINT8
*P7Data
,
675 OUT UINT8
**CertStack
,
676 OUT UINTN
*StackLength
,
677 OUT UINT8
**TrustedCert
,
678 OUT UINTN
*CertLength
682 Wrap function to use free() to free allocated memory for certificates.
684 If this interface is not supported, then ASSERT().
686 @param[in] Certs Pointer to the certificates to be freed.
691 (EFIAPI
*EDKII_CRYPTO_PKCS7_FREE_SIGNERS
) (
696 Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message
697 Syntax Standard, version 1.5". This interface is only intended to be used for
698 application to perform PKCS#7 functionality validation.
700 If this interface is not supported, then return FALSE.
702 @param[in] PrivateKey Pointer to the PEM-formatted private key data for
704 @param[in] PrivateKeySize Size of the PEM private key data in bytes.
705 @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM
707 @param[in] InData Pointer to the content to be signed.
708 @param[in] InDataSize Size of InData in bytes.
709 @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.
710 @param[in] OtherCerts Pointer to an optional additional set of certificates to
711 include in the PKCS#7 signedData (e.g. any intermediate
713 @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's
714 responsibility to free the buffer with FreePool().
715 @param[out] SignedDataSize Size of SignedData in bytes.
717 @retval TRUE PKCS#7 data signing succeeded.
718 @retval FALSE PKCS#7 data signing failed.
719 @retval FALSE This interface is not supported.
724 (EFIAPI
*EDKII_CRYPTO_PKCS7_SIGN
) (
725 IN CONST UINT8
*PrivateKey
,
726 IN UINTN PrivateKeySize
,
727 IN CONST UINT8
*KeyPassword
,
731 IN UINT8
*OtherCerts OPTIONAL
,
732 OUT UINT8
**SignedData
,
733 OUT UINTN
*SignedDataSize
737 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
738 data could be wrapped in a ContentInfo structure.
740 If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow,
741 then return FALSE. If the P7Data is not correctly formatted, then return FALSE.
743 Caution: This function may receive untrusted input. So this function will do
744 basic check for PKCS#7 data structure.
746 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
747 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
748 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
749 It's caller's responsibility to free the buffer with FreePool().
750 @param[out] ContentSize The size of the extracted content in bytes.
752 @retval TRUE The P7Data was correctly formatted for processing.
753 @retval FALSE The P7Data was not correctly formatted for processing.
759 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT
) (
760 IN CONST UINT8
*P7Data
,
763 OUT UINTN
*ContentSize
767 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
768 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
769 unchained to the signer's certificates.
770 The input signed data could be wrapped in a ContentInfo structure.
772 @param[in] P7Data Pointer to the PKCS#7 message.
773 @param[in] P7Length Length of the PKCS#7 message in bytes.
774 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
775 certificate. It's caller's responsibility to free the buffer
776 with Pkcs7FreeSigners().
777 This data structure is EFI_CERT_STACK type.
778 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
779 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
780 responsibility to free the buffer with Pkcs7FreeSigners().
781 This data structure is EFI_CERT_STACK type.
782 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
784 @retval TRUE The operation is finished successfully.
785 @retval FALSE Error occurs during the operation.
790 (EFIAPI
*EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST
) (
791 IN CONST UINT8
*P7Data
,
793 OUT UINT8
**SignerChainCerts
,
794 OUT UINTN
*ChainLength
,
795 OUT UINT8
**UnchainCerts
,
796 OUT UINTN
*UnchainLength
800 Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows
801 Authenticode Portable Executable Signature Format".
803 If AuthData is NULL, then return FALSE.
804 If ImageHash is NULL, then return FALSE.
805 If this interface is not supported, then return FALSE.
807 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
808 PE/COFF image to be verified.
809 @param[in] DataSize Size of the Authenticode Signature in bytes.
810 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
811 is used for certificate chain verification.
812 @param[in] CertSize Size of the trusted certificate in bytes.
813 @param[in] ImageHash Pointer to the original image file hash value. The procedure
814 for calculating the image hash value is described in Authenticode
816 @param[in] HashSize Size of Image hash value in bytes.
818 @retval TRUE The specified Authenticode Signature is valid.
819 @retval FALSE Invalid Authenticode Signature.
820 @retval FALSE This interface is not supported.
825 (EFIAPI
*EDKII_CRYPTO_AUTHENTICODE_VERIFY
) (
826 IN CONST UINT8
*AuthData
,
828 IN CONST UINT8
*TrustedCert
,
830 IN CONST UINT8
*ImageHash
,
835 Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode
838 If AuthData is NULL, then return FALSE.
839 If this interface is not supported, then return FALSE.
841 @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed
842 PE/COFF image to be verified.
843 @param[in] DataSize Size of the Authenticode Signature in bytes.
844 @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which
845 is used for TSA certificate chain verification.
846 @param[in] CertSize Size of the trusted certificate in bytes.
847 @param[out] SigningTime Return the time of timestamp generation time if the timestamp
850 @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.
851 @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.
856 (EFIAPI
*EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY
) (
857 IN CONST UINT8
*AuthData
,
859 IN CONST UINT8
*TsaCert
,
861 OUT EFI_TIME
*SigningTime
865 //=====================================================================================
866 // DH Key Exchange Primitive
867 //=====================================================================================
870 Allocates and Initializes one Diffie-Hellman Context for subsequent use.
872 @return Pointer to the Diffie-Hellman Context that has been initialized.
873 If the allocations fails, DhNew() returns NULL.
874 If the interface is not supported, DhNew() returns NULL.
879 (EFIAPI
*EDKII_CRYPTO_DH_NEW
) (
884 Release the specified DH context.
886 If the interface is not supported, then ASSERT().
888 @param[in] DhContext Pointer to the DH context to be released.
893 (EFIAPI
*EDKII_CRYPTO_DH_FREE
) (
898 Generates DH parameter.
900 Given generator g, and length of prime number p in bits, this function generates p,
901 and sets DH context according to value of g and p.
903 Before this function can be invoked, pseudorandom number generator must be correctly
904 initialized by RandomSeed().
906 If DhContext is NULL, then return FALSE.
907 If Prime is NULL, then return FALSE.
908 If this interface is not supported, then return FALSE.
910 @param[in, out] DhContext Pointer to the DH context.
911 @param[in] Generator Value of generator.
912 @param[in] PrimeLength Length in bits of prime to be generated.
913 @param[out] Prime Pointer to the buffer to receive the generated prime number.
915 @retval TRUE DH parameter generation succeeded.
916 @retval FALSE Value of Generator is not supported.
917 @retval FALSE PRNG fails to generate random prime number with PrimeLength.
918 @retval FALSE This interface is not supported.
923 (EFIAPI
*EDKII_CRYPTO_DH_GENERATE_PARAMETER
) (
924 IN OUT VOID
*DhContext
,
926 IN UINTN PrimeLength
,
931 Sets generator and prime parameters for DH.
933 Given generator g, and prime number p, this function and sets DH
936 If DhContext is NULL, then return FALSE.
937 If Prime is NULL, then return FALSE.
938 If this interface is not supported, then return FALSE.
940 @param[in, out] DhContext Pointer to the DH context.
941 @param[in] Generator Value of generator.
942 @param[in] PrimeLength Length in bits of prime to be generated.
943 @param[in] Prime Pointer to the prime number.
945 @retval TRUE DH parameter setting succeeded.
946 @retval FALSE Value of Generator is not supported.
947 @retval FALSE Value of Generator is not suitable for the Prime.
948 @retval FALSE Value of Prime is not a prime number.
949 @retval FALSE Value of Prime is not a safe prime number.
950 @retval FALSE This interface is not supported.
955 (EFIAPI
*EDKII_CRYPTO_DH_SET_PARAMETER
) (
956 IN OUT VOID
*DhContext
,
958 IN UINTN PrimeLength
,
959 IN CONST UINT8
*Prime
963 Generates DH public key.
965 This function generates random secret exponent, and computes the public key, which is
966 returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.
967 If the PublicKey buffer is too small to hold the public key, FALSE is returned and
968 PublicKeySize is set to the required buffer size to obtain the public key.
970 If DhContext is NULL, then return FALSE.
971 If PublicKeySize is NULL, then return FALSE.
972 If PublicKeySize is large enough but PublicKey is NULL, then return FALSE.
973 If this interface is not supported, then return FALSE.
975 @param[in, out] DhContext Pointer to the DH context.
976 @param[out] PublicKey Pointer to the buffer to receive generated public key.
977 @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.
978 On output, the size of data returned in PublicKey buffer in bytes.
980 @retval TRUE DH public key generation succeeded.
981 @retval FALSE DH public key generation failed.
982 @retval FALSE PublicKeySize is not large enough.
983 @retval FALSE This interface is not supported.
988 (EFIAPI
*EDKII_CRYPTO_DH_GENERATE_KEY
) (
989 IN OUT VOID
*DhContext
,
990 OUT UINT8
*PublicKey
,
991 IN OUT UINTN
*PublicKeySize
995 Computes exchanged common key.
997 Given peer's public key, this function computes the exchanged common key, based on its own
998 context including value of prime modulus and random secret exponent.
1000 If DhContext is NULL, then return FALSE.
1001 If PeerPublicKey is NULL, then return FALSE.
1002 If KeySize is NULL, then return FALSE.
1003 If Key is NULL, then return FALSE.
1004 If KeySize is not large enough, then return FALSE.
1005 If this interface is not supported, then return FALSE.
1007 @param[in, out] DhContext Pointer to the DH context.
1008 @param[in] PeerPublicKey Pointer to the peer's public key.
1009 @param[in] PeerPublicKeySize Size of peer's public key in bytes.
1010 @param[out] Key Pointer to the buffer to receive generated key.
1011 @param[in, out] KeySize On input, the size of Key buffer in bytes.
1012 On output, the size of data returned in Key buffer in bytes.
1014 @retval TRUE DH exchanged key generation succeeded.
1015 @retval FALSE DH exchanged key generation failed.
1016 @retval FALSE KeySize is not large enough.
1017 @retval FALSE This interface is not supported.
1022 (EFIAPI
*EDKII_CRYPTO_DH_COMPUTE_KEY
) (
1023 IN OUT VOID
*DhContext
,
1024 IN CONST UINT8
*PeerPublicKey
,
1025 IN UINTN PeerPublicKeySize
,
1027 IN OUT UINTN
*KeySize
1030 //=====================================================================================
1031 // Pseudo-Random Generation Primitive
1032 //=====================================================================================
1035 Sets up the seed value for the pseudorandom number generator.
1037 This function sets up the seed value for the pseudorandom number generator.
1038 If Seed is not NULL, then the seed passed in is used.
1039 If Seed is NULL, then default seed is used.
1040 If this interface is not supported, then return FALSE.
1042 @param[in] Seed Pointer to seed value.
1043 If NULL, default seed is used.
1044 @param[in] SeedSize Size of seed value.
1045 If Seed is NULL, this parameter is ignored.
1047 @retval TRUE Pseudorandom number generator has enough entropy for random generation.
1048 @retval FALSE Pseudorandom number generator does not have enough entropy for random generation.
1049 @retval FALSE This interface is not supported.
1054 (EFIAPI
*EDKII_CRYPTO_RANDOM_SEED
) (
1055 IN CONST UINT8
*Seed OPTIONAL
,
1060 Generates a pseudorandom byte stream of the specified size.
1062 If Output is NULL, then return FALSE.
1063 If this interface is not supported, then return FALSE.
1065 @param[out] Output Pointer to buffer to receive random value.
1066 @param[in] Size Size of random bytes to generate.
1068 @retval TRUE Pseudorandom byte stream generated successfully.
1069 @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.
1070 @retval FALSE This interface is not supported.
1075 (EFIAPI
*EDKII_CRYPTO_RANDOM_BYTES
) (
1081 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
1084 If RsaContext is NULL, then return FALSE.
1085 If MessageHash is NULL, then return FALSE.
1086 If Signature is NULL, then return FALSE.
1087 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
1089 @param[in] RsaContext Pointer to RSA context for signature verification.
1090 @param[in] MessageHash Pointer to octet message hash to be checked.
1091 @param[in] HashSize Size of the message hash in bytes.
1092 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
1093 @param[in] SigSize Size of signature in bytes.
1095 @retval TRUE Valid signature encoded in PKCS1-v1_5.
1096 @retval FALSE Invalid signature or invalid RSA context.
1101 (EFIAPI
*EDKII_CRYPTO_RSA_VERIFY_PKCS1
) (
1102 IN VOID
*RsaContext
,
1103 IN CONST UINT8
*MessageHash
,
1105 IN CONST UINT8
*Signature
,
1110 Allocates and initializes one RSA context for subsequent use.
1112 @return Pointer to the RSA context that has been initialized.
1113 If the allocations fails, RsaNew() returns NULL.
1118 (EFIAPI
*EDKII_CRYPTO_RSA_NEW
) (
1123 Release the specified RSA context.
1125 If RsaContext is NULL, then return FALSE.
1127 @param[in] RsaContext Pointer to the RSA context to be released.
1132 (EFIAPI
*EDKII_CRYPTO_RSA_FREE
) (
1137 Sets the tag-designated key component into the established RSA context.
1139 This function sets the tag-designated RSA key component into the established
1140 RSA context from the user-specified non-negative integer (octet string format
1141 represented in RSA PKCS#1).
1142 If BigNumber is NULL, then the specified key component in RSA context is cleared.
1144 If RsaContext is NULL, then return FALSE.
1146 @param[in, out] RsaContext Pointer to RSA context being set.
1147 @param[in] KeyTag Tag of RSA key component being set.
1148 @param[in] BigNumber Pointer to octet integer buffer.
1149 If NULL, then the specified key component in RSA
1151 @param[in] BnSize Size of big number buffer in bytes.
1152 If BigNumber is NULL, then it is ignored.
1154 @retval TRUE RSA key component was set successfully.
1155 @retval FALSE Invalid RSA key component tag.
1160 (EFIAPI
*EDKII_CRYPTO_RSA_SET_KEY
) (
1161 IN OUT VOID
*RsaContext
,
1162 IN RSA_KEY_TAG KeyTag
,
1163 IN CONST UINT8
*BigNumber
,
1168 Gets the tag-designated RSA key component from the established RSA context.
1170 This function retrieves the tag-designated RSA key component from the
1171 established RSA context as a non-negative integer (octet string format
1172 represented in RSA PKCS#1).
1173 If specified key component has not been set or has been cleared, then returned
1175 If the BigNumber buffer is too small to hold the contents of the key, FALSE
1176 is returned and BnSize is set to the required buffer size to obtain the key.
1178 If RsaContext is NULL, then return FALSE.
1179 If BnSize is NULL, then return FALSE.
1180 If BnSize is large enough but BigNumber is NULL, then return FALSE.
1181 If this interface is not supported, then return FALSE.
1183 @param[in, out] RsaContext Pointer to RSA context being set.
1184 @param[in] KeyTag Tag of RSA key component being set.
1185 @param[out] BigNumber Pointer to octet integer buffer.
1186 @param[in, out] BnSize On input, the size of big number buffer in bytes.
1187 On output, the size of data returned in big number buffer in bytes.
1189 @retval TRUE RSA key component was retrieved successfully.
1190 @retval FALSE Invalid RSA key component tag.
1191 @retval FALSE BnSize is too small.
1192 @retval FALSE This interface is not supported.
1197 (EFIAPI
*EDKII_CRYPTO_RSA_GET_KEY
) (
1198 IN OUT VOID
*RsaContext
,
1199 IN RSA_KEY_TAG KeyTag
,
1200 OUT UINT8
*BigNumber
,
1201 IN OUT UINTN
*BnSize
1205 Generates RSA key components.
1207 This function generates RSA key components. It takes RSA public exponent E and
1208 length in bits of RSA modulus N as input, and generates all key components.
1209 If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used.
1211 Before this function can be invoked, pseudorandom number generator must be correctly
1212 initialized by RandomSeed().
1214 If RsaContext is NULL, then return FALSE.
1215 If this interface is not supported, then return FALSE.
1217 @param[in, out] RsaContext Pointer to RSA context being set.
1218 @param[in] ModulusLength Length of RSA modulus N in bits.
1219 @param[in] PublicExponent Pointer to RSA public exponent.
1220 @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes.
1222 @retval TRUE RSA key component was generated successfully.
1223 @retval FALSE Invalid RSA key component tag.
1224 @retval FALSE This interface is not supported.
1229 (EFIAPI
*EDKII_CRYPTO_RSA_GENERATE_KEY
) (
1230 IN OUT VOID
*RsaContext
,
1231 IN UINTN ModulusLength
,
1232 IN CONST UINT8
*PublicExponent
,
1233 IN UINTN PublicExponentSize
1237 Validates key components of RSA context.
1238 NOTE: This function performs integrity checks on all the RSA key material, so
1239 the RSA key structure must contain all the private key data.
1241 This function validates key components of RSA context in following aspects:
1242 - Whether p is a prime
1243 - Whether q is a prime
1245 - Whether d*e = 1 mod lcm(p-1,q-1)
1247 If RsaContext is NULL, then return FALSE.
1248 If this interface is not supported, then return FALSE.
1250 @param[in] RsaContext Pointer to RSA context to check.
1252 @retval TRUE RSA key components are valid.
1253 @retval FALSE RSA key components are not valid.
1254 @retval FALSE This interface is not supported.
1259 (EFIAPI
*EDKII_CRYPTO_RSA_CHECK_KEY
) (
1264 Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.
1266 This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in
1268 If the Signature buffer is too small to hold the contents of signature, FALSE
1269 is returned and SigSize is set to the required buffer size to obtain the signature.
1271 If RsaContext is NULL, then return FALSE.
1272 If MessageHash is NULL, then return FALSE.
1273 If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.
1274 If SigSize is large enough but Signature is NULL, then return FALSE.
1275 If this interface is not supported, then return FALSE.
1277 @param[in] RsaContext Pointer to RSA context for signature generation.
1278 @param[in] MessageHash Pointer to octet message hash to be signed.
1279 @param[in] HashSize Size of the message hash in bytes.
1280 @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature.
1281 @param[in, out] SigSize On input, the size of Signature buffer in bytes.
1282 On output, the size of data returned in Signature buffer in bytes.
1284 @retval TRUE Signature successfully generated in PKCS1-v1_5.
1285 @retval FALSE Signature generation failed.
1286 @retval FALSE SigSize is too small.
1287 @retval FALSE This interface is not supported.
1292 (EFIAPI
*EDKII_CRYPTO_RSA_PKCS1_SIGN
) (
1293 IN VOID
*RsaContext
,
1294 IN CONST UINT8
*MessageHash
,
1296 OUT UINT8
*Signature
,
1297 IN OUT UINTN
*SigSize
1301 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
1304 If RsaContext is NULL, then return FALSE.
1305 If MessageHash is NULL, then return FALSE.
1306 If Signature is NULL, then return FALSE.
1307 If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.
1309 @param[in] RsaContext Pointer to RSA context for signature verification.
1310 @param[in] MessageHash Pointer to octet message hash to be checked.
1311 @param[in] HashSize Size of the message hash in bytes.
1312 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
1313 @param[in] SigSize Size of signature in bytes.
1315 @retval TRUE Valid signature encoded in PKCS1-v1_5.
1316 @retval FALSE Invalid signature or invalid RSA context.
1321 (EFIAPI
*EDKII_CRYPTO_RSA_PKCS1_VERIFY
) (
1322 IN VOID
*RsaContext
,
1323 IN CONST UINT8
*MessageHash
,
1325 IN CONST UINT8
*Signature
,
1330 Retrieve the RSA Private Key from the password-protected PEM key data.
1332 If PemData is NULL, then return FALSE.
1333 If RsaContext is NULL, then return FALSE.
1334 If this interface is not supported, then return FALSE.
1336 @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.
1337 @param[in] PemSize Size of the PEM key data in bytes.
1338 @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.
1339 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
1340 RSA private key component. Use RsaFree() function to free the
1343 @retval TRUE RSA Private Key was retrieved successfully.
1344 @retval FALSE Invalid PEM key data or incorrect password.
1345 @retval FALSE This interface is not supported.
1350 (EFIAPI
*EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM
) (
1351 IN CONST UINT8
*PemData
,
1353 IN CONST CHAR8
*Password
,
1354 OUT VOID
**RsaContext
1358 Retrieve the RSA Public Key from one DER-encoded X509 certificate.
1360 If Cert is NULL, then return FALSE.
1361 If RsaContext is NULL, then return FALSE.
1362 If this interface is not supported, then return FALSE.
1364 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1365 @param[in] CertSize Size of the X509 certificate in bytes.
1366 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
1367 RSA public key component. Use RsaFree() function to free the
1370 @retval TRUE RSA Public Key was retrieved successfully.
1371 @retval FALSE Fail to retrieve RSA public key from X509 certificate.
1372 @retval FALSE This interface is not supported.
1377 (EFIAPI
*EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509
) (
1378 IN CONST UINT8
*Cert
,
1380 OUT VOID
**RsaContext
1383 //----------------------------------------
1385 //----------------------------------------
1388 Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
1390 If this interface is not supported, then return zero.
1392 @return The size, in bytes, of the context buffer required for SHA-1 hash operations.
1393 @retval 0 This interface is not supported.
1398 (EFIAPI
*EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE
) (
1403 Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
1406 If Sha1Context is NULL, then return FALSE.
1407 If this interface is not supported, then return FALSE.
1409 @param[out] Sha1Context Pointer to SHA-1 context being initialized.
1411 @retval TRUE SHA-1 context initialization succeeded.
1412 @retval FALSE SHA-1 context initialization failed.
1413 @retval FALSE This interface is not supported.
1418 (EFIAPI
*EDKII_CRYPTO_SHA1_INIT
) (
1419 OUT VOID
*Sha1Context
1423 Makes a copy of an existing SHA-1 context.
1425 If Sha1Context is NULL, then return FALSE.
1426 If NewSha1Context is NULL, then return FALSE.
1427 If this interface is not supported, then return FALSE.
1429 @param[in] Sha1Context Pointer to SHA-1 context being copied.
1430 @param[out] NewSha1Context Pointer to new SHA-1 context.
1432 @retval TRUE SHA-1 context copy succeeded.
1433 @retval FALSE SHA-1 context copy failed.
1434 @retval FALSE This interface is not supported.
1439 (EFIAPI
*EDKII_CRYPTO_SHA1_DUPLICATE
) (
1440 IN CONST VOID
*Sha1Context
,
1441 OUT VOID
*NewSha1Context
1445 Digests the input data and updates SHA-1 context.
1447 This function performs SHA-1 digest on a data buffer of the specified size.
1448 It can be called multiple times to compute the digest of long or discontinuous data streams.
1449 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
1450 by Sha1Final(). Behavior with invalid context is undefined.
1452 If Sha1Context is NULL, then return FALSE.
1453 If this interface is not supported, then return FALSE.
1455 @param[in, out] Sha1Context Pointer to the SHA-1 context.
1456 @param[in] Data Pointer to the buffer containing the data to be hashed.
1457 @param[in] DataSize Size of Data buffer in bytes.
1459 @retval TRUE SHA-1 data digest succeeded.
1460 @retval FALSE SHA-1 data digest failed.
1461 @retval FALSE This interface is not supported.
1466 (EFIAPI
*EDKII_CRYPTO_SHA1_UPDATE
) (
1467 IN OUT VOID
*Sha1Context
,
1468 IN CONST VOID
*Data
,
1473 Completes computation of the SHA-1 digest value.
1475 This function completes SHA-1 hash computation and retrieves the digest value into
1476 the specified memory. After this function has been called, the SHA-1 context cannot
1478 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
1479 finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
1481 If Sha1Context is NULL, then return FALSE.
1482 If HashValue is NULL, then return FALSE.
1483 If this interface is not supported, then return FALSE.
1485 @param[in, out] Sha1Context Pointer to the SHA-1 context.
1486 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
1489 @retval TRUE SHA-1 digest computation succeeded.
1490 @retval FALSE SHA-1 digest computation failed.
1491 @retval FALSE This interface is not supported.
1496 (EFIAPI
*EDKII_CRYPTO_SHA1_FINAL
) (
1497 IN OUT VOID
*Sha1Context
,
1498 OUT UINT8
*HashValue
1502 Computes the SHA-1 message digest of a input data buffer.
1504 This function performs the SHA-1 message digest of a given data buffer, and places
1505 the digest value into the specified memory.
1507 If this interface is not supported, then return FALSE.
1509 @param[in] Data Pointer to the buffer containing the data to be hashed.
1510 @param[in] DataSize Size of Data buffer in bytes.
1511 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
1514 @retval TRUE SHA-1 digest computation succeeded.
1515 @retval FALSE SHA-1 digest computation failed.
1516 @retval FALSE This interface is not supported.
1521 (EFIAPI
*EDKII_CRYPTO_SHA1_HASH_ALL
) (
1522 IN CONST VOID
*Data
,
1524 OUT UINT8
*HashValue
1528 Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
1530 @return The size, in bytes, of the context buffer required for SHA-256 hash operations.
1535 (EFIAPI
*EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE
) (
1540 Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for
1543 If Sha256Context is NULL, then return FALSE.
1545 @param[out] Sha256Context Pointer to SHA-256 context being initialized.
1547 @retval TRUE SHA-256 context initialization succeeded.
1548 @retval FALSE SHA-256 context initialization failed.
1553 (EFIAPI
*EDKII_CRYPTO_SHA256_INIT
) (
1554 OUT VOID
*Sha256Context
1558 Makes a copy of an existing SHA-256 context.
1560 If Sha256Context is NULL, then return FALSE.
1561 If NewSha256Context is NULL, then return FALSE.
1562 If this interface is not supported, then return FALSE.
1564 @param[in] Sha256Context Pointer to SHA-256 context being copied.
1565 @param[out] NewSha256Context Pointer to new SHA-256 context.
1567 @retval TRUE SHA-256 context copy succeeded.
1568 @retval FALSE SHA-256 context copy failed.
1569 @retval FALSE This interface is not supported.
1574 (EFIAPI
*EDKII_CRYPTO_SHA256_DUPLICATE
) (
1575 IN CONST VOID
*Sha256Context
,
1576 OUT VOID
*NewSha256Context
1580 Digests the input data and updates SHA-256 context.
1582 This function performs SHA-256 digest on a data buffer of the specified size.
1583 It can be called multiple times to compute the digest of long or discontinuous data streams.
1584 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized
1585 by Sha256Final(). Behavior with invalid context is undefined.
1587 If Sha256Context is NULL, then return FALSE.
1589 @param[in, out] Sha256Context Pointer to the SHA-256 context.
1590 @param[in] Data Pointer to the buffer containing the data to be hashed.
1591 @param[in] DataSize Size of Data buffer in bytes.
1593 @retval TRUE SHA-256 data digest succeeded.
1594 @retval FALSE SHA-256 data digest failed.
1599 (EFIAPI
*EDKII_CRYPTO_SHA256_UPDATE
) (
1600 IN OUT VOID
*Sha256Context
,
1601 IN CONST VOID
*Data
,
1606 Completes computation of the SHA-256 digest value.
1608 This function completes SHA-256 hash computation and retrieves the digest value into
1609 the specified memory. After this function has been called, the SHA-256 context cannot
1611 SHA-256 context should be already correctly initialized by Sha256Init(), and should not be
1612 finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.
1614 If Sha256Context is NULL, then return FALSE.
1615 If HashValue is NULL, then return FALSE.
1617 @param[in, out] Sha256Context Pointer to the SHA-256 context.
1618 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
1621 @retval TRUE SHA-256 digest computation succeeded.
1622 @retval FALSE SHA-256 digest computation failed.
1627 (EFIAPI
*EDKII_CRYPTO_SHA256_FINAL
) (
1628 IN OUT VOID
*Sha256Context
,
1629 OUT UINT8
*HashValue
1633 Computes the SHA-256 message digest of a input data buffer.
1635 This function performs the SHA-256 message digest of a given data buffer, and places
1636 the digest value into the specified memory.
1638 If this interface is not supported, then return FALSE.
1640 @param[in] Data Pointer to the buffer containing the data to be hashed.
1641 @param[in] DataSize Size of Data buffer in bytes.
1642 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
1645 @retval TRUE SHA-256 digest computation succeeded.
1646 @retval FALSE SHA-256 digest computation failed.
1647 @retval FALSE This interface is not supported.
1652 (EFIAPI
*EDKII_CRYPTO_SHA256_HASH_ALL
) (
1653 IN CONST VOID
*Data
,
1655 OUT UINT8
*HashValue
1660 Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
1661 If this interface is not supported, then return zero.
1663 @return The size, in bytes, of the context buffer required for SHA-384 hash operations.
1664 @retval 0 This interface is not supported.
1669 (EFIAPI
*EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE
) (
1675 Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for
1678 If Sha384Context is NULL, then return FALSE.
1680 @param[out] Sha384Context Pointer to SHA-384 context being initialized.
1682 @retval TRUE SHA-384 context initialization succeeded.
1683 @retval FALSE SHA-384 context initialization failed.
1688 (EFIAPI
*EDKII_CRYPTO_SHA384_INIT
) (
1689 OUT VOID
*Sha384Context
1694 Makes a copy of an existing SHA-384 context.
1696 If Sha384Context is NULL, then return FALSE.
1697 If NewSha384Context is NULL, then return FALSE.
1698 If this interface is not supported, then return FALSE.
1700 @param[in] Sha384Context Pointer to SHA-384 context being copied.
1701 @param[out] NewSha384Context Pointer to new SHA-384 context.
1703 @retval TRUE SHA-384 context copy succeeded.
1704 @retval FALSE SHA-384 context copy failed.
1705 @retval FALSE This interface is not supported.
1710 (EFIAPI
*EDKII_CRYPTO_SHA384_DUPLICATE
) (
1711 IN CONST VOID
*Sha384Context
,
1712 OUT VOID
*NewSha384Context
1717 Digests the input data and updates SHA-384 context.
1719 This function performs SHA-384 digest on a data buffer of the specified size.
1720 It can be called multiple times to compute the digest of long or discontinuous data streams.
1721 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized
1722 by Sha384Final(). Behavior with invalid context is undefined.
1724 If Sha384Context is NULL, then return FALSE.
1726 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1727 @param[in] Data Pointer to the buffer containing the data to be hashed.
1728 @param[in] DataSize Size of Data buffer in bytes.
1730 @retval TRUE SHA-384 data digest succeeded.
1731 @retval FALSE SHA-384 data digest failed.
1736 (EFIAPI
*EDKII_CRYPTO_SHA384_UPDATE
) (
1737 IN OUT VOID
*Sha384Context
,
1738 IN CONST VOID
*Data
,
1744 Completes computation of the SHA-384 digest value.
1746 This function completes SHA-384 hash computation and retrieves the digest value into
1747 the specified memory. After this function has been called, the SHA-384 context cannot
1749 SHA-384 context should be already correctly initialized by Sha384Init(), and should not be
1750 finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.
1752 If Sha384Context is NULL, then return FALSE.
1753 If HashValue is NULL, then return FALSE.
1755 @param[in, out] Sha384Context Pointer to the SHA-384 context.
1756 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1759 @retval TRUE SHA-384 digest computation succeeded.
1760 @retval FALSE SHA-384 digest computation failed.
1765 (EFIAPI
*EDKII_CRYPTO_SHA384_FINAL
) (
1766 IN OUT VOID
*Sha384Context
,
1767 OUT UINT8
*HashValue
1772 Computes the SHA-384 message digest of a input data buffer.
1774 This function performs the SHA-384 message digest of a given data buffer, and places
1775 the digest value into the specified memory.
1777 If this interface is not supported, then return FALSE.
1779 @param[in] Data Pointer to the buffer containing the data to be hashed.
1780 @param[in] DataSize Size of Data buffer in bytes.
1781 @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest
1784 @retval TRUE SHA-384 digest computation succeeded.
1785 @retval FALSE SHA-384 digest computation failed.
1786 @retval FALSE This interface is not supported.
1791 (EFIAPI
*EDKII_CRYPTO_SHA384_HASH_ALL
) (
1792 IN CONST VOID
*Data
,
1794 OUT UINT8
*HashValue
1798 Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.
1800 @return The size, in bytes, of the context buffer required for SHA-512 hash operations.
1805 (EFIAPI
*EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE
) (
1811 Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for
1814 If Sha512Context is NULL, then return FALSE.
1816 @param[out] Sha512Context Pointer to SHA-512 context being initialized.
1818 @retval TRUE SHA-512 context initialization succeeded.
1819 @retval FALSE SHA-512 context initialization failed.
1824 (EFIAPI
*EDKII_CRYPTO_SHA512_INIT
) (
1825 OUT VOID
*Sha512Context
1830 Makes a copy of an existing SHA-512 context.
1832 If Sha512Context is NULL, then return FALSE.
1833 If NewSha512Context is NULL, then return FALSE.
1834 If this interface is not supported, then return FALSE.
1836 @param[in] Sha512Context Pointer to SHA-512 context being copied.
1837 @param[out] NewSha512Context Pointer to new SHA-512 context.
1839 @retval TRUE SHA-512 context copy succeeded.
1840 @retval FALSE SHA-512 context copy failed.
1841 @retval FALSE This interface is not supported.
1846 (EFIAPI
*EDKII_CRYPTO_SHA512_DUPLICATE
) (
1847 IN CONST VOID
*Sha512Context
,
1848 OUT VOID
*NewSha512Context
1852 Digests the input data and updates SHA-512 context.
1854 This function performs SHA-512 digest on a data buffer of the specified size.
1855 It can be called multiple times to compute the digest of long or discontinuous data streams.
1856 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized
1857 by Sha512Final(). Behavior with invalid context is undefined.
1859 If Sha512Context is NULL, then return FALSE.
1861 @param[in, out] Sha512Context Pointer to the SHA-512 context.
1862 @param[in] Data Pointer to the buffer containing the data to be hashed.
1863 @param[in] DataSize Size of Data buffer in bytes.
1865 @retval TRUE SHA-512 data digest succeeded.
1866 @retval FALSE SHA-512 data digest failed.
1871 (EFIAPI
*EDKII_CRYPTO_SHA512_UPDATE
) (
1872 IN OUT VOID
*Sha512Context
,
1873 IN CONST VOID
*Data
,
1879 Completes computation of the SHA-512 digest value.
1881 This function completes SHA-512 hash computation and retrieves the digest value into
1882 the specified memory. After this function has been called, the SHA-512 context cannot
1884 SHA-512 context should be already correctly initialized by Sha512Init(), and should not be
1885 finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.
1887 If Sha512Context is NULL, then return FALSE.
1888 If HashValue is NULL, then return FALSE.
1890 @param[in, out] Sha512Context Pointer to the SHA-512 context.
1891 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
1894 @retval TRUE SHA-512 digest computation succeeded.
1895 @retval FALSE SHA-512 digest computation failed.
1900 (EFIAPI
*EDKII_CRYPTO_SHA512_FINAL
) (
1901 IN OUT VOID
*Sha512Context
,
1902 OUT UINT8
*HashValue
1906 Computes the SHA-512 message digest of a input data buffer.
1908 This function performs the SHA-512 message digest of a given data buffer, and places
1909 the digest value into the specified memory.
1911 If this interface is not supported, then return FALSE.
1913 @param[in] Data Pointer to the buffer containing the data to be hashed.
1914 @param[in] DataSize Size of Data buffer in bytes.
1915 @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest
1918 @retval TRUE SHA-512 digest computation succeeded.
1919 @retval FALSE SHA-512 digest computation failed.
1920 @retval FALSE This interface is not supported.
1925 (EFIAPI
*EDKII_CRYPTO_SHA512_HASH_ALL
) (
1926 IN CONST VOID
*Data
,
1928 OUT UINT8
*HashValue
1931 //----------------------------------------------------------------------------
1933 //----------------------------------------------------------------------------
1936 Retrieve the subject bytes from one X.509 certificate.
1938 If Cert is NULL, then return FALSE.
1939 If SubjectSize is NULL, then return FALSE.
1940 If this interface is not supported, then return FALSE.
1942 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1943 @param[in] CertSize Size of the X509 certificate in bytes.
1944 @param[out] CertSubject Pointer to the retrieved certificate subject bytes.
1945 @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,
1946 and the size of buffer returned CertSubject on output.
1948 @retval TRUE The certificate subject retrieved successfully.
1949 @retval FALSE Invalid certificate, or the SubjectSize is too small for the result.
1950 The SubjectSize will be updated with the required size.
1951 @retval FALSE This interface is not supported.
1956 (EFIAPI
*EDKII_CRYPTO_X509_GET_SUBJECT_NAME
) (
1957 IN CONST UINT8
*Cert
,
1959 OUT UINT8
*CertSubject
,
1960 IN OUT UINTN
*SubjectSize
1964 Retrieve the common name (CN) string from one X.509 certificate.
1966 @param[in] Cert Pointer to the DER-encoded X509 certificate.
1967 @param[in] CertSize Size of the X509 certificate in bytes.
1968 @param[out] CommonName Buffer to contain the retrieved certificate common
1969 name string (UTF8). At most CommonNameSize bytes will be
1970 written and the string will be null terminated. May be
1971 NULL in order to determine the size buffer needed.
1972 @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,
1973 and the size of buffer returned CommonName on output.
1974 If CommonName is NULL then the amount of space needed
1975 in buffer (including the final null) is returned.
1977 @retval RETURN_SUCCESS The certificate CommonName retrieved successfully.
1978 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
1979 If CommonNameSize is NULL.
1980 If CommonName is not NULL and *CommonNameSize is 0.
1981 If Certificate is invalid.
1982 @retval RETURN_NOT_FOUND If no CommonName entry exists.
1983 @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size
1984 (including the final null) is returned in the
1985 CommonNameSize parameter.
1986 @retval RETURN_UNSUPPORTED The operation is not supported.
1991 (EFIAPI
*EDKII_CRYPTO_X509_GET_COMMON_NAME
) (
1992 IN CONST UINT8
*Cert
,
1994 OUT CHAR8
*CommonName
, OPTIONAL
1995 IN OUT UINTN
*CommonNameSize
1999 Retrieve the organization name (O) string from one X.509 certificate.
2001 @param[in] Cert Pointer to the DER-encoded X509 certificate.
2002 @param[in] CertSize Size of the X509 certificate in bytes.
2003 @param[out] NameBuffer Buffer to contain the retrieved certificate organization
2004 name string. At most NameBufferSize bytes will be
2005 written and the string will be null terminated. May be
2006 NULL in order to determine the size buffer needed.
2007 @param[in,out] NameBufferSiz e The size in bytes of the Name buffer on input,
2008 and the size of buffer returned Name on output.
2009 If NameBuffer is NULL then the amount of space needed
2010 in buffer (including the final null) is returned.
2012 @retval RETURN_SUCCESS The certificate Organization Name retrieved successfully.
2013 @retval RETURN_INVALID_PARAMETER If Cert is NULL.
2014 If NameBufferSize is NULL.
2015 If NameBuffer is not NULL and *CommonNameSize is 0.
2016 If Certificate is invalid.
2017 @retval RETURN_NOT_FOUND If no Organization Name entry exists.
2018 @retval RETURN_BUFFER_TOO_SMALL If the NameBuffer is NULL. The required buffer size
2019 (including the final null) is returned in the
2020 CommonNameSize parameter.
2021 @retval RETURN_UNSUPPORTED The operation is not supported.
2026 (EFIAPI
*EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME
) (
2027 IN CONST UINT8
*Cert
,
2029 OUT CHAR8
*NameBuffer
, OPTIONAL
2030 IN OUT UINTN
*NameBufferSize
2034 Verify one X509 certificate was issued by the trusted CA.
2036 If Cert is NULL, then return FALSE.
2037 If CACert is NULL, then return FALSE.
2038 If this interface is not supported, then return FALSE.
2040 @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.
2041 @param[in] CertSize Size of the X509 certificate in bytes.
2042 @param[in] CACert Pointer to the DER-encoded trusted CA certificate.
2043 @param[in] CACertSize Size of the CA Certificate in bytes.
2045 @retval TRUE The certificate was issued by the trusted CA.
2046 @retval FALSE Invalid certificate or the certificate was not issued by the given
2048 @retval FALSE This interface is not supported.
2053 (EFIAPI
*EDKII_CRYPTO_X509_VERIFY_CERT
) (
2054 IN CONST UINT8
*Cert
,
2056 IN CONST UINT8
*CACert
,
2061 Construct a X509 object from DER-encoded certificate data.
2063 If Cert is NULL, then return FALSE.
2064 If SingleX509Cert is NULL, then return FALSE.
2065 If this interface is not supported, then return FALSE.
2067 @param[in] Cert Pointer to the DER-encoded certificate data.
2068 @param[in] CertSize The size of certificate data in bytes.
2069 @param[out] SingleX509Cert The generated X509 object.
2071 @retval TRUE The X509 object generation succeeded.
2072 @retval FALSE The operation failed.
2073 @retval FALSE This interface is not supported.
2078 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE
) (
2079 IN CONST UINT8
*Cert
,
2081 OUT UINT8
**SingleX509Cert
2085 Construct a X509 stack object from a list of DER-encoded certificate data.
2087 If X509Stack is NULL, then return FALSE.
2088 If this interface is not supported, then return FALSE.
2090 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2091 On output, pointer to the X509 stack object with new
2092 inserted X509 certificate.
2093 @param ... A list of DER-encoded single certificate data followed
2094 by certificate size. A NULL terminates the list. The
2095 pairs are the arguments to X509ConstructCertificate().
2097 @retval TRUE The X509 stack construction succeeded.
2098 @retval FALSE The construction operation failed.
2099 @retval FALSE This interface is not supported.
2104 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK
) (
2105 IN OUT UINT8
**X509Stack
,
2110 Construct a X509 stack object from a list of DER-encoded certificate data.
2112 If X509Stack is NULL, then return FALSE.
2113 If this interface is not supported, then return FALSE.
2115 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
2116 On output, pointer to the X509 stack object with new
2117 inserted X509 certificate.
2118 @param[in] Args VA_LIST marker for the variable argument list.
2119 A list of DER-encoded single certificate data followed
2120 by certificate size. A NULL terminates the list. The
2121 pairs are the arguments to X509ConstructCertificate().
2123 @retval TRUE The X509 stack construction succeeded.
2124 @retval FALSE The construction operation failed.
2125 @retval FALSE This interface is not supported.
2130 (EFIAPI
*EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V
) (
2131 IN OUT UINT8
**X509Stack
,
2136 Release the specified X509 object.
2138 If the interface is not supported, then ASSERT().
2140 @param[in] X509Cert Pointer to the X509 object to be released.
2145 (EFIAPI
*EDKII_CRYPTO_X509_FREE
) (
2150 Release the specified X509 stack object.
2152 If the interface is not supported, then ASSERT().
2154 @param[in] X509Stack Pointer to the X509 stack object to be released.
2159 (EFIAPI
*EDKII_CRYPTO_X509_STACK_FREE
) (
2164 Retrieve the TBSCertificate from one given X.509 certificate.
2166 @param[in] Cert Pointer to the given DER-encoded X509 certificate.
2167 @param[in] CertSize Size of the X509 certificate in bytes.
2168 @param[out] TBSCert DER-Encoded To-Be-Signed certificate.
2169 @param[out] TBSCertSize Size of the TBS certificate in bytes.
2171 If Cert is NULL, then return FALSE.
2172 If TBSCert is NULL, then return FALSE.
2173 If TBSCertSize is NULL, then return FALSE.
2174 If this interface is not supported, then return FALSE.
2176 @retval TRUE The TBSCertificate was retrieved successfully.
2177 @retval FALSE Invalid X.509 certificate.
2182 (EFIAPI
*EDKII_CRYPTO_X509_GET_TBS_CERT
) (
2183 IN CONST UINT8
*Cert
,
2185 OUT UINT8
**TBSCert
,
2186 OUT UINTN
*TBSCertSize
2191 //=====================================================================================
2192 // Symmetric Cryptography Primitive
2193 //=====================================================================================
2196 TDES is deprecated and unsupported any longer.
2197 Keep the function field for binary compability.
2202 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE
) (
2208 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_INIT
) (
2209 OUT VOID
*TdesContext
,
2210 IN CONST UINT8
*Key
,
2216 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT
) (
2217 IN VOID
*TdesContext
,
2218 IN CONST UINT8
*Input
,
2225 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT
) (
2226 IN VOID
*TdesContext
,
2227 IN CONST UINT8
*Input
,
2234 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT
) (
2235 IN VOID
*TdesContext
,
2236 IN CONST UINT8
*Input
,
2238 IN CONST UINT8
*Ivec
,
2244 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT
) (
2245 IN VOID
*TdesContext
,
2246 IN CONST UINT8
*Input
,
2248 IN CONST UINT8
*Ivec
,
2253 Retrieves the size, in bytes, of the context buffer required for AES operations.
2255 If this interface is not supported, then return zero.
2257 @return The size, in bytes, of the context buffer required for AES operations.
2258 @retval 0 This interface is not supported.
2263 (EFIAPI
*EDKII_CRYPTO_AES_GET_CONTEXT_SIZE
) (
2268 Initializes user-supplied memory as AES context for subsequent use.
2270 This function initializes user-supplied memory pointed by AesContext as AES context.
2271 In addition, it sets up all AES key materials for subsequent encryption and decryption
2273 There are 3 options for key length, 128 bits, 192 bits, and 256 bits.
2275 If AesContext is NULL, then return FALSE.
2276 If Key is NULL, then return FALSE.
2277 If KeyLength is not valid, then return FALSE.
2278 If this interface is not supported, then return FALSE.
2280 @param[out] AesContext Pointer to AES context being initialized.
2281 @param[in] Key Pointer to the user-supplied AES key.
2282 @param[in] KeyLength Length of AES key in bits.
2284 @retval TRUE AES context initialization succeeded.
2285 @retval FALSE AES context initialization failed.
2286 @retval FALSE This interface is not supported.
2291 (EFIAPI
*EDKII_CRYPTO_AES_INIT
) (
2292 OUT VOID
*AesContext
,
2293 IN CONST UINT8
*Key
,
2298 AES ECB Mode is deprecated and unsupported any longer.
2299 Keep the function field for binary compability.
2304 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT
) (
2305 IN VOID
*AesContext
,
2306 IN CONST UINT8
*Input
,
2313 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT
) (
2314 IN VOID
*AesContext
,
2315 IN CONST UINT8
*Input
,
2321 Performs AES encryption on a data buffer of the specified size in CBC mode.
2323 This function performs AES encryption on data buffer pointed by Input, of specified
2324 size of InputSize, in CBC mode.
2325 InputSize must be multiple of block size (16 bytes). This function does not perform
2326 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2327 Initialization vector should be one block size (16 bytes).
2328 AesContext should be already correctly initialized by AesInit(). Behavior with
2329 invalid AES context is undefined.
2331 If AesContext is NULL, then return FALSE.
2332 If Input is NULL, then return FALSE.
2333 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2334 If Ivec is NULL, then return FALSE.
2335 If Output is NULL, then return FALSE.
2336 If this interface is not supported, then return FALSE.
2338 @param[in] AesContext Pointer to the AES context.
2339 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2340 @param[in] InputSize Size of the Input buffer in bytes.
2341 @param[in] Ivec Pointer to initialization vector.
2342 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2344 @retval TRUE AES encryption succeeded.
2345 @retval FALSE AES encryption failed.
2346 @retval FALSE This interface is not supported.
2351 (EFIAPI
*EDKII_CRYPTO_AES_CBC_ENCRYPT
) (
2352 IN VOID
*AesContext
,
2353 IN CONST UINT8
*Input
,
2355 IN CONST UINT8
*Ivec
,
2360 Performs AES decryption on a data buffer of the specified size in CBC mode.
2362 This function performs AES decryption on data buffer pointed by Input, of specified
2363 size of InputSize, in CBC mode.
2364 InputSize must be multiple of block size (16 bytes). This function does not perform
2365 padding. Caller must perform padding, if necessary, to ensure valid input data size.
2366 Initialization vector should be one block size (16 bytes).
2367 AesContext should be already correctly initialized by AesInit(). Behavior with
2368 invalid AES context is undefined.
2370 If AesContext is NULL, then return FALSE.
2371 If Input is NULL, then return FALSE.
2372 If InputSize is not multiple of block size (16 bytes), then return FALSE.
2373 If Ivec is NULL, then return FALSE.
2374 If Output is NULL, then return FALSE.
2375 If this interface is not supported, then return FALSE.
2377 @param[in] AesContext Pointer to the AES context.
2378 @param[in] Input Pointer to the buffer containing the data to be encrypted.
2379 @param[in] InputSize Size of the Input buffer in bytes.
2380 @param[in] Ivec Pointer to initialization vector.
2381 @param[out] Output Pointer to a buffer that receives the AES encryption output.
2383 @retval TRUE AES decryption succeeded.
2384 @retval FALSE AES decryption failed.
2385 @retval FALSE This interface is not supported.
2390 (EFIAPI
*EDKII_CRYPTO_AES_CBC_DECRYPT
) (
2391 IN VOID
*AesContext
,
2392 IN CONST UINT8
*Input
,
2394 IN CONST UINT8
*Ivec
,
2399 ARC4 is deprecated and unsupported any longer.
2400 Keep the function field for binary compability.
2405 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE
) (
2411 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_INIT
) (
2412 OUT VOID
*Arc4Context
,
2413 IN CONST UINT8
*Key
,
2419 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT
) (
2420 IN OUT VOID
*Arc4Context
,
2421 IN CONST UINT8
*Input
,
2428 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT
) (
2429 IN OUT VOID
*Arc4Context
,
2437 (EFIAPI
*DEPRECATED_EDKII_CRYPTO_ARC4_RESET
) (
2438 IN OUT VOID
*Arc4Context
2443 Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
2445 If this interface is not supported, then return zero.
2447 @return The size, in bytes, of the context buffer required for SM3 hash operations.
2448 @retval 0 This interface is not supported.
2453 (EFIAPI
* EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE
)(
2458 Initializes user-supplied memory pointed by Sm3Context as SM3 hash context for
2461 If Sm3Context is NULL, then return FALSE.
2462 If this interface is not supported, then return FALSE.
2464 @param[out] Sm3Context Pointer to SM3 context being initialized.
2466 @retval TRUE SM3 context initialization succeeded.
2467 @retval FALSE SM3 context initialization failed.
2468 @retval FALSE This interface is not supported.
2473 (EFIAPI
* EDKII_CRYPTO_SM3_INIT
)(
2474 OUT VOID
*Sm3Context
);
2477 Makes a copy of an existing SM3 context.
2479 If Sm3Context is NULL, then return FALSE.
2480 If NewSm3Context is NULL, then return FALSE.
2481 If this interface is not supported, then return FALSE.
2483 @param[in] Sm3Context Pointer to SM3 context being copied.
2484 @param[out] NewSm3Context Pointer to new SM3 context.
2486 @retval TRUE SM3 context copy succeeded.
2487 @retval FALSE SM3 context copy failed.
2488 @retval FALSE This interface is not supported.
2493 (EFIAPI
* EDKII_CRYPTO_SM3_DUPLICATE
) (
2494 IN CONST VOID
*Sm3Context
,
2495 OUT VOID
*NewSm3Context
);
2499 Digests the input data and updates SM3 context.
2501 This function performs SM3 digest on a data buffer of the specified size.
2502 It can be called multiple times to compute the digest of long or discontinuous data streams.
2503 SM3 context should be already correctly initialized by Sm3Init(), and should not be finalized
2504 by Sm3Final(). Behavior with invalid context is undefined.
2506 If Sm3Context is NULL, then return FALSE.
2507 If this interface is not supported, then return FALSE.
2509 @param[in, out] Sm3Context Pointer to the SM3 context.
2510 @param[in] Data Pointer to the buffer containing the data to be hashed.
2511 @param[in] DataSize Size of Data buffer in bytes.
2513 @retval TRUE SM3 data digest succeeded.
2514 @retval FALSE SM3 data digest failed.
2515 @retval FALSE This interface is not supported.
2520 (EFIAPI
* EDKII_CRYPTO_SM3_UPDATE
)(
2521 IN OUT VOID
*Sm3Context
,
2522 IN CONST VOID
*Data
,
2527 Completes computation of the SM3 digest value.
2529 This function completes SM3 hash computation and retrieves the digest value into
2530 the specified memory. After this function has been called, the SM3 context cannot
2532 SM3 context should be already correctly initialized by Sm3Init(), and should not be
2533 finalized by Sm3Final(). Behavior with invalid SM3 context is undefined.
2535 If Sm3Context is NULL, then return FALSE.
2536 If HashValue is NULL, then return FALSE.
2537 If this interface is not supported, then return FALSE.
2539 @param[in, out] Sm3Context Pointer to the SM3 context.
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_FINAL
)(
2551 IN OUT VOID
*Sm3Context
,
2552 OUT UINT8
*HashValue
);
2556 Computes the SM3 message digest of a input data buffer.
2558 This function performs the SM3 message digest of a given data buffer, and places
2559 the digest value into the specified memory.
2561 If this interface is not supported, then return FALSE.
2563 @param[in] Data Pointer to the buffer containing the data to be hashed.
2564 @param[in] DataSize Size of Data buffer in bytes.
2565 @param[out] HashValue Pointer to a buffer that receives the SM3 digest
2568 @retval TRUE SM3 digest computation succeeded.
2569 @retval FALSE SM3 digest computation failed.
2570 @retval FALSE This interface is not supported.
2575 (EFIAPI
* EDKII_CRYPTO_SM3_HASH_ALL
)(
2576 IN CONST VOID
*Data
,
2578 OUT UINT8
*HashValue
);
2582 Derive key data using HMAC-SHA256 based KDF.
2584 @param[in] Key Pointer to the user-supplied key.
2585 @param[in] KeySize Key size in bytes.
2586 @param[in] Salt Pointer to the salt(non-secret) value.
2587 @param[in] SaltSize Salt size in bytes.
2588 @param[in] Info Pointer to the application specific info.
2589 @param[in] InfoSize Info size in bytes.
2590 @param[out] Out Pointer to buffer to receive hkdf value.
2591 @param[in] OutSize Size of hkdf bytes to generate.
2593 @retval TRUE Hkdf generated successfully.
2594 @retval FALSE Hkdf generation failed.
2599 (EFIAPI
* EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND
)(
2600 IN CONST UINT8
*Key
,
2602 IN CONST UINT8
*Salt
,
2604 IN CONST UINT8
*Info
,
2611 Initializes the OpenSSL library.
2613 This function registers ciphers and digests used directly and indirectly
2614 by SSL/TLS, and initializes the readable error messages.
2615 This function must be called before any other action takes places.
2617 @retval TRUE The OpenSSL library has been initialized.
2618 @retval FALSE Failed to initialize the OpenSSL library.
2623 (EFIAPI
* EDKII_CRYPTO_TLS_INITIALIZE
)(
2628 Free an allocated SSL_CTX object.
2630 @param[in] TlsCtx Pointer to the SSL_CTX object to be released.
2635 (EFIAPI
* EDKII_CRYPTO_TLS_CTX_FREE
)(
2640 Creates a new SSL_CTX object as framework to establish TLS/SSL enabled
2643 @param[in] MajorVer Major Version of TLS/SSL Protocol.
2644 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
2646 @return Pointer to an allocated SSL_CTX object.
2647 If the creation failed, TlsCtxNew() returns NULL.
2652 (EFIAPI
* EDKII_CRYPTO_TLS_CTX_NEW
)(
2658 Free an allocated TLS object.
2660 This function removes the TLS object pointed to by Tls and frees up the
2661 allocated memory. If Tls is NULL, nothing is done.
2663 @param[in] Tls Pointer to the TLS object to be freed.
2668 (EFIAPI
* EDKII_CRYPTO_TLS_FREE
)(
2673 Create a new TLS object for a connection.
2675 This function creates a new TLS object for a connection. The new object
2676 inherits the setting of the underlying context TlsCtx: connection method,
2677 options, verification setting.
2679 @param[in] TlsCtx Pointer to the SSL_CTX object.
2681 @return Pointer to an allocated SSL object.
2682 If the creation failed, TlsNew() returns NULL.
2687 (EFIAPI
* EDKII_CRYPTO_TLS_NEW
)(
2692 Checks if the TLS handshake was done.
2694 This function will check if the specified TLS handshake was done.
2696 @param[in] Tls Pointer to the TLS object for handshake state checking.
2698 @retval TRUE The TLS handshake was done.
2699 @retval FALSE The TLS handshake was not done.
2704 (EFIAPI
* EDKII_CRYPTO_TLS_IN_HANDSHAKE
)(
2709 Perform a TLS/SSL handshake.
2711 This function will perform a TLS/SSL handshake.
2713 @param[in] Tls Pointer to the TLS object for handshake operation.
2714 @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.
2715 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
2717 @param[out] BufferOut Pointer to the buffer to hold the built packet.
2718 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
2719 the buffer size provided by the caller. On output, it
2720 is the buffer size in fact needed to contain the
2723 @retval EFI_SUCCESS The required TLS packet is built successfully.
2724 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2726 BufferIn is NULL but BufferInSize is NOT 0.
2727 BufferInSize is 0 but BufferIn is NOT NULL.
2728 BufferOutSize is NULL.
2729 BufferOut is NULL if *BufferOutSize is not zero.
2730 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
2731 @retval EFI_ABORTED Something wrong during handshake.
2736 (EFIAPI
* EDKII_CRYPTO_TLS_DO_HANDSHAKE
)(
2738 IN UINT8
*BufferIn
, OPTIONAL
2739 IN UINTN BufferInSize
, OPTIONAL
2740 OUT UINT8
*BufferOut
, OPTIONAL
2741 IN OUT UINTN
*BufferOutSize
2745 Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,
2746 TLS session has errors and the response packet needs to be Alert message based on error type.
2748 @param[in] Tls Pointer to the TLS object for state checking.
2749 @param[in] BufferIn Pointer to the most recently received TLS Alert packet.
2750 @param[in] BufferInSize Packet size in bytes for the most recently received TLS
2752 @param[out] BufferOut Pointer to the buffer to hold the built packet.
2753 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is
2754 the buffer size provided by the caller. On output, it
2755 is the buffer size in fact needed to contain the
2758 @retval EFI_SUCCESS The required TLS packet is built successfully.
2759 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2761 BufferIn is NULL but BufferInSize is NOT 0.
2762 BufferInSize is 0 but BufferIn is NOT NULL.
2763 BufferOutSize is NULL.
2764 BufferOut is NULL if *BufferOutSize is not zero.
2765 @retval EFI_ABORTED An error occurred.
2766 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.
2771 (EFIAPI
* EDKII_CRYPTO_TLS_HANDLE_ALERT
)(
2773 IN UINT8
*BufferIn
, OPTIONAL
2774 IN UINTN BufferInSize
, OPTIONAL
2775 OUT UINT8
*BufferOut
, OPTIONAL
2776 IN OUT UINTN
*BufferOutSize
2780 Build the CloseNotify packet.
2782 @param[in] Tls Pointer to the TLS object for state checking.
2783 @param[in, out] Buffer Pointer to the buffer to hold the built packet.
2784 @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is
2785 the buffer size provided by the caller. On output, it
2786 is the buffer size in fact needed to contain the
2789 @retval EFI_SUCCESS The required TLS packet is built successfully.
2790 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
2793 Buffer is NULL if *BufferSize is not zero.
2794 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.
2799 (EFIAPI
* EDKII_CRYPTO_TLS_CLOSE_NOTIFY
)(
2801 IN OUT UINT8
*Buffer
,
2802 IN OUT UINTN
*BufferSize
2806 Attempts to read bytes from one TLS object and places the data in Buffer.
2808 This function will attempt to read BufferSize bytes from the TLS object
2809 and places the data in Buffer.
2811 @param[in] Tls Pointer to the TLS object.
2812 @param[in,out] Buffer Pointer to the buffer to store the data.
2813 @param[in] BufferSize The size of Buffer in bytes.
2815 @retval >0 The amount of data successfully read from the TLS object.
2816 @retval <=0 No data was successfully read.
2821 (EFIAPI
* EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT
)(
2823 IN OUT VOID
*Buffer
,
2828 Attempts to write data from the buffer to TLS object.
2830 This function will attempt to write BufferSize bytes data from the Buffer
2833 @param[in] Tls Pointer to the TLS object.
2834 @param[in] Buffer Pointer to the data buffer.
2835 @param[in] BufferSize The size of Buffer in bytes.
2837 @retval >0 The amount of data successfully written to the TLS object.
2838 @retval <=0 No data was successfully written.
2843 (EFIAPI
* EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN
)(
2850 Attempts to read bytes from the specified TLS connection into the buffer.
2852 This function tries to read BufferSize bytes data from the specified TLS
2853 connection into the Buffer.
2855 @param[in] Tls Pointer to the TLS connection for data reading.
2856 @param[in,out] Buffer Pointer to the data buffer.
2857 @param[in] BufferSize The size of Buffer in bytes.
2859 @retval >0 The read operation was successful, and return value is the
2860 number of bytes actually read from the TLS connection.
2861 @retval <=0 The read operation was not successful.
2866 (EFIAPI
* EDKII_CRYPTO_TLS_READ
)(
2868 IN OUT VOID
*Buffer
,
2873 Attempts to write data to a TLS connection.
2875 This function tries to write BufferSize bytes data from the Buffer into the
2876 specified TLS connection.
2878 @param[in] Tls Pointer to the TLS connection for data writing.
2879 @param[in] Buffer Pointer to the data buffer.
2880 @param[in] BufferSize The size of Buffer in bytes.
2882 @retval >0 The write operation was successful, and return value is the
2883 number of bytes actually written to the TLS connection.
2884 @retval <=0 The write operation was not successful.
2889 (EFIAPI
* EDKII_CRYPTO_TLS_WRITE
)(
2896 Set a new TLS/SSL method for a particular TLS object.
2898 This function sets a new TLS/SSL method for a particular TLS object.
2900 @param[in] Tls Pointer to a TLS object.
2901 @param[in] MajorVer Major Version of TLS/SSL Protocol.
2902 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
2904 @retval EFI_SUCCESS The TLS/SSL method was set successfully.
2905 @retval EFI_INVALID_PARAMETER The parameter is invalid.
2906 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.
2911 (EFIAPI
* EDKII_CRYPTO_TLS_SET_VERSION
)(
2918 Set TLS object to work in client or server mode.
2920 This function prepares a TLS object to work in client or server mode.
2922 @param[in] Tls Pointer to a TLS object.
2923 @param[in] IsServer Work in server mode.
2925 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.
2926 @retval EFI_INVALID_PARAMETER The parameter is invalid.
2927 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.
2932 (EFIAPI
* EDKII_CRYPTO_TLS_SET_CONNECTION_END
)(
2938 Set the ciphers list to be used by the TLS object.
2940 This function sets the ciphers for use by a specified TLS object.
2942 @param[in] Tls Pointer to a TLS object.
2943 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16
2944 cipher identifier comes from the TLS Cipher Suite
2945 Registry of the IANA, interpreting Byte1 and Byte2
2946 in network (big endian) byte order.
2947 @param[in] CipherNum The number of cipher in the list.
2949 @retval EFI_SUCCESS The ciphers list was set successfully.
2950 @retval EFI_INVALID_PARAMETER The parameter is invalid.
2951 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.
2952 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2957 (EFIAPI
* EDKII_CRYPTO_TLS_SET_CIPHER_LIST
)(
2959 IN UINT16
*CipherId
,
2964 Set the compression method for TLS/SSL operations.
2966 This function handles TLS/SSL integrated compression methods.
2968 @param[in] CompMethod The compression method ID.
2970 @retval EFI_SUCCESS The compression method for the communication was
2972 @retval EFI_UNSUPPORTED Unsupported compression method.
2977 (EFIAPI
* EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD
)(
2982 Set peer certificate verification mode for the TLS connection.
2984 This function sets the verification mode flags for the TLS connection.
2986 @param[in] Tls Pointer to the TLS object.
2987 @param[in] VerifyMode A set of logically or'ed verification mode flags.
2992 (EFIAPI
* EDKII_CRYPTO_TLS_SET_VERIFY
)(
2994 IN UINT32 VerifyMode
2998 Set the specified host name to be verified.
3000 @param[in] Tls Pointer to the TLS object.
3001 @param[in] Flags The setting flags during the validation.
3002 @param[in] HostName The specified host name to be verified.
3004 @retval EFI_SUCCESS The HostName setting was set successfully.
3005 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3006 @retval EFI_ABORTED Invalid HostName setting.
3011 (EFIAPI
* EDKII_CRYPTO_TLS_SET_VERIFY_HOST
)(
3018 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
3020 This function sets a session ID to be used when the TLS/SSL connection is
3023 @param[in] Tls Pointer to the TLS object.
3024 @param[in] SessionId Session ID data used for session resumption.
3025 @param[in] SessionIdLen Length of Session ID in bytes.
3027 @retval EFI_SUCCESS Session ID was set successfully.
3028 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3029 @retval EFI_UNSUPPORTED No available session for ID setting.
3034 (EFIAPI
* EDKII_CRYPTO_TLS_SET_SESSIONID
)(
3036 IN UINT8
*SessionId
,
3037 IN UINT16 SessionIdLen
3041 Adds the CA to the cert store when requesting Server or Client authentication.
3043 This function adds the CA certificate to the list of CAs when requesting
3044 Server or Client authentication for the chosen TLS connection.
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_CA_CERTIFICATE
)(
3066 Loads the local public certificate into the specified TLS object.
3068 This function loads the X.509 certificate into the specified TLS object
3069 for TLS negotiation.
3071 @param[in] Tls Pointer to the TLS object.
3072 @param[in] Data Pointer to the data buffer of a DER-encoded binary
3073 X.509 certificate or PEM-encoded X.509 certificate.
3074 @param[in] DataSize The size of data buffer in bytes.
3076 @retval EFI_SUCCESS The operation succeeded.
3077 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3078 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
3079 @retval EFI_ABORTED Invalid X.509 certificate.
3084 (EFIAPI
* EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT
)(
3091 Adds the local private key to the specified TLS object.
3093 This function adds the local private key (PEM-encoded RSA or PKCS#8 private
3094 key) into the specified TLS object for TLS negotiation.
3096 @param[in] Tls Pointer to the TLS object.
3097 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA
3098 or PKCS#8 private key.
3099 @param[in] DataSize The size of data buffer in bytes.
3101 @retval EFI_SUCCESS The operation succeeded.
3102 @retval EFI_UNSUPPORTED This function is not supported.
3103 @retval EFI_ABORTED Invalid private key data.
3108 (EFIAPI
* EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY
)(
3115 Adds the CA-supplied certificate revocation list for certificate validation.
3117 This function adds the CA-supplied certificate revocation list data for
3118 certificate validity checking.
3120 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
3121 @param[in] DataSize The size of data buffer in bytes.
3123 @retval EFI_SUCCESS The operation succeeded.
3124 @retval EFI_UNSUPPORTED This function is not supported.
3125 @retval EFI_ABORTED Invalid CRL data.
3130 (EFIAPI
* EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST
)(
3136 Gets the protocol version used by the specified TLS connection.
3138 This function returns the protocol version used by the specified TLS
3141 If Tls is NULL, then ASSERT().
3143 @param[in] Tls Pointer to the TLS object.
3145 @return The protocol version of the specified TLS connection.
3150 (EFIAPI
* EDKII_CRYPTO_TLS_GET_VERSION
)(
3155 Gets the connection end of the specified TLS connection.
3157 This function returns the connection end (as client or as server) used by
3158 the specified TLS connection.
3160 If Tls is NULL, then ASSERT().
3162 @param[in] Tls Pointer to the TLS object.
3164 @return The connection end used by the specified TLS connection.
3169 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CONNECTION_END
)(
3174 Gets the cipher suite used by the specified TLS connection.
3176 This function returns current cipher suite used by the specified
3179 @param[in] Tls Pointer to the TLS object.
3180 @param[in,out] CipherId The cipher suite used by the TLS object.
3182 @retval EFI_SUCCESS The cipher suite was returned successfully.
3183 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3184 @retval EFI_UNSUPPORTED Unsupported cipher suite.
3189 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER
)(
3191 IN OUT UINT16
*CipherId
3195 Gets the compression methods used by the specified TLS connection.
3197 This function returns current integrated compression methods used by
3198 the specified TLS connection.
3200 @param[in] Tls Pointer to the TLS object.
3201 @param[in,out] CompressionId The current compression method used by
3204 @retval EFI_SUCCESS The compression method was returned successfully.
3205 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3206 @retval EFI_ABORTED Invalid Compression method.
3207 @retval EFI_UNSUPPORTED This function is not supported.
3212 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID
)(
3214 IN OUT UINT8
*CompressionId
3218 Gets the verification mode currently set in the TLS connection.
3220 This function returns the peer verification mode currently set in the
3221 specified TLS connection.
3223 If Tls is NULL, then ASSERT().
3225 @param[in] Tls Pointer to the TLS object.
3227 @return The verification mode set in the specified TLS connection.
3232 (EFIAPI
* EDKII_CRYPTO_TLS_GET_VERIFY
)(
3237 Gets the session ID used by the specified TLS connection.
3239 This function returns the TLS/SSL session ID currently used by the
3240 specified TLS connection.
3242 @param[in] Tls Pointer to the TLS object.
3243 @param[in,out] SessionId Buffer to contain the returned session ID.
3244 @param[in,out] SessionIdLen The length of Session ID in bytes.
3246 @retval EFI_SUCCESS The Session ID was returned successfully.
3247 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3248 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
3253 (EFIAPI
* EDKII_CRYPTO_TLS_GET_SESSION_ID
)(
3255 IN OUT UINT8
*SessionId
,
3256 IN OUT UINT16
*SessionIdLen
3260 Gets the client random data used in the specified TLS connection.
3262 This function returns the TLS/SSL client random data currently used in
3263 the specified TLS connection.
3265 @param[in] Tls Pointer to the TLS object.
3266 @param[in,out] ClientRandom Buffer to contain the returned client
3267 random data (32 bytes).
3272 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM
)(
3274 IN OUT UINT8
*ClientRandom
3278 Gets the server random data used in the specified TLS connection.
3280 This function returns the TLS/SSL server random data currently used in
3281 the specified TLS connection.
3283 @param[in] Tls Pointer to the TLS object.
3284 @param[in,out] ServerRandom Buffer to contain the returned server
3285 random data (32 bytes).
3290 (EFIAPI
* EDKII_CRYPTO_TLS_GET_SERVER_RANDOM
)(
3292 IN OUT UINT8
*ServerRandom
3296 Gets the master key data used in the specified TLS connection.
3298 This function returns the TLS/SSL master key material currently used in
3299 the specified TLS connection.
3301 @param[in] Tls Pointer to the TLS object.
3302 @param[in,out] KeyMaterial Buffer to contain the returned key material.
3304 @retval EFI_SUCCESS Key material was returned successfully.
3305 @retval EFI_INVALID_PARAMETER The parameter is invalid.
3306 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
3311 (EFIAPI
* EDKII_CRYPTO_TLS_GET_KEY_MATERIAL
)(
3313 IN OUT UINT8
*KeyMaterial
3317 Gets the CA Certificate from the cert store.
3319 This function returns the CA certificate for the chosen
3322 @param[in] Tls Pointer to the TLS object.
3323 @param[out] Data Pointer to the data buffer to receive the CA
3324 certificate data sent to the client.
3325 @param[in,out] DataSize The size of data buffer in bytes.
3327 @retval EFI_SUCCESS The operation succeeded.
3328 @retval EFI_UNSUPPORTED This function is not supported.
3329 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3334 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE
)(
3337 IN OUT UINTN
*DataSize
3341 Gets the local public Certificate set in the specified TLS object.
3343 This function returns the local public certificate 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_INVALID_PARAMETER The parameter is invalid.
3353 @retval EFI_NOT_FOUND The certificate is not found.
3354 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3359 (EFIAPI
* EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT
)(
3362 IN OUT UINTN
*DataSize
3366 Gets the local private key set in the specified TLS object.
3368 This function returns the local private key data which was currently set
3369 in the specified TLS object.
3371 @param[in] Tls Pointer to the TLS object.
3372 @param[out] Data Pointer to the data buffer to receive the local
3374 @param[in,out] DataSize The size of data buffer in bytes.
3376 @retval EFI_SUCCESS The operation succeeded.
3377 @retval EFI_UNSUPPORTED This function is not supported.
3378 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3383 (EFIAPI
* EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY
)(
3386 IN OUT UINTN
*DataSize
3390 Gets the CA-supplied certificate revocation list data set in the specified
3393 This function returns the CA-supplied certificate revocation list data which
3394 was currently set in the specified TLS object.
3396 @param[out] Data Pointer to the data buffer to receive the CRL data.
3397 @param[in,out] DataSize The size of data buffer in bytes.
3399 @retval EFI_SUCCESS The operation succeeded.
3400 @retval EFI_UNSUPPORTED This function is not supported.
3401 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
3406 (EFIAPI
* EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST
)(
3408 IN OUT UINTN
*DataSize
3412 Carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme.
3414 This function carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme defined in
3416 Mask generation function is the same as the message digest algorithm.
3417 If the Signature buffer is too small to hold the contents of signature, FALSE
3418 is returned and SigSize is set to the required buffer size to obtain the signature.
3420 If RsaContext is NULL, then return FALSE.
3421 If Message is NULL, then return FALSE.
3422 If MsgSize is zero or > INT_MAX, then return FALSE.
3423 If DigestLen is NOT 32, 48 or 64, return FALSE.
3424 If SaltLen is not equal to DigestLen, then return FALSE.
3425 If SigSize is large enough but Signature is NULL, then return FALSE.
3426 If this interface is not supported, then return FALSE.
3428 @param[in] RsaContext Pointer to RSA context for signature generation.
3429 @param[in] Message Pointer to octet message to be signed.
3430 @param[in] MsgSize Size of the message in bytes.
3431 @param[in] DigestLen Length of the digest in bytes to be used for RSA signature operation.
3432 @param[in] SaltLen Length of the salt in bytes to be used for PSS encoding.
3433 @param[out] Signature Pointer to buffer to receive RSA PSS signature.
3434 @param[in, out] SigSize On input, the size of Signature buffer in bytes.
3435 On output, the size of data returned in Signature buffer in bytes.
3437 @retval TRUE Signature successfully generated in RSASSA-PSS.
3438 @retval FALSE Signature generation failed.
3439 @retval FALSE SigSize is too small.
3440 @retval FALSE This interface is not supported.
3445 (EFIAPI
* EDKII_CRYPTO_RSA_PSS_SIGN
)(
3446 IN VOID
*RsaContext
,
3447 IN CONST UINT8
*Message
,
3449 IN UINT16 DigestLen
,
3451 OUT UINT8
*Signature
,
3452 IN OUT UINTN
*SigSize
3456 Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017.
3457 Implementation determines salt length automatically from the signature encoding.
3458 Mask generation function is the same as the message digest algorithm.
3459 Salt length should be equal to digest length.
3461 @param[in] RsaContext Pointer to RSA context for signature verification.
3462 @param[in] Message Pointer to octet message to be verified.
3463 @param[in] MsgSize Size of the message in bytes.
3464 @param[in] Signature Pointer to RSASSA-PSS signature to be verified.
3465 @param[in] SigSize Size of signature in bytes.
3466 @param[in] DigestLen Length of digest for RSA operation.
3467 @param[in] SaltLen Salt length for PSS encoding.
3469 @retval TRUE Valid signature encoded in RSASSA-PSS.
3470 @retval FALSE Invalid signature or invalid RSA context.
3475 (EFIAPI
* EDKII_CRYPTO_RSA_PSS_VERIFY
)(
3476 IN VOID
*RsaContext
,
3477 IN CONST UINT8
*Message
,
3479 IN CONST UINT8
*Signature
,
3481 IN UINT16 DigestLen
,
3488 /// EDK II Crypto Protocol
3490 struct _EDKII_CRYPTO_PROTOCOL
{
3492 EDKII_CRYPTO_GET_VERSION GetVersion
;
3493 /// HMAC MD5 - deprecated and unsupported
3494 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_NEW DeprecatedHmacMd5New
;
3495 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FREE DeprecatedHmacMd5Free
;
3496 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_SET_KEY DeprecatedHmacMd5SetKey
;
3497 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_DUPLICATE DeprecatedHmacMd5Duplicate
;
3498 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_UPDATE DeprecatedHmacMd5Update
;
3499 DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FINAL DeprecatedHmacMd5Final
;
3500 /// HMAC SHA1 - deprecated and unsupported
3501 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_NEW DeprecatedHmacSha1New
;
3502 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FREE DeprecatedHmacSha1Free
;
3503 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_SET_KEY DeprecatedHmacSha1SetKey
;
3504 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_DUPLICATE DeprecatedHmacSha1Duplicate
;
3505 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_UPDATE DeprecatedHmacSha1Update
;
3506 DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FINAL DeprecatedHmacSha1Final
;
3508 EDKII_CRYPTO_HMAC_SHA256_NEW HmacSha256New
;
3509 EDKII_CRYPTO_HMAC_SHA256_FREE HmacSha256Free
;
3510 EDKII_CRYPTO_HMAC_SHA256_SET_KEY HmacSha256SetKey
;
3511 EDKII_CRYPTO_HMAC_SHA256_DUPLICATE HmacSha256Duplicate
;
3512 EDKII_CRYPTO_HMAC_SHA256_UPDATE HmacSha256Update
;
3513 EDKII_CRYPTO_HMAC_SHA256_FINAL HmacSha256Final
;
3514 /// Md4 - deprecated and unsupported
3515 DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE DeprecatedMd4GetContextSize
;
3516 DEPRECATED_EDKII_CRYPTO_MD4_INIT DeprecatedMd4Init
;
3517 DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE DeprecatedMd4Duplicate
;
3518 DEPRECATED_EDKII_CRYPTO_MD4_UPDATE DeprecatedMd4Update
;
3519 DEPRECATED_EDKII_CRYPTO_MD4_FINAL DeprecatedMd4Final
;
3520 DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL DeprecatedMd4HashAll
;
3522 EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE Md5GetContextSize
;
3523 EDKII_CRYPTO_MD5_INIT Md5Init
;
3524 EDKII_CRYPTO_MD5_DUPLICATE Md5Duplicate
;
3525 EDKII_CRYPTO_MD5_UPDATE Md5Update
;
3526 EDKII_CRYPTO_MD5_FINAL Md5Final
;
3527 EDKII_CRYPTO_MD5_HASH_ALL Md5HashAll
;
3529 EDKII_CRYPTO_PKCS1_ENCRYPT_V2 Pkcs1v2Encrypt
;
3530 EDKII_CRYPTO_PKCS5_PW_HASH Pkcs5HashPassword
;
3531 EDKII_CRYPTO_PKCS7_VERIFY Pkcs7Verify
;
3532 EDKII_CRYPTO_PKCS7_VERIFY_EKU VerifyEKUsInPkcs7Signature
;
3533 EDKII_CRYPTO_PKCS7_GET_SIGNERS Pkcs7GetSigners
;
3534 EDKII_CRYPTO_PKCS7_FREE_SIGNERS Pkcs7FreeSigners
;
3535 EDKII_CRYPTO_PKCS7_SIGN Pkcs7Sign
;
3536 EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT Pkcs7GetAttachedContent
;
3537 EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST Pkcs7GetCertificatesList
;
3538 EDKII_CRYPTO_AUTHENTICODE_VERIFY AuthenticodeVerify
;
3539 EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY ImageTimestampVerify
;
3541 EDKII_CRYPTO_DH_NEW DhNew
;
3542 EDKII_CRYPTO_DH_FREE DhFree
;
3543 EDKII_CRYPTO_DH_GENERATE_PARAMETER DhGenerateParameter
;
3544 EDKII_CRYPTO_DH_SET_PARAMETER DhSetParameter
;
3545 EDKII_CRYPTO_DH_GENERATE_KEY DhGenerateKey
;
3546 EDKII_CRYPTO_DH_COMPUTE_KEY DhComputeKey
;
3548 EDKII_CRYPTO_RANDOM_SEED RandomSeed
;
3549 EDKII_CRYPTO_RANDOM_BYTES RandomBytes
;
3551 EDKII_CRYPTO_RSA_VERIFY_PKCS1 RsaVerifyPkcs1
;
3552 EDKII_CRYPTO_RSA_NEW RsaNew
;
3553 EDKII_CRYPTO_RSA_FREE RsaFree
;
3554 EDKII_CRYPTO_RSA_SET_KEY RsaSetKey
;
3555 EDKII_CRYPTO_RSA_GET_KEY RsaGetKey
;
3556 EDKII_CRYPTO_RSA_GENERATE_KEY RsaGenerateKey
;
3557 EDKII_CRYPTO_RSA_CHECK_KEY RsaCheckKey
;
3558 EDKII_CRYPTO_RSA_PKCS1_SIGN RsaPkcs1Sign
;
3559 EDKII_CRYPTO_RSA_PKCS1_VERIFY RsaPkcs1Verify
;
3560 EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM RsaGetPrivateKeyFromPem
;
3561 EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509 RsaGetPublicKeyFromX509
;
3563 EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE Sha1GetContextSize
;
3564 EDKII_CRYPTO_SHA1_INIT Sha1Init
;
3565 EDKII_CRYPTO_SHA1_DUPLICATE Sha1Duplicate
;
3566 EDKII_CRYPTO_SHA1_UPDATE Sha1Update
;
3567 EDKII_CRYPTO_SHA1_FINAL Sha1Final
;
3568 EDKII_CRYPTO_SHA1_HASH_ALL Sha1HashAll
;
3570 EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE Sha256GetContextSize
;
3571 EDKII_CRYPTO_SHA256_INIT Sha256Init
;
3572 EDKII_CRYPTO_SHA256_DUPLICATE Sha256Duplicate
;
3573 EDKII_CRYPTO_SHA256_UPDATE Sha256Update
;
3574 EDKII_CRYPTO_SHA256_FINAL Sha256Final
;
3575 EDKII_CRYPTO_SHA256_HASH_ALL Sha256HashAll
;
3577 EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE Sha384GetContextSize
;
3578 EDKII_CRYPTO_SHA384_INIT Sha384Init
;
3579 EDKII_CRYPTO_SHA384_DUPLICATE Sha384Duplicate
;
3580 EDKII_CRYPTO_SHA384_UPDATE Sha384Update
;
3581 EDKII_CRYPTO_SHA384_FINAL Sha384Final
;
3582 EDKII_CRYPTO_SHA384_HASH_ALL Sha384HashAll
;
3584 EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE Sha512GetContextSize
;
3585 EDKII_CRYPTO_SHA512_INIT Sha512Init
;
3586 EDKII_CRYPTO_SHA512_DUPLICATE Sha512Duplicate
;
3587 EDKII_CRYPTO_SHA512_UPDATE Sha512Update
;
3588 EDKII_CRYPTO_SHA512_FINAL Sha512Final
;
3589 EDKII_CRYPTO_SHA512_HASH_ALL Sha512HashAll
;
3591 EDKII_CRYPTO_X509_GET_SUBJECT_NAME X509GetSubjectName
;
3592 EDKII_CRYPTO_X509_GET_COMMON_NAME X509GetCommonName
;
3593 EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME X509GetOrganizationName
;
3594 EDKII_CRYPTO_X509_VERIFY_CERT X509VerifyCert
;
3595 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE X509ConstructCertificate
;
3596 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK X509ConstructCertificateStack
;
3597 EDKII_CRYPTO_X509_FREE X509Free
;
3598 EDKII_CRYPTO_X509_STACK_FREE X509StackFree
;
3599 EDKII_CRYPTO_X509_GET_TBS_CERT X509GetTBSCert
;
3600 /// TDES - deprecated and unsupported
3601 DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE DeprecatedTdesGetContextSize
;
3602 DEPRECATED_EDKII_CRYPTO_TDES_INIT DeprecatedTdesInit
;
3603 DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT DeprecatedTdesEcbEncrypt
;
3604 DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT DeprecatedTdesEcbDecrypt
;
3605 DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT DeprecatedTdesCbcEncrypt
;
3606 DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT DeprecatedTdesCbcDecrypt
;
3607 /// AES - ECB Mode is deprecated and unsupported
3608 EDKII_CRYPTO_AES_GET_CONTEXT_SIZE AesGetContextSize
;
3609 EDKII_CRYPTO_AES_INIT AesInit
;
3610 DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT DeprecatedAesEcbEncrypt
;
3611 DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT DeprecatedAesEcbDecrypt
;
3612 EDKII_CRYPTO_AES_CBC_ENCRYPT AesCbcEncrypt
;
3613 EDKII_CRYPTO_AES_CBC_DECRYPT AesCbcDecrypt
;
3614 /// Arc4 - deprecated and unsupported
3615 DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE DeprecatedArc4GetContextSize
;
3616 DEPRECATED_EDKII_CRYPTO_ARC4_INIT DeprecatedArc4Init
;
3617 DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT DeprecatedArc4Encrypt
;
3618 DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT DeprecatedArc4Decrypt
;
3619 DEPRECATED_EDKII_CRYPTO_ARC4_RESET DeprecatedArc4Reset
;
3621 EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE Sm3GetContextSize
;
3622 EDKII_CRYPTO_SM3_INIT Sm3Init
;
3623 EDKII_CRYPTO_SM3_DUPLICATE Sm3Duplicate
;
3624 EDKII_CRYPTO_SM3_UPDATE Sm3Update
;
3625 EDKII_CRYPTO_SM3_FINAL Sm3Final
;
3626 EDKII_CRYPTO_SM3_HASH_ALL Sm3HashAll
;
3628 EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND HkdfSha256ExtractAndExpand
;
3629 /// X509 (Continued)
3630 EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V X509ConstructCertificateStackV
;
3632 EDKII_CRYPTO_TLS_INITIALIZE TlsInitialize
;
3633 EDKII_CRYPTO_TLS_CTX_FREE TlsCtxFree
;
3634 EDKII_CRYPTO_TLS_CTX_NEW TlsCtxNew
;
3635 EDKII_CRYPTO_TLS_FREE TlsFree
;
3636 EDKII_CRYPTO_TLS_NEW TlsNew
;
3637 EDKII_CRYPTO_TLS_IN_HANDSHAKE TlsInHandshake
;
3638 EDKII_CRYPTO_TLS_DO_HANDSHAKE TlsDoHandshake
;
3639 EDKII_CRYPTO_TLS_HANDLE_ALERT TlsHandleAlert
;
3640 EDKII_CRYPTO_TLS_CLOSE_NOTIFY TlsCloseNotify
;
3641 EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT TlsCtrlTrafficOut
;
3642 EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN TlsCtrlTrafficIn
;
3643 EDKII_CRYPTO_TLS_READ TlsRead
;
3644 EDKII_CRYPTO_TLS_WRITE TlsWrite
;
3646 EDKII_CRYPTO_TLS_SET_VERSION TlsSetVersion
;
3647 EDKII_CRYPTO_TLS_SET_CONNECTION_END TlsSetConnectionEnd
;
3648 EDKII_CRYPTO_TLS_SET_CIPHER_LIST TlsSetCipherList
;
3649 EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD TlsSetCompressionMethod
;
3650 EDKII_CRYPTO_TLS_SET_VERIFY TlsSetVerify
;
3651 EDKII_CRYPTO_TLS_SET_VERIFY_HOST TlsSetVerifyHost
;
3652 EDKII_CRYPTO_TLS_SET_SESSIONID TlsSetSessionId
;
3653 EDKII_CRYPTO_TLS_SET_CA_CERTIFICATE TlsSetCaCertificate
;
3654 EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT TlsSetHostPublicCert
;
3655 EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY TlsSetHostPrivateKey
;
3656 EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST TlsSetCertRevocationList
;
3658 EDKII_CRYPTO_TLS_GET_VERSION TlsGetVersion
;
3659 EDKII_CRYPTO_TLS_GET_CONNECTION_END TlsGetConnectionEnd
;
3660 EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER TlsGetCurrentCipher
;
3661 EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID TlsGetCurrentCompressionId
;
3662 EDKII_CRYPTO_TLS_GET_VERIFY TlsGetVerify
;
3663 EDKII_CRYPTO_TLS_GET_SESSION_ID TlsGetSessionId
;
3664 EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM TlsGetClientRandom
;
3665 EDKII_CRYPTO_TLS_GET_SERVER_RANDOM TlsGetServerRandom
;
3666 EDKII_CRYPTO_TLS_GET_KEY_MATERIAL TlsGetKeyMaterial
;
3667 EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE TlsGetCaCertificate
;
3668 EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT TlsGetHostPublicCert
;
3669 EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY TlsGetHostPrivateKey
;
3670 EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST TlsGetCertRevocationList
;
3672 EDKII_CRYPTO_RSA_PSS_SIGN RsaPssSign
;
3673 EDKII_CRYPTO_RSA_PSS_VERIFY RsaPssVerify
;
3676 extern GUID gEdkiiCryptoProtocolGuid
;