From e88477844c4e1aa1a43ff1214031331e2323a193 Mon Sep 17 00:00:00 2001 From: Przemyslaw Stekiel Date: Mon, 24 Jan 2022 23:19:21 +0100 Subject: [PATCH] Adapt the mbed tls mode: ccm or gcm or cachapoly to psa version mode == MBEDTLS_MODE_CCM || mode == MBEDTLS_GCM || mode == MBEDTLS_CHACHAPOLY is equivalent to PSA_ALG_IS_AEAD( alg ). Signed-off-by: Przemyslaw Stekiel --- library/ssl_msg.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/library/ssl_msg.c b/library/ssl_msg.c index e473c27f1..d27c561f7 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -793,12 +793,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl, defined(MBEDTLS_CCM_C) || \ defined(MBEDTLS_CHACHAPOLY_C) #if defined(MBEDTLS_USE_PSA_CRYPTO) - if ( transform->psa_alg == PSA_ALG_GCM || - /* PSA_ALG_IS_AEAD( transform->psa_alg ) corresponds to - psa_alg == PSA_ALG_CCM || psa_alg == PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_CCM, 8 ) - in tls context (TLS only uses the default taglen or 8) */ - PSA_ALG_IS_AEAD( transform->psa_alg ) || - transform->psa_alg == PSA_ALG_CHACHA20_POLY1305 ) + if ( PSA_ALG_IS_AEAD( transform->psa_alg ) ) #else if( mode == MBEDTLS_MODE_GCM || mode == MBEDTLS_MODE_CCM || @@ -1233,12 +1228,7 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl, defined(MBEDTLS_CCM_C) || \ defined(MBEDTLS_CHACHAPOLY_C) #if defined(MBEDTLS_USE_PSA_CRYPTO) - if ( transform->psa_alg == PSA_ALG_GCM || - /* PSA_ALG_IS_AEAD( transform->psa_alg ) corresponds to - psa_alg == PSA_ALG_CCM || psa_alg == PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_CCM, 8 ) - in tls context (TLS only uses the default taglen or 8) */ - PSA_ALG_IS_AEAD( transform->psa_alg ) || - transform->psa_alg == PSA_ALG_CHACHA20_POLY1305 ) + if ( PSA_ALG_IS_AEAD( transform->psa_alg ) ) #else if( mode == MBEDTLS_MODE_GCM || mode == MBEDTLS_MODE_CCM ||