chantra / rpms / tpm2-tss

Forked from rpms/tpm2-tss 2 years ago
Clone

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

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