]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/FmpAuthLib: Add PublicKeyDataLength check
authorJiewen Yao <jiewen.yao@intel.com>
Thu, 22 Dec 2016 04:36:39 +0000 (12:36 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Fri, 23 Dec 2016 02:01:36 +0000 (10:01 +0800)
Add PublicKeyDataLength check to be multiple SHA256_DIGEST_SIZE
to avoid caller make mistake, or platform mis-configuration.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Qin Long <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
SecurityPkg/Library/FmpAuthenticationLibRsa2048Sha256/FmpAuthenticationLibRsa2048Sha256.c

index d113d58103c13c1d9b7c81e032096b712dd54e63..4b2556cc905a47a24284a9def7b58a1ea5b954d3 100644 (file)
@@ -306,6 +306,11 @@ AuthenticateFmpImage (
     return RETURN_UNSUPPORTED;\r
   }\r
 \r
+  if ((PublicKeyDataLength % SHA256_DIGEST_SIZE) != 0) {\r
+    DEBUG ((DEBUG_ERROR, "PublicKeyDataLength is not multiple SHA256 size\n"));\r
+    return RETURN_UNSUPPORTED;\r
+  }\r
+\r
   if (ImageSize < sizeof(EFI_FIRMWARE_IMAGE_AUTHENTICATION)) {\r
     DEBUG((DEBUG_ERROR, "AuthenticateFmpImage - ImageSize too small\n"));\r
     return RETURN_INVALID_PARAMETER;\r