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/crypto_verify | |
parent | 835ef0320d47372eac14bef31c979b8217d04498 (diff) |
NaCl moved to other repo.
Diffstat (limited to 'nacl/crypto_verify')
-rw-r--r-- | nacl/crypto_verify/16/checksum | 1 | ||||
-rw-r--r-- | nacl/crypto_verify/16/ref/api.h | 1 | ||||
-rw-r--r-- | nacl/crypto_verify/16/ref/verify.c | 24 | ||||
-rw-r--r-- | nacl/crypto_verify/16/used | 0 | ||||
-rw-r--r-- | nacl/crypto_verify/32/checksum | 1 | ||||
-rw-r--r-- | nacl/crypto_verify/32/ref/api.h | 1 | ||||
-rw-r--r-- | nacl/crypto_verify/32/ref/verify.c | 40 | ||||
-rw-r--r-- | nacl/crypto_verify/32/used | 0 | ||||
-rw-r--r-- | nacl/crypto_verify/measure.c | 18 | ||||
-rw-r--r-- | nacl/crypto_verify/try.c | 75 | ||||
-rw-r--r-- | nacl/crypto_verify/wrapper-empty.cpp | 0 |
11 files changed, 0 insertions, 161 deletions
diff --git a/nacl/crypto_verify/16/checksum b/nacl/crypto_verify/16/checksum deleted file mode 100644 index 573541ac..00000000 --- a/nacl/crypto_verify/16/checksum +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 0 | ||
diff --git a/nacl/crypto_verify/16/ref/api.h b/nacl/crypto_verify/16/ref/api.h deleted file mode 100644 index 32be2f97..00000000 --- a/nacl/crypto_verify/16/ref/api.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #define CRYPTO_BYTES 16 | ||
diff --git a/nacl/crypto_verify/16/ref/verify.c b/nacl/crypto_verify/16/ref/verify.c deleted file mode 100644 index d356060c..00000000 --- a/nacl/crypto_verify/16/ref/verify.c +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #include "crypto_verify.h" | ||
2 | |||
3 | int crypto_verify(const unsigned char *x,const unsigned char *y) | ||
4 | { | ||
5 | unsigned int differentbits = 0; | ||
6 | #define F(i) differentbits |= x[i] ^ y[i]; | ||
7 | F(0) | ||
8 | F(1) | ||
9 | F(2) | ||
10 | F(3) | ||
11 | F(4) | ||
12 | F(5) | ||
13 | F(6) | ||
14 | F(7) | ||
15 | F(8) | ||
16 | F(9) | ||
17 | F(10) | ||
18 | F(11) | ||
19 | F(12) | ||
20 | F(13) | ||
21 | F(14) | ||
22 | F(15) | ||
23 | return (1 & ((differentbits - 1) >> 8)) - 1; | ||
24 | } | ||
diff --git a/nacl/crypto_verify/16/used b/nacl/crypto_verify/16/used deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_verify/16/used +++ /dev/null | |||
diff --git a/nacl/crypto_verify/32/checksum b/nacl/crypto_verify/32/checksum deleted file mode 100644 index 573541ac..00000000 --- a/nacl/crypto_verify/32/checksum +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 0 | ||
diff --git a/nacl/crypto_verify/32/ref/api.h b/nacl/crypto_verify/32/ref/api.h deleted file mode 100644 index ae8c7f6a..00000000 --- a/nacl/crypto_verify/32/ref/api.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #define CRYPTO_BYTES 32 | ||
diff --git a/nacl/crypto_verify/32/ref/verify.c b/nacl/crypto_verify/32/ref/verify.c deleted file mode 100644 index a0e23afe..00000000 --- a/nacl/crypto_verify/32/ref/verify.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | #include "crypto_verify.h" | ||
2 | |||
3 | int crypto_verify(const unsigned char *x,const unsigned char *y) | ||
4 | { | ||
5 | unsigned int differentbits = 0; | ||
6 | #define F(i) differentbits |= x[i] ^ y[i]; | ||
7 | F(0) | ||
8 | F(1) | ||
9 | F(2) | ||
10 | F(3) | ||
11 | F(4) | ||
12 | F(5) | ||
13 | F(6) | ||
14 | F(7) | ||
15 | F(8) | ||
16 | F(9) | ||
17 | F(10) | ||
18 | F(11) | ||
19 | F(12) | ||
20 | F(13) | ||
21 | F(14) | ||
22 | F(15) | ||
23 | F(16) | ||
24 | F(17) | ||
25 | F(18) | ||
26 | F(19) | ||
27 | F(20) | ||
28 | F(21) | ||
29 | F(22) | ||
30 | F(23) | ||
31 | F(24) | ||
32 | F(25) | ||
33 | F(26) | ||
34 | F(27) | ||
35 | F(28) | ||
36 | F(29) | ||
37 | F(30) | ||
38 | F(31) | ||
39 | return (1 & ((differentbits - 1) >> 8)) - 1; | ||
40 | } | ||
diff --git a/nacl/crypto_verify/32/used b/nacl/crypto_verify/32/used deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_verify/32/used +++ /dev/null | |||
diff --git a/nacl/crypto_verify/measure.c b/nacl/crypto_verify/measure.c deleted file mode 100644 index bbfac4f1..00000000 --- a/nacl/crypto_verify/measure.c +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #include "crypto_verify.h" | ||
2 | |||
3 | const char *primitiveimplementation = crypto_verify_IMPLEMENTATION; | ||
4 | const char *implementationversion = crypto_verify_VERSION; | ||
5 | const char *sizenames[] = { "inputbytes", 0 }; | ||
6 | const long long sizes[] = { crypto_verify_BYTES }; | ||
7 | |||
8 | void preallocate(void) | ||
9 | { | ||
10 | } | ||
11 | |||
12 | void allocate(void) | ||
13 | { | ||
14 | } | ||
15 | |||
16 | void measure(void) | ||
17 | { | ||
18 | } | ||
diff --git a/nacl/crypto_verify/try.c b/nacl/crypto_verify/try.c deleted file mode 100644 index f555cb4e..00000000 --- a/nacl/crypto_verify/try.c +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* | ||
2 | * crypto_verify/try.c version 20090118 | ||
3 | * D. J. Bernstein | ||
4 | * Public domain. | ||
5 | */ | ||
6 | |||
7 | #include <stdlib.h> | ||
8 | #include "crypto_verify.h" | ||
9 | |||
10 | extern unsigned char *alignedcalloc(unsigned long long); | ||
11 | |||
12 | const char *primitiveimplementation = crypto_verify_IMPLEMENTATION; | ||
13 | |||
14 | static unsigned char *x; | ||
15 | static unsigned char *y; | ||
16 | |||
17 | void preallocate(void) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | void allocate(void) | ||
22 | { | ||
23 | x = alignedcalloc(crypto_verify_BYTES); | ||
24 | y = alignedcalloc(crypto_verify_BYTES); | ||
25 | } | ||
26 | |||
27 | void predoit(void) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | void doit(void) | ||
32 | { | ||
33 | crypto_verify(x,y); | ||
34 | } | ||
35 | |||
36 | static const char *check(void) | ||
37 | { | ||
38 | int r = crypto_verify(x,y); | ||
39 | if (r == 0) { | ||
40 | if (memcmp(x,y,crypto_verify_BYTES)) return "different strings pass verify"; | ||
41 | } else if (r == -1) { | ||
42 | if (!memcmp(x,y,crypto_verify_BYTES)) return "equal strings fail verify"; | ||
43 | } else { | ||
44 | return "weird return value from verify"; | ||
45 | } | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | char checksum[2]; | ||
50 | |||
51 | const char *checksum_compute(void) | ||
52 | { | ||
53 | long long tests; | ||
54 | long long i; | ||
55 | long long j; | ||
56 | const char *c; | ||
57 | |||
58 | for (tests = 0;tests < 100000;++tests) { | ||
59 | for (i = 0;i < crypto_verify_BYTES;++i) x[i] = random(); | ||
60 | for (i = 0;i < crypto_verify_BYTES;++i) y[i] = random(); | ||
61 | c = check(); if (c) return c; | ||
62 | for (i = 0;i < crypto_verify_BYTES;++i) y[i] = x[i]; | ||
63 | c = check(); if (c) return c; | ||
64 | y[random() % crypto_verify_BYTES] = random(); | ||
65 | c = check(); if (c) return c; | ||
66 | y[random() % crypto_verify_BYTES] = random(); | ||
67 | c = check(); if (c) return c; | ||
68 | y[random() % crypto_verify_BYTES] = random(); | ||
69 | c = check(); if (c) return c; | ||
70 | } | ||
71 | |||
72 | checksum[0] = '0'; | ||
73 | checksum[1] = 0; | ||
74 | return 0; | ||
75 | } | ||
diff --git a/nacl/crypto_verify/wrapper-empty.cpp b/nacl/crypto_verify/wrapper-empty.cpp deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_verify/wrapper-empty.cpp +++ /dev/null | |||