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 <steven.cooreman@silabs.com>
This commit is contained in:
Steven Cooreman 2021-05-11 11:10:34 +02:00
parent 8af5c5c7de
commit 9e15fb783c

View file

@ -383,28 +383,6 @@ static psa_status_t mac_compute(
return( PSA_ERROR_NOT_SUPPORTED ); 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( static psa_status_t mac_update(
mbedtls_psa_mac_operation_t *operation, mbedtls_psa_mac_operation_t *operation,
const uint8_t *input, const uint8_t *input,
@ -545,8 +523,8 @@ psa_status_t mbedtls_psa_mac_sign_setup(
size_t key_buffer_size, size_t key_buffer_size,
psa_algorithm_t alg ) psa_algorithm_t alg )
{ {
return( mac_sign_setup( operation, attributes, return( mac_setup( operation, attributes,
key_buffer, key_buffer_size, alg ) ); key_buffer, key_buffer_size, alg ) );
} }
psa_status_t mbedtls_psa_mac_verify_setup( 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, size_t key_buffer_size,
psa_algorithm_t alg ) psa_algorithm_t alg )
{ {
return( mac_verify_setup( operation, attributes, return( mac_setup( operation, attributes,
key_buffer, key_buffer_size, alg ) ); key_buffer, key_buffer_size, alg ) );
} }
psa_status_t mbedtls_psa_mac_update( 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 ) psa_algorithm_t alg )
{ {
if( is_mac_accelerated( alg ) ) if( is_mac_accelerated( alg ) )
return( mac_sign_setup( operation, attributes, return( mac_setup( operation, attributes,
key_buffer, key_buffer_size, alg ) ); key_buffer, key_buffer_size, alg ) );
else else
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }
@ -656,8 +634,8 @@ psa_status_t mbedtls_transparent_test_driver_mac_verify_setup(
psa_algorithm_t alg ) psa_algorithm_t alg )
{ {
if( is_mac_accelerated( alg ) ) if( is_mac_accelerated( alg ) )
return( mac_verify_setup( operation, attributes, return( mac_setup( operation, attributes,
key_buffer, key_buffer_size, alg ) ); key_buffer, key_buffer_size, alg ) );
else else
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }