chantra / rpms / tpm2-tss

Forked from rpms/tpm2-tss 2 years ago
Clone

Blame SOURCES/0001-esys-fix-hmac-calculation-for-tpm2_clear-command.patch

232964
From 3d3808c3eb02c27f1b114baddd03960892044909 Mon Sep 17 00:00:00 2001
232964
From: Tadeusz Struk <tadeusz.struk@intel.com>
232964
Date: Mon, 2 Mar 2020 14:45:52 -0800
232964
Subject: [PATCH] esys: fix hmac calculation for tpm2_clear command
232964
232964
After tpm2_clear command is executed it sets all ownerAuth,
232964
endorsementAuth, and lockoutAuth to the Empty Buffer and then
232964
this is used for a response auth calculation.
232964
This requires to recalculate the esys session auth value after
232964
tpm2_clear is executed or the calculated response HMAC value
232964
will be invalid and the command will fail with
232964
err: 0x0007001b "Authorizing the TPM response failed"
232964
232964
Fixes: #1641
232964
232964
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
232964
---
232964
 src/tss2-esys/api/Esys_Clear.c | 5 +++++
232964
 1 file changed, 5 insertions(+)
232964
232964
diff --git a/src/tss2-esys/api/Esys_Clear.c b/src/tss2-esys/api/Esys_Clear.c
232964
index f5c0b827425a..0f43f7e9b85f 100644
232964
--- a/src/tss2-esys/api/Esys_Clear.c
232964
+++ b/src/tss2-esys/api/Esys_Clear.c
232964
@@ -199,6 +199,11 @@ Esys_Clear_Async(
232964
     return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
232964
                           "Finish (Execute Async)");
232964
 
232964
+    /* If the command authorization is LOCKOUT we need to
232964
+     * recompute session value with an empty auth */
232964
+    if (authHandle == ESYS_TR_RH_LOCKOUT)
232964
+        iesys_compute_session_value(esysContext->session_tab[0], NULL, NULL);
232964
+
232964
     esysContext->state = _ESYS_STATE_SENT;
232964
 
232964
     return r;
232964
-- 
232964
2.30.1
232964