Rename Trusted Hob to Measured FV hob and add Guided Hob layout structure
authorczhang46 <czhang46@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Sep 2012 00:57:02 +0000 (00:57 +0000)
committerczhang46 <czhang46@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Sep 2012 00:57:02 +0000 (00:57 +0000)
Signed-off-by : Chao Zhang<chao.b.zhang@intel.com>
Reviewed-by   : Dong Guo  <guo.dong@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13762 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/Include/Guid/MeasuredFvHob.h [new file with mode: 0644]
SecurityPkg/Include/Guid/TrustedFvHob.h [deleted file]
SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf
SecurityPkg/SecurityPkg.dec
SecurityPkg/Tcg/TcgPei/TcgPei.c
SecurityPkg/Tcg/TcgPei/TcgPei.inf

diff --git a/SecurityPkg/Include/Guid/MeasuredFvHob.h b/SecurityPkg/Include/Guid/MeasuredFvHob.h
new file mode 100644 (file)
index 0000000..a2e6922
--- /dev/null
@@ -0,0 +1,36 @@
+/** @file\r
+  Defines the HOB GUID used to pass all PEI measured FV info to \r
+  DXE Driver.\r
+    \r
+Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution.  The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _MEASURED_FV_HOB_H_\r
+#define _MEASURED_FV_HOB_H_\r
+\r
+#include <IndustryStandard/UefiTcgPlatform.h>\r
+\r
+///\r
+/// The Global ID of a GUIDed HOB used to pass all PEI measured FV info to DXE Driver.\r
+///\r
+#define EFI_MEASURED_FV_HOB_GUID \\r
+  { \\r
+    0xb2360b42, 0x7173, 0x420a, { 0x86, 0x96, 0x46, 0xca, 0x6b, 0xab, 0x10, 0x60 } \\r
+  }\r
+\r
+extern EFI_GUID gMeasuredFvHobGuid;\r
+\r
+typedef struct {\r
+  UINT32                     Num;\r
+  EFI_PLATFORM_FIRMWARE_BLOB MeasuredFvBuf[1];\r
+} MEASURED_HOB_DATA;\r
+\r
+#endif\r
diff --git a/SecurityPkg/Include/Guid/TrustedFvHob.h b/SecurityPkg/Include/Guid/TrustedFvHob.h
deleted file mode 100644 (file)
index 3a3a607..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file\r
-  Defines the HOB GUID used to pass all PEI trusted FV info to \r
-  DXE Driver.\r
-    \r
-Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution.  The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _TRUSTED_FV_HOB_H_\r
-#define _TRUSTED_FV_HOB_H_\r
-\r
-///\r
-/// The Global ID of a GUIDed HOB used to pass all PEI trusted FV info to DXE Driver.\r
-///\r
-#define EFI_TRUSTED_FV_HOB_GUID \\r
-  { \\r
-    0xb2360b42, 0x7173, 0x420a, { 0x86, 0x96, 0x46, 0xca, 0x6b, 0xab, 0x10, 0x60 } \\r
-  }\r
-\r
-extern EFI_GUID gTrustedFvHobGuid;\r
-\r
-#endif\r
index f3e486e..eae68ea 100644 (file)
@@ -34,7 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/DevicePathToText.h>\r
 #include <Protocol/FirmwareVolumeBlock.h>\r
 \r
-#include <Guid/TrustedFvHob.h>\r
+#include <Guid/MeasuredFvHob.h>\r
 \r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -59,7 +59,7 @@ UINTN                             mImageSize;
 // Measured FV handle cache\r
 //\r
 EFI_HANDLE                        mCacheMeasuredHandle  = NULL;\r
-UINT32                            *mGuidHobData         = NULL;\r
+MEASURED_HOB_DATA                 *mMeasuredHobData     = NULL;\r
 \r
 /**\r
   Reads contents of a PE/COFF image in memory buffer.\r
@@ -740,7 +740,6 @@ DxeTpmMeasureBootHandler (
   PE_COFF_LOADER_IMAGE_CONTEXT        ImageContext;\r
   EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvbProtocol;\r
   EFI_PHYSICAL_ADDRESS                FvAddress;\r
-  EFI_PLATFORM_FIRMWARE_BLOB          *TrustedFvBuf;\r
   UINT32                              Index;\r
 \r
   Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **) &TcgProtocol);\r
@@ -848,14 +847,14 @@ DxeTpmMeasureBootHandler (
       return EFI_SUCCESS;\r
     }\r
     //\r
-    // The PE image from untrusted Firmware volume need be measured\r
-    // The PE image from trusted Firmware volume will be mearsured according to policy below.\r
-    //   if it is driver, do not measure\r
+    // The PE image from unmeasured Firmware volume need be measured\r
+    // The PE image from measured Firmware volume will be mearsured according to policy below.\r
+    //   If it is driver, do not measure\r
     //   If it is application, still measure.\r
     //\r
     ApplicationRequired = TRUE;\r
 \r
-    if (mCacheMeasuredHandle != Handle && mGuidHobData != NULL) {\r
+    if (mCacheMeasuredHandle != Handle && mMeasuredHobData != NULL) {\r
       //\r
       // Search for Root FV of this PE image\r
       //\r
@@ -877,11 +876,10 @@ DxeTpmMeasureBootHandler (
         return Status;\r
       }\r
 \r
-      TrustedFvBuf        = (EFI_PLATFORM_FIRMWARE_BLOB *)(mGuidHobData + 1);\r
       ApplicationRequired = FALSE;\r
 \r
-      for (Index = 0; Index < *mGuidHobData; Index++) {\r
-        if(TrustedFvBuf[Index].BlobBase == FvAddress) {\r
+      for (Index = 0; Index < mMeasuredHobData->Num; Index++) {\r
+        if(mMeasuredHobData->MeasuredFvBuf[Index].BlobBase == FvAddress) {\r
           //\r
           // Cache measured FV for next measurement\r
           //\r
@@ -996,10 +994,10 @@ DxeTpmMeasureBootLibConstructor (
 \r
   GuidHob = NULL;\r
 \r
-  GuidHob = GetFirstGuidHob (&gTrustedFvHobGuid);\r
+  GuidHob = GetFirstGuidHob (&gMeasuredFvHobGuid);\r
 \r
   if (GuidHob != NULL) {\r
-    mGuidHobData = GET_GUID_HOB_DATA (GuidHob);\r
+    mMeasuredHobData = GET_GUID_HOB_DATA (GuidHob);\r
   }\r
 \r
   return RegisterSecurity2Handler (\r
index 9b0e3cb..53b26b0 100644 (file)
@@ -53,7 +53,7 @@
   HobLib\r
 \r
 [Guids]\r
-  gTrustedFvHobGuid\r
+  gMeasuredFvHobGuid\r
 \r
 [Protocols]\r
   gEfiTcgProtocolGuid                   ## CONSUMES\r
index 2438f98..8bd7145 100644 (file)
@@ -47,8 +47,8 @@
   ## Include/Guid/TcgEventHob.h\r
   gTcgEventEntryHobGuid              = { 0x2e3044ac, 0x879f, 0x490f, {0x97, 0x60, 0xbb, 0xdf, 0xaf, 0x69, 0x5f, 0x50 }}\r
 \r
-  ## Include/Guid/TrustedFvHob.h\r
-  gTrustedFvHobGuid                  = { 0xb2360b42, 0x7173, 0x420a, { 0x86, 0x96, 0x46, 0xca, 0x6b, 0xab, 0x10, 0x60 }}\r
+  ## Include/Guid/MeasuredFvHob.h\r
+  gMeasuredFvHobGuid                 = { 0xb2360b42, 0x7173, 0x420a, { 0x86, 0x96, 0x46, 0xca, 0x6b, 0xab, 0x10, 0x60 }}\r
 \r
   ## Include/Guid/PhysicalPresenceData.h\r
   gEfiPhysicalPresenceGuid           = { 0xf6499b1, 0xe9ad, 0x493d, { 0xb9, 0xc2, 0x2f, 0x90, 0x81, 0x5c, 0x6c, 0xbc }}\r
index e8fd1f1..60d9192 100644 (file)
@@ -23,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Ppi/EndOfPeiPhase.h>\r
 \r
 #include <Guid/TcgEventHob.h>\r
-#include <Guid/TrustedFvHob.h>\r
+#include <Guid/MeasuredFvHob.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
@@ -148,35 +148,33 @@ EndofPeiSignalNotifyCallBack (
   IN VOID                          *Ppi\r
   )\r
 {  \r
-  UINT8 *HobData;\r
+  MEASURED_HOB_DATA *MeasuredHobData;\r
 \r
-  HobData = NULL;\r
+  MeasuredHobData = NULL;\r
 \r
   //\r
-  // Create a Guid hob to save all trusted Fv \r
+  // Create a Guid hob to save all measured Fv \r
   //\r
-  HobData = BuildGuidHob(\r
-              &gTrustedFvHobGuid,\r
-              sizeof(UINTN) + sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex + mMeasuredChildFvIndex)\r
-              );\r
+  MeasuredHobData = BuildGuidHob(\r
+                      &gMeasuredFvHobGuid,\r
+                      sizeof(UINTN) + sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex + mMeasuredChildFvIndex)\r
+                      );\r
 \r
-  if (HobData != NULL){\r
+  if (MeasuredHobData != NULL){\r
     //\r
     // Save measured FV info enty number\r
     //\r
-    *(UINT32 *)HobData = mMeasuredBaseFvIndex + mMeasuredChildFvIndex;\r
+    MeasuredHobData->Num = mMeasuredBaseFvIndex + mMeasuredChildFvIndex;\r
 \r
-    HobData += sizeof(UINT32);\r
     //\r
     // Save measured base Fv info\r
     //\r
-    CopyMem (HobData, mMeasuredBaseFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex));\r
+    CopyMem (MeasuredHobData->MeasuredFvBuf, mMeasuredBaseFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex));\r
 \r
-    HobData += sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex);\r
     //\r
     // Save measured child Fv info\r
     //\r
-    CopyMem (HobData, mMeasuredChildFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredChildFvIndex));\r
+    CopyMem (&MeasuredHobData->MeasuredFvBuf[mMeasuredBaseFvIndex] , mMeasuredChildFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredChildFvIndex));\r
   }\r
 \r
   return EFI_SUCCESS;\r
index 0143baa..48d4efc 100644 (file)
@@ -51,7 +51,7 @@
 \r
 [Guids]\r
   gTcgEventEntryHobGuid\r
-  gTrustedFvHobGuid\r
+  gMeasuredFvHobGuid\r
 \r
 [Ppis]\r
   gPeiLockPhysicalPresencePpiGuid\r