rbnacl-libsodium 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +4 -0
  3. data/lib/rbnacl/libsodium/version.rb +1 -1
  4. data/vendor/libsodium/AUTHORS +0 -3
  5. data/vendor/libsodium/ChangeLog +24 -0
  6. data/vendor/libsodium/THANKS +2 -0
  7. data/vendor/libsodium/autom4te.cache/output.1 +35 -147
  8. data/vendor/libsodium/autom4te.cache/output.3 +35 -147
  9. data/vendor/libsodium/autom4te.cache/requests +127 -127
  10. data/vendor/libsodium/autom4te.cache/traces.1 +244 -254
  11. data/vendor/libsodium/autom4te.cache/traces.3 +111 -113
  12. data/vendor/libsodium/builds/msvc/properties/Common.props +3 -1
  13. data/vendor/libsodium/builds/msvc/properties/Release.props +1 -3
  14. data/vendor/libsodium/builds/msvc/version.h +3 -3
  15. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +1 -11
  16. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +1 -37
  17. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +10 -1
  18. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +10 -1
  19. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +1 -11
  20. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +1 -37
  21. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +10 -1
  22. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +10 -1
  23. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +1 -11
  24. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +1 -37
  25. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +10 -1
  26. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +10 -1
  27. data/vendor/libsodium/configure +33 -145
  28. data/vendor/libsodium/configure.ac +22 -23
  29. data/vendor/libsodium/dist-build/android-build.sh +1 -0
  30. data/vendor/libsodium/dist-build/emscripten.sh +2 -2
  31. data/vendor/libsodium/dist-build/ios.sh +1 -0
  32. data/vendor/libsodium/libsodium.pc.in +1 -1
  33. data/vendor/libsodium/libsodium.vcxproj +1 -5
  34. data/vendor/libsodium/libsodium.vcxproj.filters +1 -13
  35. data/vendor/libsodium/msvc-scripts/process.bat +3 -3
  36. data/vendor/libsodium/msvc-scripts/sodium.props +4 -1
  37. data/vendor/libsodium/src/libsodium/Makefile.am +1 -10
  38. data/vendor/libsodium/src/libsodium/Makefile.in +5 -79
  39. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c +3 -1
  40. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c +3 -1
  41. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c +3 -1
  42. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +6 -0
  43. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h +2 -2
  44. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +46 -3
  45. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +2 -10
  46. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +7 -1
  47. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c +18 -0
  48. data/vendor/libsodium/src/libsodium/include/Makefile.am +0 -1
  49. data/vendor/libsodium/src/libsodium/include/Makefile.in +0 -1
  50. data/vendor/libsodium/src/libsodium/include/sodium.h +0 -1
  51. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +1 -2
  52. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +5 -0
  53. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +15 -0
  54. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +54 -3
  55. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +22 -7
  56. data/vendor/libsodium/src/libsodium/sodium/core.c +2 -0
  57. data/vendor/libsodium/src/libsodium/sodium/utils.c +305 -31
  58. data/vendor/libsodium/test/default/Makefile.am +18 -16
  59. data/vendor/libsodium/test/default/Makefile.in +141 -76
  60. data/vendor/libsodium/test/default/ed25519_convert.c +48 -0
  61. data/vendor/libsodium/test/default/ed25519_convert.exp +3 -0
  62. data/vendor/libsodium/test/default/sign.c +15 -4
  63. data/vendor/libsodium/test/default/sodium_utils2.c +70 -0
  64. data/vendor/libsodium/test/default/sodium_utils2.exp +3 -0
  65. data/vendor/libsodium/test/default/sodium_utils3.c +55 -0
  66. data/vendor/libsodium/test/default/sodium_utils3.exp +2 -0
  67. metadata +8 -24
  68. data/vendor/libsodium/src/libsodium/crypto_auth/try.c +0 -119
  69. data/vendor/libsodium/src/libsodium/crypto_box/try.c +0 -195
  70. data/vendor/libsodium/src/libsodium/crypto_hash/try.c +0 -76
  71. data/vendor/libsodium/src/libsodium/crypto_scalarmult/try.c +0 -125
  72. data/vendor/libsodium/src/libsodium/crypto_secretbox/try.c +0 -129
  73. data/vendor/libsodium/src/libsodium/crypto_sign/try.c +0 -87
  74. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-be.h +0 -273
  75. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-le.h +0 -274
  76. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table.h +0 -62
  77. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256-ctr.c +0 -239
  78. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256.h +0 -171
  79. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/api.h +0 -13
  80. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/ecrypt-sync.h +0 -27
  81. data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c +0 -16
  82. data/vendor/libsodium/src/libsodium/crypto_stream/try.c +0 -122
  83. data/vendor/libsodium/src/libsodium/crypto_verify/try.c +0 -76
  84. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +0 -67
  85. data/vendor/libsodium/src/libsodium/sodium/compat.c +0 -361
  86. data/vendor/libsodium/test/default/stream5.c +0 -29
  87. data/vendor/libsodium/test/default/stream5.exp +0 -1
  88. data/vendor/libsodium/test/default/stream6.c +0 -54
  89. data/vendor/libsodium/test/default/stream6.exp +0 -17
