libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / libsodium / test / default / sodium_utils.c
blob755147ed5517c33e7fff9adbd81ae23293da7a99
1 #include <stdio.h>
2 #include <string.h>
4 #define TEST_NAME "sodium_utils"
5 #include "cmptest.h"
7 int main(void)
9 unsigned char buf1[1000];
10 unsigned char buf2[1000];
12 randombytes(buf1, sizeof buf1);
13 memcpy(buf2, buf1, sizeof buf2);
14 printf ("%d\n", sodium_memcmp(buf1, buf2, sizeof buf1));
15 sodium_memzero(buf1, 0U);
16 printf ("%d\n", sodium_memcmp(buf1, buf2, sizeof buf1));
17 sodium_memzero(buf1, sizeof buf1 / 2);
18 printf ("%d\n", sodium_memcmp(buf1, buf2, sizeof buf1));
19 printf ("%d\n", sodium_memcmp(buf1, buf2, 0U));
20 sodium_memzero(buf2, sizeof buf2 / 2);
21 printf ("%d\n", sodium_memcmp(buf1, buf2, sizeof buf1));
23 return 0;