summaryrefslogtreecommitdiff
path: root/nacl/crypto_verify
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/crypto_verify
parent835ef0320d47372eac14bef31c979b8217d04498 (diff)
NaCl moved to other repo.
Diffstat (limited to 'nacl/crypto_verify')
-rw-r--r--nacl/crypto_verify/16/checksum1
-rw-r--r--nacl/crypto_verify/16/ref/api.h1
-rw-r--r--nacl/crypto_verify/16/ref/verify.c24
-rw-r--r--nacl/crypto_verify/16/used0
-rw-r--r--nacl/crypto_verify/32/checksum1
-rw-r--r--nacl/crypto_verify/32/ref/api.h1
-rw-r--r--nacl/crypto_verify/32/ref/verify.c40
-rw-r--r--nacl/crypto_verify/32/used0
-rw-r--r--nacl/crypto_verify/measure.c18
-rw-r--r--nacl/crypto_verify/try.c75
-rw-r--r--nacl/crypto_verify/wrapper-empty.cpp0
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 @@
10
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
3int 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 @@
10
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
3int 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
3const char *primitiveimplementation = crypto_verify_IMPLEMENTATION;
4const char *implementationversion = crypto_verify_VERSION;
5const char *sizenames[] = { "inputbytes", 0 };
6const long long sizes[] = { crypto_verify_BYTES };
7
8void preallocate(void)
9{
10}
11
12void allocate(void)
13{
14}
15
16void 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
10extern unsigned char *alignedcalloc(unsigned long long);
11
12const char *primitiveimplementation = crypto_verify_IMPLEMENTATION;
13
14static unsigned char *x;
15static unsigned char *y;
16
17void preallocate(void)
18{
19}
20
21void allocate(void)
22{
23 x = alignedcalloc(crypto_verify_BYTES);
24 y = alignedcalloc(crypto_verify_BYTES);
25}
26
27void predoit(void)
28{
29}
30
31void doit(void)
32{
33 crypto_verify(x,y);
34}
35
36static 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
49char checksum[2];
50
51const 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