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