Revision: 16380
          http://sourceforge.net/p/edk2/code/16380
Author:   qlong
Date:     2014-11-14 08:41:12 +0000 (Fri, 14 Nov 2014)
Log Message:
-----------
UEFI 2.4 X509 Certificate Hash and RFC3161 Timestamp Verification support for 
Secure Boot

Main ChangeLogs includes:
1. Introduce the new GUID and structure definitions for certificate hash and 
timestamp support;
2. Update Image Verification Library to support DBT signature checking;
3. Update the related SecureBoot Configuration Pages;

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Qin Long <[email protected]> 
Reviewed-by: Guo Dong <[email protected]>
Reviewed-by: Siyuan Fu <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdePkg/Include/Guid/ImageAuthentication.h
    trunk/edk2/MdePkg/MdePkg.dec
    
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
    
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
    
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
    trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
    trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
    
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
    
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
    
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
    
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
    
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
    
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h
    
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni

Modified: trunk/edk2/MdePkg/Include/Guid/ImageAuthentication.h
===================================================================
--- trunk/edk2/MdePkg/Include/Guid/ImageAuthentication.h        2014-11-14 
00:39:04 UTC (rev 16379)
+++ trunk/edk2/MdePkg/Include/Guid/ImageAuthentication.h        2014-11-14 
08:41:12 UTC (rev 16380)
@@ -1,23 +1,24 @@
 /** @file
   Image signature database are defined for the signed image validation.
 
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
-  This program and the accompanying materials                          
-  are licensed and made available under the terms and conditions of the BSD 
License         
-  which accompanies this distribution.  The full text of the license may be 
found at        
-  http://opensource.org/licenses/bsd-license.php                               
             
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
 
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,        
             
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.             
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
   @par Revision Reference:
-  GUIDs defined in UEFI 2.3.1 spec.
+  GUIDs defined in UEFI 2.4 spec.
 **/
 
 #ifndef __IMAGE_AUTHTICATION_H__
 #define __IMAGE_AUTHTICATION_H__
 
 #include <Guid/GlobalVariable.h>
+#include <Protocol/Hash.h>
 
 #define EFI_IMAGE_SECURITY_DATABASE_GUID \
   { \
@@ -25,15 +26,20 @@
   }
 
 ///
-/// Varialbe name with guid EFI_IMAGE_SECURITY_DATABASE_GUID 
+/// Varialbe name with guid EFI_IMAGE_SECURITY_DATABASE_GUID
 /// for the authorized signature database.
 ///
 #define EFI_IMAGE_SECURITY_DATABASE       L"db"
 ///
-/// Varialbe name with guid EFI_IMAGE_SECURITY_DATABASE_GUID 
+/// Varialbe name with guid EFI_IMAGE_SECURITY_DATABASE_GUID
 /// for the forbidden signature database.
 ///
 #define EFI_IMAGE_SECURITY_DATABASE1      L"dbx"
+///
+/// Variable name with guid EFI_IMAGE_SECURITY_DATABASE_GUID
+/// for the timestamp signature database.
+///
+#define EFI_IMAGE_SECURITY_DATABASE2      L"dbt"
 
 #define SECURE_BOOT_MODE_ENABLE           1
 #define SECURE_BOOT_MODE_DISABLE          0
@@ -45,7 +51,7 @@
 // Signature Database
 //***********************************************************************
 ///
-/// The format of a signature database. 
+/// The format of a signature database.
 ///
 #pragma pack(1)
 
@@ -76,17 +82,50 @@
   ///
   /// Size of each signature.
   ///
-  UINT32              SignatureSize; 
+  UINT32              SignatureSize;
   ///
-  /// Header before the array of signatures. The format of this header is 
specified 
+  /// Header before the array of signatures. The format of this header is 
specified
   /// by the SignatureType.
   /// UINT8           SignatureHeader[SignatureHeaderSize];
   ///
-  /// An array of signatures. Each signature is SignatureSize bytes in length. 
+  /// An array of signatures. Each signature is SignatureSize bytes in length.
   /// EFI_SIGNATURE_DATA Signatures[][SignatureSize];
   ///
 } EFI_SIGNATURE_LIST;
 
+typedef struct {
+  ///
+  /// The SHA256 hash of an X.509 certificate's To-Be-Signed contents.
+  ///
+  EFI_SHA256_HASH     ToBeSignedHash;
+  ///
+  /// The time that the certificate shall be considered to be revoked.
+  ///
+  EFI_TIME            TimeOfRevocation;
+} EFI_CERT_X509_SHA256;
+
+typedef struct {
+  ///
+  /// The SHA384 hash of an X.509 certificate's To-Be-Signed contents.
+  ///
+  EFI_SHA384_HASH     ToBeSignedHash;
+  ///
+  /// The time that the certificate shall be considered to be revoked.
+  ///
+  EFI_TIME            TimeOfRevocation;
+} EFI_CERT_X509_SHA384;
+
+typedef struct {
+  ///
+  /// The SHA512 hash of an X.509 certificate's To-Be-Signed contents.
+  ///
+  EFI_SHA512_HASH     ToBeSignedHash;
+  ///
+  /// The time that the certificate shall be considered to be revoked.
+  ///
+  EFI_TIME            TimeOfRevocation;
+} EFI_CERT_X509_SHA512;
+
 #pragma pack()
 
 ///
@@ -103,7 +142,7 @@
 /// This identifies a signature containing an RSA-2048 key. The key (only the 
modulus
 /// since the public key exponent is known to be 0x10001) shall be stored in 
big-endian
 /// order.
-/// The SignatureHeader size shall always be 0. The SignatureSize shall always 
be 16 (size 
+/// The SignatureHeader size shall always be 0. The SignatureSize shall always 
be 16 (size
 /// of SignatureOwner component) + 256 bytes.
 ///
 #define EFI_CERT_RSA2048_GUID \
@@ -112,8 +151,8 @@
   }
 
 ///
-/// This identifies a signature containing a RSA-2048 signature of a SHA-256 
hash.  The 
-/// SignatureHeader size shall always be 0. The SignatureSize shall always be 
16 (size of 
+/// This identifies a signature containing a RSA-2048 signature of a SHA-256 
hash.  The
+/// SignatureHeader size shall always be 0. The SignatureSize shall always be 
16 (size of
 /// SignatureOwner component) + 256 bytes.
 ///
 #define EFI_CERT_RSA2048_SHA256_GUID \
@@ -131,8 +170,8 @@
   }
 
 ///
-/// TThis identifies a signature containing a RSA-2048 signature of a SHA-1 
hash.  The 
-/// SignatureHeader size shall always be 0. The SignatureSize shall always be 
16 (size of 
+/// TThis identifies a signature containing a RSA-2048 signature of a SHA-1 
hash.  The
+/// SignatureHeader size shall always be 0. The SignatureSize shall always be 
16 (size of
 /// SignatureOwner component) + 256 bytes.
 ///
 #define EFI_CERT_RSA2048_SHA1_GUID \
@@ -142,11 +181,11 @@
 
 ///
 /// This identifies a signature based on an X.509 certificate. If the 
signature is an X.509
-/// certificate then verification of the signature of an image should validate 
the public 
-/// key certificate in the image using certificate path verification, up to 
this X.509 
+/// certificate then verification of the signature of an image should validate 
the public
+/// key certificate in the image using certificate path verification, up to 
this X.509
 /// certificate as a trusted root.  The SignatureHeader size shall always be 
0. The
-/// SignatureSize may vary but shall always be 16 (size of the SignatureOwner 
component) + 
-/// the size of the certificate itself. 
+/// SignatureSize may vary but shall always be 16 (size of the SignatureOwner 
component) +
+/// the size of the certificate itself.
 /// Note: This means that each certificate will normally be in a separate 
EFI_SIGNATURE_LIST.
 ///
 #define EFI_CERT_X509_GUID \
@@ -172,7 +211,7 @@
 #define EFI_CERT_SHA384_GUID \
   { \
     0xff3e5307, 0x9fd0, 0x48c9, {0x85, 0xf1, 0x8a, 0xd5, 0x6c, 0x70, 0x1e, 
0x1} \
-  }  
+  }
 
 ///
 /// This identifies a signature containing a SHA-512 hash. The SignatureHeader 
size shall
@@ -185,6 +224,45 @@
   }
 
 ///
+/// This identifies a signature containing the SHA256 hash of an X.509 
certificate's
+/// To-Be-Signed contents, and a time of revocation. The SignatureHeader size 
shall
+/// always be 0. The SignatureSize shall always be 16 (size of the 
SignatureOwner component)
+/// + 48 bytes for an EFI_CERT_X509_SHA256 structure. If the TimeOfRevocation 
is non-zero,
+/// the certificate should be considered to be revoked from that time and 
onwards, and
+/// otherwise the certificate shall be considered to always be revoked.
+///
+#define EFI_CERT_X509_SHA256_GUID \
+  { \
+    0x3bd2a492, 0x96c0, 0x4079, {0xb4, 0x20, 0xfc, 0xf9, 0x8e, 0xf1, 0x03, 
0xed } \
+  }
+
+///
+/// This identifies a signature containing the SHA384 hash of an X.509 
certificate's
+/// To-Be-Signed contents, and a time of revocation. The SignatureHeader size 
shall
+/// always be 0. The SignatureSize shall always be 16 (size of the 
SignatureOwner component)
+/// + 64 bytes for an EFI_CERT_X509_SHA384 structure. If the TimeOfRevocation 
is non-zero,
+/// the certificate should be considered to be revoked from that time and 
onwards, and
+/// otherwise the certificate shall be considered to always be revoked.
+///
+#define EFI_CERT_X509_SHA384_GUID \
+  { \
+    0x7076876e, 0x80c2, 0x4ee6, {0xaa, 0xd2, 0x28, 0xb3, 0x49, 0xa6, 0x86, 
0x5b } \
+  }
+
+///
+/// This identifies a signature containing the SHA512 hash of an X.509 
certificate's
+/// To-Be-Signed contents, and a time of revocation. The SignatureHeader size 
shall
+/// always be 0. The SignatureSize shall always be 16 (size of the 
SignatureOwner component)
+/// + 80 bytes for an EFI_CERT_X509_SHA512 structure. If the TimeOfRevocation 
is non-zero,
+/// the certificate should be considered to be revoked from that time and 
onwards, and
+/// otherwise the certificate shall be considered to always be revoked.
+///
+#define EFI_CERT_X509_SHA512_GUID \
+  { \
+    0x446dbf63, 0x2502, 0x4cda, {0xbc, 0xfa, 0x24, 0x65, 0xd2, 0xb0, 0xfe, 
0x9d } \
+  }
+
+///
 /// This identifies a signature containing a DER-encoded PKCS #7 version 1.5 
[RFC2315]
 /// SignedData value.
 ///
@@ -192,13 +270,13 @@
   { \
     0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 
0xa7} \
   }
-  
+
 //***********************************************************************
 // Image Execution Information Table Definition
 //***********************************************************************
 typedef UINT32 EFI_IMAGE_EXECUTION_ACTION;
 
-#define EFI_IMAGE_EXECUTION_AUTHENTICATION      0x00000007 
+#define EFI_IMAGE_EXECUTION_AUTHENTICATION      0x00000007
 #define EFI_IMAGE_EXECUTION_AUTH_UNTESTED       0x00000000
 #define EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED     0x00000001
 #define EFI_IMAGE_EXECUTION_AUTH_SIG_PASSED     0x00000002
@@ -208,7 +286,7 @@
 #define EFI_IMAGE_EXECUTION_INITIALIZED         0x00000008
 
 //
-// EFI_IMAGE_EXECUTION_INFO is added to EFI System Configuration Table 
+// EFI_IMAGE_EXECUTION_INFO is added to EFI System Configuration Table
 // and assigned the GUID EFI_IMAGE_SECURITY_DATABASE_GUID.
 //
 typedef struct {
@@ -221,24 +299,24 @@
   ///
   UINT32                        InfoSize;
   ///
-  /// If this image was a UEFI device driver (for option ROM, for example) 
this is the 
-  /// null-terminated, user-friendly name for the device. If the image was for 
an application, 
-  /// then this is the name of the application. If this cannot be determined, 
then a simple 
+  /// If this image was a UEFI device driver (for option ROM, for example) 
this is the
+  /// null-terminated, user-friendly name for the device. If the image was for 
an application,
+  /// then this is the name of the application. If this cannot be determined, 
then a simple
   /// NULL character should be put in this position.
   /// CHAR16                    Name[];
   ///
 
   ///
-  /// For device drivers, this is the device path of the device for which this 
device driver 
-  /// was intended. In some cases, the driver itself may be stored as part of 
the system 
-  /// firmware, but this field should record the device's path, not the 
firmware path. For 
-  /// applications, this is the device path of the application. If this cannot 
be determined, 
+  /// For device drivers, this is the device path of the device for which this 
device driver
+  /// was intended. In some cases, the driver itself may be stored as part of 
the system
+  /// firmware, but this field should record the device's path, not the 
firmware path. For
+  /// applications, this is the device path of the application. If this cannot 
be determined,
   /// a simple end-of-path device node should be put in this position.
   /// EFI_DEVICE_PATH_PROTOCOL  DevicePath;
   ///
 
   ///
-  /// Zero or more image signatures. If the image contained no signatures, 
+  /// Zero or more image signatures. If the image contained no signatures,
   /// then this field is empty.
   ///
   EFI_SIGNATURE_LIST            Signature;
@@ -249,16 +327,16 @@
   ///
   /// Number of EFI_IMAGE_EXECUTION_INFO structures.
   ///
-  UINTN                     NumberOfImages; 
+  UINTN                     NumberOfImages;
   ///
   /// Number of image instances of EFI_IMAGE_EXECUTION_INFO structures.
   ///
-  // EFI_IMAGE_EXECUTION_INFO  InformationInfo[] 
+  // EFI_IMAGE_EXECUTION_INFO  InformationInfo[]
 } EFI_IMAGE_EXECUTION_INFO_TABLE;
 
 extern EFI_GUID gEfiImageSecurityDatabaseGuid;
 extern EFI_GUID gEfiCertSha256Guid;
