from BaseCryptLib and TlsLib.\r
\r
Copyright (C) Microsoft Corporation. All rights reserved.\r
- Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
return CALL_BASECRYPTLIB (TlsGet.Services.CertRevocationList, TlsGetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED);\r
}\r
\r
+/**\r
+ Carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme.\r
+\r
+ This function carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme defined in\r
+ RFC 8017.\r
+ Mask generation function is the same as the message digest algorithm.\r
+ If the Signature buffer is too small to hold the contents of signature, FALSE\r
+ is returned and SigSize is set to the required buffer size to obtain the signature.\r
+\r
+ If RsaContext is NULL, then return FALSE.\r
+ If Message is NULL, then return FALSE.\r
+ If MsgSize is zero or > INT_MAX, then return FALSE.\r
+ If DigestLen is NOT 32, 48 or 64, return FALSE.\r
+ If SaltLen is not equal to DigestLen, then return FALSE.\r
+ If SigSize is large enough but Signature is NULL, then return FALSE.\r
+ If this interface is not supported, then return FALSE.\r
+\r
+ @param[in] RsaContext Pointer to RSA context for signature generation.\r
+ @param[in] Message Pointer to octet message to be signed.\r
+ @param[in] MsgSize Size of the message in bytes.\r
+ @param[in] DigestLen Length of the digest in bytes to be used for RSA signature operation.\r
+ @param[in] SaltLen Length of the salt in bytes to be used for PSS encoding.\r
+ @param[out] Signature Pointer to buffer to receive RSA PSS signature.\r
+ @param[in, out] SigSize On input, the size of Signature buffer in bytes.\r
+ On output, the size of data returned in Signature buffer in bytes.\r
+\r
+ @retval TRUE Signature successfully generated in RSASSA-PSS.\r
+ @retval FALSE Signature generation failed.\r
+ @retval FALSE SigSize is too small.\r
+ @retval FALSE This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CryptoServiceRsaPssSign (\r
+ IN VOID *RsaContext,\r
+ IN CONST UINT8 *Message,\r
+ IN UINTN MsgSize,\r
+ IN UINT16 DigestLen,\r
+ IN UINT16 SaltLen,\r
+ OUT UINT8 *Signature,\r
+ IN OUT UINTN *SigSize\r
+ )\r
+{\r
+ return CALL_BASECRYPTLIB (RsaPss.Services.Sign, RsaPssSign, (RsaContext, Message, MsgSize, DigestLen, SaltLen, Signature, SigSize), FALSE);\r
+}\r
+\r
+/**\r
+ Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017.\r
+ Implementation determines salt length automatically from the signature encoding.\r
+ Mask generation function is the same as the message digest algorithm.\r
+ Salt length should be equal to digest length.\r
+\r
+ @param[in] RsaContext Pointer to RSA context for signature verification.\r
+ @param[in] Message Pointer to octet message to be verified.\r
+ @param[in] MsgSize Size of the message in bytes.\r
+ @param[in] Signature Pointer to RSASSA-PSS signature to be verified.\r
+ @param[in] SigSize Size of signature in bytes.\r
+ @param[in] DigestLen Length of digest for RSA operation.\r
+ @param[in] SaltLen Salt length for PSS encoding.\r
+\r
+ @retval TRUE Valid signature encoded in RSASSA-PSS.\r
+ @retval FALSE Invalid signature or invalid RSA context.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CryptoServiceRsaPssVerify (\r
+ IN VOID *RsaContext,\r
+ IN CONST UINT8 *Message,\r
+ IN UINTN MsgSize,\r
+ IN CONST UINT8 *Signature,\r
+ IN UINTN SigSize,\r
+ IN UINT16 DigestLen,\r
+ IN UINT16 SaltLen\r
+ )\r
+{\r
+ return CALL_BASECRYPTLIB (RsaPss.Services.Verify, RsaPssVerify, (RsaContext, Message, MsgSize, Signature, SigSize, DigestLen, SaltLen), FALSE);\r
+}\r
+\r
+/**\r
+ Parallel hash function ParallelHash256, as defined in NIST's Special Publication 800-185,\r
+ published December 2016.\r
+\r
+ @param[in] Input Pointer to the input message (X).\r
+ @param[in] InputByteLen The number(>0) of input bytes provided for the input data.\r
+ @param[in] BlockSize The size of each block (B).\r
+ @param[out] Output Pointer to the output buffer.\r
+ @param[in] OutputByteLen The desired number of output bytes (L).\r
+ @param[in] Customization Pointer to the customization string (S).\r
+ @param[in] CustomByteLen The length of the customization string in bytes.\r
+\r
+ @retval TRUE ParallelHash256 digest computation succeeded.\r
+ @retval FALSE ParallelHash256 digest computation failed.\r
+ @retval FALSE This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CryptoServiceParallelHash256HashAll (\r
+ IN CONST VOID *Input,\r
+ IN UINTN InputByteLen,\r
+ IN UINTN BlockSize,\r
+ OUT VOID *Output,\r
+ IN UINTN OutputByteLen,\r
+ IN CONST VOID *Customization,\r
+ IN UINTN CustomByteLen\r
+ )\r
+{\r
+ return CALL_BASECRYPTLIB (ParallelHash.Services.HashAll, ParallelHash256HashAll, (Input, InputByteLen, BlockSize, Output, OutputByteLen, Customization, CustomByteLen), FALSE);\r
+}\r
+\r
const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {\r
/// Version\r
CryptoServiceGetCryptoVersion,\r
CryptoServiceTlsGetCaCertificate,\r
CryptoServiceTlsGetHostPublicCert,\r
CryptoServiceTlsGetHostPrivateKey,\r
- CryptoServiceTlsGetCertRevocationList\r
+ CryptoServiceTlsGetCertRevocationList,\r
+ /// RSA PSS\r
+ CryptoServiceRsaPssSign,\r
+ CryptoServiceRsaPssVerify,\r
+ /// Parallel hash\r
+ CryptoServiceParallelHash256HashAll\r
};\r