diff --git a/test/default/aead_aes256gcm.c b/test/default/aead_aes256gcm.c index 40c745bd..6c208261 100644 --- a/test/default/aead_aes256gcm.c +++ b/test/default/aead_aes256gcm.c @@ -3145,6 +3145,20 @@ tv(void) sodium_free(hex); } decrypted = (unsigned char *) sodium_malloc(message_len); + if (crypto_aead_aes256gcm_decrypt(decrypted, &found_message_len, + NULL, ciphertext, + randombytes_uniform(ciphertext_len), + ad, ad_len, nonce, key) != -1) { + printf("Verification of test vector #%u after truncation succeeded\n", + (unsigned int) i); + } + if (crypto_aead_aes256gcm_decrypt(decrypted, &found_message_len, + NULL, ciphertext, + randombytes_uniform(crypto_aead_aes256gcm_ABYTES), + ad, ad_len, nonce, key) != -1) { + printf("Verification of test vector #%u with a truncated tag failed\n", + (unsigned int) i); + } if (crypto_aead_aes256gcm_decrypt(decrypted, &found_message_len, NULL, ciphertext, ciphertext_len, ad, ad_len, nonce, key) != 0) {