Set default IV for AES-GCM to 12 bytes

Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
Steven Cooreman 2021-01-11 20:33:45 +01:00 committed by Ronald Cron
parent 82645b153d
commit 2f09913aeb

View file

@ -484,6 +484,10 @@ static int exercise_aead_key( mbedtls_svc_key_id_t key,
size_t ciphertext_length = sizeof( ciphertext ); size_t ciphertext_length = sizeof( ciphertext );
size_t plaintext_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 ) if( usage & PSA_KEY_USAGE_ENCRYPT )
{ {
PSA_ASSERT( psa_aead_encrypt( key, alg, PSA_ASSERT( psa_aead_encrypt( key, alg,