rbnacl-libsodium 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/rbnacl/libsodium/version.rb +1 -1
- data/vendor/libsodium/ChangeLog +20 -1
- data/vendor/libsodium/Makefile.in +39 -27
- data/vendor/libsodium/README.markdown +2 -2
- data/vendor/libsodium/THANKS +2 -0
- data/vendor/libsodium/aclocal.m4 +36 -33
- data/vendor/libsodium/autom4te.cache/output.1 +1118 -841
- data/vendor/libsodium/autom4te.cache/output.4 +17517 -0
- data/vendor/libsodium/autom4te.cache/requests +760 -531
- data/vendor/libsodium/autom4te.cache/traces.1 +13 -14
- data/vendor/libsodium/autom4te.cache/traces.4 +2951 -0
- data/vendor/libsodium/build-aux/compile +1 -1
- data/vendor/libsodium/build-aux/config.guess +13 -160
- data/vendor/libsodium/build-aux/config.sub +25 -11
- data/vendor/libsodium/build-aux/depcomp +1 -1
- data/vendor/libsodium/build-aux/install-sh +170 -196
- data/vendor/libsodium/build-aux/ltmain.sh +3459 -2026
- data/vendor/libsodium/build-aux/missing +1 -1
- data/vendor/libsodium/build-aux/test-driver +12 -3
- data/vendor/libsodium/builds/msvc/version.h +2 -2
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +1 -4
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +3 -8
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +11 -2
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +11 -2
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +2 -5
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +3 -8
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +11 -2
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +11 -2
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +1 -4
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +3 -8
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +11 -2
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +11 -2
- data/vendor/libsodium/builds/msvc/vs2015/libsodium.import.props +52 -0
- data/vendor/libsodium/{packaging/nuget/package.xml → builds/msvc/vs2015/libsodium.import.xml} +2 -7
- data/vendor/libsodium/builds/msvc/vs2015/libsodium.sln +81 -0
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.props +43 -0
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +352 -0
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +1073 -0
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.xml +15 -0
- data/vendor/libsodium/builds/msvc/vs2015/test/test.props +43 -0
- data/vendor/libsodium/builds/msvc/vs2015/test/test.runner.bat +78 -0
- data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj +241 -0
- data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj.filters +189 -0
- data/vendor/libsodium/configure +1117 -840
- data/vendor/libsodium/configure.ac +4 -4
- data/vendor/libsodium/dist-build/Makefile.am +2 -2
- data/vendor/libsodium/dist-build/Makefile.in +19 -7
- data/vendor/libsodium/dist-build/android-arm.sh +3 -2
- data/vendor/libsodium/dist-build/android-armv7-a.sh +4 -0
- data/vendor/libsodium/dist-build/android-build.sh +4 -5
- data/vendor/libsodium/dist-build/android-mips32.sh +4 -0
- data/vendor/libsodium/dist-build/android-x86.sh +3 -2
- data/vendor/libsodium/dist-build/emscripten.sh +4 -5
- data/vendor/libsodium/dist-build/ios.sh +56 -25
- data/vendor/libsodium/dist-build/osx.sh +20 -0
- data/vendor/libsodium/libsodium.vcxproj +1 -0
- data/vendor/libsodium/libsodium.vcxproj.filters +3 -0
- data/vendor/libsodium/m4/libtool.m4 +1366 -1030
- data/vendor/libsodium/m4/ltoptions.m4 +90 -37
- data/vendor/libsodium/m4/ltsugar.m4 +4 -3
- data/vendor/libsodium/m4/ltversion.m4 +6 -6
- data/vendor/libsodium/m4/lt~obsolete.m4 +4 -3
- data/vendor/libsodium/msvc-scripts/Makefile.in +17 -5
- data/vendor/libsodium/msvc-scripts/process.bat +2 -2
- data/vendor/libsodium/packaging/nuget/package.config +1 -1
- data/vendor/libsodium/src/Makefile.in +17 -5
- data/vendor/libsodium/src/libsodium/Makefile.am +7 -2
- data/vendor/libsodium/src/libsodium/Makefile.in +83 -55
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c +5 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c +5 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c +5 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_seal.c +67 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +8 -1
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c +5 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c +5 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +12 -6
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c +60 -25
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +12 -12
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +11 -3
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +1 -4
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +13 -3
- data/vendor/libsodium/src/libsodium/include/Makefile.in +18 -6
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +9 -5
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +9 -5
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +6 -2
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +15 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash.h +2 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +1 -1
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +2 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +2 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +2 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +6 -0
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +6 -6
- data/vendor/libsodium/src/libsodium/include/sodium/utils.h +2 -2
- data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +82 -3
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +85 -33
- data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +80 -42
- data/vendor/libsodium/src/libsodium/sodium/utils.c +16 -13
- data/vendor/libsodium/test/Makefile.am +1 -1
- data/vendor/libsodium/test/Makefile.in +18 -6
- data/vendor/libsodium/test/default/Makefile.am +9 -3
- data/vendor/libsodium/test/default/Makefile.in +72 -38
- data/vendor/libsodium/test/default/auth.c +8 -0
- data/vendor/libsodium/test/default/auth5.c +0 -2
- data/vendor/libsodium/test/default/auth7.c +0 -2
- data/vendor/libsodium/test/default/box8.c +0 -2
- data/vendor/libsodium/test/default/box_easy2.c +1 -1
- data/vendor/libsodium/test/default/box_seal.c +43 -0
- data/vendor/libsodium/test/default/box_seal.exp +4 -0
- data/vendor/libsodium/test/default/cmptest.h +1 -0
- data/vendor/libsodium/test/default/generichash2.c +1 -0
- data/vendor/libsodium/test/default/hash.c +2 -0
- data/vendor/libsodium/test/default/onetimeauth.c +1 -0
- data/vendor/libsodium/test/default/onetimeauth7.c +0 -2
- data/vendor/libsodium/test/default/pre.js.inc +0 -27
- data/vendor/libsodium/test/default/pwhash.c +18 -5
- data/vendor/libsodium/test/default/randombytes.c +44 -2
- data/vendor/libsodium/test/default/secretbox8.c +0 -2
- data/vendor/libsodium/test/default/sodium_utils2.c +5 -1
- data/vendor/libsodium/test/default/sodium_utils3.c +1 -1
- data/vendor/libsodium/test/default/stream.c +13 -1
- data/vendor/libsodium/test/default/stream.exp +1 -0
- data/vendor/libsodium/test/default/stream2.c +13 -1
- data/vendor/libsodium/test/default/stream2.exp +1 -0
- data/vendor/libsodium/test/quirks/quirks.h +26 -0
- metadata +23 -12
- data/vendor/libsodium/builds/msvc/resource.h +0 -0
- data/vendor/libsodium/builds/msvc/resource.rc +0 -0
- data/vendor/libsodium/dist-build/android-armv7.sh +0 -3
- data/vendor/libsodium/dist-build/android-mips.sh +0 -3
- data/vendor/libsodium/packaging/nuget/package.nuspec +0 -95
- data/vendor/libsodium/packaging/nuget/package.targets +0 -128
- data/vendor/libsodium/test/quirks/windows/windows-quirks.h +0 -18
@@ -37,11 +37,18 @@ crypto_generichash_keybytes(void)
|
|
37
37
|
return crypto_generichash_KEYBYTES;
|
38
38
|
}
|
39
39
|
|
40
|
-
const char *
|
40
|
+
const char *
|
41
|
+
crypto_generichash_primitive(void)
|
41
42
|
{
|
42
43
|
return crypto_generichash_PRIMITIVE;
|
43
44
|
}
|
44
45
|
|
46
|
+
size_t
|
47
|
+
crypto_generichash_statebytes(void)
|
48
|
+
{
|
49
|
+
return sizeof(crypto_generichash_state);
|
50
|
+
}
|
51
|
+
|
45
52
|
int
|
46
53
|
crypto_generichash(unsigned char *out, size_t outlen, const unsigned char *in,
|
47
54
|
unsigned long long inlen, const unsigned char *key,
|
@@ -1,6 +1,12 @@
|
|
1
1
|
|
2
2
|
#include "crypto_onetimeauth.h"
|
3
3
|
|
4
|
+
size_t
|
5
|
+
crypto_onetimeauth_statebytes(void)
|
6
|
+
{
|
7
|
+
return sizeof(crypto_onetimeauth_state);
|
8
|
+
}
|
9
|
+
|
4
10
|
size_t
|
5
11
|
crypto_onetimeauth_bytes(void)
|
6
12
|
{
|
@@ -13,12 +19,6 @@ crypto_onetimeauth_keybytes(void)
|
|
13
19
|
return crypto_onetimeauth_KEYBYTES;
|
14
20
|
}
|
15
21
|
|
16
|
-
const char *
|
17
|
-
crypto_onetimeauth_primitive(void)
|
18
|
-
{
|
19
|
-
return crypto_onetimeauth_PRIMITIVE;
|
20
|
-
}
|
21
|
-
|
22
22
|
int
|
23
23
|
crypto_onetimeauth(unsigned char *out, const unsigned char *in,
|
24
24
|
unsigned long long inlen, const unsigned char *k)
|
@@ -57,3 +57,9 @@ crypto_onetimeauth_final(crypto_onetimeauth_state *state,
|
|
57
57
|
return crypto_onetimeauth_poly1305_final
|
58
58
|
((crypto_onetimeauth_poly1305_state *) state, out);
|
59
59
|
}
|
60
|
+
|
61
|
+
const char *
|
62
|
+
crypto_onetimeauth_primitive(void)
|
63
|
+
{
|
64
|
+
return crypto_onetimeauth_PRIMITIVE;
|
65
|
+
}
|
@@ -32,6 +32,12 @@
|
|
32
32
|
|
33
33
|
#include <stdint.h>
|
34
34
|
|
35
|
+
#if SIZE_MAX > 0xffffffffULL
|
36
|
+
# define ARCH_BITS 64
|
37
|
+
#else
|
38
|
+
# define ARCH_BITS 32
|
39
|
+
#endif
|
40
|
+
|
35
41
|
#define crypto_pwhash_scryptsalsa208sha256_STRPREFIXBYTES 14
|
36
42
|
#define crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES 57
|
37
43
|
#define crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES 32
|
@@ -46,6 +52,11 @@ typedef struct {
|
|
46
52
|
size_t size;
|
47
53
|
} escrypt_region_t;
|
48
54
|
|
55
|
+
typedef union {
|
56
|
+
uint64_t d[8];
|
57
|
+
uint32_t w[16];
|
58
|
+
} escrypt_block_t;
|
59
|
+
|
49
60
|
typedef escrypt_region_t escrypt_local_t;
|
50
61
|
|
51
62
|
extern int escrypt_init_local(escrypt_local_t * __local);
|
@@ -39,27 +39,61 @@
|
|
39
39
|
#include "../crypto_scrypt.h"
|
40
40
|
|
41
41
|
static inline void
|
42
|
-
|
42
|
+
blkcpy_64(escrypt_block_t *dest, const escrypt_block_t *src)
|
43
43
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
int i;
|
45
|
+
|
46
|
+
#if (ARCH_BITS==32)
|
47
|
+
for (i = 0; i < 16; ++i)
|
48
|
+
dest->w[i] = src->w[i];
|
49
|
+
#else
|
50
|
+
for (i = 0; i < 8; ++i)
|
51
|
+
dest->d[i] = src->d[i];
|
52
|
+
#endif
|
53
|
+
}
|
48
54
|
|
49
|
-
|
50
|
-
|
55
|
+
static inline void
|
56
|
+
blkxor_64(escrypt_block_t *dest, const escrypt_block_t *src)
|
57
|
+
{
|
58
|
+
int i;
|
59
|
+
|
60
|
+
#if (ARCH_BITS==32)
|
61
|
+
for (i = 0; i < 16; ++i)
|
62
|
+
dest->w[i] ^= src->w[i];
|
63
|
+
#else
|
64
|
+
for (i = 0; i < 8; ++i)
|
65
|
+
dest->d[i] ^= src->d[i];
|
66
|
+
#endif
|
51
67
|
}
|
52
68
|
|
53
69
|
static inline void
|
54
|
-
|
70
|
+
blkcpy(escrypt_block_t *dest, const escrypt_block_t *src, size_t len)
|
55
71
|
{
|
56
|
-
size_t
|
57
|
-
|
58
|
-
|
59
|
-
|
72
|
+
size_t i, L;
|
73
|
+
#if (ARCH_BITS==32)
|
74
|
+
L = (len>>2);
|
75
|
+
for (i = 0; i < L; ++i)
|
76
|
+
dest->w[i] = src->w[i];
|
77
|
+
#else
|
78
|
+
L = (len>>3);
|
79
|
+
for (i = 0; i < L; ++i)
|
80
|
+
dest->d[i] = src->d[i];
|
81
|
+
#endif
|
82
|
+
}
|
60
83
|
|
61
|
-
|
62
|
-
|
84
|
+
static inline void
|
85
|
+
blkxor(escrypt_block_t *dest, const escrypt_block_t *src, size_t len)
|
86
|
+
{
|
87
|
+
size_t i, L;
|
88
|
+
#if (ARCH_BITS==32)
|
89
|
+
L = (len>>2);
|
90
|
+
for (i = 0; i < L; ++i)
|
91
|
+
dest->w[i] ^= src->w[i];
|
92
|
+
#else
|
93
|
+
L = (len>>3);
|
94
|
+
for (i = 0; i < L; ++i)
|
95
|
+
dest->d[i] ^= src->d[i];
|
96
|
+
#endif
|
63
97
|
}
|
64
98
|
|
65
99
|
/**
|
@@ -69,10 +103,11 @@ blkxor(void * dest, const void * src, size_t len)
|
|
69
103
|
static void
|
70
104
|
salsa20_8(uint32_t B[16])
|
71
105
|
{
|
72
|
-
|
106
|
+
escrypt_block_t X;
|
107
|
+
uint32_t *x = X.w;
|
73
108
|
size_t i;
|
74
109
|
|
75
|
-
|
110
|
+
blkcpy_64(&X, (escrypt_block_t*)B);
|
76
111
|
for (i = 0; i < 8; i += 2) {
|
77
112
|
#define R(a,b) (((a) << (b)) | ((a) >> (32 - (b))))
|
78
113
|
/* Operate on columns. */
|
@@ -118,25 +153,25 @@ blockmix_salsa8(const uint32_t * Bin, uint32_t * Bout, uint32_t * X, size_t r)
|
|
118
153
|
size_t i;
|
119
154
|
|
120
155
|
/* 1: X <-- B_{2r - 1} */
|
121
|
-
|
156
|
+
blkcpy_64((escrypt_block_t*)X, (escrypt_block_t*)&Bin[(2 * r - 1) * 16]);
|
122
157
|
|
123
158
|
/* 2: for i = 0 to 2r - 1 do */
|
124
159
|
for (i = 0; i < 2 * r; i += 2) {
|
125
160
|
/* 3: X <-- H(X \xor B_i) */
|
126
|
-
|
161
|
+
blkxor_64((escrypt_block_t*)X, (escrypt_block_t*)&Bin[i * 16]);
|
127
162
|
salsa20_8(X);
|
128
163
|
|
129
164
|
/* 4: Y_i <-- X */
|
130
165
|
/* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
|
131
|
-
|
166
|
+
blkcpy_64((escrypt_block_t*)&Bout[i * 8], (escrypt_block_t*)X);
|
132
167
|
|
133
168
|
/* 3: X <-- H(X \xor B_i) */
|
134
|
-
|
169
|
+
blkxor_64((escrypt_block_t*)X, (escrypt_block_t*)&Bin[i * 16 + 16]);
|
135
170
|
salsa20_8(X);
|
136
171
|
|
137
172
|
/* 4: Y_i <-- X */
|
138
173
|
/* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
|
139
|
-
|
174
|
+
blkcpy_64((escrypt_block_t*)&Bout[i * 8 + r * 16], (escrypt_block_t*)X);
|
140
175
|
}
|
141
176
|
}
|
142
177
|
|
@@ -177,13 +212,13 @@ smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY)
|
|
177
212
|
/* 2: for i = 0 to N - 1 do */
|
178
213
|
for (i = 0; i < N; i += 2) {
|
179
214
|
/* 3: V_i <-- X */
|
180
|
-
blkcpy(&V[i * (32 * r)], X, 128 * r);
|
215
|
+
blkcpy((escrypt_block_t*)&V[i * (32 * r)], (escrypt_block_t*)X, 128 * r);
|
181
216
|
|
182
217
|
/* 4: X <-- H(X) */
|
183
218
|
blockmix_salsa8(X, Y, Z, r);
|
184
219
|
|
185
220
|
/* 3: V_i <-- X */
|
186
|
-
blkcpy(&V[(i + 1) * (32 * r)], Y, 128 * r);
|
221
|
+
blkcpy((escrypt_block_t*)&V[(i + 1) * (32 * r)], (escrypt_block_t*)Y, 128 * r);
|
187
222
|
|
188
223
|
/* 4: X <-- H(X) */
|
189
224
|
blockmix_salsa8(Y, X, Z, r);
|
@@ -195,14 +230,14 @@ smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY)
|
|
195
230
|
j = integerify(X, r) & (N - 1);
|
196
231
|
|
197
232
|
/* 8: X <-- H(X \xor V_j) */
|
198
|
-
blkxor(X, &V[j * (32 * r)], 128 * r);
|
233
|
+
blkxor((escrypt_block_t*)X, (escrypt_block_t*)&V[j * (32 * r)], 128 * r);
|
199
234
|
blockmix_salsa8(X, Y, Z, r);
|
200
235
|
|
201
236
|
/* 7: j <-- Integerify(X) mod N */
|
202
237
|
j = integerify(Y, r) & (N - 1);
|
203
238
|
|
204
239
|
/* 8: X <-- H(X \xor V_j) */
|
205
|
-
blkxor(Y, &V[j * (32 * r)], 128 * r);
|
240
|
+
blkxor((escrypt_block_t*)Y, (escrypt_block_t*)&V[j * (32 * r)], 128 * r);
|
206
241
|
blockmix_salsa8(Y, X, Z, r);
|
207
242
|
}
|
208
243
|
/* 10: B' <-- X */
|
data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c
CHANGED
@@ -95,12 +95,12 @@ crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void)
|
|
95
95
|
|
96
96
|
int
|
97
97
|
crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
98
|
+
unsigned long long outlen,
|
99
|
+
const char * const passwd,
|
100
|
+
unsigned long long passwdlen,
|
101
|
+
const unsigned char * const salt,
|
102
|
+
unsigned long long opslimit,
|
103
|
+
size_t memlimit)
|
104
104
|
{
|
105
105
|
uint32_t N_log2;
|
106
106
|
uint32_t p;
|
@@ -125,10 +125,10 @@ crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
|
|
125
125
|
|
126
126
|
int
|
127
127
|
crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
128
|
+
const char * const passwd,
|
129
|
+
unsigned long long passwdlen,
|
130
|
+
unsigned long long opslimit,
|
131
|
+
size_t memlimit)
|
132
132
|
{
|
133
133
|
uint8_t salt[crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES];
|
134
134
|
char setting[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U];
|
@@ -179,8 +179,8 @@ crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha2
|
|
179
179
|
|
180
180
|
int
|
181
181
|
crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
|
182
|
-
|
183
|
-
|
182
|
+
const char * const passwd,
|
183
|
+
unsigned long long passwdlen)
|
184
184
|
{
|
185
185
|
char wanted[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
|
186
186
|
escrypt_local_t escrypt_local;
|
@@ -189,9 +189,17 @@ fsquare_times(felem output, const felem in, limb count) {
|
|
189
189
|
output[4] = r4;
|
190
190
|
}
|
191
191
|
|
192
|
-
#
|
193
|
-
|
194
|
-
|
192
|
+
#ifdef NATIVE_LITTLE_ENDIAN
|
193
|
+
static inline limb force_inline
|
194
|
+
load_limb(const u8 *in) {
|
195
|
+
limb out;
|
196
|
+
memcpy(&out, in, sizeof (limb));
|
197
|
+
return out;
|
198
|
+
}
|
199
|
+
static inline void force_inline
|
200
|
+
store_limb(u8 *out, limb in) {
|
201
|
+
memcpy(out, &in, sizeof (limb));
|
202
|
+
}
|
195
203
|
#else
|
196
204
|
static inline limb force_inline
|
197
205
|
load_limb(const u8 *in) {
|
@@ -43,7 +43,7 @@ crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
|
|
43
43
|
ge_double_scalarmult_vartime(&R, h, &A, sig + 32);
|
44
44
|
ge_tobytes(rcheck, &R);
|
45
45
|
|
46
|
-
return crypto_verify_32(rcheck, sig) | (-(rcheck
|
46
|
+
return crypto_verify_32(rcheck, sig) | (-(rcheck == sig)) |
|
47
47
|
sodium_memcmp(sig, rcheck, 32);
|
48
48
|
}
|
49
49
|
|
@@ -13,14 +13,11 @@ crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
|
|
13
13
|
const unsigned char *sk)
|
14
14
|
{
|
15
15
|
crypto_hash_sha512_state hs;
|
16
|
-
unsigned char pk[32];
|
17
16
|
unsigned char az[64];
|
18
17
|
unsigned char nonce[64];
|
19
18
|
unsigned char hram[64];
|
20
19
|
ge_p3 R;
|
21
20
|
|
22
|
-
memmove(pk, sk + 32, 32);
|
23
|
-
|
24
21
|
crypto_hash_sha512(az, sk, 32);
|
25
22
|
az[0] &= 248;
|
26
23
|
az[31] &= 63;
|
@@ -31,7 +28,7 @@ crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
|
|
31
28
|
crypto_hash_sha512_update(&hs, m, mlen);
|
32
29
|
crypto_hash_sha512_final(&hs, nonce);
|
33
30
|
|
34
|
-
memmove(sig + 32,
|
31
|
+
memmove(sig + 32, sk + 32, 32);
|
35
32
|
|
36
33
|
sc_reduce(nonce);
|
37
34
|
ge_scalarmult_base(&R, nonce);
|
@@ -2,6 +2,7 @@
|
|
2
2
|
#include "crypto_stream_xsalsa20.h"
|
3
3
|
|
4
4
|
#define crypto_stream crypto_stream_xsalsa20
|
5
|
+
#define crypto_stream_xor_ic crypto_stream_xsalsa20_xor_ic
|
5
6
|
#define crypto_stream_xor crypto_stream_xsalsa20_xor
|
6
7
|
#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
|
7
8
|
#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
|
@@ -13,17 +13,27 @@ static const unsigned char sigma[16] = {
|
|
13
13
|
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
|
14
14
|
};
|
15
15
|
|
16
|
-
int
|
16
|
+
int crypto_stream_xor_ic(
|
17
17
|
unsigned char *c,
|
18
18
|
const unsigned char *m,unsigned long long mlen,
|
19
|
-
const unsigned char *n,
|
19
|
+
const unsigned char *n,uint64_t ic,
|
20
20
|
const unsigned char *k
|
21
21
|
)
|
22
22
|
{
|
23
23
|
unsigned char subkey[32];
|
24
24
|
int ret;
|
25
25
|
crypto_core_hsalsa20(subkey,n,k,sigma);
|
26
|
-
ret =
|
26
|
+
ret = crypto_stream_salsa20_xor_ic(c,m,mlen,n + 16,ic,subkey);
|
27
27
|
sodium_memzero(subkey, sizeof subkey);
|
28
28
|
return ret;
|
29
29
|
}
|
30
|
+
|
31
|
+
int crypto_stream_xor(
|
32
|
+
unsigned char *c,
|
33
|
+
const unsigned char *m,unsigned long long mlen,
|
34
|
+
const unsigned char *n,
|
35
|
+
const unsigned char *k
|
36
|
+
)
|
37
|
+
{
|
38
|
+
return crypto_stream_xor_ic(c, m, mlen, n, 0ULL, k);
|
39
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
# Makefile.in generated by automake 1.
|
1
|
+
# Makefile.in generated by automake 1.15 from Makefile.am.
|
2
2
|
# @configure_input@
|
3
3
|
|
4
|
-
# Copyright (C) 1994-
|
4
|
+
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
5
5
|
|
6
6
|
# This Makefile.in is free software; the Free Software Foundation
|
7
7
|
# gives unlimited permission to copy and/or distribute it,
|
@@ -15,7 +15,17 @@
|
|
15
15
|
@SET_MAKE@
|
16
16
|
|
17
17
|
VPATH = @srcdir@
|
18
|
-
am__is_gnu_make =
|
18
|
+
am__is_gnu_make = { \
|
19
|
+
if test -z '$(MAKELEVEL)'; then \
|
20
|
+
false; \
|
21
|
+
elif test -n '$(MAKE_HOST)'; then \
|
22
|
+
true; \
|
23
|
+
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
24
|
+
true; \
|
25
|
+
else \
|
26
|
+
false; \
|
27
|
+
fi; \
|
28
|
+
}
|
19
29
|
am__make_running_with_option = \
|
20
30
|
case $${target_option-} in \
|
21
31
|
?) ;; \
|
@@ -79,8 +89,6 @@ POST_UNINSTALL = :
|
|
79
89
|
build_triplet = @build@
|
80
90
|
host_triplet = @host@
|
81
91
|
subdir = src/libsodium/include
|
82
|
-
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
83
|
-
$(nobase_include_HEADERS)
|
84
92
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
85
93
|
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
|
86
94
|
$(top_srcdir)/m4/ax_check_link_flag.m4 \
|
@@ -90,6 +98,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
|
|
90
98
|
$(top_srcdir)/configure.ac
|
91
99
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
92
100
|
$(ACLOCAL_M4)
|
101
|
+
DIST_COMMON = $(srcdir)/Makefile.am $(nobase_include_HEADERS) \
|
102
|
+
$(am__DIST_COMMON)
|
93
103
|
mkinstalldirs = $(install_sh) -d
|
94
104
|
CONFIG_CLEAN_FILES =
|
95
105
|
CONFIG_CLEAN_VPATH_FILES =
|
@@ -160,6 +170,7 @@ am__define_uniq_tagged_files = \
|
|
160
170
|
done | $(am__uniquify_input)`
|
161
171
|
ETAGS = etags
|
162
172
|
CTAGS = ctags
|
173
|
+
am__DIST_COMMON = $(srcdir)/Makefile.in
|
163
174
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
164
175
|
ACLOCAL = @ACLOCAL@
|
165
176
|
AMTAR = @AMTAR@
|
@@ -369,7 +380,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|
369
380
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libsodium/include/Makefile'; \
|
370
381
|
$(am__cd) $(top_srcdir) && \
|
371
382
|
$(AUTOMAKE) --foreign src/libsodium/include/Makefile
|
372
|
-
.PRECIOUS: Makefile
|
373
383
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
374
384
|
@case '$?' in \
|
375
385
|
*config.status*) \
|
@@ -647,6 +657,8 @@ uninstall-am: uninstall-nobase_includeHEADERS \
|
|
647
657
|
uninstall-am uninstall-nobase_includeHEADERS \
|
648
658
|
uninstall-nobase_nodist_includeHEADERS
|
649
659
|
|
660
|
+
.PRECIOUS: Makefile
|
661
|
+
|
650
662
|
|
651
663
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
652
664
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|