summaryrefslogtreecommitdiff
path: root/test/default/verify1.c
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2014-08-11 13:49:21 -0400
committerMicah Anderson <micah@riseup.net>2014-08-11 13:49:21 -0400
commit2e59f9740a29439df7c7a56cf0ae83dec3081d31 (patch)
treed5e7c4e74c9a0f1ea999327d2e68b1dd27be00e0 /test/default/verify1.c
initial import of debian version from mentors0.6.1
Diffstat (limited to 'test/default/verify1.c')
-rw-r--r--test/default/verify1.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/default/verify1.c b/test/default/verify1.c
new file mode 100644
index 0000000..def6421
--- /dev/null
+++ b/test/default/verify1.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <string.h>
+
+#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;
+}