-extern EFI_GUID gEfiCertRsa2048Guid;      
+extern EFI_GUID gEfiCertRsa2048Guid;
 extern EFI_GUID gEfiCertRsa2048Sha256Guid;
 extern EFI_GUID gEfiCertSha1Guid;
 extern EFI_GUID gEfiCertRsa2048Sha1Guid;
@@ -266,6 +344,9 @@
 extern EFI_GUID gEfiCertSha224Guid;
 extern EFI_GUID gEfiCertSha384Guid;
 extern EFI_GUID gEfiCertSha512Guid;
+extern EFI_GUID gEfiCertX509Sha256Guid;
+extern EFI_GUID gEfiCertX509Sha384Guid;
+extern EFI_GUID gEfiCertX509Sha512Guid;
 extern EFI_GUID gEfiCertPkcs7Guid;
 
-#endif
+#endif
\ No newline at end of file

Modified: trunk/edk2/MdePkg/MdePkg.dec
===================================================================
--- trunk/edk2/MdePkg/MdePkg.dec        2014-11-14 00:39:04 UTC (rev 16379)
+++ trunk/edk2/MdePkg/MdePkg.dec        2014-11-14 08:41:12 UTC (rev 16380)
@@ -201,7 +201,7 @@
   #                  Script Opcodes.  These OpCode will be restored by S3
   #                  related modules.
   S3BootScriptLib|Include/Library/S3BootScriptLib.h
-  
+
   ##  @libraryclass  I/O and MMIO Library Services that do I/O and also enable
   #                  the I/O operatation to be replayed during an S3 resume.
   #                  This library class maps directly on top of the IoLib 
class.
@@ -222,7 +222,7 @@
   #                  operatation to be replayed during an S3 resume. This
   #                  library class maps directly on top of the Timer class.
   S3StallLib|Include/Library/S3StallLib.h
-  
+
   ##  @libraryclass  Defines library APIs used by modules to get/set print 
error level.
   DebugPrintErrorLevelLib|Include/Library/DebugPrintErrorLevelLib.h
 
@@ -238,7 +238,7 @@
   ##  @libraryclass  Provides services to enable/disable periodic SMI handlers.
   #
   SmmPeriodicSmiLib|Include/Library/SmmPeriodicSmiLib.h
-  
+
 [LibraryClasses.IPF]
   ##  @libraryclass  The SAL Library provides a service to make a SAL CALL.
   SalLib|Include/Library/SalLib.h
@@ -248,7 +248,7 @@
 
   ##  @libraryclass  Provides library services to make Extended SAL Calls.
   ExtendedSalLib|Include/Library/ExtendedSalLib.h
-  
+
 [Guids]
   #
   # GUID defined in UEFI2.1/UEFI2.0/EFI1.1
@@ -523,6 +523,11 @@
   ## Include/Guid/FmpCapsule.h
   gEfiFmpCapsuleGuid             =  { 0x6dcbd5ed, 0xe82d, 0x4c44, {0xbd, 0xa1, 
0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a }}
 
+  ## Include/Guid/ImageAuthentication.h
+  gEfiCertX509Sha256Guid         = { 0x3bd2a492, 0x96c0, 0x4079, {0xb4, 0x20, 
0xfc, 0xf9, 0x8e, 0xf1, 0x03, 0xed }}
+  gEfiCertX509Sha384Guid         = { 0x7076876e, 0x80c2, 0x4ee6, {0xaa, 0xd2, 
0x28, 0xb3, 0x49, 0xa6, 0x86, 0x5b }}
+  gEfiCertX509Sha512Guid         = { 0x446dbf63, 0x2502, 0x4cda, {0xbc, 0xfa, 
0x24, 0x65, 0xd2, 0xb0, 0xfe, 0x9d }}
+
   ## Include/Protocol/Rng.h
   gEfiRngAlgorithmSp80090Hash256Guid = { 0xa7af67cb, 0x603b, 0x4d42, {0xba, 
0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 }}
   gEfiRngAlgorithmSp80090Hmac256Guid = { 0xc5149b43, 0xae85, 0x4f53, {0x99, 
0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 }}
@@ -535,7 +540,7 @@
   gEfiAdapterInfoMediaStateGuid       = { 0xD7C74207, 0xA831, 0x4A26, {0xB1, 
0xF5, 0xD1, 0x93, 0x06, 0x5C, 0xE8, 0xB6 }}
   gEfiAdapterInfoNetworkBootGuid      = { 0x1FBD2960, 0x4130, 0x41E5, {0x94, 
0xAC, 0xD2, 0xCF, 0x03, 0x7F, 0xB3, 0x7C }}
   gEfiAdapterInfoSanMacAddressGuid    = { 0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 
0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 }}
-       
+
   #
   # GUID defined in PI1.0
   #
@@ -611,7 +616,7 @@
   #
   ## Include/Guid/EventGroup.h
   gEfiEndOfDxeEventGroupGuid        = { 0x2ce967a, 0xdd7e, 0x4ffc, { 0x9e, 
0xe7, 0x81, 0xc, 0xf0, 0x47, 0x8, 0x80 }}
-  
+
   ## Include/Guid/FirmwareContentsSigned.h
   gEfiFirmwareContentsSignedGuid    = { 0xf9d89e8, 0x9259, 0x4f76, { 0xa5, 
0xaf, 0xc, 0x89, 0xe3, 0x40, 0x23, 0xdf }}
 
@@ -629,7 +634,7 @@
   gEfiIa32X64ErrorTypeBusCheckGuid   = { 0x1CF3F8B3, 0xC5B1, 0x49a2, { 0xAA, 
0x59, 0x5E, 0xEF, 0x92, 0xFF, 0xA6, 0x3C }}
 
   ## Include/Guid/Cper.h
-  gEfiIa32X64ErrorTypeMsCheckGuid    = { 0x48AB7F57, 0xDC34, 0x4f6c, { 0xA7, 
0xD3, 0xB0, 0xB5, 0xB0, 0xA7, 0x43, 0x14 }} 
+  gEfiIa32X64ErrorTypeMsCheckGuid    = { 0x48AB7F57, 0xDC34, 0x4f6c, { 0xA7, 
0xD3, 0xB0, 0xB5, 0xB0, 0xA7, 0x43, 0x14 }}
 
 [Ppis]
   ## Include/Ppi/MasterBootMode.h
@@ -733,7 +738,7 @@
   #
   # PPIs defined in PI 1.3.
   #
-  
+
   ## Include/Ppi/I2cMaster.h
   gEfiPeiI2cMasterPpiGuid            = { 0xb3bfab9b, 0x9f9c, 0x4e8b, { 0xad, 
0x37, 0x7f, 0x8c, 0x51, 0xfc, 0x62, 0x80 }}
 
@@ -924,16 +929,16 @@
 
   ## Include/Protocol/PiPcd.h
   gEfiPcdProtocolGuid = { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 
0xc5, 0x12, 0x34, 0x2f, 0x34 } }
-  
+
   ## Include/Protocol/FirmwareVolumeBlock.h
   gEfiFirmwareVolumeBlock2ProtocolGuid = { 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 
0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } }
 
   ## Include/Protocol/CpuIo2.h
   gEfiCpuIo2ProtocolGuid = {0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 
0x69, 0xd2, 0x88, 0xc6, 0x4f } }
-  
+
   ## Include/Protocol/LegacyRegion2.h
   gEfiLegacyRegion2ProtocolGuid = {0x70101eaf, 0x85, 0x440c, {0xb3, 0x56, 
0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 } }
-  
+
   ## Include/Protocol/McaInitPmi.h
   gEfiSalMcaInitPmiProtocolGuid = { 0xb60dc6e8, 0x3b6f, 0x11d5, {0xaf, 0x9, 
0x0, 0xa0, 0xc9, 0x44, 0xa0, 0x5b } }
 
@@ -1331,7 +1336,7 @@
 
   ## Include/Protocol/IpSec.h
   gEfiIpSecProtocolGuid                = { 0xdfb386f7, 0xe100, 0x43ad, {0x9c, 
0x9a, 0xed, 0x90, 0xd0, 0x8a, 0x5e, 0x12 }}
-  
+
   ## Include/Protocol/IpSec.h
   gEfiIpSec2ProtocolGuid               = { 0xa3979e64, 0xace8, 0x4ddc, {0xbc, 
0x7, 0x4d, 0x66, 0xb8, 0xfd, 0x9, 0x77 }}
 
@@ -1361,7 +1366,7 @@
 
   ## Include/Protocol/Rng.h
   gEfiRngProtocolGuid                  = { 0x3152bca5, 0xeade, 0x433d, {0x86, 
0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 }}
-  
+
   ## Include/Protocol/AdapterInformation.h
   gEfiAdapterInformationProtocolGuid    = { 0xE5DD1403, 0xD622, 0xC24E, {0x84, 
0x88, 0xC7, 0x1B, 0x17, 0xF5, 0xE8, 0x02 }}
 
@@ -1780,4 +1785,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|0|UINT8|0x00000024
 
 [UserExtensions.TianoCore."ExtraFiles"]
-  MdePkgExtra.uni
+  MdePkgExtra.uni
\ No newline at end of file

Modified: 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
===================================================================
--- 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
    2014-11-14 00:39:04 UTC (rev 16379)
+++ 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
    2014-11-14 08:41:12 UTC (rev 16380)
@@ -64,11 +64,11 @@
   };
 
 HASH_TABLE mHash[] = {
-  { L"SHA1",   20, &mHashOidValue[0],  5, Sha1GetContextSize,  Sha1Init,   
Sha1Update,    Sha1Final  },
-  { L"SHA224", 28, &mHashOidValue[5],  9, NULL,                NULL,       
NULL,          NULL       },
-  { L"SHA256", 32, &mHashOidValue[14], 9, Sha256GetContextSize,Sha256Init, 
Sha256Update,  Sha256Final},
-  { L"SHA384", 48, &mHashOidValue[23], 9, NULL,                NULL,       
NULL,          NULL       },
-  { L"SHA512", 64, &mHashOidValue[32], 9, NULL,                NULL,       
NULL,          NULL       }
+  { L"SHA1",   20, &mHashOidValue[0],  5, Sha1GetContextSize,   Sha1Init,   
Sha1Update,   Sha1Final  },
+  { L"SHA224", 28, &mHashOidValue[5],  9, NULL,                 NULL,       
NULL,         NULL       },
+  { L"SHA256", 32, &mHashOidValue[14], 9, Sha256GetContextSize, Sha256Init, 
Sha256Update, Sha256Final},
+  { L"SHA384", 48, &mHashOidValue[23], 9, Sha384GetContextSize, Sha384Init, 
Sha384Update, Sha384Final},
+  { L"SHA512", 64, &mHashOidValue[32], 9, Sha512GetContextSize, Sha512Init, 
Sha512Update, Sha512Final}
 };
 
 /**
@@ -99,11 +99,11 @@
 
   @param  FileHandle      Pointer to the file handle to read the PE/COFF image.
   @param  FileOffset      Offset into the PE/COFF image to begin the read 
operation.
-  @param  ReadSize        On input, the size in bytes of the requested read 
operation.  
+  @param  ReadSize        On input, the size in bytes of the requested read 
operation.
                           On output, the number of bytes actually read.
   @param  Buffer          Output buffer that contains the data read from the 
PE/COFF image.
-  
-  @retval EFI_SUCCESS     The specified portion of the PE/COFF image was read 
and the size 
+
+  @retval EFI_SUCCESS     The specified portion of the PE/COFF image was read 
and the size
 **/
 EFI_STATUS
 EFIAPI
@@ -117,7 +117,7 @@
   UINTN               EndPosition;
 
   if (FileHandle == NULL || ReadSize == NULL || Buffer == NULL) {
-    return EFI_INVALID_PARAMETER;    
+    return EFI_INVALID_PARAMETER;
   }
 
   if (MAX_ADDRESS - FileOffset < *ReadSize) {
@@ -306,7 +306,7 @@
   SectionHeader = NULL;
   Status        = FALSE;
 
-  if ((HashAlg != HASHALG_SHA1) && (HashAlg != HASHALG_SHA256)) {
+  if ((HashAlg >= HASHALG_MAX)) {
     return FALSE;
   }
 
@@ -315,13 +315,28 @@
   //
   ZeroMem (mImageDigest, MAX_DIGEST_SIZE);
 
-  if (HashAlg == HASHALG_SHA1) {
-    mImageDigestSize  = SHA1_DIGEST_SIZE;
-    mCertType         = gEfiCertSha1Guid;
-  } else if (HashAlg == HASHALG_SHA256) {
-    mImageDigestSize  = SHA256_DIGEST_SIZE;
-    mCertType         = gEfiCertSha256Guid;
-  } else {
+  switch (HashAlg) {
+  case HASHALG_SHA1:
+    mImageDigestSize = SHA1_DIGEST_SIZE;
+    mCertType        = gEfiCertSha1Guid;
+    break;
+
+  case HASHALG_SHA256:
+    mImageDigestSize = SHA256_DIGEST_SIZE;
+    mCertType        = gEfiCertSha256Guid;
+    break;
+
+  case HASHALG_SHA384:
+    mImageDigestSize = SHA384_DIGEST_SIZE;
+    mCertType        = gEfiCertSha384Guid;
+    break;
+
+  case HASHALG_SHA512:
+    mImageDigestSize = SHA512_DIGEST_SIZE;
+    mCertType        = gEfiCertSha512Guid;
+    break;
+
+  default:
     return FALSE;
   }
 
@@ -347,8 +362,8 @@
   //
   if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && 
mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
     //
-    // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic 
value 
-    //       in the PE/COFF Header. If the MachineType is Itanium(IA64) and 
the 
+    // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic 
value
+    //       in the PE/COFF Header. If the MachineType is Itanium(IA64) and the
     //       Magic value in the OptionalHeader is 
EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
     //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
     //
@@ -359,7 +374,7 @@
     //
     Magic =  mNtHeader.Pe32->OptionalHeader.Magic;
   }
-  
+
   //
   // 3.  Calculate the distance from the base of the image header to the image 
checksum address.
   // 4.  Hash the image header from its base to beginning of the image 
checksum.
@@ -466,7 +481,7 @@
       if (!Status) {
         goto Done;
       }
-    }    
+    }
   }
 
   //
