From aaec341c9b5268a5f078f81dee27596c113e5d9a Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Thu, 18 Feb 2021 13:30:34 +0100 Subject: [PATCH] Exercise CCM with the right amount of IV bytes in test Signed-off-by: Steven Cooreman --- tests/src/psa_exercise_key.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c index 9f80d7b65..869da7df6 100644 --- a/tests/src/psa_exercise_key.c +++ b/tests/src/psa_exercise_key.c @@ -243,6 +243,13 @@ static int exercise_aead_key( mbedtls_svc_key_id_t key, nonce_length = 12; } + /* IV length for CCM needs to be between 7 and 13 bytes */ + if( PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, 0 ) == + PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_CCM, 0 ) ) + { + nonce_length = 12; + } + if( usage & PSA_KEY_USAGE_ENCRYPT ) { PSA_ASSERT( psa_aead_encrypt( key, alg,