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

More tests

This commit is contained in:
Frank Denis 2019-01-05 21:17:48 +01:00
parent 0205a8035e
commit d4eec69ef1

View File

@ -155,6 +155,18 @@ main(void)
printf("%s\n",
sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce));
randombytes_buf(buf1, 64U);
randombytes_buf(buf2, 64U);
memset(buf_add, 0, 64U);
sodium_add(buf_add, buf1, 64U);
assert(!sodium_is_zero(buf_add, 64U));
sodium_add(buf_add, buf2, 64U);
assert(!sodium_is_zero(buf_add, 64U));
sodium_sub(buf_add, buf1, 64U);
assert(!sodium_is_zero(buf_add, 64U));
sodium_sub(buf_add, buf2, 64U);
assert(sodium_is_zero(buf_add, 64U));
for (i = 0; i < 2000U; i++) {
bin_len = randombytes_uniform(200U);
blocksize = 1U + randombytes_uniform(500U);