From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web08.382.1626470323909873709 for ; Fri, 16 Jul 2021 14:18:44 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: rodrigo.gonzalez.del.cueto@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10047"; a="207765458" X-IronPort-AV: E=Sophos;i="5.84,246,1620716400"; d="scan'208";a="207765458" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2021 14:18:43 -0700 X-IronPort-AV: E=Sophos;i="5.84,246,1620716400"; d="scan'208";a="431336934" Received: from fm73lab177-1.amr.corp.intel.com ([10.80.209.189]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2021 14:18:41 -0700 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: Fri, 16 Jul 2021 14:18:17 -0700 Message-Id: <20210716211817.263-1-rodrigo.gonzalez.del.cueto@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c index f1f8091683..34e3874a5b 100644 --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c @@ -310,7 +310,7 @@ PtpCrbTpmCommand ( // Command completed, but buffer is not enough // Status = EFI_BUFFER_TOO_SMALL; - goto GoReady_Exit; + goto GoIdle_Exit; } *SizeOut = TpmOutSize; // @@ -328,16 +328,6 @@ PtpCrbTpmCommand ( DEBUG ((EFI_D_VERBOSE, "\n")); ); -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.31.1.windows.1