]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: TcgDxe,Tcg2Dxe,TrEEDxe: New PCD for TCG event log and TCG2 final event...
authorChao Zhang <chao.b.zhang@intel.com>
Tue, 12 Jan 2016 00:37:02 +0000 (00:37 +0000)
committerczhang46 <czhang46@Edk2>
Tue, 12 Jan 2016 00:37:02 +0000 (00:37 +0000)
TCG event log and TCG2 final event log area length can be configurable to meet platform event log
requirement.
PcdTcgLogAreaMinLen    : 0x10000  based on minimum requirement in TCG ACPI Spec 00.37
PcdTcg2FinalLogAreaLen : 0x8000   based on experience value

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19639 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/SecurityPkg.dec
SecurityPkg/SecurityPkg.uni
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
SecurityPkg/Tcg/TcgDxe/TcgDxe.c
SecurityPkg/Tcg/TcgDxe/TcgDxe.inf
SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf

index d568b4757a0bd01325ee564f5e112198eb3bf708..b5f4eb75f2d147acc951fe5de5366140ee830e45 100644 (file)
@@ -5,7 +5,7 @@
 #  It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and library classes)\r
 #  and libraries instances, which are used for those features.\r
 #\r
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # (C) Copyright 2015 Hewlett Packard Enterprise Development LP <BR>\r
 # This program and the accompanying materials are licensed and made available under\r
 # the terms and conditions of the BSD License which accompanies this distribution.\r
   #\r
   gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer|{0x91, 0x29, 0xc4, 0xbd, 0xea, 0x6d, 0xda, 0xb3, 0xaa, 0x6f, 0x50, 0x16, 0xfc, 0xdb, 0x4b, 0x7e, 0x3c, 0xd6, 0xdc, 0xa4, 0x7a, 0x0e, 0xdd, 0xe6, 0x15, 0x8c, 0x73, 0x96, 0xa2, 0xd4, 0xa6, 0x4d}|VOID*|0x00010013\r
 \r
+  ## This PCD defines minimum length(in bytes) of the system preboot TCG event log area(LAML).\r
+  #  For PC Client Implementation spec up to and including 1.2 the minimum log size is 64KB.\r
+  # @Prompt Minimum length(in bytes) of the system preboot TCG event log area(LAML).\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgLogAreaMinLen|0x10000|UINT32|0x00010017\r
+\r
+  ## This PCD defines length(in bytes) of the TCG2 Final event log area.\r
+  # @Prompt Length(in bytes) of the TCG2 Final event log area.\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcg2FinalLogAreaLen|0x8000|UINT32|0x00010018\r
+\r
 [PcdsDynamic, PcdsDynamicEx]\r
 \r
   ## This PCD indicates Hash mask for TPM 2.0.<BR><BR>\r
index 91fff94cc91e4639a43be3b8a59d8aaef8be0180..5fcd3f93c26fe8784e96a11bfa23c02f2f7d2401 100644 (file)
@@ -5,7 +5,7 @@
 // It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and library classes)\r
 // and libraries instances, which are used for those features.\r
 //\r
-// Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 //\r
 // This program and the accompanying materials are licensed and made available under\r
 // the terms and conditions of the BSD License which accompanies this distribution.\r
                                                                                            "Bios may choose to register a subset of PcdTpm2HashMask.\n"\r
                                                                                            "So this PCD is final value of how many hash algo is extended to PCR."\r
 \r
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcgLogAreaMinLen_PROMPT  #language en-US "Minimum length(in bytes) of the system preboot TCG event log area(LAML)."\r
+\r
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcgLogAreaMinLen_HELP  #language en-US "This PCD defines minimum length(in bytes) of the system preboot TCG event log area(LAML).\n"\r
+                                                                                    "For PC Client Implementation spec up to and including 1.2 the minimum log size is 64KB."\r
+\r
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcg2FinalLogAreaLen_PROMPT  #language en-US "Length(in bytes) of the TCG2 Final event log area."\r
+\r
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcg2FinalLogAreaLen_HELP  #language en-US "This PCD defines length(in bytes) of the TCG2 Final event log area."\r
+\r
index ae5e0841c256be22ffaf190e307e01b90678f65e..f0dbbac5b1dd5fb7ce12936803e4c37ef2324c4a 100644 (file)
@@ -56,9 +56,6 @@ typedef struct {
   EFI_GUID                               *VendorGuid;\r
 } VARIABLE_TYPE;\r
 \r
