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

Check a return value in the secretbox_easy2 test

This commit is contained in:
Frank Denis 2015-11-01 14:45:35 +01:00
parent ec246dea25
commit debed38314

View File

@ -19,9 +19,11 @@ int main(void)
randombytes_buf(m, (unsigned long long) mlen);
randombytes_buf(nonce, sizeof nonce);
crypto_secretbox_easy(c, m, (unsigned long long) mlen, nonce, k);
crypto_secretbox_open_easy(m2, c,
(unsigned long long) mlen + crypto_secretbox_MACBYTES,
nonce, k);
if (crypto_secretbox_open_easy(m2, c,
(unsigned long long) mlen + crypto_secretbox_MACBYTES,
nonce, k) != 0) {
printf("crypto_secretbox_open_easy() failed\n");
}
printf("%d\n", memcmp(m, m2, mlen));
for (i = 0; i < mlen + crypto_secretbox_MACBYTES - 1; i++) {