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_core | |
parent | 835ef0320d47372eac14bef31c979b8217d04498 (diff) |
NaCl moved to other repo.
Diffstat (limited to 'nacl/crypto_core')
26 files changed, 0 insertions, 808 deletions
diff --git a/nacl/crypto_core/hsalsa20/checksum b/nacl/crypto_core/hsalsa20/checksum deleted file mode 100644 index f67bb2e2..00000000 --- a/nacl/crypto_core/hsalsa20/checksum +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 28ebe700b5878570702a68740aa131e6fa907e58a3f6915cd183c6db3f7afd7a | ||
diff --git a/nacl/crypto_core/hsalsa20/ref/api.h b/nacl/crypto_core/hsalsa20/ref/api.h deleted file mode 100644 index 73bd8541..00000000 --- a/nacl/crypto_core/hsalsa20/ref/api.h +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #define CRYPTO_OUTPUTBYTES 32 | ||
2 | #define CRYPTO_INPUTBYTES 16 | ||
3 | #define CRYPTO_KEYBYTES 32 | ||
4 | #define CRYPTO_CONSTBYTES 16 | ||
diff --git a/nacl/crypto_core/hsalsa20/ref/core.c b/nacl/crypto_core/hsalsa20/ref/core.c deleted file mode 100644 index 36118da0..00000000 --- a/nacl/crypto_core/hsalsa20/ref/core.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* | ||
2 | version 20080912 | ||
3 | D. J. Bernstein | ||
4 | Public domain. | ||
5 | */ | ||
6 | |||
7 | #include "crypto_core.h" | ||
8 | |||
9 | #define ROUNDS 20 | ||
10 | |||
11 | typedef unsigned int uint32; | ||
12 | |||
13 | static uint32 rotate(uint32 u,int c) | ||
14 | { | ||
15 | return (u << c) | (u >> (32 - c)); | ||
16 | } | ||
17 | |||
18 | static uint32 load_littleendian(const unsigned char *x) | ||
19 | { | ||
20 | return | ||
21 | (uint32) (x[0]) \ | ||
22 | | (((uint32) (x[1])) << 8) \ | ||
23 | | (((uint32) (x[2])) << 16) \ | ||
24 | | (((uint32) (x[3])) << 24) | ||
25 | ; | ||
26 | } | ||
27 | |||
28 | static void store_littleendian(unsigned char *x,uint32 u) | ||
29 | { | ||
30 | x[0] = u; u >>= 8; | ||
31 | x[1] = u; u >>= 8; | ||
32 | x[2] = u; u >>= 8; | ||
33 | x[3] = u; | ||
34 | } | ||
35 | |||
36 | int crypto_core( | ||
37 | unsigned char *out, | ||
38 | const unsigned char *in, | ||
39 | const unsigned char *k, | ||
40 | const unsigned char *c | ||
41 | ) | ||
42 | { | ||
43 | uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; | ||
44 | uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; | ||
45 | int i; | ||
46 | |||
47 | j0 = x0 = load_littleendian(c + 0); | ||
48 | j1 = x1 = load_littleendian(k + 0); | ||
49 | j2 = x2 = load_littleendian(k + 4); | ||
50 | j3 = x3 = load_littleendian(k + 8); | ||
51 | j4 = x4 = load_littleendian(k + 12); | ||
52 | j5 = x5 = load_littleendian(c + 4); | ||
53 | j6 = x6 = load_littleendian(in + 0); | ||
54 | j7 = x7 = load_littleendian(in + 4); | ||
55 | j8 = x8 = load_littleendian(in + 8); | ||
56 | j9 = x9 = load_littleendian(in + 12); | ||
57 | j10 = x10 = load_littleendian(c + 8); | ||
58 | j11 = x11 = load_littleendian(k + 16); | ||
59 | j12 = x12 = load_littleendian(k + 20); | ||
60 | j13 = x13 = load_littleendian(k + 24); | ||
61 | j14 = x14 = load_littleendian(k + 28); | ||
62 | j15 = x15 = load_littleendian(c + 12); | ||
63 | |||
64 | for (i = ROUNDS;i > 0;i -= 2) { | ||
65 | x4 ^= rotate( x0+x12, 7); | ||
66 | x8 ^= rotate( x4+ x0, 9); | ||
67 | x12 ^= rotate( x8+ x4,13); | ||
68 | x0 ^= rotate(x12+ x8,18); | ||
69 | x9 ^= rotate( x5+ x1, 7); | ||
70 | x13 ^= rotate( x9+ x5, 9); | ||
71 | x1 ^= rotate(x13+ x9,13); | ||
72 | x5 ^= rotate( x1+x13,18); | ||
73 | x14 ^= rotate(x10+ x6, 7); | ||
74 | x2 ^= rotate(x14+x10, 9); | ||
75 | x6 ^= rotate( x2+x14,13); | ||
76 | x10 ^= rotate( x6+ x2,18); | ||
77 | x3 ^= rotate(x15+x11, 7); | ||
78 | x7 ^= rotate( x3+x15, 9); | ||
79 | x11 ^= rotate( x7+ x3,13); | ||
80 | x15 ^= rotate(x11+ x7,18); | ||
81 | x1 ^= rotate( x0+ x3, 7); | ||
82 | x2 ^= rotate( x1+ x0, 9); | ||
83 | x3 ^= rotate( x2+ x1,13); | ||
84 | x0 ^= rotate( x3+ x2,18); | ||
85 | x6 ^= rotate( x5+ x4, 7); | ||
86 | x7 ^= rotate( x6+ x5, 9); | ||
87 | x4 ^= rotate( x7+ x6,13); | ||
88 | x5 ^= rotate( x4+ x7,18); | ||
89 | x11 ^= rotate(x10+ x9, 7); | ||
90 | x8 ^= rotate(x11+x10, 9); | ||
91 | x9 ^= rotate( x8+x11,13); | ||
92 | x10 ^= rotate( x9+ x8,18); | ||
93 | x12 ^= rotate(x15+x14, 7); | ||
94 | x13 ^= rotate(x12+x15, 9); | ||
95 | x14 ^= rotate(x13+x12,13); | ||
96 | x15 ^= rotate(x14+x13,18); | ||
97 | } | ||
98 | |||
99 | x0 += j0; | ||
100 | x1 += j1; | ||
101 | x2 += j2; | ||
102 | x3 += j3; | ||
103 | x4 += j4; | ||
104 | x5 += j5; | ||
105 | x6 += j6; | ||
106 | x7 += j7; | ||
107 | x8 += j8; | ||
108 | x9 += j9; | ||
109 | x10 += j10; | ||
110 | x11 += j11; | ||
111 | x12 += j12; | ||
112 | x13 += j13; | ||
113 | x14 += j14; | ||
114 | x15 += j15; | ||
115 | |||
116 | x0 -= load_littleendian(c + 0); | ||
117 | x5 -= load_littleendian(c + 4); | ||
118 | x10 -= load_littleendian(c + 8); | ||
119 | x15 -= load_littleendian(c + 12); | ||
120 | x6 -= load_littleendian(in + 0); | ||
121 | x7 -= load_littleendian(in + 4); | ||
122 | x8 -= load_littleendian(in + 8); | ||
123 | x9 -= load_littleendian(in + 12); | ||
124 | |||
125 | store_littleendian(out + 0,x0); | ||
126 | store_littleendian(out + 4,x5); | ||
127 | store_littleendian(out + 8,x10); | ||
128 | store_littleendian(out + 12,x15); | ||
129 | store_littleendian(out + 16,x6); | ||
130 | store_littleendian(out + 20,x7); | ||
131 | store_littleendian(out + 24,x8); | ||
132 | store_littleendian(out + 28,x9); | ||
133 | |||
134 | return 0; | ||
135 | } | ||
diff --git a/nacl/crypto_core/hsalsa20/ref/implementors b/nacl/crypto_core/hsalsa20/ref/implementors deleted file mode 100644 index f6fb3c73..00000000 --- a/nacl/crypto_core/hsalsa20/ref/implementors +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | Daniel J. Bernstein | ||
diff --git a/nacl/crypto_core/hsalsa20/ref2/api.h b/nacl/crypto_core/hsalsa20/ref2/api.h deleted file mode 100644 index 73bd8541..00000000 --- a/nacl/crypto_core/hsalsa20/ref2/api.h +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #define CRYPTO_OUTPUTBYTES 32 | ||
2 | #define CRYPTO_INPUTBYTES 16 | ||
3 | #define CRYPTO_KEYBYTES 32 | ||
4 | #define CRYPTO_CONSTBYTES 16 | ||
diff --git a/nacl/crypto_core/hsalsa20/ref2/core.c b/nacl/crypto_core/hsalsa20/ref2/core.c deleted file mode 100644 index 9a9a8c7c..00000000 --- a/nacl/crypto_core/hsalsa20/ref2/core.c +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | /* | ||
2 | version 20080912 | ||
3 | D. J. Bernstein | ||
4 | Public domain. | ||
5 | */ | ||
6 | |||
7 | #include "crypto_core.h" | ||
8 | |||
9 | #define ROUNDS 20 | ||
10 | |||
11 | typedef unsigned int uint32; | ||
12 | |||
13 | static uint32 rotate(uint32 u,int c) | ||
14 | { | ||
15 | return (u << c) | (u >> (32 - c)); | ||
16 | } | ||
17 | |||
18 | static uint32 load_littleendian(const unsigned char *x) | ||
19 | { | ||
20 | return | ||
21 | (uint32) (x[0]) \ | ||
22 | | (((uint32) (x[1])) << 8) \ | ||
23 | | (((uint32) (x[2])) << 16) \ | ||
24 | | (((uint32) (x[3])) << 24) | ||
25 | ; | ||
26 | } | ||
27 | |||
28 | static void store_littleendian(unsigned char *x,uint32 u) | ||
29 | { | ||
30 | x[0] = u; u >>= 8; | ||
31 | x[1] = u; u >>= 8; | ||
32 | x[2] = u; u >>= 8; | ||
33 | x[3] = u; | ||
34 | } | ||
35 | |||
36 | int crypto_core( | ||
37 | unsigned char *out, | ||
38 | const unsigned char *in, | ||
39 | const unsigned char *k, | ||
40 | const unsigned char *c | ||
41 | ) | ||
42 | { | ||
43 | uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; | ||
44 | int i; | ||
45 | |||
46 | x0 = load_littleendian(c + 0); | ||
47 | x1 = load_littleendian(k + 0); | ||
48 | x2 = load_littleendian(k + 4); | ||
49 | x3 = load_littleendian(k + 8); | ||
50 | x4 = load_littleendian(k + 12); | ||
51 | x5 = load_littleendian(c + 4); | ||
52 | x6 = load_littleendian(in + 0); | ||
53 | x7 = load_littleendian(in + 4); | ||
54 | x8 = load_littleendian(in + 8); | ||
55 | x9 = load_littleendian(in + 12); | ||
56 | x10 = load_littleendian(c + 8); | ||
57 | x11 = load_littleendian(k + 16); | ||
58 | x12 = load_littleendian(k + 20); | ||
59 | x13 = load_littleendian(k + 24); | ||
60 | x14 = load_littleendian(k + 28); | ||
61 | x15 = load_littleendian(c + 12); | ||
62 | |||
63 | for (i = ROUNDS;i > 0;i -= 2) { | ||
64 | x4 ^= rotate( x0+x12, 7); | ||
65 | x8 ^= rotate( x4+ x0, 9); | ||
66 | x12 ^= rotate( x8+ x4,13); | ||
67 | x0 ^= rotate(x12+ x8,18); | ||
68 | x9 ^= rotate( x5+ x1, 7); | ||
69 | x13 ^= rotate( x9+ x5, 9); | ||
70 | x1 ^= rotate(x13+ x9,13); | ||
71 | x5 ^= rotate( x1+x13,18); | ||
72 | x14 ^= rotate(x10+ x6, 7); | ||
73 | x2 ^= rotate(x14+x10, 9); | ||
74 | x6 ^= rotate( x2+x14,13); | ||
75 | x10 ^= rotate( x6+ x2,18); | ||
76 | x3 ^= rotate(x15+x11, 7); | ||
77 | x7 ^= rotate( x3+x15, 9); | ||
78 | x11 ^= rotate( x7+ x3,13); | ||
79 | x15 ^= rotate(x11+ x7,18); | ||
80 | x1 ^= rotate( x0+ x3, 7); | ||
81 | x2 ^= rotate( x1+ x0, 9); | ||
82 | x3 ^= rotate( x2+ x1,13); | ||
83 | x0 ^= rotate( x3+ x2,18); | ||
84 | x6 ^= rotate( x5+ x4, 7); | ||
85 | x7 ^= rotate( x6+ x5, 9); | ||
86 | x4 ^= rotate( x7+ x6,13); | ||
87 | x5 ^= rotate( x4+ x7,18); | ||
88 | x11 ^= rotate(x10+ x9, 7); | ||
89 | x8 ^= rotate(x11+x10, 9); | ||
90 | x9 ^= rotate( x8+x11,13); | ||
91 | x10 ^= rotate( x9+ x8,18); | ||
92 | x12 ^= rotate(x15+x14, 7); | ||
93 | x13 ^= rotate(x12+x15, 9); | ||
94 | x14 ^= rotate(x13+x12,13); | ||
95 | x15 ^= rotate(x14+x13,18); | ||
96 | } | ||
97 | |||
98 | store_littleendian(out + 0,x0); | ||
99 | store_littleendian(out + 4,x5); | ||
100 | store_littleendian(out + 8,x10); | ||
101 | store_littleendian(out + 12,x15); | ||
102 | store_littleendian(out + 16,x6); | ||
103 | store_littleendian(out + 20,x7); | ||
104 | store_littleendian(out + 24,x8); | ||
105 | store_littleendian(out + 28,x9); | ||
106 | |||
107 | return 0; | ||
108 | } | ||
diff --git a/nacl/crypto_core/hsalsa20/ref2/implementors b/nacl/crypto_core/hsalsa20/ref2/implementors deleted file mode 100644 index f6fb3c73..00000000 --- a/nacl/crypto_core/hsalsa20/ref2/implementors +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | Daniel J. Bernstein | ||
diff --git a/nacl/crypto_core/hsalsa20/used b/nacl/crypto_core/hsalsa20/used deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_core/hsalsa20/used +++ /dev/null | |||
diff --git a/nacl/crypto_core/measure.c b/nacl/crypto_core/measure.c deleted file mode 100644 index dd7bac81..00000000 --- a/nacl/crypto_core/measure.c +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #include "crypto_core.h" | ||
2 | |||
3 | const char *primitiveimplementation = crypto_core_IMPLEMENTATION; | ||
4 | const char *implementationversion = crypto_core_VERSION; | ||
5 | const char *sizenames[] = { "outputbytes", "inputbytes", "keybytes", "constbytes", 0 }; | ||
6 | const long long sizes[] = { crypto_core_OUTPUTBYTES, crypto_core_INPUTBYTES, crypto_core_KEYBYTES, crypto_core_CONSTBYTES }; | ||
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_core/salsa20/checksum b/nacl/crypto_core/salsa20/checksum deleted file mode 100644 index fcf56186..00000000 --- a/nacl/crypto_core/salsa20/checksum +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 9d1ee8d84b974e648507ffd93829376c5b4420751710e44f6593abd8769378011d85ecda51ceb8f43661d3c65ef5b57c4f5bf8df76c8202784c8df8def61e6a6 | ||
diff --git a/nacl/crypto_core/salsa20/ref/api.h b/nacl/crypto_core/salsa20/ref/api.h deleted file mode 100644 index 2a387b6d..00000000 --- a/nacl/crypto_core/salsa20/ref/api.h +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #define CRYPTO_OUTPUTBYTES 64 | ||
2 | #define CRYPTO_INPUTBYTES 16 | ||
3 | #define CRYPTO_KEYBYTES 32 | ||
4 | #define CRYPTO_CONSTBYTES 16 | ||
diff --git a/nacl/crypto_core/salsa20/ref/core.c b/nacl/crypto_core/salsa20/ref/core.c deleted file mode 100644 index 910a0056..00000000 --- a/nacl/crypto_core/salsa20/ref/core.c +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | /* | ||
2 | version 20080912 | ||
3 | D. J. Bernstein | ||
4 | Public domain. | ||
5 | */ | ||
6 | |||
7 | #include "crypto_core.h" | ||
8 | |||
9 | #define ROUNDS 20 | ||
10 | |||
11 | typedef unsigned int uint32; | ||
12 | |||
13 | static uint32 rotate(uint32 u,int c) | ||
14 | { | ||
15 | return (u << c) | (u >> (32 - c)); | ||
16 | } | ||
17 | |||
18 | static uint32 load_littleendian(const unsigned char *x) | ||
19 | { | ||
20 | return | ||
21 | (uint32) (x[0]) \ | ||
22 | | (((uint32) (x[1])) << 8) \ | ||
23 | | (((uint32) (x[2])) << 16) \ | ||
24 | | (((uint32) (x[3])) << 24) | ||
25 | ; | ||
26 | } | ||
27 | |||
28 | static void store_littleendian(unsigned char *x,uint32 u) | ||
29 | { | ||
30 | x[0] = u; u >>= 8; | ||
31 | x[1] = u; u >>= 8; | ||
32 | x[2] = u; u >>= 8; | ||
33 | x[3] = u; | ||
34 | } | ||
35 | |||
36 | int crypto_core( | ||
37 | unsigned char *out, | ||
38 | const unsigned char *in, | ||
39 | const unsigned char *k, | ||
40 | const unsigned char *c | ||
41 | ) | ||
42 | { | ||
43 | uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; | ||
44 | uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; | ||
45 | int i; | ||
46 | |||
47 | j0 = x0 = load_littleendian(c + 0); | ||
48 | j1 = x1 = load_littleendian(k + 0); | ||
49 | j2 = x2 = load_littleendian(k + 4); | ||
50 | j3 = x3 = load_littleendian(k + 8); | ||
51 | j4 = x4 = load_littleendian(k + 12); | ||
52 | j5 = x5 = load_littleendian(c + 4); | ||
53 | j6 = x6 = load_littleendian(in + 0); | ||
54 | j7 = x7 = load_littleendian(in + 4); | ||
55 | j8 = x8 = load_littleendian(in + 8); | ||
56 | j9 = x9 = load_littleendian(in + 12); | ||
57 | j10 = x10 = load_littleendian(c + 8); | ||
58 | j11 = x11 = load_littleendian(k + 16); | ||
59 | j12 = x12 = load_littleendian(k + 20); | ||
60 | j13 = x13 = load_littleendian(k + 24); | ||
61 | j14 = x14 = load_littleendian(k + 28); | ||
62 | j15 = x15 = load_littleendian(c + 12); | ||
63 | |||
64 | for (i = ROUNDS;i > 0;i -= 2) { | ||
65 | x4 ^= rotate( x0+x12, 7); | ||
66 | x8 ^= rotate( x4+ x0, 9); | ||
67 | x12 ^= rotate( x8+ x4,13); | ||
68 | x0 ^= rotate(x12+ x8,18); | ||
69 | x9 ^= rotate( x5+ x1, 7); | ||
70 | x13 ^= rotate( x9+ x5, 9); | ||
71 | x1 ^= rotate(x13+ x9,13); | ||
72 | x5 ^= rotate( x1+x13,18); | ||
73 | x14 ^= rotate(x10+ x6, 7); | ||
74 | x2 ^= rotate(x14+x10, 9); | ||
75 | x6 ^= rotate( x2+x14,13); | ||
76 | x10 ^= rotate( x6+ x2,18); | ||
77 | x3 ^= rotate(x15+x11, 7); | ||
78 | x7 ^= rotate( x3+x15, 9); | ||
79 | x11 ^= rotate( x7+ x3,13); | ||
80 | x15 ^= rotate(x11+ x7,18); | ||
81 | x1 ^= rotate( x0+ x3, 7); | ||
82 | x2 ^= rotate( x1+ x0, 9); | ||
83 | x3 ^= rotate( x2+ x1,13); | ||
84 | x0 ^= rotate( x3+ x2,18); | ||
85 | x6 ^= rotate( x5+ x4, 7); | ||
86 | x7 ^= rotate( x6+ x5, 9); | ||
87 | x4 ^= rotate( x7+ x6,13); | ||
88 | x5 ^= rotate( x4+ x7,18); | ||
89 | x11 ^= rotate(x10+ x9, 7); | ||
90 | x8 ^= rotate(x11+x10, 9); | ||
91 | x9 ^= rotate( x8+x11,13); | ||
92 | x10 ^= rotate( x9+ x8,18); | ||
93 | x12 ^= rotate(x15+x14, 7); | ||
94 | x13 ^= rotate(x12+x15, 9); | ||
95 | x14 ^= rotate(x13+x12,13); | ||
96 | x15 ^= rotate(x14+x13,18); | ||
97 | } | ||
98 | |||
99 | x0 += j0; | ||
100 | x1 += j1; | ||
101 | x2 += j2; | ||
102 | x3 += j3; | ||
103 | x4 += j4; | ||
104 | x5 += j5; | ||
105 | x6 += j6; | ||
106 | x7 += j7; | ||
107 | x8 += j8; | ||
108 | x9 += j9; | ||
109 | x10 += j10; | ||
110 | x11 += j11; | ||
111 | x12 += j12; | ||
112 | x13 += j13; | ||
113 | x14 += j14; | ||
114 | x15 += j15; | ||
115 | |||
116 | store_littleendian(out + 0,x0); | ||
117 | store_littleendian(out + 4,x1); | ||
118 | store_littleendian(out + 8,x2); | ||
119 | store_littleendian(out + 12,x3); | ||
120 | store_littleendian(out + 16,x4); | ||
121 | store_littleendian(out + 20,x5); | ||
122 | store_littleendian(out + 24,x6); | ||
123 | store_littleendian(out + 28,x7); | ||
124 | store_littleendian(out + 32,x8); | ||
125 | store_littleendian(out + 36,x9); | ||
126 | store_littleendian(out + 40,x10); | ||
127 | store_littleendian(out + 44,x11); | ||
128 | store_littleendian(out + 48,x12); | ||
129 | store_littleendian(out + 52,x13); | ||
130 | store_littleendian(out + 56,x14); | ||
131 | store_littleendian(out + 60,x15); | ||
132 | |||
133 | return 0; | ||
134 | } | ||
diff --git a/nacl/crypto_core/salsa20/ref/implementors b/nacl/crypto_core/salsa20/ref/implementors deleted file mode 100644 index f6fb3c73..00000000 --- a/nacl/crypto_core/salsa20/ref/implementors +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | Daniel J. Bernstein | ||
diff --git a/nacl/crypto_core/salsa20/used b/nacl/crypto_core/salsa20/used deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_core/salsa20/used +++ /dev/null | |||
diff --git a/nacl/crypto_core/salsa2012/checksum b/nacl/crypto_core/salsa2012/checksum deleted file mode 100644 index 2f99a8d6..00000000 --- a/nacl/crypto_core/salsa2012/checksum +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | f36d643f798efc0fca888d3ac4bdcc54c98a968c2da16bd5b8bfe9fe9025a6ca3a207e9362dc7cf17ddfc7477ee754d3f521b1df91640093754f7275b1a54293 | ||
diff --git a/nacl/crypto_core/salsa2012/ref/api.h b/nacl/crypto_core/salsa2012/ref/api.h deleted file mode 100644 index 2a387b6d..00000000 --- a/nacl/crypto_core/salsa2012/ref/api.h +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #define CRYPTO_OUTPUTBYTES 64 | ||
2 | #define CRYPTO_INPUTBYTES 16 | ||
3 | #define CRYPTO_KEYBYTES 32 | ||
4 | #define CRYPTO_CONSTBYTES 16 | ||
diff --git a/nacl/crypto_core/salsa2012/ref/core.c b/nacl/crypto_core/salsa2012/ref/core.c deleted file mode 100644 index d4b59e48..00000000 --- a/nacl/crypto_core/salsa2012/ref/core.c +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | /* | ||
2 | version 20080913 | ||
3 | D. J. Bernstein | ||
4 | Public domain. | ||
5 | */ | ||
6 | |||
7 | #include "crypto_core.h" | ||
8 | |||
9 | #define ROUNDS 12 | ||
10 | |||
11 | typedef unsigned int uint32; | ||
12 | |||
13 | static uint32 rotate(uint32 u,int c) | ||
14 | { | ||
15 | return (u << c) | (u >> (32 - c)); | ||
16 | } | ||
17 | |||
18 | static uint32 load_littleendian(const unsigned char *x) | ||
19 | { | ||
20 | return | ||
21 | (uint32) (x[0]) \ | ||
22 | | (((uint32) (x[1])) << 8) \ | ||
23 | | (((uint32) (x[2])) << 16) \ | ||
24 | | (((uint32) (x[3])) << 24) | ||
25 | ; | ||
26 | } | ||
27 | |||
28 | static void store_littleendian(unsigned char *x,uint32 u) | ||
29 | { | ||
30 | x[0] = u; u >>= 8; | ||
31 | x[1] = u; u >>= 8; | ||
32 | x[2] = u; u >>= 8; | ||
33 | x[3] = u; | ||
34 | } | ||
35 | |||
36 | int crypto_core( | ||
37 | unsigned char *out, | ||
38 | const unsigned char *in, | ||
39 | const unsigned char *k, | ||
40 | const unsigned char *c | ||
41 | ) | ||
42 | { | ||
43 | uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; | ||
44 | uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; | ||
45 | int i; | ||
46 | |||
47 | j0 = x0 = load_littleendian(c + 0); | ||
48 | j1 = x1 = load_littleendian(k + 0); | ||
49 | j2 = x2 = load_littleendian(k + 4); | ||
50 | j3 = x3 = load_littleendian(k + 8); | ||
51 | j4 = x4 = load_littleendian(k + 12); | ||
52 | j5 = x5 = load_littleendian(c + 4); | ||
53 | j6 = x6 = load_littleendian(in + 0); | ||
54 | j7 = x7 = load_littleendian(in + 4); | ||
55 | j8 = x8 = load_littleendian(in + 8); | ||
56 | j9 = x9 = load_littleendian(in + 12); | ||
57 | j10 = x10 = load_littleendian(c + 8); | ||
58 | j11 = x11 = load_littleendian(k + 16); | ||
59 | j12 = x12 = load_littleendian(k + 20); | ||
60 | j13 = x13 = load_littleendian(k + 24); | ||
61 | j14 = x14 = load_littleendian(k + 28); | ||
62 | j15 = x15 = load_littleendian(c + 12); | ||
63 | |||
64 | for (i = ROUNDS;i > 0;i -= 2) { | ||
65 | x4 ^= rotate( x0+x12, 7); | ||
66 | x8 ^= rotate( x4+ x0, 9); | ||
67 | x12 ^= rotate( x8+ x4,13); | ||
68 | x0 ^= rotate(x12+ x8,18); | ||
69 | x9 ^= rotate( x5+ x1, 7); | ||
70 | x13 ^= rotate( x9+ x5, 9); | ||
71 | x1 ^= rotate(x13+ x9,13); | ||
72 | x5 ^= rotate( x1+x13,18); | ||
73 | x14 ^= rotate(x10+ x6, 7); | ||
74 | x2 ^= rotate(x14+x10, 9); | ||
75 | x6 ^= rotate( x2+x14,13); | ||
76 | x10 ^= rotate( x6+ x2,18); | ||
77 | x3 ^= rotate(x15+x11, 7); | ||
78 | x7 ^= rotate( x3+x15, 9); | ||
79 | x11 ^= rotate( x7+ x3,13); | ||
80 | x15 ^= rotate(x11+ x7,18); | ||
81 | x1 ^= rotate( x0+ x3, 7); | ||
82 | x2 ^= rotate( x1+ x0, 9); | ||
83 | x3 ^= rotate( x2+ x1,13); | ||
84 | x0 ^= rotate( x3+ x2,18); | ||
85 | x6 ^= rotate( x5+ x4, 7); | ||
86 | x7 ^= rotate( x6+ x5, 9); | ||
87 | x4 ^= rotate( x7+ x6,13); | ||
88 | x5 ^= rotate( x4+ x7,18); | ||
89 | x11 ^= rotate(x10+ x9, 7); | ||
90 | x8 ^= rotate(x11+x10, 9); | ||
91 | x9 ^= rotate( x8+x11,13); | ||
92 | x10 ^= rotate( x9+ x8,18); | ||
93 | x12 ^= rotate(x15+x14, 7); | ||
94 | x13 ^= rotate(x12+x15, 9); | ||
95 | x14 ^= rotate(x13+x12,13); | ||
96 | x15 ^= rotate(x14+x13,18); | ||
97 | } | ||
98 | |||
99 | x0 += j0; | ||
100 | x1 += j1; | ||
101 | x2 += j2; | ||
102 | x3 += j3; | ||
103 | x4 += j4; | ||
104 | x5 += j5; | ||
105 | x6 += j6; | ||
106 | x7 += j7; | ||
107 | x8 += j8; | ||
108 | x9 += j9; | ||
109 | x10 += j10; | ||
110 | x11 += j11; | ||
111 | x12 += j12; | ||
112 | x13 += j13; | ||
113 | x14 += j14; | ||
114 | x15 += j15; | ||
115 | |||
116 | store_littleendian(out + 0,x0); | ||
117 | store_littleendian(out + 4,x1); | ||
118 | store_littleendian(out + 8,x2); | ||
119 | store_littleendian(out + 12,x3); | ||
120 | store_littleendian(out + 16,x4); | ||
121 | store_littleendian(out + 20,x5); | ||
122 | store_littleendian(out + 24,x6); | ||
123 | store_littleendian(out + 28,x7); | ||
124 | store_littleendian(out + 32,x8); | ||
125 | store_littleendian(out + 36,x9); | ||
126 | store_littleendian(out + 40,x10); | ||
127 | store_littleendian(out + 44,x11); | ||
128 | store_littleendian(out + 48,x12); | ||
129 | store_littleendian(out + 52,x13); | ||
130 | store_littleendian(out + 56,x14); | ||
131 | store_littleendian(out + 60,x15); | ||
132 | |||
133 | return 0; | ||
134 | } | ||
diff --git a/nacl/crypto_core/salsa2012/ref/implementors b/nacl/crypto_core/salsa2012/ref/implementors deleted file mode 100644 index f6fb3c73..00000000 --- a/nacl/crypto_core/salsa2012/ref/implementors +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | Daniel J. Bernstein | ||
diff --git a/nacl/crypto_core/salsa2012/used b/nacl/crypto_core/salsa2012/used deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_core/salsa2012/used +++ /dev/null | |||
diff --git a/nacl/crypto_core/salsa208/checksum b/nacl/crypto_core/salsa208/checksum deleted file mode 100644 index a16cb52f..00000000 --- a/nacl/crypto_core/salsa208/checksum +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 1e13ea9e74cb36989f7cbf4abc80b29154e1a8b150bd5244951318abea002a93ae9fe2abbcf7217526ac2a85b66c256ba9374b1257eda0c01816da328edfa11a | ||
diff --git a/nacl/crypto_core/salsa208/ref/api.h b/nacl/crypto_core/salsa208/ref/api.h deleted file mode 100644 index 2a387b6d..00000000 --- a/nacl/crypto_core/salsa208/ref/api.h +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #define CRYPTO_OUTPUTBYTES 64 | ||
2 | #define CRYPTO_INPUTBYTES 16 | ||
3 | #define CRYPTO_KEYBYTES 32 | ||
4 | #define CRYPTO_CONSTBYTES 16 | ||
diff --git a/nacl/crypto_core/salsa208/ref/core.c b/nacl/crypto_core/salsa208/ref/core.c deleted file mode 100644 index 921e7a86..00000000 --- a/nacl/crypto_core/salsa208/ref/core.c +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | /* | ||
2 | version 20080913 | ||
3 | D. J. Bernstein | ||
4 | Public domain. | ||
5 | */ | ||
6 | |||
7 | #include "crypto_core.h" | ||
8 | |||
9 | #define ROUNDS 8 | ||
10 | |||
11 | typedef unsigned int uint32; | ||
12 | |||
13 | static uint32 rotate(uint32 u,int c) | ||
14 | { | ||
15 | return (u << c) | (u >> (32 - c)); | ||
16 | } | ||
17 | |||
18 | static uint32 load_littleendian(const unsigned char *x) | ||
19 | { | ||
20 | return | ||
21 | (uint32) (x[0]) \ | ||
22 | | (((uint32) (x[1])) << 8) \ | ||
23 | | (((uint32) (x[2])) << 16) \ | ||
24 | | (((uint32) (x[3])) << 24) | ||
25 | ; | ||
26 | } | ||
27 | |||
28 | static void store_littleendian(unsigned char *x,uint32 u) | ||
29 | { | ||
30 | x[0] = u; u >>= 8; | ||
31 | x[1] = u; u >>= 8; | ||
32 | x[2] = u; u >>= 8; | ||
33 | x[3] = u; | ||
34 | } | ||
35 | |||
36 | int crypto_core( | ||
37 | unsigned char *out, | ||
38 | const unsigned char *in, | ||
39 | const unsigned char *k, | ||
40 | const unsigned char *c | ||
41 | ) | ||
42 | { | ||
43 | uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; | ||
44 | uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; | ||
45 | int i; | ||
46 | |||
47 | j0 = x0 = load_littleendian(c + 0); | ||
48 | j1 = x1 = load_littleendian(k + 0); | ||
49 | j2 = x2 = load_littleendian(k + 4); | ||
50 | j3 = x3 = load_littleendian(k + 8); | ||
51 | j4 = x4 = load_littleendian(k + 12); | ||
52 | j5 = x5 = load_littleendian(c + 4); | ||
53 | j6 = x6 = load_littleendian(in + 0); | ||
54 | j7 = x7 = load_littleendian(in + 4); | ||
55 | j8 = x8 = load_littleendian(in + 8); | ||
56 | j9 = x9 = load_littleendian(in + 12); | ||
57 | j10 = x10 = load_littleendian(c + 8); | ||
58 | j11 = x11 = load_littleendian(k + 16); | ||
59 | j12 = x12 = load_littleendian(k + 20); | ||
60 | j13 = x13 = load_littleendian(k + 24); | ||
61 | j14 = x14 = load_littleendian(k + 28); | ||
62 | j15 = x15 = load_littleendian(c + 12); | ||
63 | |||
64 | for (i = ROUNDS;i > 0;i -= 2) { | ||
65 | x4 ^= rotate( x0+x12, 7); | ||
66 | x8 ^= rotate( x4+ x0, 9); | ||
67 | x12 ^= rotate( x8+ x4,13); | ||
68 | x0 ^= rotate(x12+ x8,18); | ||
69 | x9 ^= rotate( x5+ x1, 7); | ||
70 | x13 ^= rotate( x9+ x5, 9); | ||
71 | x1 ^= rotate(x13+ x9,13); | ||
72 | x5 ^= rotate( x1+x13,18); | ||
73 | x14 ^= rotate(x10+ x6, 7); | ||
74 | x2 ^= rotate(x14+x10, 9); | ||
75 | x6 ^= rotate( x2+x14,13); | ||
76 | x10 ^= rotate( x6+ x2,18); | ||
77 | x3 ^= rotate(x15+x11, 7); | ||
78 | x7 ^= rotate( x3+x15, 9); | ||
79 | x11 ^= rotate( x7+ x3,13); | ||
80 | x15 ^= rotate(x11+ x7,18); | ||
81 | x1 ^= rotate( x0+ x3, 7); | ||
82 | x2 ^= rotate( x1+ x0, 9); | ||
83 | x3 ^= rotate( x2+ x1,13); | ||
84 | x0 ^= rotate( x3+ x2,18); | ||
85 | x6 ^= rotate( x5+ x4, 7); | ||
86 | x7 ^= rotate( x6+ x5, 9); | ||
87 | x4 ^= rotate( x7+ x6,13); | ||
88 | x5 ^= rotate( x4+ x7,18); | ||
89 | x11 ^= rotate(x10+ x9, 7); | ||
90 | x8 ^= rotate(x11+x10, 9); | ||
91 | x9 ^= rotate( x8+x11,13); | ||
92 | x10 ^= rotate( x9+ x8,18); | ||
93 | x12 ^= rotate(x15+x14, 7); | ||
94 | x13 ^= rotate(x12+x15, 9); | ||
95 | x14 ^= rotate(x13+x12,13); | ||
96 | x15 ^= rotate(x14+x13,18); | ||
97 | } | ||
98 | |||
99 | x0 += j0; | ||
100 | x1 += j1; | ||
101 | x2 += j2; | ||
102 | x3 += j3; | ||
103 | x4 += j4; | ||
104 | x5 += j5; | ||
105 | x6 += j6; | ||
106 | x7 += j7; | ||
107 | x8 += j8; | ||
108 | x9 += j9; | ||
109 | x10 += j10; | ||
110 | x11 += j11; | ||
111 | x12 += j12; | ||
112 | x13 += j13; | ||
113 | x14 += j14; | ||
114 | x15 += j15; | ||
115 | |||
116 | store_littleendian(out + 0,x0); | ||
117 | store_littleendian(out + 4,x1); | ||
118 | store_littleendian(out + 8,x2); | ||
119 | store_littleendian(out + 12,x3); | ||
120 | store_littleendian(out + 16,x4); | ||
121 | store_littleendian(out + 20,x5); | ||
122 | store_littleendian(out + 24,x6); | ||
123 | store_littleendian(out + 28,x7); | ||
124 | store_littleendian(out + 32,x8); | ||
125 | store_littleendian(out + 36,x9); | ||
126 | store_littleendian(out + 40,x10); | ||
127 | store_littleendian(out + 44,x11); | ||
128 | store_littleendian(out + 48,x12); | ||
129 | store_littleendian(out + 52,x13); | ||
130 | store_littleendian(out + 56,x14); | ||
131 | store_littleendian(out + 60,x15); | ||
132 | |||
133 | return 0; | ||
134 | } | ||
diff --git a/nacl/crypto_core/salsa208/ref/implementors b/nacl/crypto_core/salsa208/ref/implementors deleted file mode 100644 index f6fb3c73..00000000 --- a/nacl/crypto_core/salsa208/ref/implementors +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | Daniel J. Bernstein | ||
diff --git a/nacl/crypto_core/salsa208/used b/nacl/crypto_core/salsa208/used deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_core/salsa208/used +++ /dev/null | |||
diff --git a/nacl/crypto_core/try.c b/nacl/crypto_core/try.c deleted file mode 100644 index 7eb1c677..00000000 --- a/nacl/crypto_core/try.c +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /* | ||
2 | * crypto_core/try.c version 20090118 | ||
3 | * D. J. Bernstein | ||
4 | * Public domain. | ||
5 | */ | ||
6 | |||
7 | #include <stdlib.h> | ||
8 | #include "crypto_core.h" | ||
9 | |||
10 | extern unsigned char *alignedcalloc(unsigned long long); | ||
11 | |||
12 | const char *primitiveimplementation = crypto_core_IMPLEMENTATION; | ||
13 | |||
14 | static unsigned char *h; | ||
15 | static unsigned char *n; | ||
16 | static unsigned char *k; | ||
17 | static unsigned char *c; | ||
18 | static unsigned char *h2; | ||
19 | static unsigned char *n2; | ||
20 | static unsigned char *k2; | ||
21 | static unsigned char *c2; | ||
22 | |||
23 | #define hlen crypto_core_OUTPUTBYTES | ||
24 | #define nlen crypto_core_INPUTBYTES | ||
25 | #define klen crypto_core_KEYBYTES | ||
26 | #define clen crypto_core_CONSTBYTES | ||
27 | |||
28 | void preallocate(void) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | void allocate(void) | ||
33 | { | ||
34 | h = alignedcalloc(hlen); | ||
35 | n = alignedcalloc(nlen); | ||
36 | k = alignedcalloc(klen); | ||
37 | c = alignedcalloc(clen); | ||
38 | h2 = alignedcalloc(hlen); | ||
39 | n2 = alignedcalloc(nlen + crypto_core_OUTPUTBYTES); | ||
40 | k2 = alignedcalloc(klen + crypto_core_OUTPUTBYTES); | ||
41 | c2 = alignedcalloc(clen + crypto_core_OUTPUTBYTES); | ||
42 | } | ||
43 | |||
44 | void predoit(void) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | void doit(void) | ||
49 | { | ||
50 | crypto_core(h,n,k,c); | ||
51 | } | ||
52 | |||
53 | static unsigned char newbyte(void) | ||
54 | { | ||
55 | unsigned long long x; | ||
56 | long long j; | ||
57 | x = 8675309; | ||
58 | for (j = 0;j < hlen;++j) { x += h[j]; x *= x; x += (x >> 31); } | ||
59 | for (j = 0;j < nlen;++j) { x += n[j]; x *= x; x += (x >> 31); } | ||
60 | for (j = 0;j < klen;++j) { x += k[j]; x *= x; x += (x >> 31); } | ||
61 | for (j = 0;j < clen;++j) { x += c[j]; x *= x; x += (x >> 31); } | ||
62 | for (j = 0;j < 100;++j) { x += j ; x *= x; x += (x >> 31); } | ||
63 | return x; | ||
64 | } | ||
65 | |||
66 | char checksum[hlen * 2 + 1]; | ||
67 | |||
68 | const char *checksum_compute(void) | ||
69 | { | ||
70 | long long i; | ||
71 | long long j; | ||
72 | |||
73 | for (i = 0;i < 100;++i) { | ||
74 | for (j = -16;j < 0;++j) h[j] = random(); | ||
75 | for (j = hlen;j < hlen + 16;++j) h[j] = random(); | ||
76 | for (j = -16;j < hlen + 16;++j) h2[j] = h[j]; | ||
77 | for (j = -16;j < 0;++j) n[j] = random(); | ||
78 | for (j = nlen;j < nlen + 16;++j) n[j] = random(); | ||
79 | for (j = -16;j < nlen + 16;++j) n2[j] = n[j]; | ||
80 | for (j = -16;j < 0;++j) k[j] = random(); | ||
81 | for (j = klen;j < klen + 16;++j) k[j] = random(); | ||
82 | for (j = -16;j < klen + 16;++j) k2[j] = k[j]; | ||
83 | for (j = -16;j < 0;++j) c[j] = random(); | ||
84 | for (j = clen;j < clen + 16;++j) c[j] = random(); | ||
85 | for (j = -16;j < clen + 16;++j) c2[j] = c[j]; | ||
86 | if (crypto_core(h,n,k,c) != 0) return "crypto_core returns nonzero"; | ||
87 | for (j = -16;j < 0;++j) if (h2[j] != h[j]) return "crypto_core writes before output"; | ||
88 | for (j = hlen;j < hlen + 16;++j) if (h2[j] != h[j]) return "crypto_core writes after output"; | ||
89 | for (j = -16;j < klen + 16;++j) if (k2[j] != k[j]) return "crypto_core writes to k"; | ||
90 | for (j = -16;j < nlen + 16;++j) if (n2[j] != n[j]) return "crypto_core writes to n"; | ||
91 | for (j = -16;j < clen + 16;++j) if (c2[j] != c[j]) return "crypto_core writes to c"; | ||
92 | |||
93 | if (crypto_core(n2,n2,k,c) != 0) return "crypto_core returns nonzero"; | ||
94 | for (j = 0;j < hlen;++j) if (h[j] != n2[j]) return "crypto_core does not handle n overlap"; | ||
95 | for (j = 0;j < hlen;++j) n2[j] = n[j]; | ||
96 | if (crypto_core(k2,n2,k2,c) != 0) return "crypto_core returns nonzero"; | ||
97 | for (j = 0;j < hlen;++j) if (h[j] != k2[j]) return "crypto_core does not handle k overlap"; | ||
98 | for (j = 0;j < hlen;++j) k2[j] = k[j]; | ||
99 | if (crypto_core(c2,n2,k2,c2) != 0) return "crypto_core returns nonzero"; | ||
100 | for (j = 0;j < hlen;++j) if (h[j] != c2[j]) return "crypto_core does not handle c overlap"; | ||
101 | for (j = 0;j < hlen;++j) c2[j] = c[j]; | ||
102 | |||
103 | for (j = 0;j < nlen;++j) n[j] = newbyte(); | ||
104 | if (crypto_core(h,n,k,c) != 0) return "crypto_core returns nonzero"; | ||
105 | for (j = 0;j < klen;++j) k[j] = newbyte(); | ||
106 | if (crypto_core(h,n,k,c) != 0) return "crypto_core returns nonzero"; | ||
107 | for (j = 0;j < clen;++j) c[j] = newbyte(); | ||
108 | } | ||
109 | |||
110 | for (i = 0;i < hlen;++i) { | ||
111 | checksum[2 * i] = "0123456789abcdef"[15 & (h[i] >> 4)]; | ||
112 | checksum[2 * i + 1] = "0123456789abcdef"[15 & h[i]]; | ||
113 | } | ||
114 | checksum[2 * i] = 0; | ||
115 | return 0; | ||
116 | } | ||
diff --git a/nacl/crypto_core/wrapper-empty.cpp b/nacl/crypto_core/wrapper-empty.cpp deleted file mode 100644 index e69de29b..00000000 --- a/nacl/crypto_core/wrapper-empty.cpp +++ /dev/null | |||