From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3E59020945C1C for ; Sun, 17 Sep 2017 18:42:33 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2017 18:45:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,410,1500966000"; d="scan'208";a="1015437988" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by orsmga003.jf.intel.com with ESMTP; 17 Sep 2017 18:45:34 -0700 Received: from pgsmsx108.gar.corp.intel.com ([169.254.8.194]) by PGSMSX103.gar.corp.intel.com ([169.254.2.203]) with mapi id 14.03.0319.002; Mon, 18 Sep 2017 09:45:33 +0800 From: "Chiu, Chasel" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [PATCH] MdeModulePkg SmbiosMeasurementDxe: Skip measurement for OEM type Thread-Index: AQHTLUy+f2lJ4Zlzr0ObTV9fI2SqxKK55NCA Date: Mon, 18 Sep 2017 01:45:32 +0000 Message-ID: <3C3EFB470A303B4AB093197B6777CCEC4F577FE3@PGSMSX108.gar.corp.intel.com> References: <1505388547-5292-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1505388547-5292-1-git-send-email-star.zeng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [172.30.20.206] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg SmbiosMeasurementDxe: Skip measurement for OEM type X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Sep 2017 01:42:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu -----Original Message----- From: Zeng, Star=20 Sent: Thursday, September 14, 2017 7:29 PM To: edk2-devel@lists.01.org Cc: Zeng, Star ; Yao, Jiewen ; C= hiu, Chasel Subject: [PATCH] MdeModulePkg SmbiosMeasurementDxe: Skip measurement for OE= M type The generic driver has no way to know whether an OEM type should be filtere= d or not. This patch is to update the code to skip measurement for OEM type and platf= orm code can measure it by self if required. Cc: Jiewen Yao Cc: Chasel Chiu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- .../SmbiosMeasurementDxe/SmbiosMeasurementDxe.c | 54 +++++++++++++-----= ---- .../SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf | 5 +- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementD= xe.c b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c index bc5e7464e133..4a3e99aefd0f 100644 --- a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c +++ b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c @@ -1,7 +1,7 @@ /** @file This driver measures SMBIOS table to TPM. =20 -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -277,30 +2= 77,38 @@ FilterSmbiosEntry ( DEBUG ((EFI_D_INFO, "Smbios Table (Type - %d):\n", ((SMBIOS_STRUCTURE *)= TableEntry)->Type)); DEBUG_CODE (InternalDumpHex (TableEntry, TableEntrySize);); =20 - FilterStruct =3D GetFilterStructByType (((SMBIOS_STRUCTURE *)TableEntry)= ->Type); - if (FilterStruct !=3D NULL) { - if (FilterStruct->Filter =3D=3D NULL || FilterStruct->FilterCount =3D= =3D 0) { - // zero all table entries, except header - ZeroMem ((UINT8 *)TableEntry + sizeof(SMBIOS_STRUCTURE), TableEntryS= ize - sizeof(SMBIOS_STRUCTURE)); - } else { - Filter =3D FilterStruct->Filter; - for (Index =3D 0; Index < FilterStruct->FilterCount; Index++) { - if (((SMBIOS_STRUCTURE *) TableEntry)->Length >=3D (Filter[Index].= Offset + Filter[Index].Size)) { - // - // The field is present in the SMBIOS entry. - // - if ((Filter[Index].Flags & SMBIOS_FILTER_TABLE_FLAG_IS_STRING) != =3D 0) { - CopyMem (&StringId, (UINT8 *)TableEntry + Filter[Index].Offset= , sizeof(StringId)); - if (StringId !=3D 0) { - // set ' ' for string field - String =3D GetSmbiosStringById (TableEntry, StringId, &Strin= gLen); - ASSERT (String !=3D NULL); - //DEBUG ((EFI_D_INFO,"StrId(0x%x)-%a(%d)\n", StringId, Strin= g, StringLen)); - SetMem (String, StringLen, ' '); + // + // Skip measurement for OEM types. + // + if (((SMBIOS_STRUCTURE *)TableEntry)->Type >=3D SMBIOS_OEM_BEGIN) { + // zero all table fields, except header + ZeroMem ((UINT8 *)TableEntry + sizeof(SMBIOS_STRUCTURE),=20 + TableEntrySize - sizeof(SMBIOS_STRUCTURE)); } else { + FilterStruct =3D GetFilterStructByType (((SMBIOS_STRUCTURE *)TableEntr= y)->Type); + if (FilterStruct !=3D NULL) { + if (FilterStruct->Filter =3D=3D NULL || FilterStruct->FilterCount = =3D=3D 0) { + // zero all table fields, except header + ZeroMem ((UINT8 *)TableEntry + sizeof(SMBIOS_STRUCTURE), TableEntr= ySize - sizeof(SMBIOS_STRUCTURE)); + } else { + Filter =3D FilterStruct->Filter; + for (Index =3D 0; Index < FilterStruct->FilterCount; Index++) { + if (((SMBIOS_STRUCTURE *) TableEntry)->Length >=3D (Filter[Index= ].Offset + Filter[Index].Size)) { + // + // The field is present in the SMBIOS entry. + // + if ((Filter[Index].Flags & SMBIOS_FILTER_TABLE_FLAG_IS_STRING)= !=3D 0) { + CopyMem (&StringId, (UINT8 *)TableEntry + Filter[Index].Offs= et, sizeof(StringId)); + if (StringId !=3D 0) { + // set ' ' for string field + String =3D GetSmbiosStringById (TableEntry, StringId, &Str= ingLen); + ASSERT (String !=3D NULL); + //DEBUG ((EFI_D_INFO,"StrId(0x%x)-%a(%d)\n", StringId, Str= ing, StringLen)); + SetMem (String, StringLen, ' '); + } } + // zero non-string field + ZeroMem ((UINT8 *)TableEntry + Filter[Index].Offset,=20 + Filter[Index].Size); } - // zero non-string field - ZeroMem ((UINT8 *)TableEntry + Filter[Index].Offset, Filter[Inde= x].Size); } } } diff --git a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementD= xe.inf b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.i= nf index c5a779cca7fe..5d3aa67f7c8b 100644 --- a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf +++ b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.i +++ nf @@ -7,10 +7,11 @@ # such as clock registers, and system unique information, such as # asset numbers or serial numbers, MUST NOT be measured into PCR [1], # or any other PCR. -# +# The OEM types are skipped and platform code can measure them by self if = required. +# # A platform may use its own policy to filter some fields in SMBIOS table. # -# Copyright (c) 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights=20 +reserved.
# # This program and the accompanying materials # are licensed and made a= vailable under the terms and conditions of the BSD License -- 2.7.0.windows.1