]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecuritPkg: DxeImageVerificationLib: Fix wrong verification logic in DBX & DBT
authorZhang, Chao B <chao.b.zhang@intel.com>
Wed, 13 Apr 2016 08:25:50 +0000 (16:25 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Fri, 29 Apr 2016 02:48:07 +0000 (10:48 +0800)
In image verification, if image verified pass in DBT, still need to verify if it is blocked by any other cert/cert hash from DBX.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Dick Wilkins <dick_wilkins@phoenix.com>
SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c

index 4b4d3bf77de53eefdbe0e9221e95434fd1d003aa..8cedb1bfb0a3e04ac3944ec4d837a4c9d1abfcc5 100644 (file)
@@ -12,7 +12,7 @@
   DxeImageVerificationHandler(), HashPeImageByType(), HashPeImage() function will accept\r
   untrusted PE/COFF image and validate its data structure within this image buffer before use.\r
 \r
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2016, 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
@@ -1457,6 +1457,10 @@ IsForbiddenByDbx (
   for (Index = 0; Index < CertNumber; Index++) {\r
     CertSize = (UINTN) ReadUnaligned32 ((UINT32 *)CertPtr);\r
     Cert     = (UINT8 *)CertPtr + sizeof (UINT32);\r
+    //\r
+    // Advance CertPtr to the next cert in image signer's cert list\r
+    //\r
+    CertPtr = CertPtr + sizeof (UINT32) + CertSize;\r
 \r
     if (IsCertHashFoundInDatabase (Cert, CertSize, (EFI_SIGNATURE_LIST *)Data, DataSize, &RevocationTime)) {\r
       //\r
@@ -1465,11 +1469,14 @@ IsForbiddenByDbx (
       IsForbidden = TRUE;\r
       if (PassTimestampCheck (AuthData, AuthDataSize, &RevocationTime)) {\r
         IsForbidden = FALSE;\r
+        //\r
+        // Pass DBT check. Continue to check other certs in image signer's cert list against DBX, DBT\r
+        //\r
+        continue;\r
       }\r
       goto Done;\r
     }\r
 \r
-    CertPtr = CertPtr + sizeof (UINT32) + CertSize;\r
   }\r
 \r
 Done:\r