rbnacl-libsodium 0.7.0 → 1.0.0
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 +13 -0
- data/vendor/libsodium/THANKS +1 -0
- data/vendor/libsodium/autom4te.cache/output.1 +14 -90
- data/vendor/libsodium/autom4te.cache/output.3 +14 -90
- data/vendor/libsodium/autom4te.cache/requests +127 -127
- data/vendor/libsodium/autom4te.cache/traces.1 +224 -224
- data/vendor/libsodium/autom4te.cache/traces.3 +137 -144
- data/vendor/libsodium/builds/msvc/version.h +2 -2
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +3 -0
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +3 -0
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +3 -0
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +3 -0
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +3 -0
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +3 -0
- data/vendor/libsodium/configure +14 -90
- data/vendor/libsodium/configure.ac +5 -12
- data/vendor/libsodium/msvc-scripts/process.bat +2 -2
- data/vendor/libsodium/packaging/nuget/package.config +1 -1
- data/vendor/libsodium/packaging/nuget/package.nuspec +25 -25
- data/vendor/libsodium/packaging/nuget/package.targets +20 -20
- data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +2 -0
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +7 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h +9 -4
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +6 -1
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c +4 -4
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +2 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +2 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +2 -1
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +2 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +13 -13
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c +28 -27
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +16 -12
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +7 -3
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +3 -2
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +10 -8
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +13 -8
- data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +10 -8
- data/vendor/libsodium/src/libsodium/sodium/core.c +1 -1
- data/vendor/libsodium/src/libsodium/sodium/runtime.c +3 -3
- data/vendor/libsodium/src/libsodium/sodium/utils.c +12 -12
- data/vendor/libsodium/test/default/Makefile.am +9 -1
- data/vendor/libsodium/test/default/Makefile.in +35 -13
- data/vendor/libsodium/test/default/aead_chacha20poly1305.c +37 -31
- data/vendor/libsodium/test/default/auth.c +48 -9
- data/vendor/libsodium/test/default/auth.exp +18 -0
- data/vendor/libsodium/test/default/auth2.c +19 -24
- data/vendor/libsodium/test/default/auth3.c +17 -25
- data/vendor/libsodium/test/default/auth5.c +24 -24
- data/vendor/libsodium/test/default/auth6.c +9 -8
- data/vendor/libsodium/test/default/auth7.c +24 -24
- data/vendor/libsodium/test/default/box.c +74 -51
- data/vendor/libsodium/test/default/box.exp +19 -0
- data/vendor/libsodium/test/default/box2.c +48 -51
- data/vendor/libsodium/test/default/box2.exp +17 -0
- data/vendor/libsodium/test/default/box7.c +20 -18
- data/vendor/libsodium/test/default/box8.c +27 -25
- data/vendor/libsodium/test/default/box_easy.c +32 -42
- data/vendor/libsodium/test/default/box_easy2.c +3 -5
- data/vendor/libsodium/test/default/box_seed.c +20 -20
- data/vendor/libsodium/test/default/chacha20.c +41 -21
- data/vendor/libsodium/test/default/chacha20.exp +8 -5
- data/vendor/libsodium/test/default/cmptest.h +4 -0
- data/vendor/libsodium/test/default/core1.c +26 -19
- data/vendor/libsodium/test/default/core2.c +24 -23
- data/vendor/libsodium/test/default/core3.c +30 -26
- data/vendor/libsodium/test/default/core4.c +22 -23
- data/vendor/libsodium/test/default/core5.c +18 -22
- data/vendor/libsodium/test/default/core6.c +33 -34
- data/vendor/libsodium/test/default/ed25519_convert.c +16 -20
- data/vendor/libsodium/test/default/generichash.c +59 -15
- data/vendor/libsodium/test/default/generichash.exp +2 -0
- data/vendor/libsodium/test/default/generichash2.c +30 -13
- data/vendor/libsodium/test/default/generichash3.c +156 -22
- data/vendor/libsodium/test/default/generichash3.exp +11 -0
- data/vendor/libsodium/test/default/hash.c +31 -6
- data/vendor/libsodium/test/default/hash.exp +3 -0
- data/vendor/libsodium/test/default/hash3.c +10 -7
- data/vendor/libsodium/test/default/onetimeauth.c +46 -34
- data/vendor/libsodium/test/default/onetimeauth.exp +2 -0
- data/vendor/libsodium/test/default/onetimeauth2.c +20 -32
- data/vendor/libsodium/test/default/onetimeauth7.c +24 -24
- data/vendor/libsodium/test/default/pwhash.c +276 -68
- data/vendor/libsodium/test/default/pwhash.exp +20 -0
- data/vendor/libsodium/test/default/pwhash_scrypt_ll.c +31 -37
- data/vendor/libsodium/test/default/randombytes.c +85 -8
- data/vendor/libsodium/test/default/randombytes.exp +1 -0
- data/vendor/libsodium/test/default/scalarmult.c +28 -15
- data/vendor/libsodium/test/default/scalarmult2.c +20 -15
- data/vendor/libsodium/test/default/scalarmult5.c +24 -21
- data/vendor/libsodium/test/default/scalarmult6.c +24 -21
- data/vendor/libsodium/test/default/scalarmult7.c +31 -0
- data/vendor/libsodium/test/default/scalarmult7.exp +1 -0
- data/vendor/libsodium/test/default/secretbox.c +50 -45
- data/vendor/libsodium/test/default/secretbox2.c +32 -45
- data/vendor/libsodium/test/default/secretbox7.c +19 -17
- data/vendor/libsodium/test/default/secretbox8.c +26 -24
- data/vendor/libsodium/test/default/secretbox_easy.c +46 -52
- data/vendor/libsodium/test/default/secretbox_easy2.c +3 -5
- data/vendor/libsodium/test/default/shorthash.c +17 -10
- data/vendor/libsodium/test/default/sign.c +74 -39
- data/vendor/libsodium/test/default/sodium_core.c +6 -3
- data/vendor/libsodium/test/default/sodium_utils.c +57 -28
- data/vendor/libsodium/test/default/sodium_utils.exp +6 -0
- data/vendor/libsodium/test/default/sodium_utils2.c +13 -11
- data/vendor/libsodium/test/default/sodium_utils3.c +5 -10
- data/vendor/libsodium/test/default/sodium_version.c +4 -5
- data/vendor/libsodium/test/default/stream.c +23 -17
- data/vendor/libsodium/test/default/stream2.c +17 -15
- data/vendor/libsodium/test/default/stream3.c +17 -19
- data/vendor/libsodium/test/default/stream4.c +36 -45
- data/vendor/libsodium/test/default/verify1.c +20 -18
- metadata +5 -3
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +0 -356
@@ -1,5 +1,8 @@
|
|
1
|
-
[
|
2
|
-
[
|
3
|
-
[
|
4
|
-
[
|
5
|
-
[
|
1
|
+
[76b8e0ada0f13d90405d6ae55386bd28bdd219b8a08ded1aa836efcc8b770dc7da41597c5157488d7724e03fb8d84a376a43b8f41518a11cc387b669b2ee65869f07e7be5551387a98ba977c732d080dcb0f29a048e3656912c6533e32ee7aed29b721769ce64e43d57133b074d839d531ed1f28510afb45ace10a1f4b794d6f2d09a0e663266ce1ae7ed1081968a0758e718e997bd362c6b0c34634a9a0b35d]
|
2
|
+
[4540f05a9f1fb296d7736e7b208e3c96eb4fe1834688d2604f450952ed432d41bbe2a0b6ea7566d2a5d1e7e20d42af2c53d792b1c43fea817e9ad275ae5469633aeb5224ecf849929b9d828db1ced4dd832025e8018b8160b82284f3c949aa5a8eca00bbb4a73bdad192b5c42f73f2fd4e273644c8b36125a64addeb006c13a096d68b9ff7b57e7090f880392effd5b297a83bbaf2fbe8cf5d4618965e3dc776]
|
3
|
+
[de9cba7bf3d69ef5e786dc63973f653a0b49e015adbff7134fcb7df137821031e85a050278a7084527214f73efc7fa5b5277062eb7a0433e445f41e31afab757283547e3d3d30ee0371c1e6025ff4c91b794a291cf7568d48ff84b37329e2730b12738a072a2b2c7169e326fe4893a7b2421bb910b79599a7ce4fbaee86be427c5ee0e8225eb6f48231fd504939d59eac8bd106cc138779b893c54da8758f62a]
|
4
|
+
[ef3fdfd6c61578fbf5cf35bd3dd33b8009631634d21e42ac33960bd138e50d32111e4caf237ee53ca8ad6426194a88545ddc497a0b466e7d6bbdb0041b2f586b5305e5e44aff19b235936144675efbe4409eb7e8e5f1430f5f5836aeb49bb5328b017c4b9dc11f8a03863fa803dc71d5726b2b6b31aa32708afe5af1d6b690584d58792b271e5fdb92c486051c48b79a4d48a109bb2d0477956e74c25e93c3c2]
|
5
|
+
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f15916155c2be8241a38008b9a26bc35941e2444177c8ade6689de95264986d95889fb60e84629c9bd9a5acb1cc118be563eb9b3a4a472f82e09a7e778492b562ef7130e88dfe031c79db9d4f7c7a899151b9a475032b63fc385245fe054e3dd5a97a5f576fe064025]
|
6
|
+
[b5dae3cbb3d7a42bc0521db92649f5373d15dfe15440bed1ae43ee14ba18818376e616393179040372008b06420b552b4791fc1ba85e11b31b54571e69aa66587a42c9d864fe77d65c6606553ec89c24cb9cd7640bc49b1acbb922aa046b8bffd818895e835afc147cfbf1e6e630ba6c4be5a53a0b69146cb5514cca9da27385dffb96b585eadb5759d8051270f47d81c7661da216a19f18d5e7b734bc440267]
|
7
|
+
[42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242]
|
8
|
+
[7a42c9d864fe77d65c6606553ec89c24cb9cd7640bc49b1acbb922aa046b8bffd818895e835afc147cfbf1e6e630ba6c4be5a53a0b69146cb5514cca9da27385dffb96b585eadb5759d8051270f47d81c7661da216a19f18d5e7b734bc440267918c466e1428f08745f37a99c77c7f2b1b244bd4162e8b86e4a8bf85358202954ced04b52fef7b3ba787744e715554285ecb0ed6e133c528d69d346abc0ce8b0]
|
@@ -1,32 +1,39 @@
|
|
1
|
-
#include <stdio.h>
|
2
1
|
|
3
2
|
#define TEST_NAME "core1"
|
4
3
|
#include "cmptest.h"
|
5
4
|
|
6
|
-
unsigned char shared[32]
|
7
|
-
0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1
|
8
|
-
|
9
|
-
,
|
10
|
-
,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42
|
11
|
-
} ;
|
5
|
+
unsigned char shared[32]
|
6
|
+
= { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1, 0x72, 0x8e, 0x3b,
|
7
|
+
0xf4, 0x80, 0x35, 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1,
|
8
|
+
0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42 };
|
12
9
|
|
13
10
|
unsigned char zero[32] = { 0 };
|
14
11
|
|
15
|
-
unsigned char c[16] = {
|
16
|
-
|
17
|
-
,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b
|
18
|
-
} ;
|
12
|
+
unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
13
|
+
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
19
14
|
|
20
15
|
unsigned char firstkey[32];
|
21
16
|
|
22
17
|
int main(void)
|
23
18
|
{
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
19
|
+
int i;
|
20
|
+
|
21
|
+
crypto_core_hsalsa20(firstkey, zero, shared, c);
|
22
|
+
for (i = 0; i < 32; ++i) {
|
23
|
+
if (i > 0) {
|
24
|
+
printf(",");
|
25
|
+
} else {
|
26
|
+
printf(" ");
|
27
|
+
}
|
28
|
+
printf("0x%02x", (unsigned int)firstkey[i]);
|
29
|
+
if (i % 8 == 7) {
|
30
|
+
printf("\n");
|
31
|
+
}
|
32
|
+
}
|
33
|
+
assert(crypto_core_hsalsa20_outputbytes() > 0U);
|
34
|
+
assert(crypto_core_hsalsa20_inputbytes() > 0U);
|
35
|
+
assert(crypto_core_hsalsa20_keybytes() > 0U);
|
36
|
+
assert(crypto_core_hsalsa20_constbytes() > 0U);
|
37
|
+
|
38
|
+
return 0;
|
32
39
|
}
|
@@ -1,35 +1,36 @@
|
|
1
|
-
#include <stdio.h>
|
2
1
|
|
3
2
|
#define TEST_NAME "core2"
|
4
3
|
#include "cmptest.h"
|
5
4
|
|
6
|
-
unsigned char firstkey[32]
|
7
|
-
0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4
|
8
|
-
|
9
|
-
,
|
10
|
-
,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89
|
11
|
-
} ;
|
5
|
+
unsigned char firstkey[32]
|
6
|
+
= { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 0xd4, 0x62, 0xcd, 0x51,
|
7
|
+
0x19, 0x7a, 0x9a, 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 0x64,
|
8
|
+
0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 0x44, 0xf6, 0x83, 0x89 };
|
12
9
|
|
13
|
-
unsigned char nonceprefix[16]
|
14
|
-
0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73
|
15
|
-
|
16
|
-
} ;
|
10
|
+
unsigned char nonceprefix[16]
|
11
|
+
= { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73,
|
12
|
+
0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6 };
|
17
13
|
|
18
|
-
unsigned char c[16] = {
|
19
|
-
|
20
|
-
,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b
|
21
|
-
} ;
|
14
|
+
unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
15
|
+
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
22
16
|
|
23
17
|
unsigned char secondkey[32];
|
24
18
|
|
25
19
|
int main(void)
|
26
20
|
{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
int i;
|
22
|
+
|
23
|
+
crypto_core_hsalsa20(secondkey, nonceprefix, firstkey, c);
|
24
|
+
for (i = 0; i < 32; ++i) {
|
25
|
+
if (i > 0) {
|
26
|
+
printf(",");
|
27
|
+
} else {
|
28
|
+
printf(" ");
|
29
|
+
}
|
30
|
+
printf("0x%02x", (unsigned int)secondkey[i]);
|
31
|
+
if (i % 8 == 7) {
|
32
|
+
printf("\n");
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return 0;
|
35
36
|
}
|
@@ -1,25 +1,19 @@
|
|
1
|
-
#include <stdio.h>
|
2
1
|
|
3
2
|
#define TEST_NAME "core3"
|
4
3
|
#include "cmptest.h"
|
5
4
|
|
6
|
-
unsigned char secondkey[32]
|
7
|
-
0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9
|
8
|
-
|
9
|
-
,
|
10
|
-
,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4
|
11
|
-
} ;
|
5
|
+
unsigned char secondkey[32]
|
6
|
+
= { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44, 0xa9, 0x53, 0x62, 0x9b,
|
7
|
+
0x73, 0x38, 0x20, 0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21, 0xbb,
|
8
|
+
0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e, 0x66, 0x25, 0x6c, 0xe4 };
|
12
9
|
|
13
|
-
unsigned char noncesuffix[8]
|
14
|
-
0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37
|
15
|
-
} ;
|
10
|
+
unsigned char noncesuffix[8]
|
11
|
+
= { 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
|
16
12
|
|
17
|
-
unsigned char c[16] = {
|
18
|
-
|
19
|
-
,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b
|
20
|
-
} ;
|
13
|
+
unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
14
|
+
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
21
15
|
|
22
|
-
unsigned char in[16] = { 0 }
|
16
|
+
unsigned char in[16] = { 0 };
|
23
17
|
|
24
18
|
unsigned char output[64 * 256 * 256];
|
25
19
|
|
@@ -27,16 +21,26 @@ unsigned char h[32];
|
|
27
21
|
|
28
22
|
int main(void)
|
29
23
|
{
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
int i;
|
25
|
+
long long pos = 0;
|
26
|
+
|
27
|
+
for (i = 0; i < 8; ++i)
|
28
|
+
in[i] = noncesuffix[i];
|
34
29
|
do {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
30
|
+
do {
|
31
|
+
crypto_core_salsa20(output + pos, in, secondkey, c);
|
32
|
+
pos += 64;
|
33
|
+
} while (++in[8]);
|
34
|
+
} while (++in[9]);
|
35
|
+
crypto_hash_sha256(h, output, sizeof output);
|
36
|
+
for (i = 0; i < 32; ++i) {
|
37
|
+
printf("%02x", h[i]);
|
38
|
+
}
|
39
|
+
printf("\n");
|
40
|
+
assert(crypto_core_salsa20_outputbytes() > 0U);
|
41
|
+
assert(crypto_core_salsa20_inputbytes() > 0U);
|
42
|
+
assert(crypto_core_salsa20_keybytes() > 0U);
|
43
|
+
assert(crypto_core_salsa20_constbytes() > 0U);
|
44
|
+
|
45
|
+
return 0;
|
42
46
|
}
|
@@ -1,35 +1,34 @@
|
|
1
|
-
#include <stdio.h>
|
2
1
|
|
3
2
|
#define TEST_NAME "core4"
|
4
3
|
#include "cmptest.h"
|
5
4
|
|
6
|
-
unsigned char k[32] = {
|
7
|
-
|
8
|
-
,
|
9
|
-
,201,202,203,204,205,206,207,208
|
10
|
-
,209,210,211,212,213,214,215,216
|
11
|
-
} ;
|
5
|
+
unsigned char k[32] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
6
|
+
12, 13, 14, 15, 16, 201, 202, 203, 204, 205, 206,
|
7
|
+
207, 208, 209, 210, 211, 212, 213, 214, 215, 216 };
|
12
8
|
|
13
|
-
unsigned char in[16] = {
|
14
|
-
|
15
|
-
,109,110,111,112,113,114,115,116
|
16
|
-
} ;
|
9
|
+
unsigned char in[16] = { 101, 102, 103, 104, 105, 106, 107, 108,
|
10
|
+
109, 110, 111, 112, 113, 114, 115, 116 };
|
17
11
|
|
18
|
-
unsigned char c[16] = {
|
19
|
-
|
20
|
-
, 50, 45, 98,121,116,101, 32,107
|
21
|
-
} ;
|
12
|
+
unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
13
|
+
50, 45, 98, 121, 116, 101, 32, 107 };
|
22
14
|
|
23
15
|
unsigned char out[64];
|
24
16
|
|
25
17
|
int main(void)
|
26
18
|
{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
19
|
+
int i;
|
20
|
+
|
21
|
+
crypto_core_salsa20(out, in, k, c);
|
22
|
+
for (i = 0; i < 64; ++i) {
|
23
|
+
if (i > 0) {
|
24
|
+
printf(",");
|
25
|
+
} else {
|
26
|
+
printf(" ");
|
27
|
+
}
|
28
|
+
printf("%3d", (unsigned int)out[i]);
|
29
|
+
if (i % 8 == 7) {
|
30
|
+
printf("\n");
|
31
|
+
}
|
32
|
+
}
|
33
|
+
return 0;
|
35
34
|
}
|
@@ -1,34 +1,30 @@
|
|
1
|
-
#include <stdio.h>
|
2
1
|
|
3
2
|
#define TEST_NAME "core5"
|
4
3
|
#include "cmptest.h"
|
5
4
|
|
6
|
-
unsigned char k[32]
|
7
|
-
0xee,0x30,0x4f,0xca,0x27,0x00,0x8d,0x8c
|
8
|
-
|
9
|
-
,
|
10
|
-
,0x9f,0x81,0x96,0x92,0x82,0x7e,0x57,0x77
|
11
|
-
} ;
|
5
|
+
unsigned char k[32]
|
6
|
+
= { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c, 0x12, 0x6f, 0x90,
|
7
|
+
0x02, 0x79, 0x01, 0xd8, 0x0f, 0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36,
|
8
|
+
0xcf, 0x3b, 0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
12
9
|
|
13
|
-
unsigned char in[16] = {
|
14
|
-
|
15
|
-
,0x3e,0x90,0x60,0x52,0x1e,0x4b,0xb3,0x52
|
16
|
-
} ;
|
10
|
+
unsigned char in[16] = { 0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
11
|
+
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52 };
|
17
12
|
|
18
|
-
unsigned char c[16] = {
|
19
|
-
|
20
|
-
, 50, 45, 98,121,116,101, 32,107
|
21
|
-
} ;
|
13
|
+
unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
14
|
+
50, 45, 98, 121, 116, 101, 32, 107 };
|
22
15
|
|
23
16
|
unsigned char out[32];
|
24
17
|
|
25
18
|
int main(void)
|
26
19
|
{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
20
|
+
int i;
|
21
|
+
|
22
|
+
crypto_core_hsalsa20(out, in, k, c);
|
23
|
+
for (i = 0; i < 32; ++i) {
|
24
|
+
printf(",0x%02x", (unsigned int)out[i]);
|
25
|
+
if (i % 8 == 7) {
|
26
|
+
printf("\n");
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return 0;
|
34
30
|
}
|
@@ -1,49 +1,48 @@
|
|
1
|
-
#include <stdio.h>
|
2
1
|
|
3
2
|
#define TEST_NAME "core6"
|
4
3
|
#include "cmptest.h"
|
5
4
|
|
6
|
-
unsigned char k[32]
|
7
|
-
0xee,0x30,0x4f,0xca,0x27,0x00,0x8d,0x8c
|
8
|
-
|
9
|
-
,
|
10
|
-
,0x9f,0x81,0x96,0x92,0x82,0x7e,0x57,0x77
|
11
|
-
} ;
|
5
|
+
unsigned char k[32]
|
6
|
+
= { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c, 0x12, 0x6f, 0x90,
|
7
|
+
0x02, 0x79, 0x01, 0xd8, 0x0f, 0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36,
|
8
|
+
0xcf, 0x3b, 0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
12
9
|
|
13
|
-
unsigned char in[16] = {
|
14
|
-
|
15
|
-
,0x3e,0x90,0x60,0x52,0x1e,0x4b,0xb3,0x52
|
16
|
-
} ;
|
10
|
+
unsigned char in[16] = { 0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
11
|
+
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52 };
|
17
12
|
|
18
|
-
unsigned char c[16] = {
|
19
|
-
|
20
|
-
, 50, 45, 98,121,116,101, 32,107
|
21
|
-
} ;
|
13
|
+
unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
14
|
+
50, 45, 98, 121, 116, 101, 32, 107 };
|
22
15
|
|
23
16
|
unsigned char out[64];
|
24
17
|
|
25
|
-
void print(unsigned char *x,unsigned char *y)
|
18
|
+
void print(unsigned char *x, unsigned char *y)
|
26
19
|
{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
20
|
+
int i;
|
21
|
+
unsigned int borrow = 0;
|
22
|
+
|
23
|
+
for (i = 0; i < 4; ++i) {
|
24
|
+
unsigned int xi = x[i];
|
25
|
+
unsigned int yi = y[i];
|
26
|
+
printf(",0x%02x", 255 & (xi - yi - borrow));
|
27
|
+
borrow = (xi < yi + borrow);
|
28
|
+
}
|
35
29
|
}
|
36
30
|
|
37
31
|
int main(void)
|
38
32
|
{
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
33
|
+
crypto_core_salsa20(out, in, k, c);
|
34
|
+
print(out, c);
|
35
|
+
print(out + 20, c + 4);
|
36
|
+
printf("\n");
|
37
|
+
print(out + 40, c + 8);
|
38
|
+
print(out + 60, c + 12);
|
39
|
+
printf("\n");
|
40
|
+
print(out + 24, in);
|
41
|
+
print(out + 28, in + 4);
|
42
|
+
printf("\n");
|
43
|
+
print(out + 32, in + 8);
|
44
|
+
print(out + 36, in + 12);
|
45
|
+
printf("\n");
|
46
|
+
|
47
|
+
return 0;
|
49
48
|
}
|
@@ -1,34 +1,30 @@
|
|
1
|
-
#include <stdio.h>
|
2
|
-
#include <string.h>
|
3
1
|
|
4
2
|
#define TEST_NAME "ed25519_convert"
|
5
3
|
#include "cmptest.h"
|
6
4
|
|
7
|
-
static const unsigned char keypair_seed[crypto_sign_ed25519_SEEDBYTES]
|
8
|
-
0x42, 0x11, 0x51, 0xa4, 0x59, 0xfa, 0xea, 0xde,
|
9
|
-
|
10
|
-
|
11
|
-
0x4d, 0x14, 0x51, 0xa5, 0x59, 0xfa, 0xed, 0xee
|
12
|
-
};
|
5
|
+
static const unsigned char keypair_seed[crypto_sign_ed25519_SEEDBYTES]
|
6
|
+
= { 0x42, 0x11, 0x51, 0xa4, 0x59, 0xfa, 0xea, 0xde, 0x3d, 0x24, 0x71,
|
7
|
+
0x15, 0xf9, 0x4a, 0xed, 0xae, 0x42, 0x31, 0x81, 0x24, 0x09, 0x5a,
|
8
|
+
0xfa, 0xbe, 0x4d, 0x14, 0x51, 0xa5, 0x59, 0xfa, 0xed, 0xee };
|
13
9
|
|
14
10
|
int main(void)
|
15
11
|
{
|
16
|
-
unsigned char
|
17
|
-
unsigned char
|
18
|
-
unsigned char
|
19
|
-
unsigned char
|
20
|
-
unsigned char
|
21
|
-
char
|
22
|
-
char
|
23
|
-
unsigned int
|
12
|
+
unsigned char ed25519_pk[crypto_sign_ed25519_PUBLICKEYBYTES];
|
13
|
+
unsigned char ed25519_skpk[crypto_sign_ed25519_SECRETKEYBYTES];
|
14
|
+
unsigned char curve25519_pk[crypto_scalarmult_curve25519_BYTES];
|
15
|
+
unsigned char curve25519_pk2[crypto_scalarmult_curve25519_BYTES];
|
16
|
+
unsigned char curve25519_sk[crypto_scalarmult_curve25519_BYTES];
|
17
|
+
char curve25519_pk_hex[crypto_scalarmult_curve25519_BYTES * 2 + 1];
|
18
|
+
char curve25519_sk_hex[crypto_scalarmult_curve25519_BYTES * 2 + 1];
|
19
|
+
unsigned int i;
|
24
20
|
|
25
21
|
crypto_sign_ed25519_seed_keypair(ed25519_pk, ed25519_skpk, keypair_seed);
|
26
22
|
crypto_sign_ed25519_pk_to_curve25519(curve25519_pk, ed25519_pk);
|
27
23
|
crypto_sign_ed25519_sk_to_curve25519(curve25519_sk, ed25519_skpk);
|
28
|
-
sodium_bin2hex(curve25519_pk_hex, sizeof curve25519_pk_hex,
|
29
|
-
|
30
|
-
sodium_bin2hex(curve25519_sk_hex, sizeof curve25519_sk_hex,
|
31
|
-
|
24
|
+
sodium_bin2hex(curve25519_pk_hex, sizeof curve25519_pk_hex, curve25519_pk,
|
25
|
+
sizeof curve25519_pk);
|
26
|
+
sodium_bin2hex(curve25519_sk_hex, sizeof curve25519_sk_hex, curve25519_sk,
|
27
|
+
sizeof curve25519_sk);
|
32
28
|
|
33
29
|
printf("curve25519 pk: [%s]\n", curve25519_pk_hex);
|
34
30
|
printf("curve25519 sk: [%s]\n", curve25519_sk_hex);
|