Make the test of truncated chacha20poly1305 ciphers less deterministic

This commit is contained in:
Frank Denis
2016-04-04 10:40:23 +02:00
parent 501ec7a679
commit d73124a025
+7 -5
View File
@@ -111,8 +111,9 @@ tv(void)
}
m2len = 1;
if (crypto_aead_chacha20poly1305_decrypt(
m2, &m2len, NULL, c, crypto_aead_chacha20poly1305_ABYTES / 2, NULL,
0U, nonce, firstkey) != -1) {
m2, &m2len, NULL, c,
randombytes_uniform(crypto_aead_chacha20poly1305_ABYTES),
NULL, 0U, nonce, firstkey) != -1) {
printf("crypto_aead_chacha20poly1305_decrypt() worked with a short "
"ciphertext\n");
}
@@ -281,8 +282,9 @@ tv_ietf(void)
}
m2len = 1;
if (crypto_aead_chacha20poly1305_ietf_decrypt(
m2, &m2len, NULL, c, crypto_aead_chacha20poly1305_ietf_ABYTES / 2, NULL,
0U, nonce, firstkey) != -1) {
m2, &m2len, NULL, c,
randombytes_uniform(crypto_aead_chacha20poly1305_ietf_ABYTES),
NULL, 0U, nonce, firstkey) != -1) {
printf("crypto_aead_chacha20poly1305_ietf_decrypt() worked with a short "
"ciphertext\n");
}
@@ -314,7 +316,7 @@ tv_ietf(void)
printf("\n");
if (crypto_aead_chacha20poly1305_ietf_decrypt(c, &m2len, NULL, c, CLEN,
NULL, 0U, nonce, firstkey) != 0) {
NULL, 0U, nonce, firstkey) != 0) {
printf("crypto_aead_chacha20poly1305_ietf_decrypt() failed (adlen=0)\n");
}
if (m2len != MLEN) {