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>
diff --git a/library/psa_crypto_mac.c b/library/psa_crypto_mac.c
index 9db9a37..20c56a0 100644
--- a/library/psa_crypto_mac.c
+++ b/library/psa_crypto_mac.c
@@ -383,28 +383,6 @@
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 @@
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 @@
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_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_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 );
}