summaryrefslogtreecommitdiff
path: root/nacl/tests/auth5.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-13 10:09:38 -0400
committerirungentoo <irungentoo@gmail.com>2013-07-13 10:09:38 -0400
commitd4fe483efd3e0062f12430efe9deb66d43d914d7 (patch)
treee6aa9ac716ae82cdb15c6e6cb5d9d1d9d29f053b /nacl/tests/auth5.c
parent835ef0320d47372eac14bef31c979b8217d04498 (diff)
NaCl moved to other repo.
Diffstat (limited to 'nacl/tests/auth5.c')
-rw-r--r--nacl/tests/auth5.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/nacl/tests/auth5.c b/nacl/tests/auth5.c
deleted file mode 100644
index d304a073..00000000
--- a/nacl/tests/auth5.c
+++ /dev/null
@@ -1,36 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include "crypto_auth_hmacsha512256.h"
4#include "randombytes.h"
5
6unsigned char key[32];
7unsigned char c[10000];
8unsigned char a[32];
9
10main()
11{
12 int clen;
13 int i;
14 for (clen = 0;clen < 10000;++clen) {
15 randombytes(key,sizeof key);
16 randombytes(c,clen);
17 crypto_auth_hmacsha512256(a,c,clen,key);
18 if (crypto_auth_hmacsha512256_verify(a,c,clen,key) != 0) {
19 printf("fail %d\n",clen);
20 return 100;
21 }
22 if (clen > 0) {
23 c[random() % clen] += 1 + (random() % 255);
24 if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) {
25 printf("forgery %d\n",clen);
26 return 100;
27 }
28 a[random() % sizeof a] += 1 + (random() % 255);
29 if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) {
30 printf("forgery %d\n",clen);
31 return 100;
32 }
33 }
34 }
35 return 0;
36}