@@ -604,7 +619,7 @@
 
   @param[in]  AuthData            Pointer to the Authenticode Signature 
retrieved from signed image.
   @param[in]  AuthDataSize        Size of the Authenticode Signature in bytes.
-  
+
   @retval EFI_UNSUPPORTED             Hash algorithm is not supported.
   @retval EFI_SUCCESS                 Hash successfully.
 
@@ -804,6 +819,124 @@
 }
 
 /**
+  Check whether the hash of an given X.509 certificate is in forbidden 
database (DBX).
+
+  @param[in]  Certificate       Pointer to X.509 Certificate that is searched 
for.
+  @param[in]  CertSize          Size of X.509 Certificate.
+  @param[in]  SignatureList     Pointer to the Signature List in forbidden 
database.
+  @param[in]  SignatureListSize Size of Signature List.
+  @param[out] RevocationTime    Return the time that the certificate was 
revoked.
+
+  @return TRUE   The certificate hash is found in the forbidden database.
+  @return FALSE  The certificate hash is not found in the forbidden database.
+
+**/
+BOOLEAN
+IsCertHashFoundInDatabase (
+  IN  UINT8               *Certificate,
+  IN  UINTN               CertSize,
+  IN  EFI_SIGNATURE_LIST  *SignatureList,
+  IN  UINTN               SignatureListSize,
+  OUT EFI_TIME            *RevocationTime
+  )
+{
+  BOOLEAN             IsFound;
+  EFI_STATUS          Status;
+  EFI_SIGNATURE_LIST  *DbxList;
+  UINTN               DbxSize;
+  EFI_SIGNATURE_DATA  *CertHash;
+  UINTN               CertHashCount;
+  UINTN               Index;
+  UINT32              HashAlg;
+  VOID                *HashCtx;
+  UINT8               CertDigest[MAX_DIGEST_SIZE];
+  UINT8               *DbxCertHash;
+  UINTN               SiglistHeaderSize;
+
+  IsFound  = FALSE;
+  DbxList  = SignatureList;
+  DbxSize  = SignatureListSize;
+  HashCtx  = NULL;
+  HashAlg  = HASHALG_MAX;
+
+  ASSERT (RevocationTime != NULL);
+
+  while ((DbxSize > 0) && (SignatureListSize >= DbxList->SignatureListSize)) {
+    //
+    // Determine Hash Algorithm of Certificate in the forbidden database.
+    //
+    if (CompareGuid (&DbxList->SignatureType, &gEfiCertX509Sha256Guid)) {
+      HashAlg = HASHALG_SHA256;
+    } else if (CompareGuid (&DbxList->SignatureType, &gEfiCertX509Sha384Guid)) 
{
+      HashAlg = HASHALG_SHA384;
+    } else if (CompareGuid (&DbxList->SignatureType, &gEfiCertX509Sha512Guid)) 
{
+      HashAlg = HASHALG_SHA512;
+    } else {
+      DbxSize -= DbxList->SignatureListSize;
+      DbxList  = (EFI_SIGNATURE_LIST *) ((UINT8 *) DbxList + 
DbxList->SignatureListSize);
+      continue;
+    }
+
+    //
+    // Calculate the hash value of current db certificate for comparision.
+    //
+    if (mHash[HashAlg].GetContextSize == NULL) {
+      goto Done;
+    }
+    ZeroMem (CertDigest, MAX_DIGEST_SIZE);
+    HashCtx = AllocatePool (mHash[HashAlg].GetContextSize ());
+    if (HashCtx == NULL) {
+      goto Done;
+    }
+    Status = mHash[HashAlg].HashInit (HashCtx);
+    if (!Status) {
+      goto Done;
+    }
+    Status = mHash[HashAlg].HashUpdate (HashCtx, Certificate, CertSize);
+    if (!Status) {
+      goto Done;
+    }
+    Status = mHash[HashAlg].HashFinal (HashCtx, CertDigest);
+    if (!Status) {
+      goto Done;
+    }
+
+    SiglistHeaderSize = sizeof (EFI_SIGNATURE_LIST) + 
DbxList->SignatureHeaderSize;
+    CertHash          = (EFI_SIGNATURE_DATA *) ((UINT8 *) DbxList + 
SiglistHeaderSize);
+    CertHashCount     = (DbxList->SignatureListSize - SiglistHeaderSize) / 
DbxList->SignatureSize;
+    for (Index = 0; Index < CertHashCount; Index++) {
+      //
+      // Iterate each Signature Data Node within this CertList for verify.
+      //
+      DbxCertHash = CertHash->SignatureData;
+      if (CompareMem (DbxCertHash, CertDigest, mHash[HashAlg].DigestLength) == 
0) {
+        //
+        // Hash of Certificate is found in forbidden database.
+        //
+        IsFound = TRUE;
+
+        //
+        // Return the revocation time.
+        //
+        CopyMem (RevocationTime, (EFI_TIME *)(DbxCertHash + 
mHash[HashAlg].DigestLength), sizeof (EFI_TIME));
+        goto Done;
+      }
+      CertHash = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertHash + 
DbxList->SignatureSize);
+    }
+
+    DbxSize -= DbxList->SignatureListSize;
+    DbxList  = (EFI_SIGNATURE_LIST *) ((UINT8 *) DbxList + 
DbxList->SignatureListSize);
+  }
+
+Done:
+  if (HashCtx != NULL) {
+    FreePool (HashCtx);
+  }
+
+  return IsFound;
+}
+
+/**
   Check whether signature is in specified database.
 
   @param[in]  VariableName        Name of database variable that is searched 
in.
@@ -831,6 +964,7 @@
   UINTN               Index;
   UINTN               CertCount;
   BOOLEAN             IsFound;
+
   //
   // Read signature database variable.
   //
@@ -890,24 +1024,296 @@
 }
 
 /**
-  Verify PKCS#7 SignedData using certificate found in Variable which formatted
-  as EFI_SIGNATURE_LIST. The Variable may be PK, KEK, DB or DBX.
+  Check whether the timestamp is valid by comparing the signing time and the 
revocation time.
 
-  @param[in]  AuthData      Pointer to the Authenticode Signature retrieved 
from signed image.
-  @param[in]  AuthDataSize  Size of the Authenticode Signature in bytes.
-  @param[in]  VariableName  Name of Variable to search for Certificate.
-  @param[in]  VendorGuid    Variable vendor GUID.
+  @param SigningTime         A pointer to the signing time.
+  @param RevocationTime      A pointer to the revocation time.
 
-  @retval TRUE         Image pass verification.
-  @retval FALSE        Image fail verification.
+  @retval  TRUE              The SigningTime is not later than the 
RevocationTime.
+  @retval  FALSE             The SigningTime is later than the RevocationTime.
 
 **/
 BOOLEAN
-IsPkcsSignedDataVerifiedBySignatureList (
+IsValidSignatureByTimestamp (
+  IN EFI_TIME               *SigningTime,
+  IN EFI_TIME               *RevocationTime
+  )
+{
+  if (SigningTime->Year != RevocationTime->Year) {
+    return (BOOLEAN) (SigningTime->Year < RevocationTime->Year);
+  } else if (SigningTime->Month != RevocationTime->Month) {
+    return (BOOLEAN) (SigningTime->Month < RevocationTime->Month);
+  } else if (SigningTime->Day != RevocationTime->Day) {
+    return (BOOLEAN) (SigningTime->Day < RevocationTime->Day);
+  } else if (SigningTime->Hour != RevocationTime->Hour) {
+    return (BOOLEAN) (SigningTime->Hour < RevocationTime->Hour);
+  } else if (SigningTime->Minute != RevocationTime->Minute) {
+    return (BOOLEAN) (SigningTime->Minute < RevocationTime->Minute);
+  }
+
+  return (BOOLEAN) (SigningTime->Second <= RevocationTime->Second);
+}
+
+/**
+  Check if the given time value is zero.
+
+  @param[in]  Time      Pointer of a time value.
+
+  @retval     TRUE      The Time is Zero.
+  @retval     FALSE     The Time is not Zero.
+
+**/
+BOOLEAN
+IsTimeZero (
+  IN EFI_TIME               *Time
+  )
+{
+  if ((Time->Year == 0) && (Time->Month == 0) &&  (Time->Day == 0) &&
+      (Time->Hour == 0) && (Time->Minute == 0) && (Time->Second == 0)) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+/**
+  Check whether the timestamp signature is valid and the signing time is also 
earlier than 
+  the revocation time.
+
+  @param[in]  AuthData        Pointer to the Authenticode signature retrieved 
from signed image.
+  @param[in]  AuthDataSize    Size of the Authenticode signature in bytes.
+  @param[in]  RevocationTime  The time that the certificate was revoked.
+
+  @retval TRUE      Timestamp signature is valid and signing time is no later 
than the 
+                    revocation time.
+  @retval FALSE     Timestamp signature is not valid or the signing time is 
later than the
+                    revocation time.
+
+**/
+BOOLEAN
+PassTimestampCheck (
+  IN UINT8                  *AuthData,
+  IN UINTN                  AuthDataSize,
+  IN EFI_TIME               *RevocationTime
+  )
+{
+  EFI_STATUS                Status;
+  BOOLEAN                   VerifyStatus;
+  EFI_SIGNATURE_LIST        *CertList;
+  EFI_SIGNATURE_DATA        *Cert;
+  UINT8                     *DbtData;
+  UINTN                     DbtDataSize;
+  UINT8                     *RootCert;
+  UINTN                     RootCertSize;
+  UINTN                     Index;
+  UINTN                     CertCount;
+  EFI_TIME                  SigningTime;
+
+  //
+  // Variable Initialization
+  //
+  VerifyStatus      = FALSE;
+  DbtData           = NULL;
+  CertList          = NULL;
+  Cert              = NULL;
+  RootCert          = NULL;
+  RootCertSize      = 0;
+
+  //
+  // If RevocationTime is zero, the certificate shall be considered to always 
be revoked.
+  //
+  if (IsTimeZero (RevocationTime)) {
+    return FALSE;
+  }
+
+  //
+  // RevocationTime is non-zero, the certificate should be considered to be 
revoked from that time and onwards.
+  // Using the dbt to get the trusted TSA certificates.
+  //
+  DbtDataSize = 0;
+  Status   = gRT->GetVariable (EFI_IMAGE_SECURITY_DATABASE2, 
&gEfiImageSecurityDatabaseGuid, NULL, &DbtDataSize, NULL);
+  if (Status == EFI_BUFFER_TOO_SMALL) {
+    DbtData = (UINT8 *) AllocateZeroPool (DbtDataSize);
+    if (DbtData == NULL) {
+      goto Done;
+    }
+    Status = gRT->GetVariable (EFI_IMAGE_SECURITY_DATABASE2, 
&gEfiImageSecurityDatabaseGuid, NULL, &DbtDataSize, (VOID *) DbtData);
+    if (EFI_ERROR (Status)) {
+      goto Done;
+    }
+  }
+
+  CertList = (EFI_SIGNATURE_LIST *) DbtData;
+  while ((DbtDataSize > 0) && (DbtDataSize >= CertList->SignatureListSize)) {
+    if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
+      Cert      = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList + sizeof 
(EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
+      CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - 
CertList->SignatureHeaderSize) / CertList->SignatureSize;
+      for (Index = 0; Index < CertCount; Index++) {
+        //
+        // Iterate each Signature Data Node within this CertList for verify.
+        //
+        RootCert     = Cert->SignatureData;
+        RootCertSize = CertList->SignatureSize - sizeof (EFI_GUID);
+        //
+        // Get the signing time if the timestamp signature is valid.
+        //
+        if (ImageTimestampVerify (AuthData, AuthDataSize, RootCert, 
RootCertSize, &SigningTime)) {
+          //
+          // The signer signature is valid only when the signing time is 
earlier than revocation time.
+          //
+          if (IsValidSignatureByTimestamp (&SigningTime, RevocationTime)) {
+            VerifyStatus = TRUE;
+            goto Done;
+          }
+        }
+        Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) Cert + 
CertList->SignatureSize);
+      }
+    }
+    DbtDataSize -= CertList->SignatureListSize;
+    CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + 
CertList->SignatureListSize);
+  }
+
+Done:
+  if (DbtData != NULL) {
+    FreePool (DbtData);
+  }
+
+  return VerifyStatus;
+}
+
+/**
+  Check whether the image signature is forbidden by the forbidden database 
(dbx).
+  The image is forbidden to load if any certificates for signing are revoked 
before signing time.
+
+  @param[in]  AuthData      Pointer to the Authenticode signature retrieved 
from the signed image.
+  @param[in]  AuthDataSize  Size of the Authenticode signature in bytes.
+
+  @retval TRUE              Image is forbidden by dbx.
+  @retval FALSE             Image is not forbidden by dbx.
+
+**/
+BOOLEAN
+IsForbiddenByDbx (
+  IN UINT8                  *AuthData,
+  IN UINTN                  AuthDataSize
+  )
+{
+  EFI_STATUS                Status;
+  BOOLEAN                   IsForbidden;
+  UINT8                     *Data;
+  UINTN                     DataSize;
+  UINTN                     Index;
+  UINT8                     *CertBuffer;
+  UINTN                     BufferLength;
+  UINT8                     *TrustedCert;
+  UINTN                     TrustedCertLength;
+  UINT8                     CertNumber;
+  UINT8                     *CertPtr;
+  UINT8                     *Cert;
+  UINTN                     CertSize;
+  EFI_TIME                  RevocationTime;
+
+  //
+  // Variable Initialization
+  //
+  IsForbidden       = FALSE;
+  Data              = NULL;
+  Cert              = NULL;
+  CertBuffer        = NULL;
+  BufferLength      = 0;
+  TrustedCert       = NULL;
+  TrustedCertLength = 0;
+
+  //
+  // The image will not be forbidden if dbx can't be got.
+  //
+  DataSize = 0;
+  Status   = gRT->GetVariable (EFI_IMAGE_SECURITY_DATABASE1, 
&gEfiImageSecurityDatabaseGuid, NULL, &DataSize, NULL);
+  if (Status == EFI_BUFFER_TOO_SMALL) {
+    Data = (UINT8 *) AllocateZeroPool (DataSize);
+    if (Data == NULL) {
+      return IsForbidden;
+    }
+
+    Status = gRT->GetVariable (EFI_IMAGE_SECURITY_DATABASE1, 
&gEfiImageSecurityDatabaseGuid, NULL, &DataSize, (VOID *) Data);
+  }
+  if (EFI_ERROR (Status)) {
+    return IsForbidden;
+  }
+
+  //
+  // Retrieve the certificate stack from AuthData
+  // The output CertStack format will be:
+  //       UINT8  CertNumber;
+  //       UINT32 Cert1Length;
+  //       UINT8  Cert1[];
+  //       UINT32 Cert2Length;
+  //       UINT8  Cert2[];
+  //       ...
+  //       UINT32 CertnLength;
+  //       UINT8  Certn[];
+  //
+  Pkcs7GetSigners (AuthData, AuthDataSize, &CertBuffer, &BufferLength, 
&TrustedCert, &TrustedCertLength);
+  if (BufferLength == 0) {
+    IsForbidden = TRUE;
+    goto Done;
+  }
+
+  //
+  // Check if any certificates in AuthData is in the forbidden database.
+  //
+  CertNumber = (UINT8) (*CertBuffer);
+  CertPtr    = CertBuffer + 1;
+  for (Index = 0; Index < CertNumber; Index++) {
+    CertSize = (UINTN) ReadUnaligned32 ((UINT32 *)CertPtr);
+    Cert     = (UINT8 *)CertPtr + sizeof (UINT32);
+    if (IsSignatureFoundInDatabase (EFI_IMAGE_SECURITY_DATABASE1, Cert, 
&gEfiCertX509Guid, CertSize)) {
+      //
+      // Raw certificate in dbx means the image signed by the certificate is 
forbidden.
+      //
+      IsForbidden = TRUE;
+      goto Done;
+    }
+
+    if (IsCertHashFoundInDatabase (Cert, CertSize, (EFI_SIGNATURE_LIST *)Data, 
DataSize, &RevocationTime)) {
+      //
+      // Check the timestamp signature and signing time to determine if the 
image can be trusted.
+      //
+      IsForbidden = TRUE;
+      if (PassTimestampCheck (AuthData, AuthDataSize, &RevocationTime)) {
+        IsForbidden = FALSE;
+      }
+      goto Done;
+    }
+
+    CertPtr = CertPtr + sizeof (UINT32) + CertSize;
+  }
+
+Done:
+  if (Data != NULL) {
+    FreePool (Data);
+  }
+
+  Pkcs7FreeSigners (CertBuffer);
+  Pkcs7FreeSigners (TrustedCert);
+
+  return IsForbidden;
+}
+
+/**
+  Check whether the image signature can be verified by the trusted 
certificates in DB database.
+
+  @param[in]  AuthData      Pointer to the Authenticode signature retrieved 
from signed image.
+  @param[in]  AuthDataSize  Size of the Authenticode signature in bytes.
+
+  @retval TRUE         Image passed verification using certificate in db.
+  @retval FALSE        Image didn't pass verification using certificate in db.
+
+**/
+BOOLEAN
+IsAllowedByDb (
   IN UINT8              *AuthData,
-  IN UINTN              AuthDataSize,
-  IN CHAR16             *VariableName,
-  IN EFI_GUID           *VendorGuid
+  IN UINTN              AuthDataSize
   )
 {
   EFI_STATUS                Status;
@@ -929,14 +1335,14 @@
   VerifyStatus = FALSE;
 
   DataSize = 0;
-  Status   = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, 
NULL);
+  Status   = gRT->GetVariable (EFI_IMAGE_SECURITY_DATABASE, 
&gEfiImageSecurityDatabaseGuid, NULL, &DataSize, NULL);
   if (Status == EFI_BUFFER_TOO_SMALL) {
     Data = (UINT8 *) AllocateZeroPool (DataSize);
     if (Data == NULL) {
       return VerifyStatus;
     }
 
-    Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, 
(VOID *) Data);
+    Status = gRT->GetVariable (EFI_IMAGE_SECURITY_DATABASE, 
&gEfiImageSecurityDatabaseGuid, NULL, &DataSize, (VOID *) Data);
     if (EFI_ERROR (Status)) {
       goto Done;
     }
