From b09e1970bc4f2975161020247ad74c7b82614e6c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 4 Apr 2016 10:47:54 +0200 Subject: [PATCH] Test that ciphertexts shorter than the MAC size aren't even read --- test/default/aead_aes256gcm.c | 2 +- test/default/aead_chacha20poly1305.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/default/aead_aes256gcm.c b/test/default/aead_aes256gcm.c index cd6760b5..3338c5fd 100644 --- a/test/default/aead_aes256gcm.c +++ b/test/default/aead_aes256gcm.c @@ -3179,7 +3179,7 @@ tv(void) printf("Message length should have been set to zero after a failure\n"); } if (crypto_aead_aes256gcm_decrypt(decrypted, &found_message_len, - NULL, ciphertext, + NULL, NULL, randombytes_uniform(crypto_aead_aes256gcm_ABYTES), ad, ad_len, nonce, key) != -1) { printf("Verification of test vector #%u with a truncated tag failed\n", diff --git a/test/default/aead_chacha20poly1305.c b/test/default/aead_chacha20poly1305.c index 7725d656..8d1b3aae 100644 --- a/test/default/aead_chacha20poly1305.c +++ b/test/default/aead_chacha20poly1305.c @@ -111,7 +111,7 @@ tv(void) } m2len = 1; if (crypto_aead_chacha20poly1305_decrypt( - m2, &m2len, NULL, c, + m2, &m2len, NULL, NULL, randombytes_uniform(crypto_aead_chacha20poly1305_ABYTES), NULL, 0U, nonce, firstkey) != -1) { printf("crypto_aead_chacha20poly1305_decrypt() worked with a short " @@ -282,7 +282,7 @@ tv_ietf(void) } m2len = 1; if (crypto_aead_chacha20poly1305_ietf_decrypt( - m2, &m2len, NULL, c, + m2, &m2len, NULL, NULL, randombytes_uniform(crypto_aead_chacha20poly1305_ietf_ABYTES), NULL, 0U, nonce, firstkey) != -1) { printf("crypto_aead_chacha20poly1305_ietf_decrypt() worked with a short "