]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: TPM must go to Idle state on CRB command completion
authorRodrigo Gonzalez del Cueto <rodrigo.gonzalez.del.cueto@intel.com>
Fri, 17 Dec 2021 02:47:59 +0000 (10:47 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 17 Dec 2021 15:03:43 +0000 (15:03 +0000)
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 <rodrigo.gonzalez.del.cueto@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c

index 40ab998004e255bcec27bf701d8c6e394d263f72..1d99beaa101fbbd9681b1be5fa46523b61b703ea 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PTP (Platform TPM Profile) CRB (Command Response Buffer) interface used by dTPM2.0 library.\r
 \r
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>\r
 Copyright (c), Microsoft Corporation.\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -320,7 +320,7 @@ PtpCrbTpmCommand (
     // Command completed, but buffer is not enough\r
     //\r
     Status = EFI_BUFFER_TOO_SMALL;\r
-    goto GoReady_Exit;\r
+    goto GoIdle_Exit;\r
   }\r
 \r
   *SizeOut = TpmOutSize;\r
@@ -340,16 +340,6 @@ PtpCrbTpmCommand (
   DEBUG ((DEBUG_VERBOSE, "\n"));\r
   DEBUG_CODE_END ();\r
 \r
-GoReady_Exit:\r
-  //\r
-  // Goto Ready State if command is completed successfully and TPM support IdleBypass\r
-  // If not supported. flow down to GoIdle\r
-  //\r
-  if (GetCachedIdleByPass () == 1) {\r
-    MmioWrite32 ((UINTN)&CrbReg->CrbControlRequest, PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY);\r
-    return Status;\r
-  }\r
-\r
   //\r
   // Do not wait for state transition for TIMEOUT_C\r
   // This function will try to wait 2 TIMEOUT_C at the beginning in next call.\r