@@ -947,14 +1353,15 @@
     CertList = (EFI_SIGNATURE_LIST *) Data;
     while ((DataSize > 0) && (DataSize >= CertList->SignatureListSize)) {
       if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
-        Cert          = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList + sizeof 
(EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
-        CertCount     = (CertList->SignatureListSize - sizeof 
(EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
+        Cert       = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList + sizeof 
(EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
+        CertCount  = (CertList->SignatureListSize - sizeof 
(EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
+
         for (Index = 0; Index < CertCount; Index++) {
           //
           // Iterate each Signature Data Node within this CertList for verify.
           //
-          RootCert      = Cert->SignatureData;
-          RootCertSize  = CertList->SignatureSize - sizeof (EFI_GUID);
+          RootCert     = Cert->SignatureData;
+          RootCertSize = CertList->SignatureSize - sizeof (EFI_GUID);
 
           //
           // Call AuthenticodeVerify library to Verify Authenticode struct.
@@ -968,12 +1375,14 @@
                            mImageDigestSize
                            );
           if (VerifyStatus) {
-            SecureBootHook (VariableName, VendorGuid, CertList->SignatureSize, 
Cert);
+            SecureBootHook (EFI_IMAGE_SECURITY_DATABASE, 
&gEfiImageSecurityDatabaseGuid, CertList->SignatureSize, Cert);
             goto Done;
           }
+
           Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) Cert + 
CertList->SignatureSize);
         }
       }
+
       DataSize -= CertList->SignatureListSize;
       CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + 
CertList->SignatureListSize);
     }
@@ -1108,7 +1517,7 @@
   }
 
   //
-  // The policy QUERY_USER_ON_SECURITY_VIOLATION and 
ALLOW_EXECUTE_ON_SECURITY_VIOLATION 
+  // The policy QUERY_USER_ON_SECURITY_VIOLATION and 
ALLOW_EXECUTE_ON_SECURITY_VIOLATION
   // violates the UEFI spec and has been removed.
   //
   ASSERT (Policy != QUERY_USER_ON_SECURITY_VIOLATION && Policy != 
ALLOW_EXECUTE_ON_SECURITY_VIOLATION);
@@ -1183,8 +1592,8 @@
 
   if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && 
mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
     //
-    // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic 
value 
-    //       in the PE/COFF Header. If the MachineType is Itanium(IA64) and 
the 
+    // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic 
value
+    //       in the PE/COFF Header. If the MachineType is Itanium(IA64) and the
     //       Magic value in the OptionalHeader is 
EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
     //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
     //
@@ -1195,7 +1604,7 @@
     //
     Magic = mNtHeader.Pe32->OptionalHeader.Magic;
   }
-  
+
   if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
     //
     // Use PE32 offset.
@@ -1203,7 +1612,7 @@
     NumberOfRvaAndSizes = mNtHeader.Pe32->OptionalHeader.NumberOfRvaAndSizes;
     if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_SECURITY) {
       SecDataDir = (EFI_IMAGE_DATA_DIRECTORY *) 
&mNtHeader.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY];
-    }        
+    }
   } else {
     //
     // Use PE32+ offset.
@@ -1219,7 +1628,7 @@
   //
   if (SecDataDir == NULL || SecDataDir->Size == 0) {
     //
-    // This image is not signed. The SHA256 hash value of the image must match 
a record in the security database "db", 
+    // This image is not signed. The SHA256 hash value of the image must match 
a record in the security database "db",
     // and not be reflected in the security data base "dbx".
     //
     if (!HashPeImage (HASHALG_SHA256)) {
@@ -1247,7 +1656,7 @@
   }
 
   //
-  // Verify the signature of the image, multiple signatures are allowed as per 
PE/COFF Section 4.7 
+  // Verify the signature of the image, multiple signatures are allowed as per 
PE/COFF Section 4.7
   // "Attribute Certificate Table".
   // The first certificate starts at offset (SecDataDir->VirtualAddress) from 
the start of the file.
   //
@@ -1259,13 +1668,13 @@
         (SecDataDir->VirtualAddress + SecDataDir->Size - OffSet) < 
WinCertificate->dwLength) {
       break;
     }
-    
+
     //
     // Verify the image's Authenticode signature, only DER-encoded PKCS#7 
signed data is supported.
     //
     if (WinCertificate->wCertificateType == WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
       //
-      // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is 
described in the 
+      // The certificate is formatted as WIN_CERTIFICATE_EFI_PKCS which is 
described in the
       // Authenticode specification.
       //
       PkcsCertData = (WIN_CERTIFICATE_EFI_PKCS *) WinCertificate;
@@ -1298,11 +1707,11 @@
     if (EFI_ERROR (Status)) {
       continue;
     }
-    
+
     //
     // Check the digital signature against the revoked certificate in 
forbidden database (dbx).
     //
-    if (IsPkcsSignedDataVerifiedBySignatureList (AuthData, AuthDataSize, 
EFI_IMAGE_SECURITY_DATABASE1, &gEfiImageSecurityDatabaseGuid)) {
+    if (IsForbiddenByDbx (AuthData, AuthDataSize)) {
       Action = EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED;
       VerifyStatus = EFI_ACCESS_DENIED;
       break;
@@ -1312,7 +1721,7 @@
     // Check the digital signature against the valid certificate in allowed 
database (db).
     //
     if (EFI_ERROR (VerifyStatus)) {
-      if (IsPkcsSignedDataVerifiedBySignatureList (AuthData, AuthDataSize, 
EFI_IMAGE_SECURITY_DATABASE, &gEfiImageSecurityDatabaseGuid)) {
+      if (IsAllowedByDb (AuthData, AuthDataSize)) {
         VerifyStatus = EFI_SUCCESS;
       }
     }
@@ -1337,7 +1746,7 @@
     //
     VerifyStatus = EFI_ACCESS_DENIED;
   }
-  
+
   if (!EFI_ERROR (VerifyStatus)) {
     return EFI_SUCCESS;
   } else {
@@ -1407,7 +1816,7 @@
     return ;
   }
 
-  ImageExeInfoTable->NumberOfImages = 0;  
+  ImageExeInfoTable->NumberOfImages = 0;
   gBS->InstallConfigurationTable (&gEfiImageSecurityDatabaseGuid, (VOID *) 
ImageExeInfoTable);
 
 }
@@ -1434,10 +1843,10 @@
   //
   EfiCreateEventReadyToBootEx (
     TPL_CALLBACK,
-    OnReadyToBoot, 
-    NULL, 
+    OnReadyToBoot,
+    NULL,
     &Event
-    ); 
+    );
 
   return RegisterSecurity2Handler (
           DxeImageVerificationHandler,

Modified: 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
===================================================================
--- 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
    2014-11-14 00:39:04 UTC (rev 16379)
+++ 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.h
    2014-11-14 08:41:12 UTC (rev 16380)
@@ -2,13 +2,13 @@
   The internal header file includes the common header files, defines
   internal structure and functions used by ImageVerificationLib.
 
-Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials 
-are licensed and made available under the terms and conditions of the BSD 
License 
-which accompanies this distribution.  The full text of the license may be 
found at 
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
@@ -76,9 +76,9 @@
 #define HASHALG_MAX                            0x00000005
 
 //
-// Set max digest size as SHA256 Output (32 bytes) by far
+// Set max digest size as SHA512 Output (64 bytes) by far
 //
-#define MAX_DIGEST_SIZE    SHA256_DIGEST_SIZE      
+#define MAX_DIGEST_SIZE    SHA512_DIGEST_SIZE
 //
 //
 // PKCS7 Certificate definition
@@ -204,4 +204,4 @@
   HASH_FINAL               HashFinal;
 } HASH_TABLE;
 
-#endif
+#endif
\ No newline at end of file

Modified: 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
===================================================================
--- 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
  2014-11-14 00:39:04 UTC (rev 16379)
+++ 
trunk/edk2/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
  2014-11-14 08:41:12 UTC (rev 16380)
@@ -25,7 +25,7 @@
   FILE_GUID                      = 0CA970E1-43FA-4402-BC0A-81AF336BFFD6
   MODULE_TYPE                    = DXE_DRIVER
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 
+  LIBRARY_CLASS                  = NULL|DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
   CONSTRUCTOR                    = DxeImageVerificationLibConstructor
 
 #
@@ -67,6 +67,7 @@
 [Guids]
   ## SOMETIMES_CONSUMES   ## Variable:L"DB"
   ## SOMETIMES_CONSUMES   ## Variable:L"DBX"
+  ## SOMETIMES_CONSUMES   ## Variable:L"DBT"
   ## PRODUCES             ## SystemTable
   ## CONSUMES             ## SystemTable
   gEfiImageSecurityDatabaseGuid
@@ -74,16 +75,26 @@
   ## SOMETIMES_CONSUMES   ## GUID       # Unique ID for the type of the 
signature.
   ## SOMETIMES_PRODUCES   ## GUID       # Unique ID for the type of the 
signature.
   gEfiCertSha1Guid
-  
+
   ## SOMETIMES_CONSUMES   ## GUID       # Unique ID for the type of the 
signature.
   ## SOMETIMES_PRODUCES   ## GUID       # Unique ID for the type of the 
signature.
   gEfiCertSha256Guid
 
+  ## SOMETIMES_CONSUMES   ## GUID       # Unique ID for the type of the 
signature.
+  ## SOMETIMES_PRODUCES   ## GUID       # Unique ID for the type of the 
signature.
+  gEfiCertSha384Guid
+
+  ## SOMETIMES_CONSUMES   ## GUID       # Unique ID for the type of the 
signature.
+  ## SOMETIMES_PRODUCES   ## GUID       # Unique ID for the type of the 
signature.
+  gEfiCertSha512Guid
+
   gEfiCertX509Guid                      ## SOMETIMES_CONSUMES    ## GUID     # 
Unique ID for the type of the signature.
+  gEfiCertX509Sha256Guid                ## SOMETIMES_CONSUMES    ## GUID     # 
Unique ID for the type of the signature.
+  gEfiCertX509Sha384Guid                ## SOMETIMES_CONSUMES    ## GUID     # 
Unique ID for the type of the signature.
+  gEfiCertX509Sha512Guid                ## SOMETIMES_CONSUMES    ## GUID     # 
Unique ID for the type of the signature.
   gEfiCertPkcs7Guid                     ## SOMETIMES_CONSUMES    ## GUID     # 
Unique ID for the type of the certificate.
-  
+
 [Pcd]
   gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy          
## SOMETIMES_CONSUMES
   gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy     
## SOMETIMES_CONSUMES
   gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy         
## SOMETIMES_CONSUMES
-  
\ No newline at end of file

Modified: trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
===================================================================
--- trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c       
2014-11-14 00:39:04 UTC (rev 16379)
+++ trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c       
2014-11-14 08:41:12 UTC (rev 16380)
@@ -9,7 +9,7 @@
   Variable attribute should also be checked to avoid authentication bypass.
      The whole SMM authentication variable design relies on the integrity of 
flash part and SMM.
   which is assumed to be protected by platform.  All variable code and 
metadata in flash/SMM Memory
-  may not be modified without authorization. If platform fails to protect 
these resources, 
+  may not be modified without authorization. If platform fails to protect 
these resources,
   the authentication service provided in this driver will be broken, and the 
behavior is undefined.
 
   ProcessVarWithPk(), ProcessVarWithKek() and ProcessVariable() are the 
function to do
@@ -77,7 +77,10 @@
   {EFI_CERT_X509_GUID,            0,               ((UINT32) ~0)},
   {EFI_CERT_SHA224_GUID,          0,               28           },
   {EFI_CERT_SHA384_GUID,          0,               48           },
-  {EFI_CERT_SHA512_GUID,          0,               64           }
+  {EFI_CERT_SHA512_GUID,          0,               64           },
+  {EFI_CERT_X509_SHA256_GUID,     0,               48           },
+  {EFI_CERT_X509_SHA384_GUID,     0,               64           },
+  {EFI_CERT_X509_SHA512_GUID,     0,               80           }
 };
 
 /**
@@ -88,7 +91,7 @@
 
   @retval TRUE      This variable is protected, only a physical present user 
could set this variable.
   @retval FALSE     This variable is not protected.
-  
+
 **/
 BOOLEAN
 NeedPhysicallyPresent(
@@ -100,7 +103,7 @@
     || (CompareGuid (VendorGuid, &gEfiCustomModeEnableGuid) && (StrCmp 
(VariableName, EFI_CUSTOM_MODE_NAME) == 0))) {
     return TRUE;
   }
-  
+
   return FALSE;
 }
 
