diff mbox series

[v4,25/33] tpm2: refactor tpm_unassert_physical_presence for TPM2

Message ID 20191211202728.127996-26-stefanb@linux.vnet.ibm.com
State Superseded
Headers show
Series Add vTPM support to SLOF | expand

Commit Message

Stefan Berger Dec. 11, 2019, 8:27 p.m. UTC
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 lib/libtpm/tcgbios.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/lib/libtpm/tcgbios.c b/lib/libtpm/tcgbios.c
index c8759cb..bc54c8d 100644
--- a/lib/libtpm/tcgbios.c
+++ b/lib/libtpm/tcgbios.c
@@ -847,10 +847,14 @@  void tpm_finalize(void)
  */
 uint32_t tpm_unassert_physical_presence(void)
 {
-	if (tpm_state.has_physical_presence)
-		tpm_simple_cmd(0, TPM_ORD_PHYSICAL_PRESENCE,
-			       2, TPM_PP_NOT_PRESENT_LOCK,
-			       TPM_DURATION_TYPE_SHORT);
+	switch (TPM_version) {
+	case TPM_VERSION_1_2:
+		if (tpm_state.has_physical_presence)
+			tpm_simple_cmd(0, TPM_ORD_PHYSICAL_PRESENCE,
+				       2, TPM_PP_NOT_PRESENT_LOCK,
+				       TPM_DURATION_TYPE_SHORT);
+	break;
+	}
 
 	return 0;
 }