More tests
This commit is contained in:
parent
cc51916072
commit
b57f9668fc
@ -3185,6 +3185,11 @@ tv(void)
|
||||
printf("Verification of test vector #%u with a truncated tag failed\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
if (i == 0 && crypto_aead_aes256gcm_decrypt(NULL, NULL,
|
||||
NULL, ciphertext, ciphertext_len,
|
||||
ad, ad_len, nonce, key) != 0) {
|
||||
printf("Verification of test vector #%u's 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) {
|
||||
|
@ -66,6 +66,10 @@ tv(void)
|
||||
printf("m != m2\n");
|
||||
}
|
||||
memset(m2, 0, m2len);
|
||||
assert(crypto_aead_chacha20poly1305_decrypt_detached(NULL, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) == 0);
|
||||
if (crypto_aead_chacha20poly1305_decrypt_detached(m2, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
@ -239,6 +243,10 @@ tv_ietf(void)
|
||||
printf("m != m2\n");
|
||||
}
|
||||
memset(m2, 0, m2len);
|
||||
assert(crypto_aead_chacha20poly1305_ietf_decrypt_detached(NULL, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) == 0);
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt_detached(m2, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
|
@ -5,12 +5,32 @@
|
||||
#include <signal.h>
|
||||
|
||||
static void
|
||||
sigabrt_handler_3(int sig)
|
||||
sigabrt_handler_5(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_4(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_5);
|
||||
assert(crypto_aead_chacha20poly1305_ietf_encrypt(NULL, NULL, NULL, UINT64_MAX,
|
||||
NULL, 0, NULL, NULL, NULL) == -1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_3(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_4);
|
||||
assert(crypto_aead_chacha20poly1305_encrypt(NULL, NULL, NULL, UINT64_MAX,
|
||||
NULL, 0, NULL, NULL, NULL) == -1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_2(int sig)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user