@@ -1,171 +0,0 @@
1
- /* aes256.h */
2
- /* Hongjun Wu, January 2007*/
3
-
4
-
5
- #include "ecrypt-sync.h"
6
- #include "aes-table.h"
7
-
8
- #include <stdio.h>
9
-
10
- #ifdef NATIVE_LITTLE_ENDIAN
11
- # define LEROT(X, S) ((uint8_t) ((uint32_t)(X) >> (S)))
12
- # define SWP32(X) (X)
13
- #elif defined(NATIVE_BIG_ENDIAN)
14
- # define LEROT(X, S) ((uint8_t) ((uint32_t)(X) >> (24 - (S))))
15
- # define SWP32(X) ((uint32_t)((((uint32_t)(X) & 0xff000000) >> 24) | \
16
- (((uint32_t)(X) & 0x00ff0000) >> 8) | \
17
- (((uint32_t)(X) & 0x0000ff00) << 8) | \
18
- (((uint32_t)(X) & 0x000000ff) << 24)))
19
- #else
20
- # error Unsupported byte ordering
21
- #endif
22
-
23
- #define first_round(ctx,x0,y0) { \
24
- u32 z0,t0,tem0; \
25
- z0 = (x0) ^ ctx->round_key[0][0]; \
26
- t0 = LEROT(z0, 0); \
27
- tem0 = T0[t0]; \
28
- (y0) = tem0 ^ ctx->first_round_output_x0; \
29
- }
30
-
31
- #define second_round(ctx,x0,y0,y1,y2,y3) { \
32
- u32 t0,t7,t10,t13; \
33
- u32 tem0,tem7,tem10,tem13; \
34
- t0 = LEROT(x0, 0); \
35
- tem0 = T0[t0]; \
36
- (y0) = tem0 ^ ctx->second_round_output[0]; \
37
- t7 = LEROT(x0, 24); \
38
- tem7 = T3[t7]; \
39
- (y1) = tem7 ^ ctx->second_round_output[1]; \
40
- t10 = LEROT(x0, 16); \
41
- tem10 = T2[t10]; \
42
- (y2) = tem10 ^ ctx->second_round_output[2]; \
43
- t13 = LEROT(x0, 8); \
44
- tem13 = T1[t13];\
45
- (y3) = tem13 ^ ctx->second_round_output[3]; \
46
- }
47
-
48
- #define round(ctx,x0,x1,x2,x3,y0,y1,y2,y3,r) { \
49
- u32 t0,t1,t2,t3; \
50
- u32 t4,t5,t6,t7; \
51
- u32 t8,t9,t10,t11; \
52
- u32 t12,t13,t14,t15;\
53
- u32 tem0,tem1,tem2,tem3; \
54
- u32 tem4,tem5,tem6,tem7; \
55
- u32 tem8,tem9,tem10,tem11; \
56
- u32 tem12,tem13,tem14,tem15;\
57
- \
58
- t0 = LEROT(x0, 0); \
59
- tem0 = T0[t0]; \
60
- t1 = LEROT(x1, 8); \
61
- tem1 = tem0 ^ T1[t1]; \
62
- t2 = LEROT(x2, 16); \
63
- tem2 = tem1 ^ T2[t2]; \
64
- t3 = LEROT(x3, 24); \
65
- tem3 = tem2 ^ T3[t3]; \
66
- (y0) = tem3 ^ ctx->round_key[r][0]; \
67
- \
68
- t4 = LEROT(x1, 0); \
69
- tem4 = T0[t4]; \
70
- t5 = LEROT(x2, 8); \
71
- tem5 = tem4 ^ T1[t5]; \
72
- t6 = LEROT(x3, 16); \
73
- tem6 = tem5 ^ T2[t6]; \
74
- t7 = LEROT(x0, 24); \
75
- tem7 = tem6 ^ T3[t7]; \
76
- (y1) = tem7 ^ ctx->round_key[r][1]; \
77
- \
78
- t8 = LEROT(x2, 0); \
79
- tem8 = T0[t8]; \
80
- t9 = LEROT(x3, 8); \
81
- tem9 = tem8 ^ T1[t9]; \
82
- t10 = LEROT(x0, 16); \
83
- tem10 = tem9 ^ T2[t10]; \
84
- t11 = LEROT(x1, 24); \
85
- tem11 = tem10 ^ T3[t11];\
86
- (y2) = tem11 ^ ctx->round_key[r][2]; \
87
- \
88
- t12 = LEROT(x3, 0); \
89
- tem12 = T0[t12]; \
90
- t13 = LEROT(x0, 8); \
91
- tem13 = tem12 ^ T1[t13];\
92
- t14 = LEROT(x1, 16); \
93
- tem14 = tem13 ^ T2[t14];\
94
- t15 = LEROT(x2, 24); \
95
- tem15 = tem14 ^ T3[t15];\
96
- (y3) = tem15 ^ ctx->round_key[r][3]; \
97
- }
98
-
99
- /* 22.14 cycles/byte*/
100
- #define last_round(ctx,x0,x1,x2,x3,output,r) { \
101
- u32 t0,t1,t2,t3; \
102
- u32 t4,t5,t6,t7; \
103
- u32 t8,t9,t10,t11; \
104
- u32 t12,t13,t14,t15;\
105
- \
106
- t0 = LEROT(x0, 0); \
107
- output[0] = Sbox[t0]; \
108
- t7 = LEROT(x0, 24); \
109
- output[7] = Sbox[t7]; \
110
- t10 = LEROT(x0, 16); \
111
- output[10] = Sbox[t10]; \
112
- t13 = LEROT(x0, 8); \
113
- output[13] = Sbox[t13]; \
114
- \
115
- t1 = LEROT(x1, 8); \
116
- output[1] = Sbox[t1]; \
117
- t4 = LEROT(x1, 0); \
118
- output[4] = Sbox[t4]; \
119
- t11 = LEROT(x1, 24); \
120
- output[11] = Sbox[t11]; \
121
- t14 = LEROT(x1, 16); \
122
- output[14] = Sbox[t14]; \
123
- \
124
- t2 = LEROT(x2, 16); \
125
- output[2] = Sbox[t2]; \
126
- t5 = LEROT(x2, 8); \
127
- output[5] = Sbox[t5]; \
128
- t8 = LEROT(x2, 0); \
129
- output[8] = Sbox[t8]; \
130
- t15 = LEROT(x2, 24); \
131
- output[15] = Sbox[t15]; \
132
- \
133
- t3 = LEROT(x3, 24); \
134
- output[3] = Sbox[t3]; \
135
- t6 = LEROT(x3, 16); \
136
- output[6] = Sbox[t6]; \
137
- t9 = LEROT(x3, 8); \
138
- output[9] = Sbox[t9]; \
139
- t12 = LEROT(x3, 0); \
140
- output[12] = Sbox[t12]; \
141
- }
142
-
143
- #define aes256_enc_block(x,output,ctx) {\
144
- u32 y0;\
145
- u32 z0,z1,z2,z3;\
146
- u32 a0,a1,a2,a3;\
147
- u32 b0,b1,b2,b3;\
148
- u32 c0,c1,c2,c3;\
149
- u32 d0,d1,d2,d3;\
150
- u32 e0,e1,e2,e3;\
151
- u32 f0,f1,f2,f3;\
152
- u32 g0,g1,g2,g3;\
153
- u32 h0,h1,h2,h3;\
154
- u32 i0,i1,i2,i3;\
155
- u32 j0,j1,j2,j3;\
156
- u32 k0,k1,k2,k3;\
157
- first_round(ctx,x[0],y0);\
158
- second_round(ctx,y0,z0,z1,z2,z3);\
159
- round(ctx,z0,z1,z2,z3,a0,a1,a2,a3,3);\
160
- round(ctx,a0,a1,a2,a3,b0,b1,b2,b3,4);\
161
- round(ctx,b0,b1,b2,b3,c0,c1,c2,c3,5);\
162
- round(ctx,c0,c1,c2,c3,d0,d1,d2,d3,6);\
163
- round(ctx,d0,d1,d2,d3,e0,e1,e2,e3,7);\
164
- round(ctx,e0,e1,e2,e3,f0,f1,f2,f3,8);\
165
- round(ctx,f0,f1,f2,f3,g0,g1,g2,g3,9);\
166
- round(ctx,g0,g1,g2,g3,h0,h1,h2,h3,10);\
167
- round(ctx,h0,h1,h2,h3,i0,i1,i2,i3,11);\
168
- round(ctx,i0,i1,i2,i3,j0,j1,j2,j3,12);\
169
- round(ctx,j0,j1,j2,j3,k0,k1,k2,k3,13);\
170
- last_round(ctx,k0,k1,k2,k3,(output),14);\
171
- }
@@ -1,13 +0,0 @@
1
-
2
- #include "crypto_stream_aes256estream.h"
3
-
4
- #define crypto_stream crypto_stream_aes256estream
5
- #define crypto_stream_xor crypto_stream_aes256estream_xor
6
- #define crypto_stream_beforenm crypto_stream_aes256estream_beforenm
7
- #define crypto_stream_afternm crypto_stream_aes256estream_afternm
8
- #define crypto_stream_xor_afternm crypto_stream_aes256estream_xor_afternm
9
- #define crypto_stream_KEYBYTES crypto_stream_aes256estream_KEYBYTES
10
- #define crypto_stream_NONCEBYTES crypto_stream_aes256estream_NONCEBYTES
11
- #define crypto_stream_BEFORENMBYTES crypto_stream_aes256estream_BEFORENMBYTES
12
- #define crypto_stream_IMPLEMENTATION crypto_stream_aes256estream_IMPLEMENTATION
13
- #define crypto_stream_VERSION crypto_stream_aes256estream_VERSION
@@ -1,27 +0,0 @@
1
-
2
- #ifndef __ECRYPT_SYNC__
3
- #define __ECRYPT_SYNC__
4
-
5
- #include <stdint.h>
6
-
7
- typedef uint8_t u8;
8
- typedef uint32_t u32;
9
-
10
- #define Nr 14
11
- #define Nk 8
12
- #define Nb 4
13
-
14
- #pragma pack(push, 1)
15
- typedef struct ECRYPT_ctx
16
- {
17
- u32 round_key[Nr+1][4];
18
- u32 counter[4];
19
- u32 first_round_output_x0;
20
- u32 second_round_output[4];
21
- } ECRYPT_ctx;
22
- #pragma pack(pop)
23
-
24
- #define ECRYPT_encrypt_bytes(ctx, plaintext, ciphertext, msglen) \
25
- ECRYPT_process_bytes(0, ctx, plaintext, ciphertext, msglen)
26
-
27
- #endif
@@ -1,16 +0,0 @@
1
- #include "crypto_stream_aes256estream.h"
2
-
3
- size_t
4
- crypto_stream_aes256estream_keybytes(void) {
5
- return crypto_stream_aes256estream_KEYBYTES;
6
- }
7
-
8
- size_t
9
- crypto_stream_aes256estream_noncebytes(void) {
10
- return crypto_stream_aes256estream_NONCEBYTES;
11
- }
12
-
13
- size_t
14
- crypto_stream_aes256estream_beforenmbytes(void) {
15
- return crypto_stream_aes256estream_BEFORENMBYTES;
16
- }
@@ -1,122 +0,0 @@
1
- /*
2
- * crypto_stream/try.c version 20090118
3
- * D. J. Bernstein
4
- * Public domain.
5
- */
6
-
7
- #include <stdlib.h>
8
- #include "crypto_stream.h"
9
- #include "utils.h"
10
- #include "windows/windows-quirks.h"
11
-
12
- extern unsigned char *alignedcalloc(unsigned long long);
13
-
14
- const char *primitiveimplementation = crypto_stream_IMPLEMENTATION;
15
-
16
- #define MAXTEST_BYTES 10000
17
- #define CHECKSUM_BYTES 4096
18
- #define TUNE_BYTES 1536
19
-
20
- static unsigned char *k;
21
- static unsigned char *n;
22
- static unsigned char *m;
23
- static unsigned char *c;
24
- static unsigned char *s;
25
- static unsigned char *k2;
26
- static unsigned char *n2;
27
- static unsigned char *m2;
28
- static unsigned char *c2;
29
- static unsigned char *s2;
30
-
31
- void preallocate(void)
32
- {
33
- }
34
-
35
- void allocate(void)
36
- {
37
- k = alignedcalloc(crypto_stream_KEYBYTES);
38
- n = alignedcalloc(crypto_stream_NONCEBYTES);
39
- m = alignedcalloc(MAXTEST_BYTES);
40
- c = alignedcalloc(MAXTEST_BYTES);
41
- s = alignedcalloc(MAXTEST_BYTES);
42
- k2 = alignedcalloc(crypto_stream_KEYBYTES);
43
- n2 = alignedcalloc(crypto_stream_NONCEBYTES);
44
- m2 = alignedcalloc(MAXTEST_BYTES);
45
- c2 = alignedcalloc(MAXTEST_BYTES);
46
- s2 = alignedcalloc(MAXTEST_BYTES);
47
- }
48
-
49
- void predoit(void)
50
- {
51
- }
52
-
53
- void doit(void)
54
- {
55
- crypto_stream_xor(c,m,TUNE_BYTES,n,k);
56
- }
57
-
58
- char checksum[crypto_stream_KEYBYTES * 2 + 1];
59
-
60
- const char *checksum_compute(void)
61
- {
62
- long long i;
63
- long long j;
64
-
65
- for (i = 0;i < CHECKSUM_BYTES;++i) {
66
- long long mlen = i;
67
- long long clen = i;
68
- long long slen = i;
69
- long long klen = crypto_stream_KEYBYTES;
70
- long long nlen = crypto_stream_NONCEBYTES;
71
- for (j = -16;j < 0;++j) m[j] = rand();
72
- for (j = -16;j < 0;++j) c[j] = rand();
73
- for (j = -16;j < 0;++j) s[j] = rand();
74
- for (j = -16;j < 0;++j) n[j] = rand();
75
- for (j = -16;j < 0;++j) k[j] = rand();
76
- for (j = mlen;j < mlen + 16;++j) m[j] = rand();
77
- for (j = clen;j < clen + 16;++j) c[j] = rand();
78
- for (j = slen;j < slen + 16;++j) s[j] = rand();
79
- for (j = nlen;j < nlen + 16;++j) n[j] = rand();
80
- for (j = klen;j < klen + 16;++j) k[j] = rand();
81
- for (j = -16;j < mlen + 16;++j) m2[j] = m[j];
82
- for (j = -16;j < clen + 16;++j) c2[j] = c[j];
83
- for (j = -16;j < slen + 16;++j) s2[j] = s[j];
84
- for (j = -16;j < nlen + 16;++j) n2[j] = n[j];
85
- for (j = -16;j < klen + 16;++j) k2[j] = k[j];
86
-
87
- crypto_stream_xor(c,m,mlen,n,k);
88
-
89
- for (j = -16;j < mlen + 16;++j) if (m[j] != m2[j]) return "crypto_stream_xor overwrites m";
90
- for (j = -16;j < slen + 16;++j) if (s[j] != s2[j]) return "crypto_stream_xor overwrites s";
91
- for (j = -16;j < nlen + 16;++j) if (n[j] != n2[j]) return "crypto_stream_xor overwrites n";
92
- for (j = -16;j < klen + 16;++j) if (k[j] != k2[j]) return "crypto_stream_xor overwrites k";
93
- for (j = -16;j < 0;++j) if (c[j] != c2[j]) return "crypto_stream_xor writes before output";
94
- for (j = clen;j < clen + 16;++j) if (c[j] != c2[j]) return "crypto_stream_xor writes after output";
95
-
96
- for (j = -16;j < clen + 16;++j) c2[j] = c[j];
97
-
98
- crypto_stream(s,slen,n,k);
99
-
100
- for (j = -16;j < mlen + 16;++j) if (m[j] != m2[j]) return "crypto_stream overwrites m";
101
- for (j = -16;j < clen + 16;++j) if (c[j] != c2[j]) return "crypto_stream overwrites c";
102
- for (j = -16;j < nlen + 16;++j) if (n[j] != n2[j]) return "crypto_stream overwrites n";
103
- for (j = -16;j < klen + 16;++j) if (k[j] != k2[j]) return "crypto_stream overwrites k";
104
- for (j = -16;j < 0;++j) if (s[j] != s2[j]) return "crypto_stream writes before output";
105
- for (j = slen;j < slen + 16;++j) if (s[j] != s2[j]) return "crypto_stream writes after output";
106
-
107
- for (j = 0;j < mlen;++j)
108
- if ((s[j] ^ m[j]) != c[j]) return "crypto_stream_xor does not match crypto_stream";
109
-
110
- for (j = 0;j < clen;++j) k[j % klen] ^= c[j];
111
- crypto_stream_xor(m,c,clen,n,k);
112
- crypto_stream(s,slen,n,k);
113
- for (j = 0;j < mlen;++j)
114
- if ((s[j] ^ m[j]) != c[j]) return "crypto_stream_xor does not match crypto_stream";
115
- for (j = 0;j < mlen;++j) n[j % nlen] ^= m[j];
116
- m[mlen] = 0;
117
- }
118
-
119
- sodium_bin2hex(checksum, sizeof checksum, k, crypto_stream_KEYBYTES);
120
-
121
- return 0;
122
- }
@@ -1,76 +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
- #include "windows/windows-quirks.h"
10
-
11
- extern unsigned char *alignedcalloc(unsigned long long);
12
-
13
- const char *primitiveimplementation = crypto_verify_IMPLEMENTATION;
14
-
15
- static unsigned char *x;
16
- static unsigned char *y;
17
-
18
- void preallocate(void)
19
- {
20
- }
21
-
22
- void allocate(void)
23
- {
24
- x = alignedcalloc(crypto_verify_BYTES);
25
- y = alignedcalloc(crypto_verify_BYTES);
26
- }
27
-
28
- void predoit(void)
29
- {
30
- }
31
-
32
- void doit(void)
33
- {
34
- crypto_verify(x,y);
35
- }
36
-
37
- static const char *check(void)
38
- {
39
- int r = crypto_verify(x,y);
40
- if (r == 0) {
41
- if (memcmp(x,y,crypto_verify_BYTES)) return "different strings pass verify";
42
- } else if (r == -1) {
43
- if (!memcmp(x,y,crypto_verify_BYTES)) return "equal strings fail verify";
44
- } else {
45
- return "weird return value from verify";
46
- }
47
- return 0;
48
- }
49
-
50
- char checksum[2];
51
-
52
- const char *checksum_compute(void)
53
- {
54
- long long tests;
55
- long long i;
56
- long long j;
57
- const char *c;
58
-
59
- for (tests = 0;tests < 100000;++tests) {
60
- for (i = 0;i < crypto_verify_BYTES;++i) x[i] = rand();
61
- for (i = 0;i < crypto_verify_BYTES;++i) y[i] = rand();
62
- c = check(); if (c) return c;
63
- for (i = 0;i < crypto_verify_BYTES;++i) y[i] = x[i];
64
- c = check(); if (c) return c;
65
- y[rand() % crypto_verify_BYTES] = rand();
66
- c = check(); if (c) return c;
67
- y[rand() % crypto_verify_BYTES] = rand();
68
- c = check(); if (c) return c;
69
- y[rand() % crypto_verify_BYTES] = rand();
70
- c = check(); if (c) return c;
71
- }
72
-
73
- checksum[0] = '0';
74
- checksum[1] = 0;
75
- return 0;
76
- }
@@ -1,67 +0,0 @@
1
- #ifndef crypto_stream_aes256estream_H
2
- #define crypto_stream_aes256estream_H
3
-
4
- /*
5
- * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6
- * While it provides some protection against eavesdropping, it does NOT
7
- * provide any security against active attacks.
8
- * Furthermore, this implementation was not part of NaCl.
9
- *
10
- * If you are looking for a stream cipher, you might consider
11
- * crypto_stream_aes128ctr, crypto_stream_chacha20 or crypto_stream_(x)salsa20
12
- * which are timing-attack resistant.
13
- *
14
- * But unless you know what you're doing, what you are looking for is probably
15
- * the crypto_box or crypto_secretbox functions.
16
- */
17
-
18
- #include <stddef.h>
19
- #include "export.h"
20
-
21
- #ifdef __cplusplus
22
- # if __GNUC__
23
- # pragma GCC diagnostic ignored "-Wlong-long"
24
- # endif
25
- extern "C" {
26
- #endif
27
-
28
- #define crypto_stream_aes256estream_KEYBYTES 32U
29
- SODIUM_EXPORT
30
- size_t crypto_stream_aes256estream_keybytes(void);
31
-
32
- #define crypto_stream_aes256estream_NONCEBYTES 16U
33
- SODIUM_EXPORT
34
- size_t crypto_stream_aes256estream_noncebytes(void);
35
-
36
- #define crypto_stream_aes256estream_BEFORENMBYTES 276U
37
- SODIUM_EXPORT
38
- size_t crypto_stream_aes256estream_beforenmbytes(void);
39
-
40
- SODIUM_EXPORT
41
- int crypto_stream_aes256estream(unsigned char *out, unsigned long long len,
42
- const unsigned char *nonce, const unsigned char *c);
43
-
44
- SODIUM_EXPORT
45
- int crypto_stream_aes256estream_xor(unsigned char *out, const unsigned char *in,
46
- unsigned long long inlen, const unsigned char *n,
47
- const unsigned char *k);
48
-
49
- SODIUM_EXPORT
50
- int crypto_stream_aes256estream_beforenm(unsigned char *c, const unsigned char *k);
51
-
52
- SODIUM_EXPORT
53
- int crypto_stream_aes256estream_afternm(unsigned char *out, unsigned long long len,
54
- const unsigned char *nonce,
55
- const unsigned char *c);
56
-
57
- SODIUM_EXPORT
58
- int crypto_stream_aes256estream_xor_afternm(unsigned char *out, const unsigned char *in,
59
- unsigned long long len,
60
- const unsigned char *nonce,
61
- const unsigned char *c);
62
-
63
- #ifdef __cplusplus
64
- }
65
- #endif
66
-
67
- #endif