From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.7076.1589436382772691070 for ; Wed, 13 May 2020 23:06:22 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: maggie.chu@intel.com) IronPort-SDR: io44W3xE04R9eOhIT3iswdnDx7UW13/HtSAXW0ueBwbnKl+vEQNQJVMW3u2ZzTjrIRWgyixpdu RxNQV6JFGSVQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 23:06:21 -0700 IronPort-SDR: hTVDqmQBZ65JYLcRxcIhAyjSbRdZ36XPq9oZ6kK+ha308ROC9X1lvtpkwwfbZ7aUuet01c6Jkz jq/oDrS2nzYw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,390,1583222400"; d="scan'208";a="307008965" Received: from chumaggi-mobl1.gar.corp.intel.com ([10.213.40.7]) by FMSMGA003.fm.intel.com with ESMTP; 13 May 2020 23:06:18 -0700 From: "Maggie Chu" To: devel@edk2.groups.io Cc: Eric Dong , Jian J Wang , Chao Zhang , Jiewen Yao Subject: [PATCH] SecurityPkg: Get default value from same source for TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE Date: Thu, 14 May 2020 14:06:03 +0800 Message-Id: <20200514060603.1078-1-maggie.chu@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable https://bugzilla.tianocore.org/show_bug.cgi?id=3D2713 In current code, If TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE variable is not e= xist, code will get default value from two places. This fix is to make the default value comes from the PCD gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags Signed-off-by: Maggie Chu Cc: Eric Dong Cc: Jian J Wang Cc: Chao Zhang Cc: Jiewen Yao --- .../Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c | 2 +- .../Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenceLib.c | 2 +- .../PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenceLib.inf | 3 += ++ .../Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c | 5 += +++- .../SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2Physical= PresenceLib.c b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2Physi= calPresenceLib.c index 80e2e37bf4..bf793555aa 100644 --- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenc= eLib.c +++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenc= eLib.c @@ -1228,7 +1228,7 @@ Tcg2PhysicalPresenceLibGetManagementFlags ( &PpiFlags=0D );=0D if (EFI_ERROR (Status)) {=0D - PpiFlags.PPFlags =3D TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS= _STORAGE_MANAGEMENT_FLAG_DEFAULT;=0D + PpiFlags.PPFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags);=0D }=0D return PpiFlags.PPFlags;=0D }=0D diff --git a/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2Physical= PresenceLib.c b/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2Physi= calPresenceLib.c index a111351516..a2c157d8a7 100644 --- a/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenc= eLib.c +++ b/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenc= eLib.c @@ -47,7 +47,7 @@ Tcg2PhysicalPresenceLibGetManagementFlags ( &PpiFlags=0D );=0D if (EFI_ERROR (Status)) {=0D - PpiFlags.PPFlags =3D TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS= _STORAGE_MANAGEMENT_FLAG_DEFAULT;=0D + PpiFlags.PPFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags);=0D }=0D return PpiFlags.PPFlags;=0D }=0D diff --git a/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2Physical= PresenceLib.inf b/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2Phy= sicalPresenceLib.inf index d34f232022..11ebaa9263 100644 --- a/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenc= eLib.inf +++ b/SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenc= eLib.inf @@ -43,5 +43,8 @@ [Ppis]=0D gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES=0D =0D +[Pcd]=0D + gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOME= TIMES_CONSUMES=0D +=0D [Depex]=0D gEfiPeiReadOnlyVariable2PpiGuid=0D diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Physical= PresenceLib.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Physi= calPresenceLib.c index 3827df9663..08ef5416d8 100644 --- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.c +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.c @@ -31,6 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =0D EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;=0D BOOLEAN mIsTcg2PPVerLowerThan_1_3 =3D FALSE;=0D +UINT32 mTcg2PhysicalPresenceFlags;=0D =0D /**=0D The handler for TPM physical presence function:=0D @@ -162,7 +163,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( &Flags=0D );=0D if (EFI_ERROR (Status)) {=0D - Flags.PPFlags =3D TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS_= STORAGE_MANAGEMENT_FLAG_DEFAULT;=0D + Flags.PPFlags =3D mTcg2PhysicalPresenceFlags;=0D }=0D ReturnCode =3D Tcg2PpVendorLibSubmitRequestToPreOSFunction (*Operation= Request, Flags.PPFlags, *RequestParameter);=0D }=0D @@ -396,5 +397,7 @@ Tcg2PhysicalPresenceLibConstructor ( Status =3D gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL,= (VOID**)&mTcg2PpSmmVariable);=0D ASSERT_EFI_ERROR (Status);=0D =0D + mTcg2PhysicalPresenceFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags);=0D +=0D return EFI_SUCCESS;=0D }=0D diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Physical= PresenceLib.inf b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Phy= sicalPresenceLib.inf index e0e5fef5f1..1f40629e3b 100644 --- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.inf +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.inf @@ -50,6 +50,7 @@ =0D [Pcd]=0D gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CON= SUMES=0D + gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOM= ETIMES_CONSUMES=0D =0D [Depex]=0D gEfiSmmVariableProtocolGuid=0D --=20 2.16.2.windows.1