Blame SOURCES/0001-esys-fix-Esys_StartAuthSession-called-with-optional-.patch

28cd4a
From 0bd19b61c8cd07d03b6efffc05f95d5ec427a3d6 Mon Sep 17 00:00:00 2001
28cd4a
From: Tadeusz Struk <tadeusz.struk@intel.com>
28cd4a
Date: Tue, 14 Jan 2020 10:55:20 -0800
28cd4a
Subject: [PATCH] esys: fix Esys_StartAuthSession called with optional params
28cd4a
28cd4a
For an HMAC session if any of the optional params are ESYS_TR_NONE
28cd4a
we need to use the same tpm2_handles TPM2_RH_NULL (0x40000007)
28cd4a
as in the prepare call to correctly calculate cpHash and HMAC
28cd4a
values for the session.
28cd4a
28cd4a
Fixes: #1590
28cd4a
28cd4a
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
28cd4a
---
28cd4a
 src/tss2-esys/api/Esys_StartAuthSession.c | 14 +++++++++++++-
28cd4a
 1 file changed, 13 insertions(+), 1 deletion(-)
28cd4a
28cd4a
diff --git a/src/tss2-esys/api/Esys_StartAuthSession.c b/src/tss2-esys/api/Esys_StartAuthSession.c
28cd4a
index 313604a2077c..3ccd842a7572 100644
28cd4a
--- a/src/tss2-esys/api/Esys_StartAuthSession.c
28cd4a
+++ b/src/tss2-esys/api/Esys_StartAuthSession.c
28cd4a
@@ -260,7 +260,19 @@ Esys_StartAuthSession_Async(
28cd4a
     iesys_compute_session_value(esysContext->session_tab[2], NULL, NULL);
28cd4a
 
28cd4a
     /* Generate the auth values and set them in the SAPI command buffer */
28cd4a
-    r = iesys_gen_auths(esysContext, tpmKeyNode, bindNode, NULL, &auths);
28cd4a
+
28cd4a
+    RSRC_NODE_T none;
28cd4a
+    size_t offset = 0;
28cd4a
+    none.rsrc.handle = TPM2_RH_NULL;
28cd4a
+    none.rsrc.rsrcType = IESYSC_WITHOUT_MISC_RSRC;
28cd4a
+    r = Tss2_MU_TPM2_HANDLE_Marshal(TPM2_RH_NULL,
28cd4a
+                                none.rsrc.name.name,
28cd4a
+                                sizeof(none.rsrc.name.name),
28cd4a
+                                &offset);
28cd4a
+    return_state_if_error(r, _ESYS_STATE_INIT, "Marshaling TPM handle.");
28cd4a
+    none.rsrc.name.size = offset;
28cd4a
+    r = iesys_gen_auths(esysContext, tpmKeyNode ? tpmKeyNode : &none,
28cd4a
+                                     bindNode ? bindNode : &none, NULL, &auths);
28cd4a
     return_state_if_error(r, _ESYS_STATE_INIT,
28cd4a
                           "Error in computation of auth values");
28cd4a
 
28cd4a
-- 
28cd4a
2.27.0
28cd4a