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

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