diff --git a/.gitignore b/.gitignore index a47195eb..3b1c0f66 100644 --- a/.gitignore +++ b/.gitignore @@ -100,6 +100,7 @@ test/default/stream3 test/default/stream4 test/default/stream5 test/default/stream6 +test/default/verify1 test-driver testing android-toolchain-* diff --git a/test/default/Makefile.am b/test/default/Makefile.am index f637cec0..36b04329 100644 --- a/test/default/Makefile.am +++ b/test/default/Makefile.am @@ -48,7 +48,8 @@ EXTRA_DIST = \ stream3.exp \ stream4.exp \ stream5.exp \ - stream6.exp + stream6.exp \ + verify1.exp DISTCLEANFILES = \ auth.res \ @@ -97,7 +98,8 @@ DISTCLEANFILES = \ stream3.res \ stream4.res \ stream5.res \ - stream6.res + stream6.res \ + verify1.res AM_CPPFLAGS = \ -DTEST_SRCDIR=\"@srcdir@\" \ @@ -154,7 +156,8 @@ TESTS_TARGETS = \ stream3 \ stream4 \ stream5 \ - stream6 + stream6 \ + verify1 check_PROGRAMS = $(TESTS_TARGETS) @@ -304,4 +307,7 @@ stream5_LDADD = $(TESTS_LDADD) stream6_SOURCE = cmptest.h stream6.c stream6_LDADD = $(TESTS_LDADD) +verify1_SOURCE = cmptest.h verify1.c +verify1_LDADD = $(TESTS_LDADD) + verify: check diff --git a/test/default/verify1.c b/test/default/verify1.c new file mode 100644 index 00000000..def6421c --- /dev/null +++ b/test/default/verify1.c @@ -0,0 +1,34 @@ +#include +#include + +#define TEST_NAME "verify1" +#include "cmptest.h" + +unsigned char v16[16], v16x[16]; +unsigned char v32[32], v32x[32]; +unsigned char v64[64], v64x[64]; + +int main(void) +{ + randombytes_buf(v16, sizeof v16); + randombytes_buf(v32, sizeof v32); + randombytes_buf(v64, sizeof v64); + + memcpy(v16x, v16, sizeof v16); + memcpy(v32x, v32, sizeof v32); + memcpy(v64x, v64, sizeof v64); + + printf("%d\n", crypto_verify_16(v16, v16x)); + printf("%d\n", crypto_verify_32(v32, v32x)); + printf("%d\n", crypto_verify_64(v64, v64x)); + + v16x[randombytes_random() & 15U]++; + v32x[randombytes_random() & 31U]++; + v64x[randombytes_random() & 63U]++; + + printf("%d\n", crypto_verify_16(v16, v16x)); + printf("%d\n", crypto_verify_32(v32, v32x)); + printf("%d\n", crypto_verify_64(v64, v64x)); + + return 0; +} diff --git a/test/default/verify1.exp b/test/default/verify1.exp new file mode 100644 index 00000000..2b845004 --- /dev/null +++ b/test/default/verify1.exp @@ -0,0 +1,6 @@ +0 +0 +0 +-1 +-1 +-1