From bbb19524147ae07ce02ae52ae4d6ee6f32ece5c8 Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Tue, 11 May 2021 11:10:34 +0200 Subject: [PATCH] Refactor out mac_sign_setup and mac_verify_setup Since they became equivalent after moving the is_sign checking back to the PSA core, they're now redundant, and the generic mac_setup function can just be called directly. Signed-off-by: Steven Cooreman --- library/psa_crypto_mac.c | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/library/psa_crypto_mac.c b/library/psa_crypto_mac.c index 9db9a37e52..20c56a0214 100644 --- a/library/psa_crypto_mac.c +++ b/library/psa_crypto_mac.c @@ -383,28 +383,6 @@ static psa_status_t mac_compute( return( PSA_ERROR_NOT_SUPPORTED ); } -static psa_status_t mac_sign_setup( - mbedtls_psa_mac_operation_t *operation, - const psa_key_attributes_t *attributes, - const uint8_t *key_buffer, - size_t key_buffer_size, - psa_algorithm_t alg ) -{ - return( mac_setup( operation, - attributes, key_buffer, key_buffer_size, alg ) ); -} - -static psa_status_t mac_verify_setup( - mbedtls_psa_mac_operation_t *operation, - const psa_key_attributes_t *attributes, - const uint8_t *key_buffer, - size_t key_buffer_size, - psa_algorithm_t alg ) -{ - return( mac_setup( operation, - attributes, key_buffer, key_buffer_size, alg ) ); -} - static psa_status_t mac_update( mbedtls_psa_mac_operation_t *operation, const uint8_t *input, @@ -545,8 +523,8 @@ psa_status_t mbedtls_psa_mac_sign_setup( size_t key_buffer_size, psa_algorithm_t alg ) { - return( mac_sign_setup( operation, attributes, - key_buffer, key_buffer_size, alg ) ); + return( mac_setup( operation, attributes, + key_buffer, key_buffer_size, alg ) ); } psa_status_t mbedtls_psa_mac_verify_setup( @@ -556,8 +534,8 @@ psa_status_t mbedtls_psa_mac_verify_setup( size_t key_buffer_size, psa_algorithm_t alg ) { - return( mac_verify_setup( operation, attributes, - key_buffer, key_buffer_size, alg ) ); + return( mac_setup( operation, attributes, + key_buffer, key_buffer_size, alg ) ); } psa_status_t mbedtls_psa_mac_update( @@ -642,8 +620,8 @@ psa_status_t mbedtls_transparent_test_driver_mac_sign_setup( psa_algorithm_t alg ) { if( is_mac_accelerated( alg ) ) - return( mac_sign_setup( operation, attributes, - key_buffer, key_buffer_size, alg ) ); + return( mac_setup( operation, attributes, + key_buffer, key_buffer_size, alg ) ); else return( PSA_ERROR_NOT_SUPPORTED ); } @@ -656,8 +634,8 @@ psa_status_t mbedtls_transparent_test_driver_mac_verify_setup( psa_algorithm_t alg ) { if( is_mac_accelerated( alg ) ) - return( mac_verify_setup( operation, attributes, - key_buffer, key_buffer_size, alg ) ); + return( mac_setup( operation, attributes, + key_buffer, key_buffer_size, alg ) ); else return( PSA_ERROR_NOT_SUPPORTED ); }