From 61bb8fc693687c05c66eaafaf3c0ece217e84594 Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Mon, 15 Mar 2021 12:32:48 +0100 Subject: [PATCH] remove superfluous calls to hash_abort The PSA Core is already calling psa_hash_abort, so the driver doesn't have to do that explicitly. Signed-off-by: Steven Cooreman --- library/psa_crypto_hash.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/library/psa_crypto_hash.c b/library/psa_crypto_hash.c index bd9a1d7e53..432d8a0caa 100644 --- a/library/psa_crypto_hash.c +++ b/library/psa_crypto_hash.c @@ -422,8 +422,6 @@ static psa_status_t hash_update( return( PSA_ERROR_BAD_STATE ); } - if( ret != 0 ) - hash_abort( operation ); return( mbedtls_to_psa_error( ret ) ); } @@ -507,15 +505,8 @@ static psa_status_t hash_finish( exit: if( status == PSA_SUCCESS ) - { *hash_length = actual_hash_length; - return( hash_abort( operation ) ); - } - else - { - hash_abort( operation ); - return( status ); - } + return( status ); } static psa_status_t hash_compute( @@ -528,6 +519,7 @@ static psa_status_t hash_compute( { mbedtls_psa_hash_operation_t operation = MBEDTLS_PSA_HASH_OPERATION_INIT; psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + psa_status_t abort_status = PSA_ERROR_CORRUPTION_DETECTED; *hash_length = hash_size; status = hash_setup( &operation, alg ); @@ -541,11 +533,12 @@ static psa_status_t hash_compute( goto exit; exit: + abort_status = hash_abort( &operation ); if( status == PSA_SUCCESS ) - status = hash_abort( &operation ); + return( abort_status ); else - hash_abort( &operation ); - return( status ); + return( status ); + } #endif /* INCLUDE_HASH_CORE */