libsodium: Update to version 0.5.0
[tomato/tomato-dir865l.git] / release / src / router / libsodium / test / default / verify1.c
blobdef6421ca692d927b3760b23d649b500a1d46d85
1 #include <stdio.h>
2 #include <string.h>
4 #define TEST_NAME "verify1"
5 #include "cmptest.h"
7 unsigned char v16[16], v16x[16];
8 unsigned char v32[32], v32x[32];
9 unsigned char v64[64], v64x[64];
11 int main(void)
13 randombytes_buf(v16, sizeof v16);
14 randombytes_buf(v32, sizeof v32);
15 randombytes_buf(v64, sizeof v64);
17 memcpy(v16x, v16, sizeof v16);
18 memcpy(v32x, v32, sizeof v32);
19 memcpy(v64x, v64, sizeof v64);
21 printf("%d\n", crypto_verify_16(v16, v16x));
22 printf("%d\n", crypto_verify_32(v32, v32x));
23 printf("%d\n", crypto_verify_64(v64, v64x));
25 v16x[randombytes_random() & 15U]++;
26 v32x[randombytes_random() & 31U]++;
27 v64x[randombytes_random() & 63U]++;
29 printf("%d\n", crypto_verify_16(v16, v16x));
30 printf("%d\n", crypto_verify_32(v32, v32x));
31 printf("%d\n", crypto_verify_64(v64, v64x));
33 return 0;