]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c
CryptoPkg: Support for SHA384 & SHA512 RSA signing schemes
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptRsaExt.c
index e3dd4844c4449c430aaf7c56818831a3dd0fb88c..7cd5fecf04cb139bde01c85abb43eae2ef323540 100644 (file)
@@ -7,7 +7,7 @@
   3) RsaCheckKey\r
   4) RsaPkcs1Sign\r
 \r
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -276,7 +276,7 @@ RsaCheckKey (
 \r
   If RsaContext is NULL, then return FALSE.\r
   If MessageHash is NULL, then return FALSE.\r
-  If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.\r
+  If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-384 or SHA-512 digest, then return FALSE.\r
   If SigSize is large enough but Signature is NULL, then return FALSE.\r
 \r
   @param[in]       RsaContext   Pointer to RSA context for signature generation.\r
@@ -326,7 +326,7 @@ RsaPkcs1Sign (
 \r
   //\r
   // Determine the message digest algorithm according to digest size.\r
-  //   Only MD5, SHA-1 or SHA-256 algorithm is supported.\r
+  //   Only MD5, SHA-1, SHA-256, SHA-384 or SHA-512 algorithm is supported.\r
   //\r
   switch (HashSize) {\r
   case MD5_DIGEST_SIZE:\r
@@ -341,6 +341,14 @@ RsaPkcs1Sign (
     DigestType = NID_sha256;\r
     break;\r
 \r
+  case SHA384_DIGEST_SIZE:\r
+    DigestType = NID_sha384;\r
+    break;\r
+\r
+  case SHA512_DIGEST_SIZE:\r
+    DigestType = NID_sha512;\r
+    break;\r
+\r
   default:\r
     return FALSE;\r
   }\r