-#define  EFI_TCG_LOG_AREA_SIZE        0x10000\r
-#define  EFI_TCG_FINAL_LOG_AREA_SIZE  0x1000\r
-\r
 #define  TCG2_DEFAULT_MAX_COMMAND_SIZE        0x1000\r
 #define  TCG2_DEFAULT_MAX_RESPONSE_SIZE       0x1000\r
 \r
@@ -1470,19 +1467,19 @@ SetupEventLog (
       Status = gBS->AllocatePages (\r
                       AllocateMaxAddress,\r
                       EfiACPIMemoryNVS,\r
-                      EFI_SIZE_TO_PAGES (EFI_TCG_LOG_AREA_SIZE),\r
+                      EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcgLogAreaMinLen)),\r
                       &Lasa\r
                       );\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
       mTcgDxeData.EventLogAreaStruct[Index].Lasa = Lasa;\r
-      mTcgDxeData.EventLogAreaStruct[Index].Laml = EFI_TCG_LOG_AREA_SIZE;\r
+      mTcgDxeData.EventLogAreaStruct[Index].Laml = PcdGet32 (PcdTcgLogAreaMinLen);\r
       //\r
       // To initialize them as 0xFF is recommended \r
       // because the OS can know the last entry for that.\r
       //\r
-      SetMem ((VOID *)(UINTN)Lasa, EFI_TCG_LOG_AREA_SIZE, 0xFF);\r
+      SetMem ((VOID *)(UINTN)Lasa, PcdGet32 (PcdTcgLogAreaMinLen), 0xFF);\r
       //\r
       // Create first entry for Log Header Entry Data\r
       //\r
@@ -1571,13 +1568,13 @@ SetupEventLog (
       Status = gBS->AllocatePages (\r
                       AllocateMaxAddress,\r
                       EfiACPIMemoryNVS,\r
-                      EFI_SIZE_TO_PAGES (EFI_TCG_FINAL_LOG_AREA_SIZE),\r
+                      EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcg2FinalLogAreaLen)),\r
                       &Lasa\r
                       );\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
-      SetMem ((VOID *)(UINTN)Lasa, EFI_TCG_FINAL_LOG_AREA_SIZE, 0xFF);\r
+      SetMem ((VOID *)(UINTN)Lasa, PcdGet32 (PcdTcg2FinalLogAreaLen), 0xFF);\r
 \r
       //\r
       // Initialize\r
