chantra / rpms / tpm2-tss

Forked from rpms/tpm2-tss 2 years ago
Clone

Blame SOURCES/0001-esys-fixup-compute_encrypted_salt-err-handling-in-Es.patch

b9d646
From 380d5f9ec3aa1f5e456598fe66d275467660177b Mon Sep 17 00:00:00 2001
b9d646
From: Tadeusz Struk <tadeusz.struk@intel.com>
b9d646
Date: Thu, 16 Jan 2020 09:27:04 -0800
b9d646
Subject: [PATCH] esys: fixup compute_encrypted_salt err handling in
b9d646
 Esys_StartAuthSession
b9d646
b9d646
Use return_state_if_error() macro for compute_encrypted_salt()
b9d646
error handling in Esys_StartAuthSession to maintain the correct
b9d646
context state.
b9d646
b9d646
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
b9d646
---
b9d646
 src/tss2-esys/api/Esys_StartAuthSession.c | 13 ++++---------
b9d646
 1 file changed, 4 insertions(+), 9 deletions(-)
b9d646
b9d646
diff --git a/src/tss2-esys/api/Esys_StartAuthSession.c b/src/tss2-esys/api/Esys_StartAuthSession.c
b9d646
index 3ccd842a7572..1717928a717d 100644
b9d646
--- a/src/tss2-esys/api/Esys_StartAuthSession.c
b9d646
+++ b/src/tss2-esys/api/Esys_StartAuthSession.c
b9d646
@@ -223,20 +223,15 @@ Esys_StartAuthSession_Async(
b9d646
     TSS2_RC r2;
b9d646
     r2 = iesys_compute_encrypted_salt(esysContext, tpmKeyNode,
b9d646
                                       &encryptedSaltAux);
b9d646
-    return_if_error(r2, "Error in parameter encryption.");
b9d646
+    return_state_if_error(r2, _ESYS_STATE_INIT, "Error in parameter encryption.");
b9d646
 
b9d646
     if (nonceCaller == NULL) {
b9d646
         r2 = iesys_crypto_hash_get_digest_size(authHash,&authHash_size);
b9d646
-        if (r2 != TSS2_RC_SUCCESS) {
b9d646
-            LOG_ERROR("Error: initialize auth session (%x).", r2);
b9d646
-            return r2;
b9d646
-        }
b9d646
+        return_state_if_error(r2, _ESYS_STATE_INIT, "Error in hash_get_digest_size.");
b9d646
+
b9d646
         r2 = iesys_crypto_random2b(&esysContext->in.StartAuthSession.nonceCallerData,
b9d646
                                    authHash_size);
b9d646
-        if (r2 != TSS2_RC_SUCCESS) {
b9d646
-            LOG_ERROR("Error: initialize auth session (%x).", r2);
b9d646
-            return r2;
b9d646
-        }
b9d646
+        return_state_if_error(r2, _ESYS_STATE_INIT, "Error in crypto_random2b.");
b9d646
         esysContext->in.StartAuthSession.nonceCaller
b9d646
            = &esysContext->in.StartAuthSession.nonceCallerData;
b9d646
         nonceCaller = esysContext->in.StartAuthSession.nonceCaller;
b9d646
-- 
b9d646
2.27.0
b9d646