From d4eec69ef1d58a50126ff84b89d52f0fbd16962e Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 5 Jan 2019 21:17:48 +0100 Subject: [PATCH] More tests --- test/default/sodium_utils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/default/sodium_utils.c b/test/default/sodium_utils.c index 7ad22d5d..379518fc 100644 --- a/test/default/sodium_utils.c +++ b/test/default/sodium_utils.c @@ -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);