From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 2CB151A1E12 for ; Mon, 29 Aug 2016 20:21:15 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP; 29 Aug 2016 20:21:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,254,1470726000"; d="scan'208";a="1043194012" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 29 Aug 2016 20:21:14 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 29 Aug 2016 20:21:14 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 29 Aug 2016 20:21:13 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.109]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.174]) with mapi id 14.03.0248.002; Tue, 30 Aug 2016 11:21:11 +0800 From: "Zhang, Chao B" To: "Wu, Hao A" , "edk2-devel@lists.01.org" , "Gao, Liming" Thread-Topic: [PATCH 3/3] SecurityPkg: Use IsZeroGuid API for zero GUID checking Thread-Index: AQHSAmdrBdDgTu7dj0igyOIDhYdvLKBg1jug Date: Tue, 30 Aug 2016 03:21:11 +0000 Message-ID: References: <1472524574-17732-1-git-send-email-hao.a.wu@intel.com> <1472524574-17732-4-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1472524574-17732-4-git-send-email-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWNjZmZkN2ItYTQ4OS00YjU3LWE5MzgtMmY0YjY3NDRmYjM1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImpuQjIrZkFiWVN4Q0VTdFVpTFJOMVQ3clJuV0U1VzNmb1dRdTY5U0Z4NGc9In0= x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 3/3] SecurityPkg: Use IsZeroGuid API for zero GUID checking X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2016 03:21:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chao Zhang Thanks & Best regards Chao Zhang -----Original Message----- From: Wu, Hao A=20 Sent: Tuesday, August 30, 2016 10:36 AM To: edk2-devel@lists.01.org; Gao, Liming Cc: Wu, Hao A; Zhang, Chao B Subject: [PATCH 3/3] SecurityPkg: Use IsZeroGuid API for zero GUID checking Instead of comparing a GUID with gZeroGuid via the CompareGuid API, the commit uses the IsZeroGuid API to check if the given GUID is a zero GUID. Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu --- SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c | 7 +++= ---- .../Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf | 3 +-- SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c | 5 ++-= -- SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf | 3 +-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLi= b.c b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c index 1f2574e..aacafa8 100644 --- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c +++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c @@ -15,7 +15,7 @@ Tcg2MeasureGptTable() function will receive untrusted GPT partition tabl= e, and parse partition data carefully. =20 -Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
This program and the accompanying materials=20 are licensed and made available under the terms and conditions of the BSD = License=20 @@ -36,7 +36,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. #include =20 #include -#include =20 #include #include @@ -202,7 +201,7 @@ Tcg2MeasureGptTable ( PartitionEntry =3D (EFI_PARTITION_ENTRY *)EntryPtr; NumberOfPartition =3D 0; for (Index =3D 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index= ++) { - if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) { + if (!IsZeroGuid (&PartitionEntry->PartitionTypeGUID)) { NumberOfPartition++; =20 } PartitionEntry =3D (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + P= rimaryHeader->SizeOfPartitionEntry); @@ -238,7 +237,7 @@ Tcg2MeasureGptTable ( PartitionEntry =3D (EFI_PARTITION_ENTRY*)EntryPtr; NumberOfPartition =3D 0; for (Index =3D 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index= ++) { - if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) { + if (!IsZeroGuid (&PartitionEntry->PartitionTypeGUID)) { CopyMem ( (UINT8 *)&GptData->Partitions + NumberOfPartition * PrimaryHeader-= >SizeOfPartitionEntry, (UINT8 *)PartitionEntry, diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLi= b.inf b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf index 1296c97..a11988e 100644 --- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf +++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf @@ -9,7 +9,7 @@ # This external input must be validated carefully to avoid security issue= s such=20 # as buffer overflow or integer overflow. # -# Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may be= found at @@ -58,7 +58,6 @@ =20 [Guids] gMeasuredFvHobGuid ## SOMETIMES_CONSUMES ## HOB - gZeroGuid ## SOMETIMES_CONSUMES ## GUID =20 [Protocols] gEfiTcg2ProtocolGuid ## SOMETIMES_CONSUMES diff --git a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.= c b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c index 8ab60d8..52bf582 100644 --- a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c +++ b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c @@ -34,7 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. #include =20 #include -#include =20 #include #include @@ -202,7 +201,7 @@ TcgMeasureGptTable ( PartitionEntry =3D (EFI_PARTITION_ENTRY *)EntryPtr; NumberOfPartition =3D 0; for (Index =3D 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index= ++) { - if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) { + if (!IsZeroGuid (&PartitionEntry->PartitionTypeGUID)) { NumberOfPartition++; =20 } PartitionEntry =3D (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + P= rimaryHeader->SizeOfPartitionEntry); @@ -236,7 +235,7 @@ TcgMeasureGptTable ( PartitionEntry =3D (EFI_PARTITION_ENTRY*)EntryPtr; NumberOfPartition =3D 0; for (Index =3D 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index= ++) { - if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) { + if (!IsZeroGuid (&PartitionEntry->PartitionTypeGUID)) { CopyMem ( (UINT8 *)&GptData->Partitions + NumberOfPartition * PrimaryHeader-= >SizeOfPartitionEntry, (UINT8 *)PartitionEntry, diff --git a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.= inf b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf index 0d58eec..553e683 100644 --- a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf +++ b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf @@ -9,7 +9,7 @@ # This external input must be validated carefully to avoid security issue= s such=20 # as buffer overflow or integer overflow. # -# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may be= found at @@ -58,7 +58,6 @@ =20 [Guids] gMeasuredFvHobGuid ## SOMETIMES_CONSUMES ## HOB - gZeroGuid ## SOMETIMES_CONSUMES ## GUID =20 [Protocols] gEfiTcgProtocolGuid ## SOMETIMES_CONSUMES --=20 1.9.5.msysgit.0