From e4030f2cd181bd9885dd437d0aef419b5a3fb1be Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Tue, 22 Jun 2021 17:36:55 +0100 Subject: [PATCH] Replace function with macro that already exists I wrote a function to determine the base algorithm given a variant, however this is already implemented by PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG Signed-off-by: Paul Elliott --- library/psa_crypto.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index aec22c79c..9254f36e7 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -3398,20 +3398,7 @@ psa_status_t psa_aead_decrypt( mbedtls_svc_key_id_t key, /* Helper function to get the base algorithm from its variants. */ static psa_algorithm_t psa_aead_get_base_algorithm(psa_algorithm_t alg) { - switch( PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, 0 ) ) - { - case PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_CCM, 0 ): - return( PSA_ALG_CCM ); - - case PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_GCM, 0 ): - return( PSA_ALG_GCM ); - - case PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_CHACHA20_POLY1305, 0 ): - return( PSA_ALG_CHACHA20_POLY1305 ); - - default: - return( PSA_ERROR_NOT_SUPPORTED ); - } + return PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG( alg ); } /* Set the key for a multipart authenticated encryption operation. */