rbnacl-libsodium 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +23 -0
- data/CHANGES.md +5 -0
- data/Gemfile +5 -2
- data/Rakefile +5 -0
- data/ext/rbnacl/extconf.rb +2 -1
- data/lib/rbnacl/libsodium.rb +8 -2
- data/lib/rbnacl/libsodium/version.rb +1 -1
- data/vendor/libsodium/AUTHORS +14 -0
- data/vendor/libsodium/ChangeLog +26 -0
- data/vendor/libsodium/LICENSE +1 -1
- data/vendor/libsodium/Makefile.am +1 -0
- data/vendor/libsodium/Makefile.in +9 -0
- data/vendor/libsodium/README.markdown +7 -0
- data/vendor/libsodium/aclocal.m4 +1 -0
- data/vendor/libsodium/appveyor.yml +25 -0
- data/vendor/libsodium/autom4te.cache/output.1 +640 -126
- data/vendor/libsodium/autom4te.cache/output.6 +19049 -0
- data/vendor/libsodium/autom4te.cache/requests +1151 -914
- data/vendor/libsodium/autom4te.cache/traces.1 +472 -426
- data/vendor/libsodium/autom4te.cache/traces.6 +3193 -0
- data/vendor/libsodium/builds/msvc/version.h +2 -2
- data/vendor/libsodium/builds/msvc/vs2010/libsodium.sln +50 -79
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +20 -8
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +208 -166
- data/vendor/libsodium/builds/msvc/vs2012/libsodium.sln +50 -79
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +20 -8
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +206 -164
- data/vendor/libsodium/builds/msvc/vs2013/libsodium.sln +52 -81
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +20 -8
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +206 -164
- data/vendor/libsodium/builds/msvc/vs2015/libsodium.sln +52 -81
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +20 -8
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +206 -164
- data/vendor/libsodium/configure +639 -125
- data/vendor/libsodium/configure.ac +94 -16
- data/vendor/libsodium/dist-build/Makefile.in +9 -0
- data/vendor/libsodium/dist-build/emscripten-symbols.def +370 -0
- data/vendor/libsodium/dist-build/emscripten.sh +9 -3
- data/vendor/libsodium/dist-build/generate-emscripten-symbols.sh +43 -0
- data/vendor/libsodium/libsodium-uninstalled.pc.in +1 -1
- data/vendor/libsodium/libsodium.pc.in +1 -1
- data/vendor/libsodium/libsodium.vcxproj +70 -66
- data/vendor/libsodium/libsodium.vcxproj.filters +204 -192
- data/vendor/libsodium/m4/ax_valgrind_check.m4 +190 -0
- data/vendor/libsodium/msvc-scripts/Makefile.in +9 -0
- data/vendor/libsodium/msvc-scripts/process.bat +2 -2
- data/vendor/libsodium/src/Makefile.in +9 -0
- data/vendor/libsodium/src/libsodium/Makefile.am +31 -6
- data/vendor/libsodium/src/libsodium/Makefile.in +238 -42
- data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +234 -38
- data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +208 -118
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_seal.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c +1 -4
- data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.c +1799 -1790
- data/vendor/libsodium/src/libsodium/crypto_core/curve25519/ref10/curve25519_ref10.h +39 -39
- data/vendor/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.c +86 -0
- data/vendor/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.h +28 -0
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +38 -46
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +47 -55
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +47 -55
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +47 -55
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c +7 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h +0 -89
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +50 -141
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-avx2.c +45 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-avx2.h +123 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ref.c +3 -2
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-sse41.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/{blake2b-round.h → blake2b-compress-sse41.h} +2 -28
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ssse3.c +2 -4
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-compress-ssse3.h +97 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-avx2.h +339 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-sse2.h +0 -2
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-load-sse41.h +0 -2
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +29 -18
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +4 -43
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +3 -32
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +1 -20
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +22 -41
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +12 -39
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +2 -4
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h +1 -20
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c +570 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.h +198 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.c +444 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.h +32 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c +229 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ssse3.c +222 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-impl.h +40 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c +238 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.h +251 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.c +80 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-ref.h +38 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/blamka-round-ssse3.h +117 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2i.c +164 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/crypto_pwhash.c +106 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +4 -4
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c +186 -186
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +3 -2
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c +33 -33
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +253 -254
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c +16 -17
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c +11 -11
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h +1 -1
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h +3 -2
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h +5 -3
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c +41 -41
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +10 -2
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h +1 -1
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +4 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +4 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c +31 -32
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +4 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h +1 -1
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S +4 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.h +1 -1
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base_namespace.h +1 -1
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h +1 -1
- data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +2 -6
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c +8 -28
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +75 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +6 -6
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h +1 -18
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +20 -20
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h +4 -4
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +6 -6
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +56 -77
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +2 -8
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +2 -8
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +2 -8
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +2 -8
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +2 -8
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +2 -8
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +1 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +1 -5
- data/vendor/libsodium/src/libsodium/include/Makefile.am +3 -0
- data/vendor/libsodium/src/libsodium/include/Makefile.in +19 -8
- data/vendor/libsodium/src/libsodium/include/sodium.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_aes256gcm.h +50 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +94 -22
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +6 -6
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h +35 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash.h +89 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +86 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +6 -6
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +0 -11
- data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +3 -0
- data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +3 -0
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +5 -1
- data/vendor/libsodium/src/libsodium/sodium/common.h +150 -0
- data/vendor/libsodium/src/libsodium/sodium/core.c +3 -1
- data/vendor/libsodium/src/libsodium/sodium/runtime.c +37 -19
- data/vendor/libsodium/src/libsodium/sodium/utils.c +18 -9
- data/vendor/libsodium/test/Makefile.in +9 -0
- data/vendor/libsodium/test/default/Makefile.am +10 -0
- data/vendor/libsodium/test/default/Makefile.in +53 -20
- data/vendor/libsodium/test/default/aead_aes256gcm.c +43 -17
- data/vendor/libsodium/test/default/aead_chacha20poly1305.c +179 -86
- data/vendor/libsodium/test/default/auth7.c +5 -5
- data/vendor/libsodium/test/default/box.c +4 -4
- data/vendor/libsodium/test/default/box2.c +1 -1
- data/vendor/libsodium/test/default/core6.c +1 -1
- data/vendor/libsodium/test/default/generichash.c +12 -1
- data/vendor/libsodium/test/default/generichash2.c +2 -2
- data/vendor/libsodium/test/default/generichash3.c +21 -0
- data/vendor/libsodium/test/default/pwhash.c +186 -168
- data/vendor/libsodium/test/default/pwhash.exp +11 -30
- data/vendor/libsodium/test/default/pwhash_scrypt.c +349 -0
- data/vendor/libsodium/test/default/pwhash_scrypt.exp +31 -0
- data/vendor/libsodium/test/default/secretbox.c +1 -1
- data/vendor/libsodium/test/default/secretbox2.c +1 -1
- data/vendor/libsodium/test/default/sign.c +15 -0
- data/vendor/libsodium/test/default/sodium_utils2.c +8 -3
- data/vendor/libsodium/test/default/sodium_utils3.c +4 -2
- data/vendor/libsodium/test/default/verify1.c +0 -4
- data/vendor/libsodium/test/quirks/quirks.h +3 -0
- metadata +37 -22
- data/vendor/libsodium/builds/msvc/vs2010/test/test.props +0 -43
- data/vendor/libsodium/builds/msvc/vs2010/test/test.runner.bat +0 -78
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +0 -244
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +0 -192
- data/vendor/libsodium/builds/msvc/vs2012/test/test.props +0 -43
- data/vendor/libsodium/builds/msvc/vs2012/test/test.runner.bat +0 -78
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +0 -244
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +0 -192
- data/vendor/libsodium/builds/msvc/vs2013/test/test.props +0 -43
- data/vendor/libsodium/builds/msvc/vs2013/test/test.runner.bat +0 -78
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +0 -244
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +0 -192
- data/vendor/libsodium/builds/msvc/vs2015/test/test.props +0 -43
- data/vendor/libsodium/builds/msvc/vs2015/test/test.runner.bat +0 -78
- data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj +0 -244
- data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj.filters +0 -192
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h +0 -146
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c +0 -64
data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c
CHANGED
@@ -34,8 +34,7 @@
|
|
34
34
|
typedef uint8_t u8;
|
35
35
|
typedef uint64_t limb;
|
36
36
|
typedef limb felem[5];
|
37
|
-
|
38
|
-
// platforms only as far as I know.
|
37
|
+
/* Special gcc mode for 128-bit integers */
|
39
38
|
typedef unsigned uint128_t __attribute__ ((mode(TI)));
|
40
39
|
|
41
40
|
/* Sum two numbers: output += in */
|
@@ -315,7 +314,7 @@ fmonty(limb *x2, limb *z2, /* output 2Q */
|
|
315
314
|
|
316
315
|
memcpy(origx, x, 5 * sizeof(limb));
|
317
316
|
fsum(x, z);
|
318
|
-
fdifference_backwards(z, origx);
|
317
|
+
fdifference_backwards(z, origx); /* does x - z */
|
319
318
|
|
320
319
|
memcpy(origxprime, xprime, sizeof(limb) * 5);
|
321
320
|
fsum(xprime, zprime);
|
@@ -332,19 +331,19 @@ fmonty(limb *x2, limb *z2, /* output 2Q */
|
|
332
331
|
fsquare_times(xx, x, 1);
|
333
332
|
fsquare_times(zz, z, 1);
|
334
333
|
fmul(x2, xx, zz);
|
335
|
-
fdifference_backwards(zz, xx);
|
334
|
+
fdifference_backwards(zz, xx); /* does zz = xx - zz */
|
336
335
|
fscalar_product(zzz, zz, 121665);
|
337
336
|
fsum(zzz, xx);
|
338
337
|
fmul(z2, zz, zzz);
|
339
338
|
}
|
340
339
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
340
|
+
/* -----------------------------------------------------------------------------
|
341
|
+
Maybe swap the contents of two limb arrays (@a and @b), each @len elements
|
342
|
+
long. Perform the swap iff @swap is non-zero.
|
343
|
+
|
344
|
+
This function performs the swap without leaking any side-channel
|
345
|
+
information.
|
346
|
+
----------------------------------------------------------------------------- */
|
348
347
|
static void
|
349
348
|
swap_conditional(limb a[5], limb b[5], limb iswap) {
|
350
349
|
unsigned i;
|
@@ -411,17 +410,17 @@ cmult(limb *resultx, limb *resultz, const u8 *n, const limb *q) {
|
|
411
410
|
}
|
412
411
|
|
413
412
|
|
414
|
-
|
415
|
-
|
416
|
-
|
413
|
+
/* -----------------------------------------------------------------------------
|
414
|
+
Shamelessly copied from djb's code, tightened a little
|
415
|
+
----------------------------------------------------------------------------- */
|
417
416
|
static void
|
418
417
|
crecip(felem out, const felem z) {
|
419
418
|
felem a,t0,b,c;
|
420
419
|
|
421
|
-
/* 2 */ fsquare_times(a, z, 1);
|
420
|
+
/* 2 */ fsquare_times(a, z, 1); /* a = 2 */
|
422
421
|
/* 8 */ fsquare_times(t0, a, 2);
|
423
|
-
/* 9 */ fmul(b, t0, z);
|
424
|
-
/* 11 */ fmul(a, b, a);
|
422
|
+
/* 9 */ fmul(b, t0, z); /* b = 9 */
|
423
|
+
/* 11 */ fmul(a, b, a); /* a = 11 */
|
425
424
|
/* 22 */ fsquare_times(t0, a, 1);
|
426
425
|
/* 2^5 - 2^0 = 31 */ fmul(b, t0, b);
|
427
426
|
/* 2^10 - 2^5 */ fsquare_times(t0, b, 5);
|
@@ -127,17 +127,17 @@ fe_mul121666(fe h,const fe f)
|
|
127
127
|
int64_t carry8;
|
128
128
|
int64_t carry9;
|
129
129
|
|
130
|
-
carry9 = (h9 + (int64_t)
|
131
|
-
carry1 = (h1 + (int64_t)
|
132
|
-
carry3 = (h3 + (int64_t)
|
133
|
-
carry5 = (h5 + (int64_t)
|
134
|
-
carry7 = (h7 + (int64_t)
|
135
|
-
|
136
|
-
carry0 = (h0 + (int64_t)
|
137
|
-
carry2 = (h2 + (int64_t)
|
138
|
-
carry4 = (h4 + (int64_t)
|
139
|
-
carry6 = (h6 + (int64_t)
|
140
|
-
carry8 = (h8 + (int64_t)
|
130
|
+
carry9 = (h9 + ((int64_t) 1 << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
|
131
|
+
carry1 = (h1 + ((int64_t) 1 << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
|
132
|
+
carry3 = (h3 + ((int64_t) 1 << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
|
133
|
+
carry5 = (h5 + ((int64_t) 1 << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
|
134
|
+
carry7 = (h7 + ((int64_t) 1 << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
|
135
|
+
|
136
|
+
carry0 = (h0 + ((int64_t) 1 << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
|
137
|
+
carry2 = (h2 + ((int64_t) 1 << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
|
138
|
+
carry4 = (h4 + ((int64_t) 1 << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
|
139
|
+
carry6 = (h6 + ((int64_t) 1 << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
|
140
|
+
carry8 = (h8 + ((int64_t) 1 << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
|
141
141
|
|
142
142
|
h[0] = h0;
|
143
143
|
h[1] = h1;
|
@@ -12,12 +12,14 @@
|
|
12
12
|
extern "C" {
|
13
13
|
#endif
|
14
14
|
|
15
|
-
#include
|
15
|
+
#include <stdint.h>
|
16
|
+
#include <stdlib.h>
|
17
|
+
|
16
18
|
#include "fe51_namespace.h"
|
17
19
|
|
18
|
-
typedef struct
|
20
|
+
typedef struct
|
19
21
|
{
|
20
|
-
|
22
|
+
uint64_t v[5];
|
21
23
|
}
|
22
24
|
fe51;
|
23
25
|
|
@@ -11,47 +11,47 @@
|
|
11
11
|
|
12
12
|
void fe51_invert(fe51 *r, const fe51 *x)
|
13
13
|
{
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
14
|
+
fe51 z2;
|
15
|
+
fe51 z9;
|
16
|
+
fe51 z11;
|
17
|
+
fe51 z2_5_0;
|
18
|
+
fe51 z2_10_0;
|
19
|
+
fe51 z2_20_0;
|
20
|
+
fe51 z2_50_0;
|
21
|
+
fe51 z2_100_0;
|
22
|
+
fe51 t;
|
23
|
+
|
24
|
+
/* 2 */ fe51_square(&z2,x);
|
25
|
+
/* 4 */ fe51_square(&t,&z2);
|
26
|
+
/* 8 */ fe51_square(&t,&t);
|
27
|
+
/* 9 */ fe51_mul(&z9,&t,x);
|
28
|
+
/* 11 */ fe51_mul(&z11,&z9,&z2);
|
29
|
+
/* 22 */ fe51_square(&t,&z11);
|
30
|
+
/* 2^5 - 2^0 = 31 */ fe51_mul(&z2_5_0,&t,&z9);
|
31
|
+
|
32
|
+
/* 2^10 - 2^5 */ fe51_nsquare(&t,&z2_5_0, 5);
|
33
|
+
/* 2^10 - 2^0 */ fe51_mul(&z2_10_0,&t,&z2_5_0);
|
34
|
+
|
35
|
+
/* 2^20 - 2^10 */ fe51_nsquare(&t,&z2_10_0, 10);
|
36
|
+
/* 2^20 - 2^0 */ fe51_mul(&z2_20_0,&t,&z2_10_0);
|
37
|
+
|
38
|
+
/* 2^40 - 2^20 */ fe51_nsquare(&t,&z2_20_0, 20);
|
39
|
+
/* 2^40 - 2^0 */ fe51_mul(&t,&t,&z2_20_0);
|
40
|
+
|
41
|
+
/* 2^50 - 2^10 */ fe51_nsquare(&t,&t,10);
|
42
|
+
/* 2^50 - 2^0 */ fe51_mul(&z2_50_0,&t,&z2_10_0);
|
43
|
+
|
44
|
+
/* 2^100 - 2^50 */ fe51_nsquare(&t,&z2_50_0, 50);
|
45
|
+
/* 2^100 - 2^0 */ fe51_mul(&z2_100_0,&t,&z2_50_0);
|
46
|
+
|
47
|
+
/* 2^200 - 2^100 */ fe51_nsquare(&t,&z2_100_0, 100);
|
48
|
+
/* 2^200 - 2^0 */ fe51_mul(&t,&t,&z2_100_0);
|
49
|
+
|
50
|
+
/* 2^250 - 2^50 */ fe51_nsquare(&t,&t, 50);
|
51
|
+
/* 2^250 - 2^0 */ fe51_mul(&t,&t,&z2_50_0);
|
52
|
+
|
53
|
+
/* 2^255 - 2^5 */ fe51_nsquare(&t,&t,5);
|
54
|
+
/* 2^255 - 21 */ fe51_mul(r,&t,&z11);
|
55
55
|
}
|
56
56
|
|
57
57
|
#endif
|
@@ -7,10 +7,18 @@
|
|
7
7
|
#include "consts_namespace.h"
|
8
8
|
.text
|
9
9
|
.p2align 5
|
10
|
-
|
10
|
+
#ifdef ASM_HIDE_SYMBOL
|
11
|
+
ASM_HIDE_SYMBOL fe51_mul
|
12
|
+
ASM_HIDE_SYMBOL _fe51_mul
|
13
|
+
#endif
|
11
14
|
.globl fe51_mul
|
12
|
-
_fe51_mul
|
15
|
+
.globl _fe51_mul
|
16
|
+
#ifdef __ELF__
|
17
|
+
.type fe51_mul, @function
|
18
|
+
.type _fe51_mul, @function
|
19
|
+
#endif
|
13
20
|
fe51_mul:
|
21
|
+
_fe51_mul:
|
14
22
|
mov %rsp,%r11
|
15
23
|
and $31,%r11
|
16
24
|
add $96,%r11
|
data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c
CHANGED
@@ -3,51 +3,50 @@
|
|
3
3
|
*/
|
4
4
|
|
5
5
|
#include "fe.h"
|
6
|
-
#include "crypto_uint64.h"
|
7
6
|
|
8
7
|
#ifdef HAVE_AVX_ASM
|
9
8
|
|
10
|
-
static
|
9
|
+
static uint64_t load_3(const unsigned char *in)
|
11
10
|
{
|
12
|
-
|
13
|
-
result = (
|
14
|
-
result |= ((
|
15
|
-
result |= ((
|
11
|
+
uint64_t result;
|
12
|
+
result = (uint64_t) in[0];
|
13
|
+
result |= ((uint64_t) in[1]) << 8;
|
14
|
+
result |= ((uint64_t) in[2]) << 16;
|
16
15
|
return result;
|
17
16
|
}
|
18
17
|
|
19
|
-
static
|
18
|
+
static uint64_t load_4(const unsigned char *in)
|
20
19
|
{
|
21
|
-
|
22
|
-
result = (
|
23
|
-
result |= ((
|
24
|
-
result |= ((
|
25
|
-
result |= ((
|
20
|
+
uint64_t result;
|
21
|
+
result = (uint64_t) in[0];
|
22
|
+
result |= ((uint64_t) in[1]) << 8;
|
23
|
+
result |= ((uint64_t) in[2]) << 16;
|
24
|
+
result |= ((uint64_t) in[3]) << 24;
|
26
25
|
return result;
|
27
26
|
}
|
28
27
|
|
29
28
|
void fe_frombytes(fe h,const unsigned char *s)
|
30
29
|
{
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
30
|
+
uint64_t h0 = load_4(s);
|
31
|
+
uint64_t h1 = load_3(s + 4) << 6;
|
32
|
+
uint64_t h2 = load_3(s + 7) << 5;
|
33
|
+
uint64_t h3 = load_3(s + 10) << 3;
|
34
|
+
uint64_t h4 = load_3(s + 13) << 2;
|
35
|
+
uint64_t h5 = load_4(s + 16);
|
36
|
+
uint64_t h6 = load_3(s + 20) << 7;
|
37
|
+
uint64_t h7 = load_3(s + 23) << 5;
|
38
|
+
uint64_t h8 = load_3(s + 26) << 4;
|
39
|
+
uint64_t h9 = (load_3(s + 29) & 8388607) << 2;
|
40
|
+
uint64_t carry0;
|
41
|
+
uint64_t carry1;
|
42
|
+
uint64_t carry2;
|
43
|
+
uint64_t carry3;
|
44
|
+
uint64_t carry4;
|
45
|
+
uint64_t carry5;
|
46
|
+
uint64_t carry6;
|
47
|
+
uint64_t carry7;
|
48
|
+
uint64_t carry8;
|
49
|
+
uint64_t carry9;
|
51
50
|
|
52
51
|
carry9 = h9 >> 25; h0 += carry9 * 19; h9 &= 0x1FFFFFF;
|
53
52
|
carry1 = h1 >> 25; h2 += carry1; h1 &= 0x1FFFFFF;
|
@@ -11,10 +11,6 @@
|
|
11
11
|
#include "crypto_stream_salsa20.h"
|
12
12
|
#include "utils.h"
|
13
13
|
|
14
|
-
static const unsigned char sigma[16] = {
|
15
|
-
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
|
16
|
-
};
|
17
|
-
|
18
14
|
int
|
19
15
|
crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
|
20
16
|
const unsigned char *m,
|
@@ -27,7 +23,7 @@ crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
|
|
27
23
|
unsigned long long i;
|
28
24
|
unsigned long long mlen0;
|
29
25
|
|
30
|
-
crypto_core_hsalsa20(subkey, n, k,
|
26
|
+
crypto_core_hsalsa20(subkey, n, k, NULL);
|
31
27
|
|
32
28
|
if (((uintptr_t) c >= (uintptr_t) m &&
|
33
29
|
(uintptr_t) c - (uintptr_t) m < mlen) ||
|
@@ -93,7 +89,7 @@ crypto_secretbox_open_detached(unsigned char *m, const unsigned char *c,
|
|
93
89
|
unsigned long long i;
|
94
90
|
unsigned long long mlen0;
|
95
91
|
|
96
|
-
crypto_core_hsalsa20(subkey, n, k,
|
92
|
+
crypto_core_hsalsa20(subkey, n, k, NULL);
|
97
93
|
crypto_stream_salsa20(block0, crypto_stream_salsa20_KEYBYTES,
|
98
94
|
n + 16, subkey);
|
99
95
|
if (crypto_onetimeauth_poly1305_verify(mac, c, clen, block0) != 0) {
|