@@ -1588,7 +1585,7 @@ SetupEventLog (
 \r
       mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogFormat = mTcg2EventInfo[Index].LogFormat;\r
       mTcgDxeData.FinalEventLogAreaStruct[Index].Lasa = Lasa + sizeof(EFI_TCG2_FINAL_EVENTS_TABLE);\r
-      mTcgDxeData.FinalEventLogAreaStruct[Index].Laml = EFI_TCG_FINAL_LOG_AREA_SIZE - sizeof(EFI_TCG2_FINAL_EVENTS_TABLE);\r
+      mTcgDxeData.FinalEventLogAreaStruct[Index].Laml = PcdGet32 (PcdTcg2FinalLogAreaLen) - sizeof(EFI_TCG2_FINAL_EVENTS_TABLE);\r
       mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogSize = 0;\r
       mTcgDxeData.FinalEventLogAreaStruct[Index].LastEvent = (VOID *)(UINTN)mTcgDxeData.FinalEventLogAreaStruct[Index].Lasa;\r
       mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogStarted = FALSE;\r
index ca6741b3ad4d9a39f14dff57301221cf8ba2e567..fd120e55383414581cf0a1384a7e0898509abc11 100644 (file)
@@ -7,7 +7,7 @@
 #  This external input must be validated carefully to avoid security issue like\r
 #  buffer overflow, integer overflow.\r
 #\r
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution. The full text of the license may be found at\r
   gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice              ## SOMETIMES_CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2HashAlgorithmBitmap                  ## CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2NumberOfPCRBanks                     ## CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgLogAreaMinLen                         ## CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcg2FinalLogAreaLen                      ## CONSUMES\r
 \r
 [Depex]\r
   TRUE\r
index 4e2741c0cf5fd32f9ada263e36abafa6839e1623..1e52179885c2d59e4f7d40442b93ed12186846b5 100644 (file)
@@ -53,8 +53,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "TpmComm.h"\r
 \r
-#define  EFI_TCG_LOG_AREA_SIZE        0x10000\r
-\r
 #define TCG_DXE_DATA_FROM_THIS(this)  \\r
   BASE_CR (this, TCG_DXE_DATA, TcgProtocol)\r
 \r
@@ -653,7 +651,7 @@ SetupEventLog (
     Status = gBS->AllocatePages (\r
                     AllocateMaxAddress,\r
                     EfiACPIMemoryNVS,\r
-                    EFI_SIZE_TO_PAGES (EFI_TCG_LOG_AREA_SIZE),\r
+                    EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcgLogAreaMinLen)),\r
                     &Lasa\r
                     );\r
     if (EFI_ERROR (Status)) {\r
@@ -664,8 +662,8 @@ SetupEventLog (
     // To initialize them as 0xFF is recommended \r
     // because the OS can know the last entry for that.\r
     //\r
-    SetMem ((VOID *)(UINTN)mTcgClientAcpiTemplate.Lasa, EFI_TCG_LOG_AREA_SIZE, 0xFF);\r
-    mTcgClientAcpiTemplate.Laml = EFI_TCG_LOG_AREA_SIZE;\r
+    SetMem ((VOID *)(UINTN)mTcgClientAcpiTemplate.Lasa, PcdGet32 (PcdTcgLogAreaMinLen), 0xFF);\r
+    mTcgClientAcpiTemplate.Laml = PcdGet32 (PcdTcgLogAreaMinLen);\r
   \r
   } else {\r
     Lasa = mTcgServerAcpiTemplate.Lasa;\r
@@ -673,7 +671,7 @@ SetupEventLog (
     Status = gBS->AllocatePages (\r
                     AllocateMaxAddress,\r
                     EfiACPIMemoryNVS,\r
-                    EFI_SIZE_TO_PAGES (EFI_TCG_LOG_AREA_SIZE),\r
+                    EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcgLogAreaMinLen)),\r
                     &Lasa\r
                     );\r
     if (EFI_ERROR (Status)) {\r
@@ -684,8 +682,8 @@ SetupEventLog (
     // To initialize them as 0xFF is recommended \r
     // because the OS can know the last entry for that.\r
     //\r
-    SetMem ((VOID *)(UINTN)mTcgServerAcpiTemplate.Lasa, EFI_TCG_LOG_AREA_SIZE, 0xFF);\r
-    mTcgServerAcpiTemplate.Laml = EFI_TCG_LOG_AREA_SIZE;\r
+    SetMem ((VOID *)(UINTN)mTcgServerAcpiTemplate.Lasa, PcdGet32 (PcdTcgLogAreaMinLen), 0xFF);\r
+    mTcgServerAcpiTemplate.Laml = PcdGet32 (PcdTcgLogAreaMinLen);\r
   }\r
 \r
   GuidHob.Raw = GetHobList ();\r
index 0976304883f2ca403083c490775f2266763bc5a1..e5409dfefd50e5f79298375f35b0431139c07728 100644 (file)
@@ -2,7 +2,7 @@
 #  Produces TCG protocol and measures boot environment\r
 #  This module will produce TCG protocol and measure boot environment.\r
 #\r
-# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution. The full text of the license may be found at\r
@@ -75,6 +75,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId         ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision   ## SOMETIMES_CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice   ## SOMETIMES_CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgLogAreaMinLen              ## CONSUMES\r
 \r
 [Depex]\r
   TRUE\r
index 8f344fe93efac9566e098ffeb04f5765b34315a8..dfdee046885546ef49e742011179b3d31a7663d6 100644 (file)
@@ -55,8 +55,6 @@ typedef struct {
   EFI_GUID                               *VendorGuid;\r
 } VARIABLE_TYPE;\r
 \r
-#define  EFI_TCG_LOG_AREA_SIZE        0x10000\r
-\r
 #define  TREE_DEFAULT_MAX_COMMAND_SIZE        0x1000\r
 #define  TREE_DEFAULT_MAX_RESPONSE_SIZE       0x1000\r
 \r
@@ -949,19 +947,19 @@ SetupEventLog (
       Status = gBS->AllocatePages (\r
                       AllocateMaxAddress,\r
                       EfiACPIMemoryNVS,\r
-                      EFI_SIZE_TO_PAGES (EFI_TCG_LOG_AREA_SIZE),\r
+                      EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcgLogAreaMinLen)),\r
                       &Lasa\r
                       );\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
       mTcgDxeData.EventLogAreaStruct[Index].Lasa = Lasa;\r
-      mTcgDxeData.EventLogAreaStruct[Index].Laml = EFI_TCG_LOG_AREA_SIZE;\r
+      mTcgDxeData.EventLogAreaStruct[Index].Laml = PcdGet32 (PcdTcgLogAreaMinLen);\r
       //\r
       // To initialize them as 0xFF is recommended \r
       // because the OS can know the last entry for that.\r
       //\r
-      SetMem ((VOID *)(UINTN)Lasa, EFI_TCG_LOG_AREA_SIZE, 0xFF);\r
+      SetMem ((VOID *)(UINTN)Lasa, PcdGet32 (PcdTcgLogAreaMinLen), 0xFF);\r
   }\r
 \r
   //\r