@@ -122,7 +125,7 @@
   if (Variable.CurrPtr != NULL && *(GetVariableDataPtr (Variable.CurrPtr)) == 
CUSTOM_SECURE_BOOT_MODE) {
     return TRUE;
   }
-  
+
   return FALSE;
 }
 
@@ -256,7 +259,7 @@
     Data      = GetVariableDataPtr (Variable.CurrPtr);
     ASSERT ((DataSize != 0) && (Data != NULL));
     //
-    // "AuthVarKeyDatabase" is an internal variable. Its DataSize is always 
ensured not to exceed mPubKeyStore buffer size(See definition before) 
+    // "AuthVarKeyDatabase" is an internal variable. Its DataSize is always 
ensured not to exceed mPubKeyStore buffer size(See definition before)
     //  Therefore, there is no memory overflow in underlying CopyMem.
     //
     CopyMem (mPubKeyStore, (UINT8 *) Data, DataSize);
@@ -269,7 +272,7 @@
   } else {
     DEBUG ((EFI_D_INFO, "Variable %s exists.\n", EFI_PLATFORM_KEY_NAME));
   }
-  
+
   //
   // Create "SetupMode" variable with BS+RT attribute set.
   //
@@ -293,7 +296,7 @@
   if (EFI_ERROR (Status)) {
     return Status;
   }
-  
+
   //
   // Create "SignatureSupport" variable with BS+RT attribute set.
   //
@@ -390,12 +393,12 @@
   if (EFI_ERROR (Status)) {
     return Status;
   }
-  
+
   DEBUG ((EFI_D_INFO, "Variable %s is %x\n", EFI_CUSTOM_MODE_NAME, 
CustomMode));
 
   //
   // Check "certdb" variable's existence.
-  // If it doesn't exist, then create a new one with 
+  // If it doesn't exist, then create a new one with
   // EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.
   //
   Status = FindVariable (
@@ -423,7 +426,7 @@
     if (EFI_ERROR (Status)) {
       return Status;
     }
-  }  
+  }
 
   //
   // Check "VendorKeysNv" variable's existence and create "VendorKeys" 
variable accordingly.
@@ -480,7 +483,7 @@
   Add public key in store and return its index.
 
   @param[in]  PubKey                  Input pointer to Public Key data
-  @param[in]  VariableDataEntry       The variable data entry 
+  @param[in]  VariableDataEntry       The variable data entry
 
   @return                             Index of new added item
 
@@ -543,7 +546,7 @@
         //
         return 0;
       }
-      
+
       Status = Reclaim (
                  mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase,
                  &mVariableModuleGlobal->NonVolatileLastVariableOffset,
@@ -573,7 +576,7 @@
       Data      = GetVariableDataPtr (Variable.CurrPtr);
       ASSERT ((DataSize != 0) && (Data != NULL));
       //
-      // "AuthVarKeyDatabase" is an internal used variable. Its DataSize is 
always ensured not to exceed mPubKeyStore buffer size(See definition before) 
+      // "AuthVarKeyDatabase" is an internal used variable. Its DataSize is 
always ensured not to exceed mPubKeyStore buffer size(See definition before)
       //  Therefore, there is no memory overflow in underlying CopyMem.
       //
       CopyMem (mPubKeyStore, (UINT8 *) Data, DataSize);
@@ -581,7 +584,7 @@
 
       if (mPubKeyNumber == mMaxKeyNumber) {
         return 0;
-      }     
+      }
     }
 
     //
@@ -656,7 +659,7 @@
   UINT8                           Digest[SHA256_DIGEST_SIZE];
   VOID                            *Rsa;
   UINTN                           PayloadSize;
-  
+
   PayloadSize = DataSize - AUTHINFO_SIZE;
   Rsa         = NULL;
   CertData    = NULL;
