From nobody Sun Apr 28 10:56:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59493+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59493+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1589436383; cv=none; d=zohomail.com; s=zohoarc; b=gKXM27TxpTqkhmpD5ZNjwSjtPunqDQCEe6rW4VOxAgjuAvATGMGKdmtIr9M4O/PlPbCfToXdkc5xN0vpJuR3b4phByB5UsVJFqG87eihfzhy5IK0VVDa5UYl2wPltFWDCT2N+NTo+K7nNyGORQaiSMp+YYRLncavW9Ju0+ErwhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589436383; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=6uwmdZvg+1NIIwPnjhMXTW79Hewul6tEDyTdTfPPqcE=; b=W1LYEiRPBdW3+zUDC1kD9Ci128gDruQ1qouo+mhUbzDWHbmr7GTrXrOjVK2l51RMOM1bz47vHYcYln5D+zr1X3UGu+aezxTTImPp6bf48Up5PTjjDn8O+8dSljgpYaCIPPpMC70ZfV/jOhwbyTPKCZvDSxf52FuYZkqXLJKGlQA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59493+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589436383513488.50059774294107; Wed, 13 May 2020 23:06:23 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id p6mPYY1788612xcX4Doq8lL3; Wed, 13 May 2020 23:06:23 -0700 X-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 IronPort-SDR: io44W3xE04R9eOhIT3iswdnDx7UW13/HtSAXW0ueBwbnKl+vEQNQJVMW3u2ZzTjrIRWgyixpdu RxNQV6JFGSVQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-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" X-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: [edk2-devel] [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> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,maggie.chu@intel.com X-Gm-Message-State: V0R502ZA8eGMtZ1XAt7Vwj8Mx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589436383; bh=lMSujGVt8+TwYvwVrljl/PhqXfGVoK6TohfWIPtbrD0=; h=Cc:Date:From:Reply-To:Subject:To; b=neNvAYSmjs7P1A6SIP4IEdBZSpG0ZL5VfT/ezkE9Ymga7EIUpgF/yCVwF17MGn/v2Py BJVK6gh9HBfCArWOKVfWBi+2+xJEoEnNAGShl81G//XNu6e5zFNwFa1ptl+F9FOxrJYM4 jb3JdDnhfg2db9DCniDNdVaZW8IS+J3krJw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 ); if (EFI_ERROR (Status)) { - PpiFlags.PPFlags =3D TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS= _STORAGE_MANAGEMENT_FLAG_DEFAULT; + PpiFlags.PPFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags); } return PpiFlags.PPFlags; } 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 ); if (EFI_ERROR (Status)) { - PpiFlags.PPFlags =3D TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS= _STORAGE_MANAGEMENT_FLAG_DEFAULT; + PpiFlags.PPFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags); } return PpiFlags.PPFlags; } 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] gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES =20 +[Pcd] + gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOME= TIMES_CONSUMES + [Depex] gEfiPeiReadOnlyVariable2PpiGuid 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 =20 EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable; BOOLEAN mIsTcg2PPVerLowerThan_1_3 =3D FALSE; +UINT32 mTcg2PhysicalPresenceFlags; =20 /** The handler for TPM physical presence function: @@ -162,7 +163,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( &Flags ); if (EFI_ERROR (Status)) { - Flags.PPFlags =3D TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS_= STORAGE_MANAGEMENT_FLAG_DEFAULT; + Flags.PPFlags =3D mTcg2PhysicalPresenceFlags; } ReturnCode =3D Tcg2PpVendorLibSubmitRequestToPreOSFunction (*Operation= Request, Flags.PPFlags, *RequestParameter); } @@ -396,5 +397,7 @@ Tcg2PhysicalPresenceLibConstructor ( Status =3D gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL,= (VOID**)&mTcg2PpSmmVariable); ASSERT_EFI_ERROR (Status); =20 + mTcg2PhysicalPresenceFlags =3D PcdGet32(PcdTcg2PhysicalPresenceFlags); + return EFI_SUCCESS; } 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 @@ =20 [Pcd] gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CON= SUMES + gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOM= ETIMES_CONSUMES =20 [Depex] gEfiSmmVariableProtocolGuid --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59493): https://edk2.groups.io/g/devel/message/59493 Mute This Topic: https://groups.io/mt/74199464/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-