rbnacl-libsodium 1.0.6 → 1.0.7
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/AUTHORS +10 -3
- data/vendor/libsodium/ChangeLog +19 -1
- data/vendor/libsodium/Makefile.in +1 -0
- data/vendor/libsodium/README.markdown +1 -1
- data/vendor/libsodium/THANKS +1 -0
- data/vendor/libsodium/autogen.sh +24 -4
- data/vendor/libsodium/autom4te.cache/output.1 +208 -24
- data/vendor/libsodium/autom4te.cache/output.5 +208 -24
- data/vendor/libsodium/autom4te.cache/requests +869 -869
- data/vendor/libsodium/autom4te.cache/traces.1 +426 -406
- data/vendor/libsodium/autom4te.cache/traces.5 +255 -245
- data/vendor/libsodium/builds/msvc/version.h +2 -2
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +14 -44
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +36 -132
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +14 -44
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +36 -132
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +14 -44
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +36 -132
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +14 -44
- data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +62 -158
- data/vendor/libsodium/configure +208 -24
- data/vendor/libsodium/configure.ac +70 -15
- data/vendor/libsodium/dist-build/Makefile.in +1 -0
- data/vendor/libsodium/dist-build/emscripten.sh +52 -19
- data/vendor/libsodium/dist-build/ios.sh +8 -8
- data/vendor/libsodium/dist-build/msys2-win32.sh +2 -1
- data/vendor/libsodium/dist-build/msys2-win64.sh +2 -1
- data/vendor/libsodium/dist-build/osx.sh +2 -2
- data/vendor/libsodium/examples/box.c +3 -1
- data/vendor/libsodium/examples/box_detached.c +4 -2
- data/vendor/libsodium/examples/utils.h +3 -1
- data/vendor/libsodium/libsodium.vcxproj +13 -13
- data/vendor/libsodium/libsodium.vcxproj.filters +31 -35
- data/vendor/libsodium/msvc-scripts/Makefile.in +1 -0
- data/vendor/libsodium/msvc-scripts/process.bat +2 -2
- data/vendor/libsodium/src/Makefile.in +1 -0
- data/vendor/libsodium/src/libsodium/Makefile.am +43 -45
- data/vendor/libsodium/src/libsodium/Makefile.in +250 -249
- data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +28 -22
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c +3 -4
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c +3 -4
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c +4 -4
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c +4 -4
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c +6 -4
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +6 -2
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c +5 -3
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c +13 -9
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +2 -2
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +36 -26
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +1 -2
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +2 -3
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +2 -3
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/{auth_poly1305_donna.c → poly1305_donna.c} +18 -11
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +1 -5
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +10 -9
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +17 -9
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +10 -1
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +708 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h +31 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c +11 -12
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/{smult_curve25519_donna_c64.c → curve25519_donna_c64.c} +32 -15
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.h +9 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/curve25519_ref10.c +73 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/curve25519_ref10.h +9 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c +1 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S +25 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h +20 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c +114 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h +9 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h +25 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h +33 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c +57 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +189 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h +16 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +165 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +219 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c +76 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +1432 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h +18 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S +1287 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.h +18 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base_namespace.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S +17 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c +67 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c +3 -2
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h +2 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c +42 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +7 -7
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c +113 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +10 -7
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +10 -10
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c +10 -9
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +2 -3
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +72 -68
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/{api.h → stream_chacha20_ref.h} +5 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/{stream_chacha20_api.c → stream_chacha20.c} +27 -7
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.h +22 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.c +329 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.h +27 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +1 -1
- 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 +1 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +2 -2
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +4 -4
- data/vendor/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c +14 -21
- data/vendor/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c +14 -37
- data/vendor/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c +14 -69
- data/vendor/libsodium/src/libsodium/include/Makefile.in +1 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +8 -4
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +4 -2
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +2 -2
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +2 -3
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h +2 -1
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +6 -1
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +5 -0
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h +6 -20
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h +1 -28
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h +1 -27
- data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/utils.h +6 -0
- data/vendor/libsodium/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c +3 -3
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +58 -51
- data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +23 -18
- data/vendor/libsodium/src/libsodium/sodium/core.c +4 -0
- data/vendor/libsodium/src/libsodium/sodium/runtime.c +34 -15
- data/vendor/libsodium/src/libsodium/sodium/utils.c +104 -14
- data/vendor/libsodium/test/Makefile.in +1 -0
- data/vendor/libsodium/test/default/Makefile.in +1 -0
- data/vendor/libsodium/test/default/auth.c +5 -5
- data/vendor/libsodium/test/default/auth2.c +3 -3
- data/vendor/libsodium/test/default/auth3.c +3 -3
- data/vendor/libsodium/test/default/auth5.c +4 -4
- data/vendor/libsodium/test/default/auth6.c +3 -3
- data/vendor/libsodium/test/default/auth7.c +4 -4
- data/vendor/libsodium/test/default/box.c +13 -9
- data/vendor/libsodium/test/default/box2.c +11 -8
- data/vendor/libsodium/test/default/box7.c +11 -9
- data/vendor/libsodium/test/default/box8.c +32 -19
- data/vendor/libsodium/test/default/box_easy.c +31 -10
- data/vendor/libsodium/test/default/box_easy.exp +3 -19
- data/vendor/libsodium/test/default/box_easy2.c +30 -15
- data/vendor/libsodium/test/default/box_seed.c +1 -1
- data/vendor/libsodium/test/default/cmptest.h +22 -1
- data/vendor/libsodium/test/default/core1.c +6 -5
- data/vendor/libsodium/test/default/core2.c +6 -5
- data/vendor/libsodium/test/default/core3.c +8 -7
- data/vendor/libsodium/test/default/core4.c +11 -8
- data/vendor/libsodium/test/default/core5.c +7 -5
- data/vendor/libsodium/test/default/core6.c +8 -6
- data/vendor/libsodium/test/default/generichash.c +0 -15
- data/vendor/libsodium/test/default/generichash.exp +0 -1
- data/vendor/libsodium/test/default/generichash3.c +1 -21
- data/vendor/libsodium/test/default/generichash3.exp +1 -1
- data/vendor/libsodium/test/default/hash.c +3 -3
- data/vendor/libsodium/test/default/hash3.c +2 -2
- data/vendor/libsodium/test/default/index.html.tpl +84 -0
- data/vendor/libsodium/test/default/onetimeauth.c +3 -3
- data/vendor/libsodium/test/default/onetimeauth2.c +5 -4
- data/vendor/libsodium/test/default/onetimeauth7.c +4 -4
- data/vendor/libsodium/test/default/pre.js.inc +14 -6
- data/vendor/libsodium/test/default/randombytes.c +2 -2
- data/vendor/libsodium/test/default/scalarmult.c +19 -6
- data/vendor/libsodium/test/default/scalarmult.exp +1 -0
- data/vendor/libsodium/test/default/scalarmult2.c +2 -2
- data/vendor/libsodium/test/default/scalarmult5.c +6 -4
- data/vendor/libsodium/test/default/scalarmult6.c +5 -3
- data/vendor/libsodium/test/default/scalarmult7.c +11 -7
- data/vendor/libsodium/test/default/secretbox.c +7 -6
- data/vendor/libsodium/test/default/secretbox2.c +7 -6
- data/vendor/libsodium/test/default/secretbox7.c +5 -5
- data/vendor/libsodium/test/default/secretbox8.c +5 -5
- data/vendor/libsodium/test/default/secretbox_easy.c +27 -17
- data/vendor/libsodium/test/default/secretbox_easy.exp +7 -95
- data/vendor/libsodium/test/default/secretbox_easy2.c +22 -10
- data/vendor/libsodium/test/default/sign.c +5 -0
- data/vendor/libsodium/test/default/sodium_utils.c +73 -0
- data/vendor/libsodium/test/default/sodium_utils.exp +6 -0
- data/vendor/libsodium/test/default/stream.c +7 -6
- data/vendor/libsodium/test/default/stream2.c +4 -4
- data/vendor/libsodium/test/default/stream3.c +6 -5
- data/vendor/libsodium/test/default/stream4.c +7 -6
- data/vendor/libsodium/test/default/verify1.c +61 -18
- data/vendor/libsodium/test/default/verify1.exp +2 -6
- metadata +37 -44
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/api.h +0 -9
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h +0 -9
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/api.h +0 -9
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +0 -20
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h +0 -10
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h +0 -10
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h +0 -10
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h +0 -10
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h +0 -2
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/api.h +0 -10
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/api.h +0 -10
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h +0 -6
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c +0 -13
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/api.h +0 -5
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c +0 -14
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c +0 -54
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c +0 -14
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h +0 -11
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h +0 -7
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h +0 -15
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h +0 -12
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h +0 -54
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c +0 -348
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h +0 -34
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c +0 -230
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h +0 -51
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c +0 -150
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c +0 -106
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c +0 -16
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h +0 -13
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h +0 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h +0 -10
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h +0 -9
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h +0 -11
- data/vendor/libsodium/src/libsodium/crypto_verify/16/ref/api.h +0 -2
- data/vendor/libsodium/src/libsodium/crypto_verify/32/ref/api.h +0 -2
- data/vendor/libsodium/src/libsodium/crypto_verify/64/ref/api.h +0 -2
@@ -1,9 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_auth_hmacsha512256.h"
|
3
|
-
|
4
|
-
#define crypto_auth crypto_auth_hmacsha512256
|
5
|
-
#define crypto_auth_verify crypto_auth_hmacsha512256_verify
|
6
|
-
#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
|
7
|
-
#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
|
8
|
-
#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512256_IMPLEMENTATION
|
9
|
-
#define crypto_auth_VERSION crypto_auth_hmacsha512256_VERSION
|
@@ -1,20 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
3
|
-
|
4
|
-
#define crypto_box crypto_box_curve25519xsalsa20poly1305
|
5
|
-
#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open
|
6
|
-
#define crypto_box_seed_keypair crypto_box_curve25519xsalsa20poly1305_seed_keypair
|
7
|
-
#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair
|
8
|
-
#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm
|
9
|
-
#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm
|
10
|
-
#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm
|
11
|
-
#define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
|
12
|
-
#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
|
13
|
-
#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
|
14
|
-
#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
|
15
|
-
#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
|
16
|
-
#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
|
17
|
-
#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
|
18
|
-
#define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES)
|
19
|
-
#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION
|
20
|
-
#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION
|
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_core_hsalsa20.h"
|
3
|
-
|
4
|
-
#define crypto_core crypto_core_hsalsa20
|
5
|
-
#define crypto_core_OUTPUTBYTES crypto_core_hsalsa20_OUTPUTBYTES
|
6
|
-
#define crypto_core_INPUTBYTES crypto_core_hsalsa20_INPUTBYTES
|
7
|
-
#define crypto_core_KEYBYTES crypto_core_hsalsa20_KEYBYTES
|
8
|
-
#define crypto_core_CONSTBYTES crypto_core_hsalsa20_CONSTBYTES
|
9
|
-
#define crypto_core_IMPLEMENTATION crypto_core_hsalsa20_IMPLEMENTATION
|
10
|
-
#define crypto_core_VERSION crypto_core_hsalsa20_VERSION
|
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_core_salsa20.h"
|
3
|
-
|
4
|
-
#define crypto_core crypto_core_salsa20
|
5
|
-
#define crypto_core_OUTPUTBYTES crypto_core_salsa20_OUTPUTBYTES
|
6
|
-
#define crypto_core_INPUTBYTES crypto_core_salsa20_INPUTBYTES
|
7
|
-
#define crypto_core_KEYBYTES crypto_core_salsa20_KEYBYTES
|
8
|
-
#define crypto_core_CONSTBYTES crypto_core_salsa20_CONSTBYTES
|
9
|
-
#define crypto_core_IMPLEMENTATION crypto_core_salsa20_IMPLEMENTATION
|
10
|
-
#define crypto_core_VERSION crypto_core_salsa20_VERSION
|
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_core_salsa2012.h"
|
3
|
-
|
4
|
-
#define crypto_core crypto_core_salsa2012
|
5
|
-
#define crypto_core_OUTPUTBYTES crypto_core_salsa2012_OUTPUTBYTES
|
6
|
-
#define crypto_core_INPUTBYTES crypto_core_salsa2012_INPUTBYTES
|
7
|
-
#define crypto_core_KEYBYTES crypto_core_salsa2012_KEYBYTES
|
8
|
-
#define crypto_core_CONSTBYTES crypto_core_salsa2012_CONSTBYTES
|
9
|
-
#define crypto_core_IMPLEMENTATION crypto_core_salsa2012_IMPLEMENTATION
|
10
|
-
#define crypto_core_VERSION crypto_core_salsa2012_VERSION
|
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_core_salsa208.h"
|
3
|
-
|
4
|
-
#define crypto_core crypto_core_salsa208
|
5
|
-
#define crypto_core_OUTPUTBYTES crypto_core_salsa208_OUTPUTBYTES
|
6
|
-
#define crypto_core_INPUTBYTES crypto_core_salsa208_INPUTBYTES
|
7
|
-
#define crypto_core_KEYBYTES crypto_core_salsa208_KEYBYTES
|
8
|
-
#define crypto_core_CONSTBYTES crypto_core_salsa208_CONSTBYTES
|
9
|
-
#define crypto_core_IMPLEMENTATION crypto_core_salsa208_IMPLEMENTATION
|
10
|
-
#define crypto_core_VERSION crypto_core_salsa208_VERSION
|
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_hash_sha256.h"
|
3
|
-
|
4
|
-
#define crypto_hash crypto_hash_sha256
|
5
|
-
#define crypto_hash_init crypto_hash_sha256_init
|
6
|
-
#define crypto_hash_update crypto_hash_sha256_update
|
7
|
-
#define crypto_hash_final crypto_hash_sha256_final
|
8
|
-
#define crypto_hash_BYTES crypto_hash_sha256_BYTES
|
9
|
-
#define crypto_hash_IMPLEMENTATION crypto_hash_sha256_IMPLEMENTATION
|
10
|
-
#define crypto_hash_VERSION crypto_hash_sha256_VERSION
|
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_hash_sha512.h"
|
3
|
-
|
4
|
-
#define crypto_hash crypto_hash_sha512
|
5
|
-
#define crypto_hash_init crypto_hash_sha512_init
|
6
|
-
#define crypto_hash_update crypto_hash_sha512_update
|
7
|
-
#define crypto_hash_final crypto_hash_sha512_final
|
8
|
-
#define crypto_hash_BYTES crypto_hash_sha512_BYTES
|
9
|
-
#define crypto_hash_IMPLEMENTATION crypto_hash_sha512_IMPLEMENTATION
|
10
|
-
#define crypto_hash_VERSION crypto_hash_sha512_VERSION
|
data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "api.h"
|
3
|
-
#include "crypto_scalarmult.h"
|
4
|
-
|
5
|
-
#ifndef HAVE_TI_MODE
|
6
|
-
|
7
|
-
static const unsigned char basepoint[32] = {9};
|
8
|
-
|
9
|
-
int crypto_scalarmult_base(unsigned char *q,const unsigned char *n)
|
10
|
-
{
|
11
|
-
return crypto_scalarmult(q,n,basepoint);
|
12
|
-
}
|
13
|
-
|
14
|
-
#endif
|
data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "api.h"
|
3
|
-
#include "crypto_scalarmult.h"
|
4
|
-
#include "fe.h"
|
5
|
-
|
6
|
-
#ifndef HAVE_TI_MODE
|
7
|
-
|
8
|
-
int crypto_scalarmult(unsigned char *q,
|
9
|
-
const unsigned char *n,
|
10
|
-
const unsigned char *p)
|
11
|
-
{
|
12
|
-
unsigned char e[32];
|
13
|
-
unsigned int i;
|
14
|
-
fe x1;
|
15
|
-
fe x2;
|
16
|
-
fe z2;
|
17
|
-
fe x3;
|
18
|
-
fe z3;
|
19
|
-
fe tmp0;
|
20
|
-
fe tmp1;
|
21
|
-
int pos;
|
22
|
-
unsigned int swap;
|
23
|
-
unsigned int b;
|
24
|
-
|
25
|
-
for (i = 0;i < 32;++i) e[i] = n[i];
|
26
|
-
e[0] &= 248;
|
27
|
-
e[31] &= 127;
|
28
|
-
e[31] |= 64;
|
29
|
-
fe_frombytes(x1,p);
|
30
|
-
fe_1(x2);
|
31
|
-
fe_0(z2);
|
32
|
-
fe_copy(x3,x1);
|
33
|
-
fe_1(z3);
|
34
|
-
|
35
|
-
swap = 0;
|
36
|
-
for (pos = 254;pos >= 0;--pos) {
|
37
|
-
b = e[pos / 8] >> (pos & 7);
|
38
|
-
b &= 1;
|
39
|
-
swap ^= b;
|
40
|
-
fe_cswap(x2,x3,swap);
|
41
|
-
fe_cswap(z2,z3,swap);
|
42
|
-
swap = b;
|
43
|
-
#include "montgomery.h"
|
44
|
-
}
|
45
|
-
fe_cswap(x2,x3,swap);
|
46
|
-
fe_cswap(z2,z3,swap);
|
47
|
-
|
48
|
-
fe_invert(z2,z2);
|
49
|
-
fe_mul(x2,x2,z2);
|
50
|
-
fe_tobytes(q,x2);
|
51
|
-
return 0;
|
52
|
-
}
|
53
|
-
|
54
|
-
#endif
|
data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_scalarmult_curve25519.h"
|
3
|
-
|
4
|
-
size_t
|
5
|
-
crypto_scalarmult_curve25519_bytes(void)
|
6
|
-
{
|
7
|
-
return crypto_scalarmult_curve25519_BYTES;
|
8
|
-
}
|
9
|
-
|
10
|
-
size_t
|
11
|
-
crypto_scalarmult_curve25519_scalarbytes(void)
|
12
|
-
{
|
13
|
-
return crypto_scalarmult_curve25519_SCALARBYTES;
|
14
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_secretbox_xsalsa20poly1305.h"
|
3
|
-
|
4
|
-
#define crypto_secretbox crypto_secretbox_xsalsa20poly1305
|
5
|
-
#define crypto_secretbox_open crypto_secretbox_xsalsa20poly1305_open
|
6
|
-
#define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES
|
7
|
-
#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
|
8
|
-
#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
|
9
|
-
#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
|
10
|
-
#define crypto_secretbox_IMPLEMENTATION crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION
|
11
|
-
#define crypto_secretbox_VERSION crypto_secretbox_xsalsa20poly1305_VERSION
|
@@ -1,7 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_shorthash_siphash24.h"
|
3
|
-
|
4
|
-
#define crypto_shorthash crypto_shorthash_siphash24
|
5
|
-
#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES
|
6
|
-
#define crypto_shorthash_IMPLEMENTATION crypto_shorthash_siphash24_IMPLEMENTATION
|
7
|
-
#define crypto_shorthash_VERSION crypto_shorthash_siphash24_VERSION
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_sign_ed25519.h"
|
3
|
-
|
4
|
-
#define crypto_sign crypto_sign_ed25519
|
5
|
-
#define crypto_sign_detached crypto_sign_ed25519_detached
|
6
|
-
#define crypto_sign_open crypto_sign_ed25519_open
|
7
|
-
#define crypto_sign_verify_detached crypto_sign_ed25519_verify_detached
|
8
|
-
#define crypto_sign_keypair crypto_sign_ed25519_keypair
|
9
|
-
#define crypto_sign_seed_keypair crypto_sign_ed25519_seed_keypair
|
10
|
-
#define crypto_sign_BYTES crypto_sign_ed25519_BYTES
|
11
|
-
#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
|
12
|
-
#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
|
13
|
-
#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
|
14
|
-
#define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION
|
15
|
-
#define crypto_sign_VERSION crypto_sign_ed25519_VERSION
|
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "crypto_sign_edwards25519sha512batch.h"
|
3
|
-
|
4
|
-
#define crypto_sign crypto_sign_edwards25519sha512batch
|
5
|
-
#define crypto_sign_open crypto_sign_edwards25519sha512batch_open
|
6
|
-
#define crypto_sign_keypair crypto_sign_edwards25519sha512batch_keypair
|
7
|
-
#define crypto_sign_BYTES crypto_sign_edwards25519sha512batch_BYTES
|
8
|
-
#define crypto_sign_PUBLICKEYBYTES crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES
|
9
|
-
#define crypto_sign_SECRETKEYBYTES crypto_sign_edwards25519sha512batch_SECRETKEYBYTES
|
10
|
-
#define crypto_sign_IMPLEMENTATION crypto_sign_edwards25519sha512batch_IMPLEMENTATION
|
11
|
-
#define crypto_sign_VERSION crypto_sign_edwards25519sha512batch_VERSION
|
12
|
-
|
@@ -1,54 +0,0 @@
|
|
1
|
-
#ifndef FE25519_H
|
2
|
-
#define FE25519_H
|
3
|
-
|
4
|
-
#define fe25519 crypto_sign_edwards25519sha512batch_fe25519
|
5
|
-
#define fe25519_unpack crypto_sign_edwards25519sha512batch_fe25519_unpack
|
6
|
-
#define fe25519_pack crypto_sign_edwards25519sha512batch_fe25519_pack
|
7
|
-
#define fe25519_cmov crypto_sign_edwards25519sha512batch_fe25519_cmov
|
8
|
-
#define fe25519_setone crypto_sign_edwards25519sha512batch_fe25519_setone
|
9
|
-
#define fe25519_setzero crypto_sign_edwards25519sha512batch_fe25519_setzero
|
10
|
-
#define fe25519_neg crypto_sign_edwards25519sha512batch_fe25519_neg
|
11
|
-
#define fe25519_getparity crypto_sign_edwards25519sha512batch_fe25519_getparity
|
12
|
-
#define fe25519_add crypto_sign_edwards25519sha512batch_fe25519_add
|
13
|
-
#define fe25519_sub crypto_sign_edwards25519sha512batch_fe25519_sub
|
14
|
-
#define fe25519_mul crypto_sign_edwards25519sha512batch_fe25519_mul
|
15
|
-
#define fe25519_square crypto_sign_edwards25519sha512batch_fe25519_square
|
16
|
-
#define fe25519_pow crypto_sign_edwards25519sha512batch_fe25519_pow
|
17
|
-
#define fe25519_sqrt_vartime crypto_sign_edwards25519sha512batch_fe25519_sqrt_vartime
|
18
|
-
#define fe25519_invert crypto_sign_edwards25519sha512batch_fe25519_invert
|
19
|
-
|
20
|
-
#include "crypto_uint32.h"
|
21
|
-
|
22
|
-
typedef struct {
|
23
|
-
crypto_uint32 v[32];
|
24
|
-
} fe25519;
|
25
|
-
|
26
|
-
void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
|
27
|
-
|
28
|
-
void fe25519_pack(unsigned char r[32], const fe25519 *x);
|
29
|
-
|
30
|
-
void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
|
31
|
-
|
32
|
-
void fe25519_setone(fe25519 *r);
|
33
|
-
|
34
|
-
void fe25519_setzero(fe25519 *r);
|
35
|
-
|
36
|
-
void fe25519_neg(fe25519 *r, const fe25519 *x);
|
37
|
-
|
38
|
-
unsigned char fe25519_getparity(const fe25519 *x);
|
39
|
-
|
40
|
-
void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
41
|
-
|
42
|
-
void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
43
|
-
|
44
|
-
void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
45
|
-
|
46
|
-
void fe25519_square(fe25519 *r, const fe25519 *x);
|
47
|
-
|
48
|
-
void fe25519_pow(fe25519 *r, const fe25519 *x, const unsigned char *e);
|
49
|
-
|
50
|
-
int fe25519_sqrt_vartime(fe25519 *r, const fe25519 *x, unsigned char parity);
|
51
|
-
|
52
|
-
void fe25519_invert(fe25519 *r, const fe25519 *x);
|
53
|
-
|
54
|
-
#endif
|
@@ -1,348 +0,0 @@
|
|
1
|
-
#include "fe25519.h"
|
2
|
-
|
3
|
-
#define WINDOWSIZE 4 /* Should be 1,2, or 4 */
|
4
|
-
#define WINDOWMASK ((1<<WINDOWSIZE)-1)
|
5
|
-
|
6
|
-
static void reduce_add_sub(fe25519 *r)
|
7
|
-
{
|
8
|
-
crypto_uint32 t;
|
9
|
-
int i,rep;
|
10
|
-
|
11
|
-
for(rep=0;rep<4;rep++)
|
12
|
-
{
|
13
|
-
t = r->v[31] >> 7;
|
14
|
-
r->v[31] &= 127;
|
15
|
-
t *= 19;
|
16
|
-
r->v[0] += t;
|
17
|
-
for(i=0;i<31;i++)
|
18
|
-
{
|
19
|
-
t = r->v[i] >> 8;
|
20
|
-
r->v[i+1] += t;
|
21
|
-
r->v[i] &= 255;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
static void reduce_mul(fe25519 *r)
|
27
|
-
{
|
28
|
-
crypto_uint32 t;
|
29
|
-
int i,rep;
|
30
|
-
|
31
|
-
for(rep=0;rep<2;rep++)
|
32
|
-
{
|
33
|
-
t = r->v[31] >> 7;
|
34
|
-
r->v[31] &= 127;
|
35
|
-
t *= 19;
|
36
|
-
r->v[0] += t;
|
37
|
-
for(i=0;i<31;i++)
|
38
|
-
{
|
39
|
-
t = r->v[i] >> 8;
|
40
|
-
r->v[i+1] += t;
|
41
|
-
r->v[i] &= 255;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
/* reduction modulo 2^255-19 */
|
47
|
-
static void freeze(fe25519 *r)
|
48
|
-
{
|
49
|
-
int i;
|
50
|
-
unsigned int m = (r->v[31] == 127);
|
51
|
-
for(i=30;i>1;i--)
|
52
|
-
m *= (r->v[i] == 255);
|
53
|
-
m *= (r->v[0] >= 237);
|
54
|
-
|
55
|
-
r->v[31] -= m*127;
|
56
|
-
for(i=30;i>0;i--)
|
57
|
-
r->v[i] -= m*255;
|
58
|
-
r->v[0] -= m*237;
|
59
|
-
}
|
60
|
-
|
61
|
-
/*freeze input before calling isone*/
|
62
|
-
static int isone(const fe25519 *x)
|
63
|
-
{
|
64
|
-
int i;
|
65
|
-
int r = (x->v[0] == 1);
|
66
|
-
for(i=1;i<32;i++)
|
67
|
-
r *= (x->v[i] == 0);
|
68
|
-
return r;
|
69
|
-
}
|
70
|
-
|
71
|
-
/*freeze input before calling iszero*/
|
72
|
-
static int iszero(const fe25519 *x)
|
73
|
-
{
|
74
|
-
int i;
|
75
|
-
int r = (x->v[0] == 0);
|
76
|
-
for(i=1;i<32;i++)
|
77
|
-
r *= (x->v[i] == 0);
|
78
|
-
return r;
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
static int issquare(const fe25519 *x)
|
83
|
-
{
|
84
|
-
unsigned char e[32] = {0xf6,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f}; /* (p-1)/2 */
|
85
|
-
fe25519 t;
|
86
|
-
|
87
|
-
fe25519_pow(&t,x,e);
|
88
|
-
freeze(&t);
|
89
|
-
return isone(&t) || iszero(&t);
|
90
|
-
}
|
91
|
-
|
92
|
-
void fe25519_unpack(fe25519 *r, const unsigned char x[32])
|
93
|
-
{
|
94
|
-
int i;
|
95
|
-
for(i=0;i<32;i++) r->v[i] = x[i];
|
96
|
-
r->v[31] &= 127;
|
97
|
-
}
|
98
|
-
|
99
|
-
/* Assumes input x being reduced mod 2^255 */
|
100
|
-
void fe25519_pack(unsigned char r[32], const fe25519 *x)
|
101
|
-
{
|
102
|
-
int i;
|
103
|
-
unsigned int m;
|
104
|
-
for(i=0;i<32;i++)
|
105
|
-
r[i] = x->v[i];
|
106
|
-
|
107
|
-
/* freeze byte array */
|
108
|
-
m = (r[31] == 127); /* XXX: some compilers might use branches; fix */
|
109
|
-
for(i=30;i>1;i--)
|
110
|
-
m *= (r[i] == 255);
|
111
|
-
m *= (r[0] >= 237);
|
112
|
-
r[31] -= m*127;
|
113
|
-
for(i=30;i>0;i--)
|
114
|
-
r[i] -= m*255;
|
115
|
-
r[0] -= m*237;
|
116
|
-
}
|
117
|
-
|
118
|
-
void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b)
|
119
|
-
{
|
120
|
-
unsigned char nb = 1-b;
|
121
|
-
int i;
|
122
|
-
for(i=0;i<32;i++) r->v[i] = nb * r->v[i] + b * x->v[i];
|
123
|
-
}
|
124
|
-
|
125
|
-
unsigned char fe25519_getparity(const fe25519 *x)
|
126
|
-
{
|
127
|
-
fe25519 t;
|
128
|
-
int i;
|
129
|
-
for(i=0;i<32;i++) t.v[i] = x->v[i];
|
130
|
-
freeze(&t);
|
131
|
-
return t.v[0] & 1;
|
132
|
-
}
|
133
|
-
|
134
|
-
void fe25519_setone(fe25519 *r)
|
135
|
-
{
|
136
|
-
int i;
|
137
|
-
r->v[0] = 1;
|
138
|
-
for(i=1;i<32;i++) r->v[i]=0;
|
139
|
-
}
|
140
|
-
|
141
|
-
void fe25519_setzero(fe25519 *r)
|
142
|
-
{
|
143
|
-
int i;
|
144
|
-
for(i=0;i<32;i++) r->v[i]=0;
|
145
|
-
}
|
146
|
-
|
147
|
-
void fe25519_neg(fe25519 *r, const fe25519 *x)
|
148
|
-
{
|
149
|
-
fe25519 t;
|
150
|
-
int i;
|
151
|
-
for(i=0;i<32;i++) t.v[i]=x->v[i];
|
152
|
-
fe25519_setzero(r);
|
153
|
-
fe25519_sub(r, r, &t);
|
154
|
-
}
|
155
|
-
|
156
|
-
void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y)
|
157
|
-
{
|
158
|
-
int i;
|
159
|
-
for(i=0;i<32;i++) r->v[i] = x->v[i] + y->v[i];
|
160
|
-
reduce_add_sub(r);
|
161
|
-
}
|
162
|
-
|
163
|
-
void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y)
|
164
|
-
{
|
165
|
-
int i;
|
166
|
-
crypto_uint32 t[32];
|
167
|
-
t[0] = x->v[0] + 0x1da;
|
168
|
-
t[31] = x->v[31] + 0xfe;
|
169
|
-
for(i=1;i<31;i++) t[i] = x->v[i] + 0x1fe;
|
170
|
-
for(i=0;i<32;i++) r->v[i] = t[i] - y->v[i];
|
171
|
-
reduce_add_sub(r);
|
172
|
-
}
|
173
|
-
|
174
|
-
void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y)
|
175
|
-
{
|
176
|
-
int i,j;
|
177
|
-
crypto_uint32 t[63];
|
178
|
-
for(i=0;i<63;i++)t[i] = 0;
|
179
|
-
|
180
|
-
for(i=0;i<32;i++)
|
181
|
-
for(j=0;j<32;j++)
|
182
|
-
t[i+j] += x->v[i] * y->v[j];
|
183
|
-
|
184
|
-
for(i=32;i<63;i++)
|
185
|
-
r->v[i-32] = t[i-32] + 38*t[i];
|
186
|
-
r->v[31] = t[31]; /* result now in r[0]...r[31] */
|
187
|
-
|
188
|
-
reduce_mul(r);
|
189
|
-
}
|
190
|
-
|
191
|
-
void fe25519_square(fe25519 *r, const fe25519 *x)
|
192
|
-
{
|
193
|
-
fe25519_mul(r, x, x);
|
194
|
-
}
|
195
|
-
|
196
|
-
/*XXX: Make constant time! */
|
197
|
-
void fe25519_pow(fe25519 *r, const fe25519 *x, const unsigned char *e)
|
198
|
-
{
|
199
|
-
/*
|
200
|
-
fe25519 g;
|
201
|
-
fe25519_setone(&g);
|
202
|
-
int i;
|
203
|
-
unsigned char j;
|
204
|
-
for(i=32;i>0;i--)
|
205
|
-
{
|
206
|
-
for(j=128;j>0;j>>=1)
|
207
|
-
{
|
208
|
-
fe25519_square(&g,&g);
|
209
|
-
if(e[i-1] & j)
|
210
|
-
fe25519_mul(&g,&g,x);
|
211
|
-
}
|
212
|
-
}
|
213
|
-
for(i=0;i<32;i++) r->v[i] = g.v[i];
|
214
|
-
*/
|
215
|
-
fe25519 g;
|
216
|
-
int i,j,k;
|
217
|
-
fe25519 t;
|
218
|
-
unsigned char w;
|
219
|
-
fe25519 pre[(1 << WINDOWSIZE)];
|
220
|
-
|
221
|
-
fe25519_setone(&g);
|
222
|
-
|
223
|
-
// Precomputation
|
224
|
-
fe25519_setone(pre);
|
225
|
-
pre[1] = *x;
|
226
|
-
for(i=2;i<(1<<WINDOWSIZE);i+=2)
|
227
|
-
{
|
228
|
-
fe25519_square(pre+i, pre+i/2);
|
229
|
-
fe25519_mul(pre+i+1, pre+i, pre+1);
|
230
|
-
}
|
231
|
-
|
232
|
-
// Fixed-window scalar multiplication
|
233
|
-
for(i=32;i>0;i--)
|
234
|
-
{
|
235
|
-
for(j=8-WINDOWSIZE;j>=0;j-=WINDOWSIZE)
|
236
|
-
{
|
237
|
-
for(k=0;k<WINDOWSIZE;k++)
|
238
|
-
fe25519_square(&g, &g);
|
239
|
-
// Cache-timing resistant loading of precomputed value:
|
240
|
-
w = (e[i-1]>>j) & WINDOWMASK;
|
241
|
-
t = pre[0];
|
242
|
-
for(k=1;k<(1<<WINDOWSIZE);k++)
|
243
|
-
fe25519_cmov(&t, &pre[k], k==w);
|
244
|
-
fe25519_mul(&g, &g, &t);
|
245
|
-
}
|
246
|
-
}
|
247
|
-
*r = g;
|
248
|
-
}
|
249
|
-
|
250
|
-
/* Return 0 on success, 1 otherwise */
|
251
|
-
int fe25519_sqrt_vartime(fe25519 *r, const fe25519 *x, unsigned char parity)
|
252
|
-
{
|
253
|
-
unsigned char e[32] = {0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f}; /* (p-1)/4 */
|
254
|
-
unsigned char e2[32] = {0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f}; /* (p+3)/8 */
|
255
|
-
unsigned char e3[32] = {0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f}; /* (p-5)/8 */
|
256
|
-
fe25519 p = {{0}};
|
257
|
-
fe25519 d;
|
258
|
-
int i;
|
259
|
-
|
260
|
-
/* See HAC, Alg. 3.37 */
|
261
|
-
if (!issquare(x)) return -1;
|
262
|
-
fe25519_pow(&d,x,e);
|
263
|
-
freeze(&d);
|
264
|
-
if(isone(&d))
|
265
|
-
fe25519_pow(r,x,e2);
|
266
|
-
else
|
267
|
-
{
|
268
|
-
for(i=0;i<32;i++)
|
269
|
-
d.v[i] = 4*x->v[i];
|
270
|
-
fe25519_pow(&d,&d,e3);
|
271
|
-
for(i=0;i<32;i++)
|
272
|
-
r->v[i] = 2*x->v[i];
|
273
|
-
fe25519_mul(r,r,&d);
|
274
|
-
}
|
275
|
-
freeze(r);
|
276
|
-
if((r->v[0] & 1) != (parity & 1))
|
277
|
-
{
|
278
|
-
fe25519_sub(r,&p,r);
|
279
|
-
}
|
280
|
-
return 0;
|
281
|
-
}
|
282
|
-
|
283
|
-
void fe25519_invert(fe25519 *r, const fe25519 *x)
|
284
|
-
{
|
285
|
-
fe25519 z2;
|
286
|
-
fe25519 z9;
|
287
|
-
fe25519 z11;
|
288
|
-
fe25519 z2_5_0;
|
289
|
-
fe25519 z2_10_0;
|
290
|
-
fe25519 z2_20_0;
|
291
|
-
fe25519 z2_50_0;
|
292
|
-
fe25519 z2_100_0;
|
293
|
-
fe25519 t0;
|
294
|
-
fe25519 t1;
|
295
|
-
int i;
|
296
|
-
|
297
|
-
/* 2 */ fe25519_square(&z2,x);
|
298
|
-
/* 4 */ fe25519_square(&t1,&z2);
|
299
|
-
/* 8 */ fe25519_square(&t0,&t1);
|
300
|
-
/* 9 */ fe25519_mul(&z9,&t0,x);
|
301
|
-
/* 11 */ fe25519_mul(&z11,&z9,&z2);
|
302
|
-
/* 22 */ fe25519_square(&t0,&z11);
|
303
|
-
/* 2^5 - 2^0 = 31 */ fe25519_mul(&z2_5_0,&t0,&z9);
|
304
|
-
|
305
|
-
/* 2^6 - 2^1 */ fe25519_square(&t0,&z2_5_0);
|
306
|
-
/* 2^7 - 2^2 */ fe25519_square(&t1,&t0);
|
307
|
-
/* 2^8 - 2^3 */ fe25519_square(&t0,&t1);
|
308
|
-
/* 2^9 - 2^4 */ fe25519_square(&t1,&t0);
|
309
|
-
/* 2^10 - 2^5 */ fe25519_square(&t0,&t1);
|
310
|
-
/* 2^10 - 2^0 */ fe25519_mul(&z2_10_0,&t0,&z2_5_0);
|
311
|
-
|
312
|
-
/* 2^11 - 2^1 */ fe25519_square(&t0,&z2_10_0);
|
313
|
-
/* 2^12 - 2^2 */ fe25519_square(&t1,&t0);
|
314
|
-
/* 2^20 - 2^10 */ for (i = 2;i < 10;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
|
315
|
-
/* 2^20 - 2^0 */ fe25519_mul(&z2_20_0,&t1,&z2_10_0);
|
316
|
-
|
317
|
-
/* 2^21 - 2^1 */ fe25519_square(&t0,&z2_20_0);
|
318
|
-
/* 2^22 - 2^2 */ fe25519_square(&t1,&t0);
|
319
|
-
/* 2^40 - 2^20 */ for (i = 2;i < 20;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
|
320
|
-
/* 2^40 - 2^0 */ fe25519_mul(&t0,&t1,&z2_20_0);
|
321
|
-
|
322
|
-
/* 2^41 - 2^1 */ fe25519_square(&t1,&t0);
|
323
|
-
/* 2^42 - 2^2 */ fe25519_square(&t0,&t1);
|
324
|
-
/* 2^50 - 2^10 */ for (i = 2;i < 10;i += 2) { fe25519_square(&t1,&t0); fe25519_square(&t0,&t1); }
|
325
|
-
/* 2^50 - 2^0 */ fe25519_mul(&z2_50_0,&t0,&z2_10_0);
|
326
|
-
|
327
|
-
/* 2^51 - 2^1 */ fe25519_square(&t0,&z2_50_0);
|
328
|
-
/* 2^52 - 2^2 */ fe25519_square(&t1,&t0);
|
329
|
-
/* 2^100 - 2^50 */ for (i = 2;i < 50;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
|
330
|
-
/* 2^100 - 2^0 */ fe25519_mul(&z2_100_0,&t1,&z2_50_0);
|
331
|
-
|
332
|
-
/* 2^101 - 2^1 */ fe25519_square(&t1,&z2_100_0);
|
333
|
-
/* 2^102 - 2^2 */ fe25519_square(&t0,&t1);
|
334
|
-
/* 2^200 - 2^100 */ for (i = 2;i < 100;i += 2) { fe25519_square(&t1,&t0); fe25519_square(&t0,&t1); }
|
335
|
-
/* 2^200 - 2^0 */ fe25519_mul(&t1,&t0,&z2_100_0);
|
336
|
-
|
337
|
-
/* 2^201 - 2^1 */ fe25519_square(&t0,&t1);
|
338
|
-
/* 2^202 - 2^2 */ fe25519_square(&t1,&t0);
|
339
|
-
/* 2^250 - 2^50 */ for (i = 2;i < 50;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
|
340
|
-
/* 2^250 - 2^0 */ fe25519_mul(&t0,&t1,&z2_50_0);
|
341
|
-
|
342
|
-
/* 2^251 - 2^1 */ fe25519_square(&t1,&t0);
|
343
|
-
/* 2^252 - 2^2 */ fe25519_square(&t0,&t1);
|
344
|
-
/* 2^253 - 2^3 */ fe25519_square(&t1,&t0);
|
345
|
-
/* 2^254 - 2^4 */ fe25519_square(&t0,&t1);
|
346
|
-
/* 2^255 - 2^5 */ fe25519_square(&t1,&t0);
|
347
|
-
/* 2^255 - 21 */ fe25519_mul(r,&t1,&z11);
|
348
|
-
}
|