From nobody Mon Apr 29 18:23:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 151779794403488.25589625531086; Sun, 4 Feb 2018 18:32:24 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 458E4223AF833; Sun, 4 Feb 2018 18:26:41 -0800 (PST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 0E1452237A4FF for ; Sun, 4 Feb 2018 18:26:39 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Feb 2018 18:32:20 -0800 Received: from czhan46-mobl1.ccr.corp.intel.com ([10.239.192.114]) by orsmga005.jf.intel.com with ESMTP; 04 Feb 2018 18:32:19 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=chao.b.zhang@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,462,1511856000"; d="scan'208";a="198606601" From: "Zhang, Chao B" To: edk2-devel@lists.01.org Date: Mon, 5 Feb 2018 10:32:17 +0800 Message-Id: <20180205023217.20904-1-chao.b.zhang@intel.com> X-Mailer: git-send-email 2.11.0.windows.1 Subject: [edk2] [PATCH] SecurityPkg: Support PP version lower than 1.3 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yao Jiewen , Chao Zhang , Long Qin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" TCG PP 1.2 & PP 1.3 spec defined different Opcodes. Update code to support both. Cc: Long Qin Cc: Yao Jiewen Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chao Zhang Reviewed-by: Long Qin --- .../SmmTcg2PhysicalPresenceLib.c | 31 +++++++++++++++++-= ---- .../SmmTcg2PhysicalPresenceLib.inf | 7 +++-- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Physical= PresenceLib.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Physi= calPresenceLib.c index 6061453..ffade10 100644 --- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.c +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.c @@ -10,7 +10,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPr= esenceLibGetUserConfirmationStatusFunction() will receive untrusted input and do validation. =20 -Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials=20 are licensed and made available under the terms and conditions of the BSD = License=20 which accompanies this distribution. The full text of the license may be = found at=20 @@ -27,12 +27,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITH= ER EXPRESS OR IMPLIED. =20 #include =20 +#include #include #include #include #include =20 +#define PP_INF_VERSION_1_2 "1.2" + EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable; +BOOLEAN mIsTcg2PPVerLowerThan_1_3 =3D FALSE; =20 /** The handler for TPM physical presence function: @@ -337,11 +341,22 @@ Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunct= ion ( break; =20 default: - if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERAT= ION) { - // - // TCG PP spec defined operations that are reserved or un-implemen= ted - // - return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; + if (mIsTcg2PPVerLowerThan_1_3 =3D=3D FALSE) { + if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPER= ATION) { + // + // TCG2 PP1.3 spec defined operations that are reserved or un-im= plemented + // + return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; + } + } else { + // + // TCG PP lower than 1.3. (1.0, 1.1, 1.2) + // + if (OperationRequest <=3D TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) { + RequestConfirmed =3D TRUE; + } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFI= C_OPERATION) { + return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED; + } } break; } @@ -377,6 +392,10 @@ Tcg2PhysicalPresenceLibConstructor ( { EFI_STATUS Status; =20 + if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPr= esenceInterfaceVer), AsciiStrLen(PP_INF_VERSION_1_2)) <=3D0) { + mIsTcg2PPVerLowerThan_1_3 =3D TRUE; + } + // // Locate SmmVariableProtocol. // diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Physical= PresenceLib.inf b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2Phy= sicalPresenceLib.inf index 5fa84b1..8367097 100644 --- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.inf +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenc= eLib.inf @@ -7,7 +7,7 @@ # This driver will have external input - variable. # This external input must be validated carefully to avoid security issue. # -# Copyright (c) 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2018, 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 @@ -52,6 +52,9 @@ ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence" ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags" gEfiTcg2PhysicalPresenceGuid - =20 + +[Pcd] + gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CON= SUMES + [Depex] gEfiSmmVariableProtocolGuid \ No newline at end of file --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel