Code flow/readability improvements after review
* Early return since there's nothing to clean up
* Get rid of unnecessary local variable
* Check algorithm validity for MAC in the PSA core instead of in the driver
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
diff --git a/library/psa_crypto_mac.c b/library/psa_crypto_mac.c
index 0189cde..d8e2293 100644
--- a/library/psa_crypto_mac.c
+++ b/library/psa_crypto_mac.c
@@ -243,7 +243,7 @@
mbedtls_psa_mac_operation_t *operation,
psa_algorithm_t alg )
{
- psa_status_t status = PSA_ERROR_NOT_SUPPORTED;
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
operation->alg = PSA_ALG_FULL_LENGTH_MAC( alg );
operation->key_set = 0;
@@ -268,8 +268,7 @@
else
#endif /* BUILTIN_ALG_HMAC */
{
- if( ! PSA_ALG_IS_MAC( alg ) )
- status = PSA_ERROR_INVALID_ARGUMENT;
+ status = PSA_ERROR_NOT_SUPPORTED;
}
if( status != PSA_SUCCESS )