rbnacl-libsodium 1.0.1 → 1.0.2
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 -0
- data/vendor/libsodium/LICENSE +1 -1
- data/vendor/libsodium/Makefile.in +8 -4
- data/vendor/libsodium/THANKS +3 -0
- data/vendor/libsodium/autom4te.cache/output.1 +96 -57
- data/vendor/libsodium/autom4te.cache/output.3 +96 -57
- data/vendor/libsodium/autom4te.cache/requests +544 -544
- data/vendor/libsodium/autom4te.cache/traces.1 +386 -367
- data/vendor/libsodium/autom4te.cache/traces.3 +222 -213
- data/vendor/libsodium/builds/msvc/version.h +2 -2
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.props +1 -1
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.props +1 -1
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.props +1 -1
- data/vendor/libsodium/configure +95 -56
- data/vendor/libsodium/configure.ac +26 -11
- data/vendor/libsodium/dist-build/Makefile.am +1 -0
- data/vendor/libsodium/dist-build/Makefile.in +2 -0
- data/vendor/libsodium/dist-build/emscripten.sh +48 -10
- data/vendor/libsodium/dist-build/ios.sh +59 -7
- data/vendor/libsodium/libsodium-uninstalled.pc.in +6 -0
- data/vendor/libsodium/msvc-scripts/Makefile.in +1 -0
- data/vendor/libsodium/msvc-scripts/process.bat +2 -2
- data/vendor/libsodium/msvc-scripts/sodium.props +2 -2
- data/vendor/libsodium/src/Makefile.in +1 -0
- data/vendor/libsodium/src/libsodium/Makefile.in +1 -0
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +46 -4
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c +13 -2
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +8 -2
- data/vendor/libsodium/src/libsodium/crypto_sign/crypto_sign.c +6 -6
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +3 -1
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +13 -6
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +8 -8
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c +10 -6
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +11 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +11 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +11 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +11 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +5 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +5 -1
- data/vendor/libsodium/src/libsodium/include/Makefile.in +1 -0
- data/vendor/libsodium/src/libsodium/include/sodium.h +44 -44
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +61 -36
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +0 -10
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +20 -18
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign.h +3 -3
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +3 -3
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +2 -2
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +1 -1
- data/vendor/libsodium/src/libsodium/include/sodium/utils.h +10 -3
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +9 -2
- data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +9 -2
- data/vendor/libsodium/src/libsodium/sodium/utils.c +97 -72
- data/vendor/libsodium/test/Makefile.in +1 -0
- data/vendor/libsodium/test/default/Makefile.am +9 -2
- data/vendor/libsodium/test/default/Makefile.in +38 -78
- data/vendor/libsodium/test/default/box_easy2.c +55 -10
- data/vendor/libsodium/test/default/box_easy2.exp +3 -0
- data/vendor/libsodium/test/default/cmptest.h +4 -0
- data/vendor/libsodium/test/default/{pre.js → pre.js.inc} +10 -4
- data/vendor/libsodium/test/default/pwhash.c +6 -4
- data/vendor/libsodium/test/default/scalarmult6.c +0 -2
- data/vendor/libsodium/test/default/sign.c +1 -1
- data/vendor/libsodium/test/default/sodium_utils2.c +5 -2
- data/vendor/libsodium/test/default/sodium_utils3.c +3 -1
- metadata +5 -4
@@ -250,6 +250,7 @@ SODIUM_LIBRARY_VERSION = @SODIUM_LIBRARY_VERSION@
|
|
250
250
|
SODIUM_LIBRARY_VERSION_MAJOR = @SODIUM_LIBRARY_VERSION_MAJOR@
|
251
251
|
SODIUM_LIBRARY_VERSION_MINOR = @SODIUM_LIBRARY_VERSION_MINOR@
|
252
252
|
STRIP = @STRIP@
|
253
|
+
TEST_LDFLAGS = @TEST_LDFLAGS@
|
253
254
|
VERSION = @VERSION@
|
254
255
|
abs_builddir = @abs_builddir@
|
255
256
|
abs_srcdir = @abs_srcdir@
|
@@ -2,6 +2,7 @@
|
|
2
2
|
EXTRA_DIST = \
|
3
3
|
cmptest.h \
|
4
4
|
wintest.bat \
|
5
|
+
pre.js.inc \
|
5
6
|
aead_chacha20poly1305.exp \
|
6
7
|
auth.exp \
|
7
8
|
auth2.exp \
|
@@ -127,6 +128,8 @@ AM_CPPFLAGS = \
|
|
127
128
|
-I$(top_builddir)/src/libsodium/include/sodium \
|
128
129
|
-I$(top_srcdir)/test/quirks
|
129
130
|
|
131
|
+
AM_LDFLAGS = @TEST_LDFLAGS@
|
132
|
+
|
130
133
|
TESTS_TARGETS = \
|
131
134
|
aead_chacha20poly1305 \
|
132
135
|
auth \
|
@@ -176,8 +179,6 @@ TESTS_TARGETS = \
|
|
176
179
|
sign \
|
177
180
|
sodium_core \
|
178
181
|
sodium_utils \
|
179
|
-
sodium_utils2 \
|
180
|
-
sodium_utils3 \
|
181
182
|
sodium_version \
|
182
183
|
stream \
|
183
184
|
stream2 \
|
@@ -185,6 +186,12 @@ TESTS_TARGETS = \
|
|
185
186
|
stream4 \
|
186
187
|
verify1
|
187
188
|
|
189
|
+
if !EMSCRIPTEN
|
190
|
+
TESTS_TARGETS += \
|
191
|
+
sodium_utils2 \
|
192
|
+
sodium_utils3
|
193
|
+
endif
|
194
|
+
|
188
195
|
check_PROGRAMS = $(TESTS_TARGETS)
|
189
196
|
|
190
197
|
TESTS = $(TESTS_TARGETS)
|
@@ -77,8 +77,12 @@ PRE_UNINSTALL = :
|
|
77
77
|
POST_UNINSTALL = :
|
78
78
|
build_triplet = @build@
|
79
79
|
host_triplet = @host@
|
80
|
-
|
81
|
-
|
80
|
+
@EMSCRIPTEN_FALSE@am__append_1 = \
|
81
|
+
@EMSCRIPTEN_FALSE@ sodium_utils2 \
|
82
|
+
@EMSCRIPTEN_FALSE@ sodium_utils3
|
83
|
+
|
84
|
+
check_PROGRAMS = $(am__EXEEXT_2)
|
85
|
+
TESTS = $(am__EXEEXT_2)
|
82
86
|
subdir = test/default
|
83
87
|
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
84
88
|
$(top_srcdir)/build-aux/depcomp \
|
@@ -95,7 +99,9 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
|
95
99
|
mkinstalldirs = $(install_sh) -d
|
96
100
|
CONFIG_CLEAN_FILES =
|
97
101
|
CONFIG_CLEAN_VPATH_FILES =
|
98
|
-
am__EXEEXT_1 =
|
102
|
+
@EMSCRIPTEN_FALSE@am__EXEEXT_1 = sodium_utils2$(EXEEXT) \
|
103
|
+
@EMSCRIPTEN_FALSE@ sodium_utils3$(EXEEXT)
|
104
|
+
am__EXEEXT_2 = aead_chacha20poly1305$(EXEEXT) auth$(EXEEXT) \
|
99
105
|
auth2$(EXEEXT) auth3$(EXEEXT) auth5$(EXEEXT) auth6$(EXEEXT) \
|
100
106
|
auth7$(EXEEXT) box$(EXEEXT) box2$(EXEEXT) box7$(EXEEXT) \
|
101
107
|
box8$(EXEEXT) box_easy$(EXEEXT) box_easy2$(EXEEXT) \
|
@@ -111,10 +117,9 @@ am__EXEEXT_1 = aead_chacha20poly1305$(EXEEXT) auth$(EXEEXT) \
|
|
111
117
|
secretbox2$(EXEEXT) secretbox7$(EXEEXT) secretbox8$(EXEEXT) \
|
112
118
|
secretbox_easy$(EXEEXT) secretbox_easy2$(EXEEXT) \
|
113
119
|
shorthash$(EXEEXT) sign$(EXEEXT) sodium_core$(EXEEXT) \
|
114
|
-
sodium_utils$(EXEEXT)
|
115
|
-
sodium_utils3$(EXEEXT) sodium_version$(EXEEXT) stream$(EXEEXT) \
|
120
|
+
sodium_utils$(EXEEXT) sodium_version$(EXEEXT) stream$(EXEEXT) \
|
116
121
|
stream2$(EXEEXT) stream3$(EXEEXT) stream4$(EXEEXT) \
|
117
|
-
verify1$(EXEEXT)
|
122
|
+
verify1$(EXEEXT) $(am__EXEEXT_1)
|
118
123
|
aead_chacha20poly1305_SOURCES = aead_chacha20poly1305.c
|
119
124
|
aead_chacha20poly1305_OBJECTS = aead_chacha20poly1305.$(OBJEXT)
|
120
125
|
aead_chacha20poly1305_DEPENDENCIES = $(TESTS_LDADD)
|
@@ -652,6 +657,7 @@ SODIUM_LIBRARY_VERSION = @SODIUM_LIBRARY_VERSION@
|
|
652
657
|
SODIUM_LIBRARY_VERSION_MAJOR = @SODIUM_LIBRARY_VERSION_MAJOR@
|
653
658
|
SODIUM_LIBRARY_VERSION_MINOR = @SODIUM_LIBRARY_VERSION_MINOR@
|
654
659
|
STRIP = @STRIP@
|
660
|
+
TEST_LDFLAGS = @TEST_LDFLAGS@
|
655
661
|
VERSION = @VERSION@
|
656
662
|
abs_builddir = @abs_builddir@
|
657
663
|
abs_srcdir = @abs_srcdir@
|
@@ -708,6 +714,7 @@ top_srcdir = @top_srcdir@
|
|
708
714
|
EXTRA_DIST = \
|
709
715
|
cmptest.h \
|
710
716
|
wintest.bat \
|
717
|
+
pre.js.inc \
|
711
718
|
aead_chacha20poly1305.exp \
|
712
719
|
auth.exp \
|
713
720
|
auth2.exp \
|
@@ -833,64 +840,17 @@ AM_CPPFLAGS = \
|
|
833
840
|
-I$(top_builddir)/src/libsodium/include/sodium \
|
834
841
|
-I$(top_srcdir)/test/quirks
|
835
842
|
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
box8 \
|
848
|
-
box_easy \
|
849
|
-
box_easy2 \
|
850
|
-
box_seed \
|
851
|
-
chacha20 \
|
852
|
-
core1 \
|
853
|
-
core2 \
|
854
|
-
core3 \
|
855
|
-
core4 \
|
856
|
-
core5 \
|
857
|
-
core6 \
|
858
|
-
ed25519_convert \
|
859
|
-
generichash \
|
860
|
-
generichash2 \
|
861
|
-
generichash3 \
|
862
|
-
hash \
|
863
|
-
hash3 \
|
864
|
-
onetimeauth \
|
865
|
-
onetimeauth2 \
|
866
|
-
onetimeauth7 \
|
867
|
-
pwhash \
|
868
|
-
pwhash_scrypt_ll \
|
869
|
-
randombytes \
|
870
|
-
scalarmult \
|
871
|
-
scalarmult2 \
|
872
|
-
scalarmult5 \
|
873
|
-
scalarmult6 \
|
874
|
-
scalarmult7 \
|
875
|
-
secretbox \
|
876
|
-
secretbox2 \
|
877
|
-
secretbox7 \
|
878
|
-
secretbox8 \
|
879
|
-
secretbox_easy \
|
880
|
-
secretbox_easy2 \
|
881
|
-
shorthash \
|
882
|
-
sign \
|
883
|
-
sodium_core \
|
884
|
-
sodium_utils \
|
885
|
-
sodium_utils2 \
|
886
|
-
sodium_utils3 \
|
887
|
-
sodium_version \
|
888
|
-
stream \
|
889
|
-
stream2 \
|
890
|
-
stream3 \
|
891
|
-
stream4 \
|
892
|
-
verify1
|
893
|
-
|
843
|
+
AM_LDFLAGS = @TEST_LDFLAGS@
|
844
|
+
TESTS_TARGETS = aead_chacha20poly1305 auth auth2 auth3 auth5 auth6 \
|
845
|
+
auth7 box box2 box7 box8 box_easy box_easy2 box_seed chacha20 \
|
846
|
+
core1 core2 core3 core4 core5 core6 ed25519_convert \
|
847
|
+
generichash generichash2 generichash3 hash hash3 onetimeauth \
|
848
|
+
onetimeauth2 onetimeauth7 pwhash pwhash_scrypt_ll randombytes \
|
849
|
+
scalarmult scalarmult2 scalarmult5 scalarmult6 scalarmult7 \
|
850
|
+
secretbox secretbox2 secretbox7 secretbox8 secretbox_easy \
|
851
|
+
secretbox_easy2 shorthash sign sodium_core sodium_utils \
|
852
|
+
sodium_version stream stream2 stream3 stream4 verify1 \
|
853
|
+
$(am__append_1)
|
894
854
|
TESTS_LDADD = \
|
895
855
|
${top_builddir}/src/libsodium/libsodium.la
|
896
856
|
|
@@ -1896,20 +1856,6 @@ sodium_utils.log: sodium_utils$(EXEEXT)
|
|
1896
1856
|
--log-file $$b.log --trs-file $$b.trs \
|
1897
1857
|
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
1898
1858
|
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
1899
|
-
sodium_utils2.log: sodium_utils2$(EXEEXT)
|
1900
|
-
@p='sodium_utils2$(EXEEXT)'; \
|
1901
|
-
b='sodium_utils2'; \
|
1902
|
-
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
1903
|
-
--log-file $$b.log --trs-file $$b.trs \
|
1904
|
-
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
1905
|
-
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
1906
|
-
sodium_utils3.log: sodium_utils3$(EXEEXT)
|
1907
|
-
@p='sodium_utils3$(EXEEXT)'; \
|
1908
|
-
b='sodium_utils3'; \
|
1909
|
-
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
1910
|
-
--log-file $$b.log --trs-file $$b.trs \
|
1911
|
-
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
1912
|
-
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
1913
1859
|
sodium_version.log: sodium_version$(EXEEXT)
|
1914
1860
|
@p='sodium_version$(EXEEXT)'; \
|
1915
1861
|
b='sodium_version'; \
|
@@ -1952,6 +1898,20 @@ verify1.log: verify1$(EXEEXT)
|
|
1952
1898
|
--log-file $$b.log --trs-file $$b.trs \
|
1953
1899
|
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
1954
1900
|
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
1901
|
+
sodium_utils2.log: sodium_utils2$(EXEEXT)
|
1902
|
+
@p='sodium_utils2$(EXEEXT)'; \
|
1903
|
+
b='sodium_utils2'; \
|
1904
|
+
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
1905
|
+
--log-file $$b.log --trs-file $$b.trs \
|
1906
|
+
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
1907
|
+
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
1908
|
+
sodium_utils3.log: sodium_utils3$(EXEEXT)
|
1909
|
+
@p='sodium_utils3$(EXEEXT)'; \
|
1910
|
+
b='sodium_utils3'; \
|
1911
|
+
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
1912
|
+
--log-file $$b.log --trs-file $$b.trs \
|
1913
|
+
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
1914
|
+
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
1955
1915
|
.test.log:
|
1956
1916
|
@p='$<'; \
|
1957
1917
|
$(am__set_b); \
|
@@ -5,18 +5,28 @@
|
|
5
5
|
unsigned char m[10000];
|
6
6
|
unsigned char m2[10000];
|
7
7
|
unsigned char c[crypto_box_MACBYTES + 10000];
|
8
|
-
unsigned char nonce[crypto_box_NONCEBYTES];
|
9
|
-
unsigned char alicepk[crypto_box_PUBLICKEYBYTES];
|
10
|
-
unsigned char alicesk[crypto_box_SECRETKEYBYTES];
|
11
|
-
unsigned char bobpk[crypto_box_PUBLICKEYBYTES];
|
12
|
-
unsigned char bobsk[crypto_box_SECRETKEYBYTES];
|
13
|
-
unsigned char mac[crypto_box_MACBYTES];
|
14
8
|
|
15
9
|
int main(void)
|
16
10
|
{
|
17
|
-
|
18
|
-
|
11
|
+
unsigned char *alicepk;
|
12
|
+
unsigned char *alicesk;
|
13
|
+
unsigned char *bobpk;
|
14
|
+
unsigned char *bobsk;
|
15
|
+
unsigned char *mac;
|
16
|
+
unsigned char *nonce;
|
17
|
+
unsigned char *k1;
|
18
|
+
unsigned char *k2;
|
19
|
+
size_t mlen;
|
20
|
+
size_t i;
|
19
21
|
|
22
|
+
alicepk = (unsigned char *) sodium_malloc(crypto_box_PUBLICKEYBYTES);
|
23
|
+
alicesk = (unsigned char *) sodium_malloc(crypto_box_SECRETKEYBYTES);
|
24
|
+
bobpk = (unsigned char *) sodium_malloc(crypto_box_PUBLICKEYBYTES);
|
25
|
+
bobsk = (unsigned char *) sodium_malloc(crypto_box_SECRETKEYBYTES);
|
26
|
+
mac = (unsigned char *) sodium_malloc(crypto_box_MACBYTES);
|
27
|
+
nonce = (unsigned char *) sodium_malloc(crypto_box_NONCEBYTES);
|
28
|
+
k1 = (unsigned char *) sodium_malloc(crypto_box_BEFORENMBYTES);
|
29
|
+
k2 = (unsigned char *) sodium_malloc(crypto_box_BEFORENMBYTES);
|
20
30
|
crypto_box_keypair(alicepk, alicesk);
|
21
31
|
crypto_box_keypair(bobpk, bobsk);
|
22
32
|
mlen = (size_t) randombytes_uniform((uint32_t)sizeof m);
|
@@ -49,11 +59,46 @@ int main(void)
|
|
49
59
|
printf("crypto_box_open_easy() failed\n");
|
50
60
|
}
|
51
61
|
|
62
|
+
crypto_box_beforenm(k1, alicepk, bobsk);
|
63
|
+
crypto_box_beforenm(k2, bobpk, alicesk);
|
64
|
+
|
65
|
+
memset(m2, 0, sizeof m2);
|
66
|
+
|
67
|
+
if (crypto_box_easy_afternm(c, m, SIZE_MAX - 1U, nonce, k1) == 0) {
|
68
|
+
printf("crypto_box_easy_afternm() with a short ciphertext should have failed\n");
|
69
|
+
}
|
70
|
+
crypto_box_easy_afternm(c, m, (unsigned long long) mlen, nonce, k1);
|
71
|
+
crypto_box_open_easy_afternm(m2, c,
|
72
|
+
(unsigned long long) mlen + crypto_box_MACBYTES,
|
73
|
+
nonce, k2);
|
74
|
+
printf("%d\n", memcmp(m, m2, mlen));
|
75
|
+
if (crypto_box_open_easy_afternm(m2, c, crypto_box_MACBYTES - 1U,
|
76
|
+
nonce, k2) == 0) {
|
77
|
+
printf("crypto_box_open_easy_afternm() with a huge ciphertext should have failed\n");
|
78
|
+
}
|
79
|
+
memset(m2, 0, sizeof m2);
|
52
80
|
crypto_box_detached(c, mac, m, (unsigned long long) mlen,
|
53
|
-
nonce,
|
81
|
+
nonce, alicepk, bobsk);
|
54
82
|
crypto_box_open_detached(m2, c, mac, (unsigned long long) mlen,
|
55
|
-
nonce,
|
83
|
+
nonce, bobpk, alicesk);
|
84
|
+
printf("%d\n", memcmp(m, m2, mlen));
|
85
|
+
|
86
|
+
memset(m2, 0, sizeof m2);
|
87
|
+
crypto_box_detached_afternm(c, mac, m, (unsigned long long) mlen,
|
88
|
+
nonce, k1);
|
89
|
+
crypto_box_open_detached_afternm(m2, c, mac, (unsigned long long) mlen,
|
90
|
+
nonce, k2);
|
56
91
|
printf("%d\n", memcmp(m, m2, mlen));
|
57
92
|
|
93
|
+
sodium_free(alicepk);
|
94
|
+
sodium_free(alicesk);
|
95
|
+
sodium_free(bobpk);
|
96
|
+
sodium_free(bobsk);
|
97
|
+
sodium_free(mac);
|
98
|
+
sodium_free(nonce);
|
99
|
+
sodium_free(k1);
|
100
|
+
sodium_free(k2);
|
101
|
+
printf("OK\n");
|
102
|
+
|
58
103
|
return 0;
|
59
104
|
}
|
@@ -6,7 +6,7 @@ try {
|
|
6
6
|
}
|
7
7
|
Module['preRun'] = Module['preRun'] || [];
|
8
8
|
Module['preRun'].push(function(){
|
9
|
-
var randombyte = null;
|
9
|
+
var randombyte = null;
|
10
10
|
try {
|
11
11
|
function randombyte_standard() {
|
12
12
|
var buf = new Int8Array(1);
|
@@ -23,11 +23,17 @@ Module['preRun'].push(function(){
|
|
23
23
|
}
|
24
24
|
randombyte_node();
|
25
25
|
randombyte = randombyte_node;
|
26
|
-
} catch(e) {
|
26
|
+
} catch(e) {
|
27
|
+
throw 'No secure random number generator found';
|
28
|
+
}
|
27
29
|
}
|
28
30
|
FS.init();
|
31
|
+
FS.mkdir('/test-data');
|
32
|
+
FS.mount(NODEFS, { root: '.' }, '/test-data');
|
33
|
+
FS.analyzePath('/dev/random').exists && FS.unlink('/dev/random');
|
34
|
+
FS.analyzePath('/dev/urandom') && FS.unlink('/dev/urandom');
|
29
35
|
var devFolder = FS.findObject('/dev') ||
|
30
|
-
Module['FS_createFolder']('/', 'dev', true, true);
|
36
|
+
Module['FS_createFolder']('/', 'dev', true, true);
|
31
37
|
Module['FS_createDevice'](devFolder, 'random', randombyte);
|
32
|
-
Module['FS_createDevice'](devFolder, 'urandom', randombyte);
|
38
|
+
Module['FS_createDevice'](devFolder, 'urandom', randombyte);
|
33
39
|
});
|
@@ -2,6 +2,10 @@
|
|
2
2
|
#define TEST_NAME "pwhash"
|
3
3
|
#include "cmptest.h"
|
4
4
|
|
5
|
+
#define OUT_LEN 128
|
6
|
+
#define OPSLIMIT 1000000
|
7
|
+
#define MEMLIMIT 10000000
|
8
|
+
|
5
9
|
static void tv(void)
|
6
10
|
{
|
7
11
|
static struct {
|
@@ -267,8 +271,10 @@ static void tv3(void)
|
|
267
271
|
|
268
272
|
do {
|
269
273
|
out = (char *) sodium_malloc(strlen(tests[i].out) + 1U);
|
274
|
+
assert(out != NULL);
|
270
275
|
memcpy(out, tests[i].out, strlen(tests[i].out) + 1U);
|
271
276
|
passwd = (char *) sodium_malloc(strlen(tests[i].passwd) + 1U);
|
277
|
+
assert(passwd != NULL);
|
272
278
|
memcpy(passwd, tests[i].passwd, strlen(tests[i].passwd) + 1U);
|
273
279
|
if (crypto_pwhash_scryptsalsa208sha256_str_verify(
|
274
280
|
out, passwd, strlen(passwd)) != 0) {
|
@@ -279,10 +285,6 @@ static void tv3(void)
|
|
279
285
|
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
280
286
|
}
|
281
287
|
|
282
|
-
#define OUT_LEN 128
|
283
|
-
#define OPSLIMIT 1000000
|
284
|
-
#define MEMLIMIT 10000000
|
285
|
-
|
286
288
|
int main(void)
|
287
289
|
{
|
288
290
|
char str_out[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
|
@@ -12,8 +12,6 @@ unsigned char alicepk_[crypto_scalarmult_SCALARBYTES]
|
|
12
12
|
0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38,
|
13
13
|
0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a };
|
14
14
|
|
15
|
-
unsigned char k[32];
|
16
|
-
|
17
15
|
int main(void)
|
18
16
|
{
|
19
17
|
unsigned char *k;
|
@@ -1091,7 +1091,7 @@ int main(void)
|
|
1091
1091
|
printf("signature failure: [%u]\n", i);
|
1092
1092
|
continue;
|
1093
1093
|
}
|
1094
|
-
if (crypto_sign_open(m,
|
1094
|
+
if (crypto_sign_open(m, NULL, sm, smlen, test_data[i].pk) != 0) {
|
1095
1095
|
printf("crypto_sign_open() failure: [%u]\n", i);
|
1096
1096
|
continue;
|
1097
1097
|
}
|
@@ -48,8 +48,9 @@ int main(void)
|
|
48
48
|
for (i = 0U; i < 10000U; i++) {
|
49
49
|
size = randombytes_uniform(100000U);
|
50
50
|
buf = sodium_malloc(size);
|
51
|
+
assert(buf != NULL);
|
51
52
|
memset(buf, i, size);
|
52
|
-
|
53
|
+
sodium_mprotect_noaccess(buf);
|
53
54
|
sodium_free(buf);
|
54
55
|
}
|
55
56
|
printf("OK\n");
|
@@ -65,12 +66,14 @@ int main(void)
|
|
65
66
|
#endif
|
66
67
|
size = randombytes_uniform(100000U);
|
67
68
|
buf = sodium_malloc(size);
|
69
|
+
assert(buf != NULL);
|
68
70
|
sodium_mprotect_readonly(buf);
|
69
71
|
sodium_mprotect_readwrite(buf);
|
72
|
+
#ifndef __EMSCRIPTEN__
|
70
73
|
sodium_memzero(((unsigned char *)buf) + size, 1U);
|
71
74
|
sodium_mprotect_noaccess(buf);
|
72
75
|
sodium_free(buf);
|
73
76
|
printf("Overflow not caught\n");
|
74
|
-
|
77
|
+
#endif
|
75
78
|
return 0;
|
76
79
|
}
|
@@ -43,12 +43,14 @@ int main(void)
|
|
43
43
|
#endif
|
44
44
|
size = randombytes_uniform(100000U);
|
45
45
|
buf = sodium_malloc(size);
|
46
|
+
assert(buf != NULL);
|
46
47
|
sodium_mprotect_noaccess(buf);
|
47
48
|
sodium_mprotect_readwrite(buf);
|
49
|
+
#ifndef __EMSCRIPTEN__
|
48
50
|
sodium_memzero(((unsigned char *)buf) - 8, 8U);
|
49
51
|
sodium_mprotect_readonly(buf);
|
50
52
|
sodium_free(buf);
|
51
53
|
printf("Underflow not caught\n");
|
52
|
-
|
54
|
+
#endif
|
53
55
|
return 0;
|
54
56
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbnacl-libsodium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artiom Di
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbnacl
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- vendor/libsodium/dist-build/msys2-win32.sh
|
185
185
|
- vendor/libsodium/dist-build/msys2-win64.sh
|
186
186
|
- vendor/libsodium/install-sh
|
187
|
+
- vendor/libsodium/libsodium-uninstalled.pc.in
|
187
188
|
- vendor/libsodium/libsodium.pc.in
|
188
189
|
- vendor/libsodium/libsodium.sln
|
189
190
|
- vendor/libsodium/libsodium.vcxproj
|
@@ -572,7 +573,7 @@ files:
|
|
572
573
|
- vendor/libsodium/test/default/onetimeauth2.exp
|
573
574
|
- vendor/libsodium/test/default/onetimeauth7.c
|
574
575
|
- vendor/libsodium/test/default/onetimeauth7.exp
|
575
|
-
- vendor/libsodium/test/default/pre.js
|
576
|
+
- vendor/libsodium/test/default/pre.js.inc
|
576
577
|
- vendor/libsodium/test/default/pwhash.c
|
577
578
|
- vendor/libsodium/test/default/pwhash.exp
|
578
579
|
- vendor/libsodium/test/default/pwhash_scrypt_ll.c
|
@@ -647,7 +648,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
647
648
|
version: '0'
|
648
649
|
requirements: []
|
649
650
|
rubyforge_project:
|
650
|
-
rubygems_version: 2.
|
651
|
+
rubygems_version: 2.4.5
|
651
652
|
signing_key:
|
652
653
|
specification_version: 4
|
653
654
|
summary: rbnacl with bundled libsodium
|