chantra / rpms / tpm2-tss

Forked from rpms/tpm2-tss 2 years ago
Clone

Blame SOURCES/0001-esys-zero-out-ctx-salt-after-on-startAuthSession_fin.patch

e56592
From 1ec07af70925ece698b733d55dedd1d9878b70f2 Mon Sep 17 00:00:00 2001
e56592
From: Tadeusz Struk <tadeusz.struk@intel.com>
e56592
Date: Fri, 24 Jan 2020 19:05:34 -0800
e56592
Subject: [PATCH] esys: zero out ctx->salt after on startAuthSession_finish
e56592
e56592
The ctx->salt is used to calculate session key during
e56592
startAuthSession call if the caller pass a valid tpmKey
e56592
parameter. There salt is calculated in the _Async call
e56592
and the the session key is calculated in the _Finish call.
e56592
The problem is that if in the same context an unsalted
e56592
session is created after a salted session the ctx->salt
e56592
will still hold the old value and it will incorrectly
e56592
be used for session key calculation in the the subsequent
e56592
_Finish call. To fix this the salt needs to be set to
e56592
cleaned after no longer needed.
e56592
e56592
Fixes: #1574
e56592
e56592
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
e56592
---
e56592
 src/tss2-esys/api/Esys_StartAuthSession.c | 1 +
e56592
 1 file changed, 1 insertion(+)
e56592
e56592
diff --git a/src/tss2-esys/api/Esys_StartAuthSession.c b/src/tss2-esys/api/Esys_StartAuthSession.c
e56592
index 1717928a717d..6367419d7c9a 100644
e56592
--- a/src/tss2-esys/api/Esys_StartAuthSession.c
e56592
+++ b/src/tss2-esys/api/Esys_StartAuthSession.c
e56592
@@ -497,6 +497,7 @@ Esys_StartAuthSession_Finish(
e56592
     goto_if_error(r, "Marshal session name", error_cleanup);
e56592
 
e56592
     sessionHandleNode->rsrc.name.size = offset;
e56592
+    memset(&esysContext->salt, '\0', sizeof(esysContext->salt));
e56592
     esysContext->state = _ESYS_STATE_INIT;
e56592
 
e56592
     return TSS2_RC_SUCCESS;
e56592
-- 
e56592
2.27.0
e56592