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

Stefan Berger stefanb at linux.vnet.ibm.com
Thu Dec 12 07:27:20 AEDT 2019


Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
---
 lib/libtpm/tcgbios.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

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;
 }
-- 
2.17.1



More information about the SLOF mailing list