@@ -969,10 +967,10 @@ SetupEventLog (
   //\r
     if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_CLIENT) {\r
       mTcgClientAcpiTemplate.Lasa = mTcgDxeData.EventLogAreaStruct[0].Lasa;\r
-      mTcgClientAcpiTemplate.Laml = EFI_TCG_LOG_AREA_SIZE;\r
+      mTcgClientAcpiTemplate.Laml = PcdGet32 (PcdTcgLogAreaMinLen);\r
     } else {\r
       mTcgServerAcpiTemplate.Lasa = mTcgDxeData.EventLogAreaStruct[0].Lasa;\r
-      mTcgServerAcpiTemplate.Laml = EFI_TCG_LOG_AREA_SIZE;\r
+      mTcgServerAcpiTemplate.Laml = PcdGet32 (PcdTcgLogAreaMinLen);\r
     }\r
 \r
   //\r
index 258ab46db94dbe131d7b85c79ed6ddc3f4073ca5..c22e8f00045b57232c4a74bb8a4b68c0ca552966 100644 (file)
@@ -7,7 +7,7 @@
 #  This external input must be validated carefully to avoid security issue like\r
 #  buffer overflow, integer overflow.\r
 #\r
-# Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution. The full text of the license may be found at\r
@@ -94,6 +94,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId                    ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision              ## SOMETIMES_CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice              ## SOMETIMES_CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgLogAreaMinLen                         ## CONSUMES\r
 \r
 [Depex]\r
   TRUE\r