@@ -885,7 +888,7 @@
 }
 
 /**
-  Check input data form to make sure it is a valid EFI_SIGNATURE_LIST for 
PK/KEK/db/dbx variable.
+  Check input data form to make sure it is a valid EFI_SIGNATURE_LIST for 
PK/KEK/db/dbx/dbt variable.
 
   @param[in]  VariableName                Name of Variable to be check.
   @param[in]  VendorGuid                  Variable vendor GUID.
@@ -894,7 +897,7 @@
 
   @return EFI_INVALID_PARAMETER           Invalid signature list format.
   @return EFI_SUCCESS                     Passed signature list format check 
successfully.
-  
+
 **/
 EFI_STATUS
 CheckSignatureListFormat(
@@ -921,9 +924,10 @@
 
   if (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp 
(VariableName, EFI_PLATFORM_KEY_NAME) == 0)){
     IsPk = TRUE;
-  } else if ((CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && StrCmp 
(VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0) ||
-             (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 
-              (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0 || 
StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))){
+  } else if ((CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp 
(VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0)) ||
+             (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) &&
+             ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || 
(StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0) ||
+              (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE2) == 0)))) {
     IsPk = FALSE;
   } else {
     return EFI_SUCCESS;
@@ -942,10 +946,10 @@
     for (Index = 0; Index < (sizeof (mSupportSigItem) / sizeof 
(EFI_SIGNATURE_ITEM)); Index++ ) {
       if (CompareGuid (&SigList->SignatureType, 
&mSupportSigItem[Index].SigType)) {
         //
-        // The value of SignatureSize should always be 16 (size of 
SignatureOwner 
+        // The value of SignatureSize should always be 16 (size of 
SignatureOwner
         // component) add the data length according to signature type.
         //
-        if (mSupportSigItem[Index].SigDataSize != ((UINT32) ~0) && 
+        if (mSupportSigItem[Index].SigDataSize != ((UINT32) ~0) &&
           (SigList->SignatureSize - sizeof (EFI_GUID)) != 
mSupportSigItem[Index].SigDataSize) {
           return EFI_INVALID_PARAMETER;
         }
@@ -986,7 +990,7 @@
       return EFI_INVALID_PARAMETER;
     }
     SigCount += (SigList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - 
SigList->SignatureHeaderSize) / SigList->SignatureSize;
-    
+
     SigDataSize -= SigList->SignatureListSize;
     SigList = (EFI_SIGNATURE_LIST *) ((UINT8 *) SigList + 
SigList->SignatureListSize);
   }
@@ -1007,7 +1011,7 @@
 
   @return EFI_SUCCESS           Variable is updated successfully.
   @return Others                Failed to update variable.
-  
+
 **/
 EFI_STATUS
 VendorKeyIsModified (
@@ -1021,7 +1025,7 @@
     return EFI_SUCCESS;
   }
   mVendorKeyState = VENDOR_KEYS_MODIFIED;
-  
+
   FindVariable (EFI_VENDOR_KEYS_NV_VARIABLE_NAME, &gEfiVendorKeysNvGuid, 
&Variable, &mVariableModuleGlobal->VariableGlobal, FALSE);
   Status = UpdateVariable (
              EFI_VENDOR_KEYS_NV_VARIABLE_NAME,
@@ -1093,10 +1097,10 @@
   UINT8                       *Payload;
   UINTN                       PayloadSize;
 
-  if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0 || 
+  if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0 ||
       (Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) {
     //
-    // PK, KEK and db/dbx should set EFI_VARIABLE_NON_VOLATILE attribute and 
should be a time-based
+    // PK, KEK and db/dbx/dbt should set EFI_VARIABLE_NON_VOLATILE attribute 
and should be a time-based
     // authenticated variable.
     //
     return EFI_INVALID_PARAMETER;
@@ -1221,7 +1225,7 @@
   if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0 ||
       (Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) {
     //
-    // DB and DBX should set EFI_VARIABLE_NON_VOLATILE attribute and should be 
a time-based
+    // DB, DBX and DBT should set EFI_VARIABLE_NON_VOLATILE attribute and 
should be a time-based
     // authenticated variable.
     //
     return EFI_INVALID_PARAMETER;
@@ -1253,7 +1257,7 @@
     if (EFI_ERROR (Status)) {
       return Status;
     }
-    
+
     Status = UpdateVariable (
                VariableName,
                VendorGuid,
@@ -1338,23 +1342,23 @@
     //
     return EFI_SECURITY_VIOLATION;
   }
-  
+
   //
   // A time-based authenticated variable and a count-based authenticated 
variable
   // can't be updated by each other.
-  // 
-  if (Variable->CurrPtr != NULL) {    
+  //
+  if (Variable->CurrPtr != NULL) {
     if (((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) &&
         ((Variable->CurrPtr->Attributes & 
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0)) {
-      return EFI_SECURITY_VIOLATION;      
+      return EFI_SECURITY_VIOLATION;
     }
-    
-    if (((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 
0) && 
+
+    if (((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 
0) &&
         ((Variable->CurrPtr->Attributes & 
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0)) {
-      return EFI_SECURITY_VIOLATION;      
+      return EFI_SECURITY_VIOLATION;
     }
   }
-    
+
   //
   // Process Time-based Authenticated variable.
   //
@@ -1392,7 +1396,7 @@
       KeyIndex   = Variable->CurrPtr->PubKeyIndex;
       IsFirstTime = FALSE;
     }
-  } else if ((Variable->CurrPtr != NULL) && 
+  } else if ((Variable->CurrPtr != NULL) &&
              ((Variable->CurrPtr->Attributes & 
(EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | 
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) != 0)
             ) {
     //
@@ -1423,7 +1427,7 @@
   if (!IsFirstTime) {
     //
     // 2 cases need to check here
-    //   1. Internal PubKey variable. PubKeyIndex is always 0 
+    //   1. Internal PubKey variable. PubKeyIndex is always 0
     //   2. Other counter-based AuthVariable. Check input PubKey.
     //
     if (KeyIndex == 0 || CompareMem (PubKey, mPubKeyStore + (KeyIndex - 1) * 
EFI_CERT_TYPE_RSA2048_SIZE, EFI_CERT_TYPE_RSA2048_SIZE) != 0) {
@@ -1478,7 +1482,7 @@
 
   @param[in, out]  Data              Pointer to original EFI_SIGNATURE_LIST.
   @param[in]       DataSize          Size of Data buffer.
-  @param[in]       FreeBufSize       Size of free data buffer 
+  @param[in]       FreeBufSize       Size of free data buffer
   @param[in]       NewData           Pointer to new EFI_SIGNATURE_LIST to be 
appended.
   @param[in]       NewDataSize       Size of NewData buffer.
   @param[out]      MergedBufSize     Size of the merged buffer
@@ -1714,7 +1718,7 @@
       //
       // Check whether VariableName matches.
       //
-      if ((NameSize == StrLen (VariableName)) && 
+      if ((NameSize == StrLen (VariableName)) &&
           (CompareMem (Data + Offset, VariableName, NameSize * sizeof 
(CHAR16)) == 0)) {
         Offset = Offset + NameSize * sizeof (CHAR16);
 
@@ -1723,7 +1727,7 @@
         }
 
         if (CertDataSize != NULL) {
-          *CertDataSize = CertSize;        
+          *CertDataSize = CertSize;
         }
 
         if (CertNodeOffset != NULL) {
@@ -1744,7 +1748,7 @@
     }
   }
 
-  return EFI_NOT_FOUND;  
+  return EFI_NOT_FOUND;
 }
 
 /**
@@ -1778,7 +1782,7 @@
   if ((VariableName == NULL) || (VendorGuid == NULL) || (CertData == NULL) || 
(CertDataSize == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
-  
+
   //
   // Get variable "certdb".
   //
@@ -1788,7 +1792,7 @@
              &CertDbVariable,
              &mVariableModuleGlobal->VariableGlobal,
              FALSE
-             );      
+             );
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -1851,7 +1855,7 @@
   if ((VariableName == NULL) || (VendorGuid == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
-  
+
   //
   // Get variable "certdb".
   //
@@ -1861,7 +1865,7 @@
              &CertDbVariable,
              &mVariableModuleGlobal->VariableGlobal,
              FALSE
-             );      
+             );
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -1929,8 +1933,8 @@
 
   //
   // Set "certdb".
-  // 
-  VarAttr  = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;  
+  //
+  VarAttr  = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
   Status   = UpdateVariable (
                EFI_CERT_DB_NAME,
                &gEfiCertDbGuid,
@@ -1984,7 +1988,7 @@
   if ((VariableName == NULL) || (VendorGuid == NULL) || (CertData == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
-  
+
   //
   // Get variable "certdb".
   //
@@ -1994,7 +1998,7 @@
              &CertDbVariable,
              &mVariableModuleGlobal->VariableGlobal,
              FALSE
-             );      
+             );
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -2030,7 +2034,7 @@
   // Construct new data content of variable "certdb".
   //
   NameSize      = (UINT32) StrLen (VariableName);
-  CertNodeSize  = sizeof (AUTH_CERT_DB_DATA) + (UINT32) CertDataSize + 
NameSize * sizeof (CHAR16); 
+  CertNodeSize  = sizeof (AUTH_CERT_DB_DATA) + (UINT32) CertDataSize + 
NameSize * sizeof (CHAR16);
   NewCertDbSize = (UINT32) DataSize + CertNodeSize;
   if (NewCertDbSize > mMaxCertDbSize) {
     return EFI_OUT_OF_RESOURCES;
@@ -2053,7 +2057,7 @@
   CopyMem (&Ptr->CertNodeSize, &CertNodeSize, sizeof (UINT32));
   CopyMem (&Ptr->NameSize, &NameSize, sizeof (UINT32));
   CopyMem (&Ptr->CertDataSize, &CertDataSize, sizeof (UINT32));
-  
+
   CopyMem (
     (UINT8 *) Ptr + sizeof (AUTH_CERT_DB_DATA),
     VariableName,
@@ -2065,11 +2069,11 @@
     CertData,
     CertDataSize
     );
-  
+
   //
   // Set "certdb".
-  // 
-  VarAttr  = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;  
+  //
+  VarAttr  = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
   Status   = UpdateVariable (
                EFI_CERT_DB_NAME,
                &gEfiCertDbGuid,
@@ -2349,7 +2353,7 @@
   } else if (AuthVarType == AuthVarTypePriv) {
 
     //
-    // Process common authenticated variable except PK/KEK/DB/DBX.
+    // Process common authenticated variable except PK/KEK/DB/DBX/DBT.
     // Get signer's certificates from SignedData.
     //
     VerifyStatus = Pkcs7GetSigners (
@@ -2376,7 +2380,7 @@
       if (EFI_ERROR (Status)) {
         goto Exit;
       }
-    
+
       if ((CertStackSize != CertsSizeinDb) ||
           (CompareMem (SignerCerts, CertsInCertDb, CertsSizeinDb) != 0)) {
         goto Exit;
@@ -2419,7 +2423,7 @@
     Cert     = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList + sizeof 
(EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
     RootCert      = Cert->SignatureData;
     RootCertSize  = CertList->SignatureSize - (sizeof (EFI_SIGNATURE_DATA) - 
1);
-    
+
     // Verify Pkcs7 SignedData via Pkcs7Verify library.
     //
     VerifyStatus = Pkcs7Verify (
@@ -2469,4 +2473,3 @@
            &CertData->TimeStamp
            );
 }
-

Modified: trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
===================================================================
--- trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c  
2014-11-14 00:39:04 UTC (rev 16379)
+++ trunk/edk2/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c  
2014-11-14 08:41:12 UTC (rev 16380)
@@ -592,14 +592,14 @@
 
   Check the PubKeyIndex is a valid key or not.
 
-  This function will iterate the NV storage to see if this PubKeyIndex is 
still referenced 
+  This function will iterate the NV storage to see if this PubKeyIndex is 
still referenced
   by any valid count-based auth variabe.
-  
+
   @param[in]  PubKeyIndex     Index of the public key in public key store.
 
   @retval     TRUE            The PubKeyIndex is still in use.
   @retval     FALSE           The PubKeyIndex is not referenced by any 
count-based auth variabe.
-  
+
 **/
 BOOLEAN
 IsValidPubKeyIndex (
@@ -617,20 +617,20 @@
   VariableStoreEnd = GetEndPointer ((VARIABLE_STORE_HEADER *) (UINTN) 
mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase);
 
   while (IsValidVariableHeader (Variable, VariableStoreEnd)) {
-    if ((Variable->State == VAR_ADDED || Variable->State == 
(VAR_IN_DELETED_TRANSITION & VAR_ADDED)) && 
+    if ((Variable->State == VAR_ADDED || Variable->State == 
(VAR_IN_DELETED_TRANSITION & VAR_ADDED)) &&
         Variable->PubKeyIndex == PubKeyIndex) {
       return TRUE;
     }
     Variable = GetNextVariablePtr (Variable);
   }
-  
+
   return FALSE;
 }
 
 /**
 
   Get the number of valid public key in PubKeyStore.
-  
+
   @param[in]  PubKeyNumber     Number of the public key in public key store.
 
   @return     Number of valid public key in PubKeyStore.
@@ -645,13 +645,13 @@
   UINT32       Counter;
 
   Counter = 0;
-  
+
   for (PubKeyIndex = 1; PubKeyIndex <= PubKeyNumber; PubKeyIndex++) {
     if (IsValidPubKeyIndex (PubKeyIndex)) {
       Counter++;
     }
   }
-  
+
   return Counter;
 }
 
@@ -659,7 +659,7 @@
 
   Filter the useless key in public key store.
 
-  This function will find out all valid public keys in public key database, 
save them in new allocated 
+  This function will find out all valid public keys in public key database, 
save them in new allocated
   buffer NewPubKeyStore, and give the new PubKeyIndex. The caller is 
responsible for freeing buffer
   NewPubKeyIndex and NewPubKeyStore with FreePool().
 
@@ -668,10 +668,10 @@
   @param[out]  NewPubKeyIndex       Point to an array of new PubKeyIndex 
corresponds to NewPubKeyStore.
   @param[out]  NewPubKeyStore       Saved all valid public keys in PubKeyStore.
   @param[out]  NewPubKeySize        Buffer size of the NewPubKeyStore.
-  
+
   @retval  EFI_SUCCESS              Trim operation is complete successfully.
   @retval  EFI_OUT_OF_RESOURCES     No enough memory resources, or no useless 
key in PubKeyStore.
-  
+
 **/
 EFI_STATUS
 PubKeyStoreFilter (
@@ -685,7 +685,7 @@
   UINT32        PubKeyIndex;
   UINT32        CopiedKey;
   UINT32        NewPubKeyNumber;
-  
+
   NewPubKeyNumber = GetValidPubKeyNumber (PubKeyNumber);
   if (NewPubKeyNumber == PubKeyNumber) {
     return EFI_OUT_OF_RESOURCES;
@@ -739,7 +739,7 @@
   @param[in]      NewVariable             Pointer to new variable.
   @param[in]      NewVariableSize         New variable size.
   @param[in]      ReclaimPubKeyStore      Reclaim for public key database or 
not.
-  
+
   @return EFI_SUCCESS                  Reclaim operation has finished 
successfully.
   @return EFI_OUT_OF_RESOURCES         No enough memory resources or variable 
space.
   @return EFI_DEVICE_ERROR             The public key database doesn't exist.
@@ -873,7 +873,7 @@
     while (IsValidVariableHeader (Variable, GetEndPointer 
(VariableStoreHeader))) {
       NextVariable = GetNextVariablePtr (Variable);
       if (Variable->State == VAR_ADDED || Variable->State == 
(VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
-        if ((StrCmp (GetVariableNamePtr (Variable), AUTHVAR_KEYDB_NAME) == 0) 
&& 
+        if ((StrCmp (GetVariableNamePtr (Variable), AUTHVAR_KEYDB_NAME) == 0) 
&&
             (CompareGuid (&Variable->VendorGuid, 
&gEfiAuthenticatedVariableGuid))) {
           //
           // Skip the public key database, it will be reinstalled later.
@@ -882,7 +882,7 @@
           Variable = NextVariable;
           continue;
         }
-        
+
         VariableSize = (UINTN) NextVariable - (UINTN) Variable;
         CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize);
         ((VARIABLE_HEADER*) CurrPtr)->PubKeyIndex = 
NewPubKeyIndex[Variable->PubKeyIndex];
@@ -909,7 +909,7 @@
     Variable->DataSize = NewPubKeySize;
     StrCpy (GetVariableNamePtr (Variable), GetVariableNamePtr (PubKeyHeader));
     CopyMem (GetVariableDataPtr (Variable), NewPubKeyStore, NewPubKeySize);
-    CurrPtr = (UINT8*) GetNextVariablePtr (Variable); 
+    CurrPtr = (UINT8*) GetNextVariablePtr (Variable);
     CommonVariableTotalSize += (UINTN) CurrPtr - (UINTN) Variable;
   } else {
     //
@@ -1524,7 +1524,7 @@
 
   @param[in] Attributes         Variable attributes for Variable entries.
   @param ...                    The variable argument list with type 
VARIABLE_ENTRY_CONSISTENCY *.
-                                A NULL terminates the list. The VariableSize 
of 
+                                A NULL terminates the list. The VariableSize of
                                 VARIABLE_ENTRY_CONSISTENCY is the variable 
data size as input.
                                 It will be changed to variable total size as 
output.
 
@@ -1803,7 +1803,7 @@
         VariableEntry[0].VariableSize = ISO_639_2_ENTRY_SIZE + 1;
         VariableEntry[0].Guid = &gEfiGlobalVariableGuid;
         VariableEntry[0].Name = EFI_LANG_VARIABLE_NAME;
-        
+
         VariableEntry[1].VariableSize = AsciiStrSize (BestPlatformLang);
         VariableEntry[1].Guid = &gEfiGlobalVariableGuid;
         VariableEntry[1].Name = EFI_PLATFORM_LANG_VARIABLE_NAME;
@@ -2009,7 +2009,7 @@
         Status = EFI_INVALID_PARAMETER;
         goto Done;
       }
-      
+
       //
       // Only variable that have RT attributes can be updated/deleted in 
Runtime.
       //
@@ -2103,20 +2103,21 @@
         CopyMem (BufferForMerge, (UINT8 *) ((UINTN) Variable->CurrPtr + 
DataOffset), Variable->CurrPtr->DataSize);
 
         //
-        // Set Max Common Variable Data Size as default MaxDataSize 
+        // Set Max Common Variable Data Size as default MaxDataSize
         //
         MaxDataSize = PcdGet32 (PcdMaxVariableSize) - DataOffset;
 
         if ((CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) &&
-            ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || 
(StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))) ||
-            (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp 
(VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0))) {
+            ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || 
(StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0) ||
+             (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE2) == 0))) ||
+             (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp 
(VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0))) {
           //
           // For variables with formatted as EFI_SIGNATURE_LIST, the driver 
shall not perform an append of
           // EFI_SIGNATURE_DATA values that are already part of the existing 
variable value.
           //
           Status = AppendSignatureList (
                      BufferForMerge,
-                     Variable->CurrPtr->DataSize, 
+                     Variable->CurrPtr->DataSize,
                      MaxDataSize - Variable->CurrPtr->DataSize,
                      Data,
                      DataSize,
@@ -2530,8 +2531,8 @@
 /**
   Check if a Unicode character is a hexadecimal character.
 
-  This function checks if a Unicode character is a 
-  hexadecimal character.  The valid hexadecimal character is 
+  This function checks if a Unicode character is a
+  hexadecimal character.  The valid hexadecimal character is
   L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
 
 
@@ -2701,7 +2702,7 @@
 
   @retval TRUE      This variable is read-only variable.
   @retval FALSE     This variable is NOT read-only variable.
-  
+
 **/
 BOOLEAN
 IsReadOnlyVariable (
@@ -2722,7 +2723,7 @@
       return TRUE;
     }
   }
-  
+
   return FALSE;
 }
 
@@ -3077,8 +3078,8 @@
 
   if ((UINTN)(~0) - PayloadSize < StrSize(VariableName)){
     //
-    // Prevent whole variable size overflow 
-    // 
+    // Prevent whole variable size overflow
+    //
     return EFI_INVALID_PARAMETER;
   }
 
@@ -3184,8 +3185,9 @@
     Status = ProcessVarWithPk (VariableName, VendorGuid, Data, DataSize, 
&Variable, Attributes, TRUE);
   } else if (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp 
(VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0)) {
     Status = ProcessVarWithPk (VariableName, VendorGuid, Data, DataSize, 
&Variable, Attributes, FALSE);
-  } else if (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) && 
-          ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || 
(StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))) {
+  } else if (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) &&
+          ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || 
(StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))
+           || (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE2)) == 0) {
     Status = ProcessVarWithPk (VariableName, VendorGuid, Data, DataSize, 
&Variable, Attributes, FALSE);
     if (EFI_ERROR (Status)) {
       Status = ProcessVarWithKek (VariableName, VendorGuid, Data, DataSize, 
&Variable, Attributes);
@@ -3937,4 +3939,3 @@
 
   return Status;
 }
-

Modified: 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
===================================================================
--- 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
       2014-11-14 00:39:04 UTC (rev 16379)
+++ 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
       2014-11-14 08:41:12 UTC (rev 16380)
@@ -1,13 +1,13 @@
 /** @file
   VFR file used by the SecureBoot configuration component.
 
-Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials 
-are licensed and made available under the terms and conditions of the BSD 
License 
-which accompanies this distribution.  The full text of the license may be 
found at 
+Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
@@ -24,7 +24,7 @@
     varid = SECUREBOOT_CONFIGURATION_VARSTORE_ID,
     name  = SECUREBOOT_CONFIGURATION,
     guid  = SECUREBOOT_CONFIG_FORM_SET_GUID;
-  
+
   //
   // ##1 Form "Secure Boot Configuration"
   //
@@ -37,7 +37,7 @@
       help   = STRING_TOKEN(STR_SECURE_BOOT_STATE_HELP),
       text   = STRING_TOKEN(STR_SECURE_BOOT_STATE_PROMPT),
         text   = STRING_TOKEN(STR_SECURE_BOOT_STATE_CONTENT);
-        
+
     //
     // Define of Check Box: Attempt Secure Boot
     //
@@ -48,8 +48,8 @@
               help     = STRING_TOKEN(STR_NULL),
               flags    = INTERACTIVE,
       endcheckbox;
-    endif;  
-    
+    endif;
+
     //
     // Display of Check Box: Attempt Secure Boot
     //
@@ -61,7 +61,7 @@
           flags  = INTERACTIVE | RESET_REQUIRED,
     endcheckbox;
     endif;
-    
+
     //
     // Display of Oneof: 'Secure Boot Mode'
     //
@@ -75,14 +75,14 @@
       endoneof;
     endif;
       oneof name = SecureBootMode,
-            questionid = KEY_SECURE_BOOT_MODE,      
+            questionid = KEY_SECURE_BOOT_MODE,
             prompt = STRING_TOKEN(STR_SECURE_BOOT_MODE_PROMPT),
             help   = STRING_TOKEN(STR_SECURE_BOOT_MODE_HELP),
             flags  = INTERACTIVE | NUMERIC_SIZE_1,
             option text = STRING_TOKEN(STR_STANDARD_MODE),    value = 
SECURE_BOOT_MODE_STANDARD, flags = DEFAULT;
             option text = STRING_TOKEN(STR_CUSTOM_MODE),      value = 
SECURE_BOOT_MODE_CUSTOM,   flags = 0;
       endoneof;
-    
+
     //
     //
     // Display of 'Current Secure Boot Mode'
@@ -97,55 +97,63 @@
       endif;
     endif;
   endform;
-  
+
   //
   // ##2 Form: 'Custom Secure Boot Options'
   //
   form formid = FORMID_SECURE_BOOT_OPTION_FORM,
     title  = STRING_TOKEN(STR_SECURE_BOOT_OPTION_TITLE);
-    
+
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
     goto FORMID_SECURE_BOOT_PK_OPTION_FORM,
          prompt = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION),
          help   = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION_HELP),
          flags  = INTERACTIVE,
          key    = KEY_SECURE_BOOT_PK_OPTION;
-        
+
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
     goto FORMID_SECURE_BOOT_KEK_OPTION_FORM,
          prompt = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION),
          help   = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION_HELP),
          flags  = INTERACTIVE,
          key    = KEY_SECURE_BOOT_KEK_OPTION;
-        
+
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
     goto FORMID_SECURE_BOOT_DB_OPTION_FORM,
          prompt = STRING_TOKEN(STR_SECURE_BOOT_DB_OPTION),
          help   = STRING_TOKEN(STR_SECURE_BOOT_DB_OPTION_HELP),
          flags  = INTERACTIVE,
          key    = KEY_SECURE_BOOT_DB_OPTION;
-    
+
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
     goto FORMID_SECURE_BOOT_DBX_OPTION_FORM,
          prompt = STRING_TOKEN(STR_SECURE_BOOT_DBX_OPTION),
          help   = STRING_TOKEN(STR_SECURE_BOOT_DBX_OPTION_HELP),
          flags  = INTERACTIVE,
          key    = KEY_SECURE_BOOT_DBX_OPTION;
 
+    subtitle text = STRING_TOKEN(STR_NULL);
+
+    goto FORMID_SECURE_BOOT_DBT_OPTION_FORM,
+         prompt = STRING_TOKEN(STR_SECURE_BOOT_DBT_OPTION),
+         help   = STRING_TOKEN(STR_SECURE_BOOT_DBT_OPTION_HELP),
+         flags  = INTERACTIVE,
+         key    = KEY_SECURE_BOOT_DBT_OPTION;
+
   endform;
-  
+
   //
   // ##3 Form: 'PK Options'
   //
   form formid = FORMID_SECURE_BOOT_PK_OPTION_FORM,
     title  = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION);
-    
+
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
     //
     // Define of Check Box: 'Delete PK'
     //
@@ -155,7 +163,7 @@
                help     = STRING_TOKEN(STR_NULL),
       endcheckbox;
     endif;
-    
+
     grayoutif ideqval SECUREBOOT_CONFIGURATION.HasPk == 1;
     goto FORMID_ENROLL_PK_FORM,
          prompt = STRING_TOKEN(STR_ENROLL_PK),
@@ -163,28 +171,28 @@
          flags  = INTERACTIVE,
          key    = KEY_ENROLL_PK;
     endif;
-    
+
     subtitle text = STRING_TOKEN(STR_NULL);
-   
+
     //
-    // Display of Check Box: 'Delete Pk' 
+    // Display of Check Box: 'Delete Pk'
     //
     grayoutif ideqval SECUREBOOT_CONFIGURATION.HideSecureBoot == 1;
     checkbox varid = SECUREBOOT_CONFIGURATION.DeletePk,
           questionid = KEY_SECURE_BOOT_DELETE_PK,
-          prompt = STRING_TOKEN(STR_DELETE_PK),          
+          prompt = STRING_TOKEN(STR_DELETE_PK),
           help   = STRING_TOKEN(STR_DELETE_PK_HELP),
           flags  = INTERACTIVE | RESET_REQUIRED,
     endcheckbox;
     endif;
   endform;
-  
+
   //
   // ##4 Form: 'Enroll PK'
   //
   form formid = FORMID_ENROLL_PK_FORM,
     title  = STRING_TOKEN(STR_ENROLL_PK);
-    
+
     subtitle text = STRING_TOKEN(STR_NULL);
 
     goto FORM_FILE_EXPLORER_ID_PK,
@@ -193,7 +201,7 @@
          flags = INTERACTIVE,
          key = SECUREBOOT_ADD_PK_FILE_FORM_ID;
   endform;
-  
+
   //
   // ##5 Form: 'KEK Options'
   //
@@ -201,29 +209,29 @@
     title  = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION);
 
     //
-    // Display of 'Enroll KEK' 
+    // Display of 'Enroll KEK'
     //
     goto FORMID_ENROLL_KEK_FORM,
          prompt = STRING_TOKEN(STR_ENROLL_KEK),
          help   = STRING_TOKEN(STR_ENROLL_KEK_HELP),
          flags  = INTERACTIVE;
-    
-    subtitle text = STRING_TOKEN(STR_NULL);     
-   
+
+    subtitle text = STRING_TOKEN(STR_NULL);
+
     //
-    // Display of 'Delete KEK' 
+    // Display of 'Delete KEK'
     //
     goto FORMID_DELETE_KEK_FORM,
          prompt = STRING_TOKEN(STR_DELETE_KEK),
          help   = STRING_TOKEN(STR_DELETE_KEK_HELP),
          flags  = INTERACTIVE,
          key    = KEY_DELETE_KEK;
-  
-    subtitle text = STRING_TOKEN(STR_NULL);    
+
+    subtitle text = STRING_TOKEN(STR_NULL);
   endform;
 
   //
-  // ##6 Form: 'Enroll KEK' 
+  // ##6 Form: 'Enroll KEK'
   //
   form formid = FORMID_ENROLL_KEK_FORM,
     title = STRING_TOKEN(STR_ENROLL_KEK_TITLE);
@@ -258,7 +266,7 @@
       help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
       flags  = INTERACTIVE,
       key    = KEY_VALUE_SAVE_AND_EXIT_KEK;
- 
+
     goto FORMID_SECURE_BOOT_OPTION_FORM,
       prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
       help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
@@ -269,15 +277,15 @@
 
   //
   // ##7 Form: 'Delete KEK'
-  //  
+  //
   form formid = FORMID_DELETE_KEK_FORM,
     title  = STRING_TOKEN(STR_DELETE_KEK_TITLE);
 
     label LABEL_KEK_DELETE;
     label LABEL_END;
-         
+
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
   endform;
 
   //
@@ -300,7 +308,7 @@
     help   = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
     flags  = INTERACTIVE,
     key    = SECUREBOOT_DELETE_SIGNATURE_FROM_DB;
-    
+
   endform;
 
   //
@@ -327,6 +335,29 @@
   endform;
 
   //
+  // ##9 Form: 'DBT Options'
+  //
+  form formid = FORMID_SECURE_BOOT_DBT_OPTION_FORM,
+    title = STRING_TOKEN(STR_SECURE_BOOT_DBT_OPTION);
+
+    subtitle text = STRING_TOKEN(STR_NULL);
+
+    goto SECUREBOOT_ENROLL_SIGNATURE_TO_DBT,
+    prompt = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
+    help   = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
+    flags  = 0;
+
+    subtitle text = STRING_TOKEN(STR_NULL);
+
+    goto SECUREBOOT_DELETE_SIGNATURE_FROM_DBT,
+    prompt = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
+    help   = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
+    flags  = INTERACTIVE,
+    key    = SECUREBOOT_DELETE_SIGNATURE_FROM_DBT;
+
+  endform;
+
+  //
   // Form: 'Delete Signature' for DB Options.
   //
   form formid = SECUREBOOT_DELETE_SIGNATURE_FROM_DB,
@@ -335,7 +366,7 @@
     label LABEL_DB_DELETE;
     label LABEL_END;
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
   endform;
 
   //
@@ -347,10 +378,22 @@
     label LABEL_DBX_DELETE;
     label LABEL_END;
     subtitle text = STRING_TOKEN(STR_NULL);
-    
+
   endform;
 
   //
+  // Form: 'Delete Signature' for DBT Options.
+  //
+  form formid = SECUREBOOT_DELETE_SIGNATURE_FROM_DBT,
+    title  = STRING_TOKEN(STR_SECURE_BOOT_DELETE_SIGNATURE);
+
+    label LABEL_DBT_DELETE;
+    label LABEL_END;
+    subtitle text = STRING_TOKEN(STR_NULL);
+
+  endform;
+
+  //
   // Form: 'Enroll Signature' for DB options.
   //
   form formid = SECUREBOOT_ENROLL_SIGNATURE_TO_DB,
@@ -386,7 +429,7 @@
          help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
          flags  = INTERACTIVE,
          key    = KEY_VALUE_SAVE_AND_EXIT_DB;
- 
+
     goto FORMID_SECURE_BOOT_OPTION_FORM,
          prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
          help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
@@ -409,7 +452,6 @@
          flags = INTERACTIVE,
          key = SECUREBOOT_ENROLL_SIGNATURE_TO_DBX;
 
-    subtitle text = STRING_TOKEN(STR_NULL);
     label SECUREBOOT_ENROLL_SIGNATURE_TO_DBX;
     label LABEL_END;
     subtitle text = STRING_TOKEN(STR_NULL);
@@ -423,6 +465,38 @@
             maxsize = SECURE_BOOT_GUID_SIZE,
     endstring;
 
+    oneof name = SignatureFormatInDbx,
+          varid       = SECUREBOOT_CONFIGURATION.CertificateFormat,
+          prompt      = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_PROMPT),
+          help        = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_HELP),
+          option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_SHA256), value 
= 0x2, flags = DEFAULT;
+          option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_SHA384), value 
= 0x3, flags = 0;
+          option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_SHA512), value 
= 0x4, flags = 0;
+          option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_RAW), value = 
0x5, flags = 0;
+    endoneof;
+
+    suppressif ideqval SECUREBOOT_CONFIGURATION.CertificateFormat == 5;
+        checkbox varid  = SECUREBOOT_CONFIGURATION.AlwaysRevocation,
+               prompt = STRING_TOKEN(STR_ALWAYS_CERTIFICATE_REVOCATION_PROMPT),
+               help   = STRING_TOKEN(STR_ALWAYS_CERTIFICATE_REVOCATION_HELP),
+               flags  = INTERACTIVE,
+        endcheckbox;
+
+        suppressif ideqval SECUREBOOT_CONFIGURATION.AlwaysRevocation == 1;
+            date  varid  = SECUREBOOT_CONFIGURATION.RevocationDate,
+                  prompt = 
STRING_TOKEN(STR_CERTIFICATE_REVOCATION_DATE_PROMPT),
+                  help   = STRING_TOKEN(STR_CERTIFICATE_REVOCATION_DATE_HELP),
+                  flags  = STORAGE_NORMAL,
+            enddate;
+
+            time varid   = SECUREBOOT_CONFIGURATION.RevocationTime,
+                 prompt  = 
STRING_TOKEN(STR_CERTIFICATE_REVOCATION_TIME_PROMPT),
+                 help    = STRING_TOKEN(STR_CERTIFICATE_REVOCATION_TIME_HELP),
+                 flags   = STORAGE_NORMAL,
+            endtime;
+        endif;
+    endif;
+
     subtitle text = STRING_TOKEN(STR_NULL);
     subtitle text = STRING_TOKEN(STR_NULL);
 
@@ -431,7 +505,7 @@
          help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
          flags  = INTERACTIVE,
          key    = KEY_VALUE_SAVE_AND_EXIT_DBX;
- 
+
     goto FORMID_SECURE_BOOT_OPTION_FORM,
          prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
          help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
@@ -441,6 +515,51 @@
   endform;
 
   //
+  // Form: 'Enroll Signature' for DBT options.
+  //
+  form formid = SECUREBOOT_ENROLL_SIGNATURE_TO_DBT,
+    title = STRING_TOKEN(STR_SECURE_BOOT_ENROLL_SIGNATURE);
+
+    subtitle text = STRING_TOKEN(STR_NULL);
+
+    goto FORM_FILE_EXPLORER_ID_DBT,
+         prompt = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
+         help = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
+         flags = INTERACTIVE,
+         key = SECUREBOOT_ENROLL_SIGNATURE_TO_DBT;
+
+    subtitle text = STRING_TOKEN(STR_NULL);
+    label SECUREBOOT_ENROLL_SIGNATURE_TO_DBT;
+    label LABEL_END;
+    subtitle text = STRING_TOKEN(STR_NULL);
+
+    string  varid   = SECUREBOOT_CONFIGURATION.SignatureGuid,
+            prompt  = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID),
+            help    = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID_HELP),
+            flags   = INTERACTIVE,
+            key     = KEY_SECURE_BOOT_SIGNATURE_GUID_DBT,
+            minsize = SECURE_BOOT_GUID_SIZE,
+            maxsize = SECURE_BOOT_GUID_SIZE,
+    endstring;
+
+    subtitle text = STRING_TOKEN(STR_NULL);
+    subtitle text = STRING_TOKEN(STR_NULL);
+
+    goto FORMID_SECURE_BOOT_OPTION_FORM,
+         prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
+         help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
+         flags  = INTERACTIVE,
+         key    = KEY_VALUE_SAVE_AND_EXIT_DBT;
+
+    goto FORMID_SECURE_BOOT_OPTION_FORM,
+         prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
+         help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
+         flags  = INTERACTIVE,
+         key    = KEY_VALUE_NO_SAVE_AND_EXIT_DBT;
+
+  endform;
+
+  //
   // File Explorer for PK
   //
   form formid = FORM_FILE_EXPLORER_ID_PK,
@@ -449,7 +568,7 @@
        label FORM_FILE_EXPLORER_ID;
        label LABEL_END;
   endform;
-  
+
   //
   // File Explorer for KEK
   //
@@ -480,7 +599,16 @@
        label LABEL_END;
   endform;
 
+  //
+  // File Explorer for DBT
+  //
+  form formid = FORM_FILE_EXPLORER_ID_DBT,
+       title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE);
 
+       label FORM_FILE_EXPLORER_ID;
+       label LABEL_END;
+  endform;
+
   //
   // Enroll Pk from File Commit Form
   //
@@ -489,21 +617,23 @@
 
     label SECUREBOOT_ADD_PK_FILE_FORM_ID;
     label LABEL_END;
-    
+
     subtitle text = STRING_TOKEN(STR_NULL);
 
      text
        help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
        text   = STRING_TOKEN(STR_SAVE_AND_EXIT),
+       text   = STRING_TOKEN(STR_NULL),
        flags  = INTERACTIVE,
        key    = KEY_VALUE_SAVE_AND_EXIT_PK;
 
      text
        help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
        text   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
+       text   = STRING_TOKEN(STR_NULL),
        flags  = INTERACTIVE,
        key    = KEY_VALUE_NO_SAVE_AND_EXIT_PK;
 
   endform;
 
-endformset;
+endformset;
\ No newline at end of file

Modified: 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
===================================================================
--- 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
    2014-11-14 00:39:04 UTC (rev 16379)
+++ 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
    2014-11-14 08:41:12 UTC (rev 16380)
@@ -62,40 +62,40 @@
   ## SOMETIMES_CONSUMES      ## Variable:L"CustomMode"
   ## SOMETIMES_PRODUCES      ## Variable:L"CustomMode"
   gEfiCustomModeEnableGuid
-    
+
   ## SOMETIMES_CONSUMES      ## Variable:L"SecureBootEnable"
   ## SOMETIMES_PRODUCES      ## Variable:L"SecureBootEnable"
   gEfiSecureBootEnableDisableGuid
-  
+
   ## SOMETIMES_CONSUMES      ## GUID            # Unique ID for the type of 
the signature.
   ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of 
the signature.
   gEfiCertRsa2048Guid
-  
+
   ## SOMETIMES_CONSUMES      ## GUID            # Unique ID for the type of 
the signature.
-  ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of 
the signature.                               
+  ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of 
the signature.
   gEfiCertX509Guid
-  
+
   ## SOMETIMES_CONSUMES      ## GUID            # Unique ID for the type of 
the signature.
-  ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of 
the signature.   
+  ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of 
the signature.
   gEfiCertSha1Guid
-  
+
   ## SOMETIMES_CONSUMES      ## GUID            # Unique ID for the type of 
the signature.
-  ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of 
the signature.   
+  ## SOMETIMES_PRODUCES      ## GUID            # Unique ID for the type of 
the signature.
   gEfiCertSha256Guid
-  
+
   ## SOMETIMES_CONSUMES      ## Variable:L"db"
   ## SOMETIMES_PRODUCES      ## Variable:L"db"
   ## SOMETIMES_CONSUMES      ## Variable:L"dbx"
   ## SOMETIMES_PRODUCES      ## Variable:L"dbx"
   gEfiImageSecurityDatabaseGuid
-    
+
   ## SOMETIMES_CONSUMES      ## Variable:L"SetupMode"
   ## SOMETIMES_PRODUCES      ## Variable:L"PK"
   ## SOMETIMES_CONSUMES      ## Variable:L"KEK"
   ## SOMETIMES_PRODUCES      ## Variable:L"KEK"
   ## SOMETIMES_CONSUMES      ## Variable:L"SecureBoot"
   gEfiGlobalVariableGuid
-  
+
   gEfiIfrTianoGuid                              ## PRODUCES            ## GUID 
      # HII opcode
   ## PRODUCES                ## HII
   ## CONSUMES                ## HII
@@ -105,6 +105,10 @@
   gEfiFileSystemVolumeLabelInfoIdGuid           ## SOMETIMES_CONSUMES  ## GUID 
 # Indicate the information type
   gEfiFileInfoGuid                              ## SOMETIMES_CONSUMES  ## GUID 
 # Indicate the information type
 
+  gEfiCertX509Sha256Guid                        ## SOMETIMES_PRODUCES  ## GUID 
 # Unique ID for the type of the certificate.
+  gEfiCertX509Sha384Guid                        ## SOMETIMES_PRODUCES  ## GUID 
 # Unique ID for the type of the certificate.
+  gEfiCertX509Sha512Guid                        ## SOMETIMES_PRODUCES  ## GUID 
 # Unique ID for the type of the certificate.
+
 [Protocols]
   gEfiHiiConfigAccessProtocolGuid               ## PRODUCES
   gEfiDevicePathProtocolGuid                    ## PRODUCES
@@ -119,4 +123,3 @@
 
 [UserExtensions.TianoCore."ExtraFiles"]
   SecureBootConfigDxeExtra.uni
-  
\ No newline at end of file

Modified: 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
===================================================================
--- 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
     2014-11-14 00:39:04 UTC (rev 16379)
+++ 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
     2014-11-14 08:41:12 UTC (rev 16380)
@@ -65,7 +65,7 @@
 }
 
 /**
-  Helper function called as part of the code needed to allocate 
+  Helper function called as part of the code needed to allocate
   the proper sized buffer for various EFI interfaces.
 
   @param[in, out]   Status          Current status
@@ -122,7 +122,7 @@
 }
 
 /**
-  Append file name to existing file name, and allocate a new buffer 
+  Append file name to existing file name, and allocate a new buffer
   to hold the appended result.
 
   @param[in]  Str1  The existing file name
@@ -149,7 +149,7 @@
   Str   = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));
   ASSERT (Str != NULL);
 
-  TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16)); 
+  TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));
   ASSERT (TmpStr != NULL);
 
   StrCat (Str, Str1);
@@ -170,7 +170,7 @@
       //
 
       //
-      // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of 
two strings 
+      // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of 
two strings
       // that overlap.
       //
       StrCpy (TmpStr, Ptr + 3);
@@ -182,7 +182,7 @@
       //
 
       //
-      // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of 
two strings 
+      // Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of 
two strings
       // that overlap.
       //
       StrCpy (TmpStr, Ptr + 2);
@@ -196,7 +196,7 @@
   }
 
   FreePool (TmpStr);
-  
+
   return Str;
 }
 
@@ -354,7 +354,7 @@
   Free resources allocated in Allocate Rountine.
 
   @param[in, out]  MenuOption        Menu to be freed
-  
+
 **/
 VOID
 FreeMenu (
@@ -459,7 +459,7 @@
   This function opens a file with the open mode according to the file path. The
   Attributes is valid only for EFI_FILE_MODE_CREATE.
 
-  @param[in, out]  FilePath        On input, the device path to the file.  
+  @param[in, out]  FilePath        On input, the device path to the file.
                                    On output, the remaining device path.
   @param[out]      FileHandle      Pointer to the file handle.
   @param[in]       OpenMode        The mode to open the file with.
@@ -495,7 +495,7 @@
   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *EfiSimpleFileSystemProtocol;
   EFI_FILE_PROTOCOL               *Handle1;
   EFI_FILE_PROTOCOL               *Handle2;
-  EFI_HANDLE                      DeviceHandle; 
+  EFI_HANDLE                      DeviceHandle;
 
   if ((FilePath == NULL || FileHandle == NULL)) {
     return EFI_INVALID_PARAMETER;
@@ -816,7 +816,7 @@
   if (NoSimpleFsHandles != 0) {
     FreePool (SimpleFsHandle);
   }
-  
+
   //
   // Remember how many file system options are here
   //
@@ -826,7 +826,7 @@
 
 
 /**
-  Find files under the current directory. All files and sub-directories 
+  Find files under the current directory. All files and sub-directories
   in current directory will be stored in DirectoryMenu for future use.
 
   @param[in] MenuEntry     The Menu Entry.
@@ -892,7 +892,7 @@
   if (DirInfo == NULL) {
     return EFI_OUT_OF_RESOURCES;
   }
-  
+
   //
   // Get all files in current directory
   // Pass 1 to get Directories
@@ -934,7 +934,7 @@
                                     NewFileContext->FileName
                                     );
       NewMenuEntry->HelpString = NULL;
-      
+
       NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & 
EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);
       if (NewFileContext->IsDir) {
         BufferSize = StrLen (DirInfo->FileName) * 2 + 6;
@@ -977,7 +977,7 @@
 {
   //
   // Free current updated date
-  //  
+  //
   if (mStartOpCodeHandle != NULL) {
     HiiFreeOpCodeHandle (mStartOpCodeHandle);
   }
@@ -1032,6 +1032,9 @@
   } else if (FeCurrentState == FileExplorerStateEnrollSignatureFileToDbx) {
     FormId     = SECUREBOOT_ENROLL_SIGNATURE_TO_DBX;
     FileFormId = FORM_FILE_EXPLORER_ID_DBX;
+  } else if (FeCurrentState == FileExplorerStateEnrollSignatureFileToDbt) {
+    FormId     = SECUREBOOT_ENROLL_SIGNATURE_TO_DBT;
+    FileFormId = FORM_FILE_EXPLORER_ID_DBT;
   } else {
     return;
   }
@@ -1118,7 +1121,7 @@
     //
     FreeMenu (&FsOptionMenu);
     FindFileSystem ();
-    
+
     CreateMenuStringToken (PrivateData->HiiHandle, &FsOptionMenu);
     UpdateFileExplorePage (PrivateData->HiiHandle, &FsOptionMenu, 
PrivateData->FeCurrentState);
 
@@ -1156,13 +1159,15 @@
         FormId = SECUREBOOT_ENROLL_SIGNATURE_TO_DB;
       } else if (PrivateData->FeCurrentState == 
FileExplorerStateEnrollSignatureFileToDbx) {
         FormId = SECUREBOOT_ENROLL_SIGNATURE_TO_DBX;
+      } else if (PrivateData->FeCurrentState == 
FileExplorerStateEnrollSignatureFileToDbt) {
+        FormId = SECUREBOOT_ENROLL_SIGNATURE_TO_DBT;
       } else {
         return FALSE;
       }
 
       PrivateData->MenuEntry = NewMenuEntry;
       PrivateData->FileContext->FileName = NewFileContext->FileName;
-      
+
       TmpDevicePath = NewFileContext->DevicePath;
       OpenFileByDevicePath (
         &TmpDevicePath,
@@ -1200,7 +1205,7 @@
 }
 
 /**
-  Clean up the dynamic opcode at label and form specified by both LabelId. 
+  Clean up the dynamic opcode at label and form specified by both LabelId.
 
   @param[in] LabelId         It is both the Form ID and Label ID for opcode 
deletion.
   @param[in] PrivateData     Module private data.
@@ -1226,4 +1231,3 @@
     mEndOpCodeHandle    // LABEL_END
     );
 }
-

Modified: 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
===================================================================
--- 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
     2014-11-14 00:39:04 UTC (rev 16379)
+++ 
trunk/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
     2014-11-14 08:41:12 UTC (rev 16380)
@@ -17,7 +17,7 @@
 CHAR16              mSecureBootStorageName[] = L"SECUREBOOT_CONFIGURATION";
 
 SECUREBOOT_CONFIG_PRIVATE_DATA         mSecureBootConfigPrivateDateTemplate = {
-  SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE,  
+  SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE,
   {
     SecureBootExtractConfig,
     SecureBootRouteConfig,
@@ -63,16 +63,16 @@
   };
 
 HASH_TABLE mHash[] = {
-  { L"SHA1",   20, &mHashOidValue[8],  5, Sha1GetContextSize,  Sha1Init,   
Sha1Update,    Sha1Final  },
-  { L"SHA224", 28, &mHashOidValue[13], 9, NULL,                NULL,       
NULL,          NULL       },
-  { L"SHA256", 32, &mHashOidValue[22], 9, Sha256GetContextSize,Sha256Init, 
Sha256Update,  Sha256Final},

@@ Diff output truncated at 100000 characters. @@

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to