From fbc4b4aa8e86fc3f2c584a1ad5157ccb90bb5d9f Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Fri, 10 Jun 2022 08:54:53 +0200 Subject: [PATCH] Fix psa_pake_abort() order to correctly free memory when alg is PSA_ALG_JPAKE Signed-off-by: Neil Armstrong --- library/psa_crypto_pake.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/psa_crypto_pake.c b/library/psa_crypto_pake.c index 7f147b7cca..48995dd0d1 100644 --- a/library/psa_crypto_pake.c +++ b/library/psa_crypto_pake.c @@ -702,10 +702,6 @@ psa_status_t psa_pake_abort(psa_pake_operation_t * operation) return( PSA_SUCCESS ); } - operation->alg = 0; - operation->state = 0; - operation->sequence = 0; - #if defined(MBEDTLS_PSA_BUILTIN_ALG_ECJPAKE) if( operation->alg == PSA_ALG_JPAKE ) { @@ -721,6 +717,10 @@ psa_status_t psa_pake_abort(psa_pake_operation_t * operation) } #endif + operation->alg = 0; + operation->state = 0; + operation->sequence = 0; + return( PSA_SUCCESS ); }