diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-13 10:09:38 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-13 10:09:38 -0400 |
commit | d4fe483efd3e0062f12430efe9deb66d43d914d7 (patch) | |
tree | e6aa9ac716ae82cdb15c6e6cb5d9d1d9d29f053b /nacl/tests/auth5.c | |
parent | 835ef0320d47372eac14bef31c979b8217d04498 (diff) |
NaCl moved to other repo.
Diffstat (limited to 'nacl/tests/auth5.c')
-rw-r--r-- | nacl/tests/auth5.c | 36 |
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 | |||
6 | unsigned char key[32]; | ||
7 | unsigned char c[10000]; | ||
8 | unsigned char a[32]; | ||
9 | |||
10 | main() | ||
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 | } | ||