]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add more error handling code to DxeImageVerificationLib and BaseCryptLib.
authorsfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 19 Mar 2012 05:10:46 +0000 (05:10 +0000)
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 19 Mar 2012 05:10:46 +0000 (05:10 +0000)
Signed-off-by: sfu5
Reviewed-by: qianouyang
Reviewed-by: gdong1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13109 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h

index 91977522a9138cd9c751f543d22c0def0a553ce1..19852dd483241b32f622327f3f5c57a2b4dc4644 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implement image verification services for secure boot service in UEFI2.3.1.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -486,7 +486,15 @@ HashPeImageByType (
     //            .... }\r
     //    The DigestAlgorithmIdentifiers can be used to determine the hash algorithm in PE/COFF hashing\r
     //    This field has the fixed offset (+32) in final Authenticode ASN.1 data.\r
+    //    Fixed offset (+32) is calculated based on two bytes of length encoding.\r
     //\r
+    if ((*(PkcsCertData->CertData + 1) & TWO_BYTE_ENCODE) != TWO_BYTE_ENCODE) {\r
+      //\r
+      // Only support two bytes of Long Form of Length Encoding.\r
+      //\r
+      continue;\r
+    }\r
+\r
     if (CompareMem (PkcsCertData->CertData + 32, mHash[Index].OidValue, mHash[Index].OidLength) == 0) {\r
       break;\r
     }\r
index 2cd1f87468d3951fac2d2d449eb2d567744e3207..881e4e5c35861b2100869dbc8da05d7a279fab5a 100644 (file)
@@ -2,7 +2,7 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by ImageVerificationLib.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
@@ -40,6 +40,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define EFI_CERT_TYPE_RSA2048_SHA256_SIZE 256\r
 #define EFI_CERT_TYPE_RSA2048_SIZE        256\r
 #define MAX_NOTIFY_STRING_LEN             64\r
+#define TWO_BYTE_ENCODE                   0x82\r
 \r
 //\r
 // Image type definitions\r