From nobody Mon Apr 29 10:34:30 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+61331+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+61331+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1592304007; cv=none; d=zohomail.com; s=zohoarc; b=bsec3GpFXLDAyfp4IY/FpFPYiH0YDnhTmBaVMT1JYut+Qw4H4qD7nWmqm+5PhsaCeyRj1yvG7SXdmenpzASQRhBvNHCylIzSNHoX2iq8fXGdEjn1cdy/mEyDUC6MAuQa+WbHXI4DjVRvn6hzNIf6k8UvlzdXhCcWkwg6aBTyA+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592304007; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=a+f0S2xLIYvmpqvFN3bgQlRj57SnhCLzPCfrgBUYa8k=; b=jeer7KGxTaVGKh/2CUzFL4TwcK4T3fBwABA5q46ky+GBmSSoMiEJ8JvpdX6aLoxKfRsYB2+ZH3kZlaBxJL9U3Wkjuc9KINQBDI1lV/cNF9RjgFM7a1KaVt0q3+tBlBY1fGTLTNh+hslgubT+AxKwlNQwEmYT7CW1SI254KX/7Nk= 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+61331+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 1592304007443196.3222527139818; Tue, 16 Jun 2020 03:40:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5E9hYY1788612xXcqYNo9rQ5; Tue, 16 Jun 2020 03:40:07 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.5599.1592292701361334119 for ; Tue, 16 Jun 2020 00:31:41 -0700 IronPort-SDR: iBs/UiupxtypuL8UVcr/suqwI2bjO7Q2gOSM00mp1Rm9AF1wRVd2c6Wsbma17WzC+ZUy1TJjZt cS9y5gUx1AEA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 00:31:40 -0700 IronPort-SDR: crm5IMfuQJ7fjJgPyyF8uRLOxhixM+/rc6u37NhHQW8tKVvFoF4XncFdfWuyAVUAYEoXN4FbXh Dfdw6b1nF3Kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,518,1583222400"; d="scan'208";a="420673754" X-Received: from shwdesssddpdqi.ccr.corp.intel.com ([10.239.9.10]) by orsmga004.jf.intel.com with ESMTP; 16 Jun 2020 00:31:38 -0700 From: Qi Zhang To: devel@edk2.groups.io Cc: "Zhang, Qi" , Jiewen Yao , Jian J Wang , Chao Zhang , Rahul Kumar Subject: [edk2-devel] [PATCH 1/2] SecurityPkg/Tpm2CommandLib: add new function Tpm2GetCapabilityIsCmdImpl. Date: Tue, 16 Jun 2020 15:30:49 +0800 Message-Id: <20200616073048.2019-2-qi1.zhang@intel.com> In-Reply-To: <20200616073048.2019-1-qi1.zhang@intel.com> References: <20200616073048.2019-1-qi1.zhang@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,qi1.zhang@intel.com X-Gm-Message-State: vNm7jhKJbTy85EDPQku03R0Lx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592304007; bh=KbsPX6SVY94kf0Yz92i+Mda1QYMwkBiCMdILeE1VkFY=; h=Cc:Date:From:Reply-To:Subject:To; b=eHwXwIEpi1Fukj6506vsd5evaqMtddN06phOQTIPvNsrmw51rnRXDmq1W60MjBqgQqc yID9IUYfVgJQeyrjc8bfCV9a6lYqOH9DSGCD1gO3ZrjMcF2uOP8tKer/PlEy208LZ/fRd yx/eTyDOQ6oGlEM72JBx4vX7YXylF8415Lg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: "Zhang, Qi" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2793 check if the commad is supported by comparing the command code with command index. Cc: Jiewen Yao Cc: Jian J Wang Cc: Chao Zhang Cc: Rahul Kumar Signed-off-by: Qi Zhang --- SecurityPkg/Include/Library/Tpm2CommandLib.h | 16 ++++++++++++++++ SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c | 40 +++++++++++++++++= +++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/SecurityPkg/Include/Library/Tpm2CommandLib.h b/SecurityPkg/Inc= lude/Library/Tpm2CommandLib.h index ce381e786b..ce7290c0f5 100644 --- a/SecurityPkg/Include/Library/Tpm2CommandLib.h +++ b/SecurityPkg/Include/Library/Tpm2CommandLib.h @@ -790,6 +790,22 @@ Tpm2GetCapabilityAlgorithmSet ( OUT UINT32 *AlgorithmSet ); =20 +/** + This function will query if the command is supported. + + @param[In] Command TPM_CC command starts from TPM_CC_FIRST. + @param[out] IsCmdImpl The command is supported or not. + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR The command was unsuccessful. +**/ +EFI_STATUS +EFIAPI +Tpm2GetCapabilityIsCmdImpl ( + IN TPM_CC Command, + OUT BOOLEAN *IsCmdImpl + ); + /** This command is used to check to see if specific combinations of algorit= hm parameters are supported. =20 diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c b/Security= Pkg/Library/Tpm2CommandLib/Tpm2Capability.c index 85b11c7715..0c8f980e69 100644 --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c @@ -39,6 +39,8 @@ typedef struct { =20 #pragma pack() =20 +#define TPMA_CC_COMMANDINDEX_MASK 0x2000FFFF + /** This command returns various information regarding the TPM and its curre= nt state. =20 @@ -628,6 +630,44 @@ Tpm2GetCapabilityAlgorithmSet ( return EFI_SUCCESS; } =20 +/** + This function will query if the command is supported. + + @param[In] Command TPM_CC command starts from TPM_CC_FIRST. + @param[out] IsCmdImpl The command is supported or not. + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR The command was unsuccessful. +**/ +EFI_STATUS +EFIAPI +Tpm2GetCapabilityIsCmdImpl ( + IN TPM_CC Command, + OUT BOOLEAN *IsCmdImpl + ) +{ + TPMS_CAPABILITY_DATA TpmCap; + TPMI_YES_NO MoreData; + EFI_STATUS Status; + UINT32 Attribute; + + Status =3D Tpm2GetCapability ( + TPM_CAP_COMMANDS, + Command, + 1, + &MoreData, + &TpmCap + ); + if (EFI_ERROR (Status)) { + return Status; + } + + CopyMem (&Attribute, &TpmCap.data.command.commandAttributes[0], sizeof (= UINT32)); + *IsCmdImpl =3D (Command =3D=3D (SwapBytes32(Attribute) & TPMA_CC_COMMAND= INDEX_MASK)); + + return EFI_SUCCESS; +} + /** This command is used to check to see if specific combinations of algorit= hm parameters are supported. =20 --=20 2.26.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 (#61331): https://edk2.groups.io/g/devel/message/61331 Mute This Topic: https://groups.io/mt/74913407/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- From nobody Mon Apr 29 10:34:30 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+61332+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+61332+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1592304007; cv=none; d=zohomail.com; s=zohoarc; b=I0h3oPA0DKExTVouWL8HIcKGp0mhlKqzAipBzHdo7IsK5b2cctYzy99sWrklYvOQ/CsmXulTb7Lh1irYPd7Fd4MlKz+SXjrdPmK0Z4kgSBzNGBud63PEO78zk1NRpwiDmfrr+DUTxOVic5X4U0cxctWuE+85T7wHlVf3aVKPsxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592304007; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=SCoUi1+X6mFc73VBg5iMCeF8RW1WemVJTC7t2Muk5CU=; b=XiEjdK1SUXG/jkC9OkWB8GBPS4MlUK8KeFQNvbLJWqL/cNDnpbmMMNvyXKOWOqZR6dl+YxfsN7FG4OhMXNj4Kwtn6wR5wGJKbjpow/gepAkDzjYfNl8uDJ/1k7xJdtCNt4Xm0GrnxdYvbT1Kwj8kZm96LSfLg+fxs4vdx3C1Sgs= 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+61332+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 15923040077996.868637607844789; Tue, 16 Jun 2020 03:40:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id lvoqYY1788612xpMNfO2VOgJ; Tue, 16 Jun 2020 03:40:07 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.5633.1592292714764311075 for ; Tue, 16 Jun 2020 00:31:54 -0700 IronPort-SDR: PqkHf6ZWyjMrPqy9b14DhxgSwNIjosfjtYDMvWgI64xJ/o+ka10zow39aFpWXN1fRHcB9s7DNQ T9Ls7J88nhaQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 00:31:52 -0700 IronPort-SDR: LmFxrAtJD4JjdUefaG68QNdl90VjLzEXs+mWLsj3Q7e5YwfdyZdXS+QoYkuVsKZRZpIUBpH05H ocOXAY7M2tVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,518,1583222400"; d="scan'208";a="420673795" X-Received: from shwdesssddpdqi.ccr.corp.intel.com ([10.239.9.10]) by orsmga004.jf.intel.com with ESMTP; 16 Jun 2020 00:31:51 -0700 From: Qi Zhang To: devel@edk2.groups.io Cc: Qi Zhang , Jiewen Yao , Jian J Wang , Chao Zhang , Rahul Kumar Subject: [edk2-devel] [PATCH 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported. Date: Tue, 16 Jun 2020 15:30:51 +0800 Message-Id: <20200616073048.2019-3-qi1.zhang@intel.com> In-Reply-To: <20200616073048.2019-1-qi1.zhang@intel.com> References: <20200616073048.2019-1-qi1.zhang@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,qi1.zhang@intel.com X-Gm-Message-State: 9cVlvY9LaFQMaCdzyn6MTy7nx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592304007; bh=u+YVS1d0debol1h0EX514PDOOJkpm937nhy4nDoAJ9o=; h=Cc:Date:From:Reply-To:Subject:To; b=pXw9bLXle9aEytqYpx0j9aUbdDaL6+Fcyus36YfcZv1vfLd0JN6p2O9sxhd3P3puiDb FDGyerObP/8bxDyq3Dh6m3U/XbzS8mxAx9Z7dH7//JPEvJ5O5hCntUNqPbrOFcKtoMQ3U ktCoby/X3K3hruCReIP2/9dLP4aVlluRASc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2793 In current implementation TPM2_ChangeEPS command is always available in the TPM2 operation pull down list in TCG2 Configuration, which is confusing when the command is not supported by specific TPM chip. As a user experience improvement, TPM2_ChangeEPS command should be removed from the list when it is not supported. Cc: Jiewen Yao Cc: Jian J Wang Cc: Chao Zhang Cc: Rahul Kumar Signed-off-by: Qi Zhang --- SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr | 2 ++ SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 7 +++++++ SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h | 1 + 3 files changed, 10 insertions(+) diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr b/SecurityPkg/Tcg/Tc= g2Config/Tcg2Config.vfr index 91a463997c..47d63b009d 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr @@ -144,7 +144,9 @@ formset option text =3D STRING_TOKEN(STR_TCG2_DISABLE), value =3D TCG2= _PHYSICAL_PRESENCE_DISABLE, flags =3D RESET_REQUIRED; option text =3D STRING_TOKEN(STR_TCG2_CLEAR), value =3D TCG2_P= HYSICAL_PRESENCE_CLEAR, flags =3D RESET_REQUIRED; option text =3D STRING_TOKEN(STR_TCG2_SET_PCD_BANKS), value = =3D TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS, flags =3D RESET_REQUIRED; + suppressif ideqval TCG2_CONFIGURATION_INFO.ChangeEPSSupported = =3D=3D 0; option text =3D STRING_TOKEN(STR_TCG2_CHANGE_EPS), value =3D T= CG2_PHYSICAL_PRESENCE_CHANGE_EPS, flags =3D RESET_REQUIRED; + endif option text =3D STRING_TOKEN(STR_TCG2_LOG_ALL_DIGESTS), value = =3D TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS, flags =3D RESET_REQUIRED; option text =3D STRING_TOKEN(STR_TCG2_DISABLE_ENDORSEMENT_ENAB= LE_STORAGE_HIERARCHY), value =3D TCG2_PHYSICAL_PRESENCE_DISABLE_ENDORSEMENT= _ENABLE_STORAGE_HIERARCHY, flags =3D RESET_REQUIRED; endoneof; diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c b/SecurityPkg/Tcg/= Tcg2Config/Tcg2ConfigImpl.c index baa8fcd08d..464cacc207 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c @@ -788,6 +788,7 @@ InstallTcg2ConfigForm ( CHAR16 TempBuffer[1024]; TCG2_CONFIGURATION_INFO Tcg2ConfigInfo; TPM2_PTP_INTERFACE_TYPE TpmDeviceInterfaceDetected; + BOOLEAN IsCmdImp =3D FALSE; =20 DriverHandle =3D NULL; ConfigAccess =3D &PrivateData->ConfigAccess; @@ -870,6 +871,12 @@ InstallTcg2ConfigForm ( HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_SUPPORTED= _HASH_ALGO_CONTENT), TempBuffer, NULL); } =20 + Status =3D Tpm2GetCapabilityIsCmdImpl(TPM_CC_ChangeEPS, &IsCmdImp); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Tpm2GetCapabilityIsCmdImpl fails %r\n", Status)); + } + Tcg2ConfigInfo.ChangeEPSSupported =3D IsCmdImp; + FillBufferWithBootHashAlg (TempBuffer, sizeof(TempBuffer), PcdGet32 (Pcd= Tcg2HashAlgorithmBitmap)); HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_BIOS_HASH_ALGO_C= ONTENT), TempBuffer, NULL); =20 diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h b/SecurityPkg/Tc= g/Tcg2Config/Tcg2ConfigNvData.h index a91c052850..b84af40a04 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h @@ -70,6 +70,7 @@ typedef struct { UINT8 TpmDeviceInterfaceAttempt; BOOLEAN TpmDeviceInterfacePtpFifoSupported; BOOLEAN TpmDeviceInterfacePtpCrbSupported; + BOOLEAN ChangeEPSSupported; } TCG2_CONFIGURATION_INFO; =20 // --=20 2.26.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 (#61332): https://edk2.groups.io/g/devel/message/61332 Mute This Topic: https://groups.io/mt/74913408/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-