From 2f09913aebf47788a9a705e02227b29e6f42b6bb Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Mon, 11 Jan 2021 20:33:45 +0100 Subject: [PATCH] Set default IV for AES-GCM to 12 bytes Signed-off-by: Steven Cooreman --- tests/suites/test_suite_psa_crypto.function | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index 62c76c533..7e2b53f4e 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -484,6 +484,10 @@ static int exercise_aead_key( mbedtls_svc_key_id_t key, size_t ciphertext_length = sizeof( ciphertext ); size_t plaintext_length = sizeof( ciphertext ); + /* Default IV length for AES-GCM is 12 bytes */ + if( (alg & ~PSA_ALG_AEAD_TAG_LENGTH_MASK) == PSA_ALG_GCM ) + nonce_length = 12; + if( usage & PSA_KEY_USAGE_ENCRYPT ) { PSA_ASSERT( psa_aead_encrypt( key, alg,