From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.1613.1639709287104291869 for ; Thu, 16 Dec 2021 18:48:07 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=lTasJxxh; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: rodrigo.gonzalez.del.cueto@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639709287; x=1671245287; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ckc+3VgFTGGEpkZZk06oR2lAfDZez9g96C0/uz9QNHA=; b=lTasJxxhQoKCMbm2FWcrArg45CyakdHSeraREQGdhdvIZBuida+NoKeD HUYirbOdKrf/qO9rWb5Qzym5q9/aB/vGOPZ6jv3YbjXlqTihOjdFnks2F KQgeDKfjIRtRfm2wD3FQ7PqBB7EdL62cmAH0IeIs3GgLFpi+Yj73pXEPA an1hjPX2bIFtcaJ7sRr+teerss6r+w1DzDeAzxmeKu/nP9EHWcNfScNyo OwGuoGpkIWjpsUWTYfn3dj6n/eIHiIHo5hJDMI4Ma44H0t2haaN9Nw59D us4NDhZh+9tdP3nQQnlq0tP3Bc6ID14nnZwONAQu4TMhl5HmQOHWsOa4J g==; X-IronPort-AV: E=McAfee;i="6200,9189,10200"; a="325949795" X-IronPort-AV: E=Sophos;i="5.88,213,1635231600"; d="scan'208";a="325949795" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 18:48:06 -0800 X-IronPort-AV: E=Sophos;i="5.88,213,1635231600"; d="scan'208";a="568813138" Received: from fm73lab177-1.amr.corp.intel.com ([10.80.209.189]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 18:48:06 -0800 From: "Rodrigo Gonzalez del Cueto" To: devel@edk2.groups.io Cc: Rodrigo Gonzalez del Cueto , Jian J Wang , Jiewen Yao Subject: [PATCH] SecurityPkg: TPM must go to Idle state on CRB command completion Date: Thu, 16 Dec 2021 18:47:59 -0800 Message-Id: <20211217024759.653-1-rodrigo.gonzalez.del.cueto@intel.com> X-Mailer: git-send-email 2.33.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3463 In V2: Fixed patch format and uncrustify cleanup In V1: To follow the TCG CRB protocol specification, on every CRB TPM command completion the TPM should return to Idle state, regardless of the CRB Idle Bypass capability reported by the TPM device. See: TCG PC Client Device Driver Design Principles for TPM 2.0, Version 1.0, Rev 0.27 Signed-off-by: Rodrigo Gonzalez del Cueto Cc: Jian J Wang Cc: Jiewen Yao --- SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c index 40ab998004..1d99beaa10 100644 --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c @@ -1,7 +1,7 @@ /** @file PTP (Platform TPM Profile) CRB (Command Response Buffer) interface used by dTPM2.0 library. -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
Copyright (c), Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -320,7 +320,7 @@ PtpCrbTpmCommand ( // Command completed, but buffer is not enough // Status = EFI_BUFFER_TOO_SMALL; - goto GoReady_Exit; + goto GoIdle_Exit; } *SizeOut = TpmOutSize; @@ -340,16 +340,6 @@ PtpCrbTpmCommand ( DEBUG ((DEBUG_VERBOSE, "\n")); DEBUG_CODE_END (); -GoReady_Exit: - // - // Goto Ready State if command is completed successfully and TPM support IdleBypass - // If not supported. flow down to GoIdle - // - if (GetCachedIdleByPass () == 1) { - MmioWrite32 ((UINTN)&CrbReg->CrbControlRequest, PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY); - return Status; - } - // // Do not wait for state transition for TIMEOUT_C // This function will try to wait 2 TIMEOUT_C at the beginning in next call. -- 2.26.2.windows.1