From 6d81f7e1196faf6c0797110a272970c250fd55c6 Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Mon, 14 Sep 2020 13:14:31 +0200 Subject: [PATCH] Final feedback from @ronald-cron-arm Signed-off-by: Steven Cooreman --- library/psa_crypto.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 8383eaeb2..931e2e915 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -4088,9 +4088,11 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation, alg ); if( status == PSA_SUCCESS ) + { /* Once the driver context is initialised, it needs to be freed using * psa_cipher_abort. Indicate this through setting alg. */ operation->alg = alg; + } if( status != PSA_ERROR_NOT_SUPPORTED || psa_key_lifetime_is_external( slot->attr.lifetime ) ) @@ -4491,10 +4493,7 @@ psa_status_t psa_cipher_finish( psa_cipher_operation_t *operation, else if( output_size >= *output_length ) memcpy( output, temp_output_buffer, *output_length ); else - { status = PSA_ERROR_BUFFER_TOO_SMALL; - goto exit; - } exit: if( operation->mbedtls_in_use == 1 ) @@ -4505,8 +4504,6 @@ exit: else { *output_length = 0; - - mbedtls_platform_zeroize( temp_output_buffer, sizeof( temp_output_buffer ) ); (void) psa_cipher_abort( operation ); return( status );