]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
Rename Trusted Hob to Measured FV hob and add Guided Hob layout structure
[mirror_edk2.git] / SecurityPkg / Library / DxeTpmMeasureBootLib / DxeTpmMeasureBootLib.c
index f3e486eadc7a97bb9d129c0ec7b40c63abe9296d..eae68eab6babb05d0059f9417e4dfc2249d144f5 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