]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg SmbiosMeasurementDxe: Skip measurement for OEM type
authorStar Zeng <star.zeng@intel.com>
Thu, 14 Sep 2017 11:24:35 +0000 (19:24 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 18 Sep 2017 02:19:40 +0000 (10:19 +0800)
The generic driver has no way to know whether an OEM type should
be filtered or not.
This patch is to update the code to skip measurement for OEM type
and platform code can measure it by self if required.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c
MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf

index bc5e7464e1339638a2305fcc19fccb3b953d7d97..4a3e99aefd0f7d45472a133e4d457bbe66720cd2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This driver measures SMBIOS table to TPM.\r
 \r
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2017, 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
@@ -277,30 +277,38 @@ FilterSmbiosEntry (
   DEBUG ((EFI_D_INFO, "Smbios Table (Type - %d):\n", ((SMBIOS_STRUCTURE *)TableEntry)->Type));\r
   DEBUG_CODE (InternalDumpHex (TableEntry, TableEntrySize););\r
 \r
-  FilterStruct = GetFilterStructByType (((SMBIOS_STRUCTURE *)TableEntry)->Type);\r
-  if (FilterStruct != NULL) {\r
-    if (FilterStruct->Filter == NULL || FilterStruct->FilterCount == 0) {\r
-      // zero all table entries, except header\r
-      ZeroMem ((UINT8 *)TableEntry + sizeof(SMBIOS_STRUCTURE), TableEntrySize - sizeof(SMBIOS_STRUCTURE));\r
-    } else {\r
-      Filter = FilterStruct->Filter;\r
-      for (Index = 0; Index < FilterStruct->FilterCount; Index++) {\r
-        if (((SMBIOS_STRUCTURE *) TableEntry)->Length >= (Filter[Index].Offset + Filter[Index].Size)) {\r
-          //\r
-          // The field is present in the SMBIOS entry.\r
-          //\r
-          if ((Filter[Index].Flags & SMBIOS_FILTER_TABLE_FLAG_IS_STRING) != 0) {\r
-            CopyMem (&StringId, (UINT8 *)TableEntry + Filter[Index].Offset, sizeof(StringId));\r
-            if (StringId != 0) {\r
-              // set ' ' for string field\r
-              String = GetSmbiosStringById (TableEntry, StringId, &StringLen);\r
-              ASSERT (String != NULL);\r
-              //DEBUG ((EFI_D_INFO,"StrId(0x%x)-%a(%d)\n", StringId, String, StringLen));\r
-              SetMem (String, StringLen, ' ');\r
+  //\r
+  // Skip measurement for OEM types.\r
+  //\r
+  if (((SMBIOS_STRUCTURE *)TableEntry)->Type >= SMBIOS_OEM_BEGIN) {\r
+    // zero all table fields, except header\r
+    ZeroMem ((UINT8 *)TableEntry + sizeof(SMBIOS_STRUCTURE), TableEntrySize - sizeof(SMBIOS_STRUCTURE));\r
+  } else {\r
+    FilterStruct = GetFilterStructByType (((SMBIOS_STRUCTURE *)TableEntry)->Type);\r
+    if (FilterStruct != NULL) {\r
+      if (FilterStruct->Filter == NULL || FilterStruct->FilterCount == 0) {\r
+        // zero all table fields, except header\r
+        ZeroMem ((UINT8 *)TableEntry + sizeof(SMBIOS_STRUCTURE), TableEntrySize - sizeof(SMBIOS_STRUCTURE));\r
+      } else {\r
+        Filter = FilterStruct->Filter;\r
+        for (Index = 0; Index < FilterStruct->FilterCount; Index++) {\r
+          if (((SMBIOS_STRUCTURE *) TableEntry)->Length >= (Filter[Index].Offset + Filter[Index].Size)) {\r
+            //\r
+            // The field is present in the SMBIOS entry.\r
+            //\r
+            if ((Filter[Index].Flags & SMBIOS_FILTER_TABLE_FLAG_IS_STRING) != 0) {\r
+              CopyMem (&StringId, (UINT8 *)TableEntry + Filter[Index].Offset, sizeof(StringId));\r
+              if (StringId != 0) {\r
+                // set ' ' for string field\r
+                String = GetSmbiosStringById (TableEntry, StringId, &StringLen);\r
+                ASSERT (String != NULL);\r
+                //DEBUG ((EFI_D_INFO,"StrId(0x%x)-%a(%d)\n", StringId, String, StringLen));\r
+                SetMem (String, StringLen, ' ');\r
+              }\r
             }\r
+            // zero non-string field\r
+            ZeroMem ((UINT8 *)TableEntry + Filter[Index].Offset, Filter[Index].Size);\r
           }\r
-          // zero non-string field\r
-          ZeroMem ((UINT8 *)TableEntry + Filter[Index].Offset, Filter[Index].Size);\r
         }\r
       }\r
     }\r
index c5a779cca7fe28a9a67a90dc3d542d721fd35ce1..5d3aa67f7c8bf438028931547d7ec5e8c43ccb26 100644 (file)
@@ -7,10 +7,11 @@
 #     such as clock registers, and system unique information, such as\r
 #     asset numbers or serial numbers, MUST NOT be measured into PCR [1],\r
 #     or any other PCR.\r
-#\r
+# The OEM types are skipped and platform code can measure them by self if required.\r
+# \r
 # A platform may use its own policy to filter some fields in SMBIOS table.\r
 #\r
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r