1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

Test crypto_aead with a short ciphertext

This commit is contained in:
Frank Denis 2014-09-13 14:51:21 -07:00
parent a92731a9f4
commit 2645422a32

View File

@ -91,6 +91,18 @@ int main(void)
printf("m != m2 (adlen=0)\n");
}
if (crypto_aead_chacha20poly1305_decrypt(m2, &m2len, NULL, c,
crypto_aead_chacha20poly1305_ABYTES / 2,
NULL, 0U,
nonce, firstkey) != -1) {
printf("crypto_aead_chacha20poly1305_decrypt() worked with a short ciphertext\n");
}
if (crypto_aead_chacha20poly1305_decrypt(m2, &m2len, NULL, c, 0U,
NULL, 0U,
nonce, firstkey) != -1) {
printf("crypto_aead_chacha20poly1305_decrypt() worked with an empty ciphertext\n");
}
assert(crypto_aead_chacha20poly1305_keybytes() > 0U);
assert(crypto_aead_chacha20poly1305_npubbytes() > 0U);
assert(crypto_aead_chacha20poly1305_nsecbytes() == 0U);