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
@@ -16,9 +16,8 @@ extern "C" {
|
|
16
16
|
#include <stdint.h>
|
17
17
|
#include <stdio.h>
|
18
18
|
|
19
|
-
typedef struct crypto_onetimeauth_poly1305_state {
|
20
|
-
unsigned
|
21
|
-
unsigned char opaque[136];
|
19
|
+
typedef CRYPTO_ALIGN(16) struct crypto_onetimeauth_poly1305_state {
|
20
|
+
unsigned char opaque[256];
|
22
21
|
} crypto_onetimeauth_poly1305_state;
|
23
22
|
|
24
23
|
#define crypto_onetimeauth_poly1305_BYTES 16U
|
@@ -27,7 +27,8 @@ int crypto_scalarmult_base(unsigned char *q, const unsigned char *n);
|
|
27
27
|
|
28
28
|
SODIUM_EXPORT
|
29
29
|
int crypto_scalarmult(unsigned char *q, const unsigned char *n,
|
30
|
-
const unsigned char *p)
|
30
|
+
const unsigned char *p)
|
31
|
+
__attribute__ ((warn_unused_result));
|
31
32
|
|
32
33
|
#ifdef __cplusplus
|
33
34
|
}
|
@@ -19,11 +19,16 @@ size_t crypto_scalarmult_curve25519_scalarbytes(void);
|
|
19
19
|
|
20
20
|
SODIUM_EXPORT
|
21
21
|
int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
|
22
|
-
const unsigned char *p)
|
22
|
+
const unsigned char *p)
|
23
|
+
__attribute__ ((warn_unused_result));
|
23
24
|
|
24
25
|
SODIUM_EXPORT
|
25
26
|
int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
|
26
27
|
|
28
|
+
/* ------------------------------------------------------------------------- */
|
29
|
+
|
30
|
+
int _crypto_scalarmult_curve25519_pick_best_implementation(void);
|
31
|
+
|
27
32
|
#ifdef __cplusplus
|
28
33
|
}
|
29
34
|
#endif
|
@@ -65,6 +65,11 @@ int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
|
|
65
65
|
unsigned long long mlen,
|
66
66
|
const unsigned char *n, uint32_t ic,
|
67
67
|
const unsigned char *k);
|
68
|
+
|
69
|
+
/* ------------------------------------------------------------------------- */
|
70
|
+
|
71
|
+
int _crypto_stream_chacha20_pick_best_implementation(void);
|
72
|
+
|
68
73
|
#ifdef __cplusplus
|
69
74
|
}
|
70
75
|
#endif
|
@@ -4,33 +4,19 @@
|
|
4
4
|
|
5
5
|
#ifdef __native_client__
|
6
6
|
|
7
|
-
#include
|
8
|
-
#include
|
7
|
+
# include "export.h"
|
8
|
+
# include "randombytes.h"
|
9
9
|
|
10
|
-
#
|
11
|
-
|
12
|
-
#ifdef __cplusplus
|
10
|
+
# ifdef __cplusplus
|
13
11
|
extern "C" {
|
14
|
-
#endif
|
12
|
+
# endif
|
15
13
|
|
16
14
|
SODIUM_EXPORT
|
17
15
|
extern struct randombytes_implementation randombytes_nativeclient_implementation;
|
18
16
|
|
19
|
-
|
20
|
-
const char *randombytes_nativeclient_implementation_name(void);
|
21
|
-
|
22
|
-
SODIUM_EXPORT
|
23
|
-
uint32_t randombytes_nativeclient(void);
|
24
|
-
|
25
|
-
SODIUM_EXPORT
|
26
|
-
uint32_t randombytes_nativeclient_uniform(const uint32_t upper_bound);
|
27
|
-
|
28
|
-
SODIUM_EXPORT
|
29
|
-
void randombytes_nativeclient_buf(void * const buf, const size_t size);
|
30
|
-
|
31
|
-
#ifdef __cplusplus
|
17
|
+
# ifdef __cplusplus
|
32
18
|
}
|
33
|
-
#endif
|
19
|
+
# endif
|
34
20
|
|
35
21
|
#endif
|
36
22
|
|
@@ -2,17 +2,8 @@
|
|
2
2
|
#ifndef randombytes_salsa20_random_H
|
3
3
|
#define randombytes_salsa20_random_H
|
4
4
|
|
5
|
-
/*
|
6
|
-
* THREAD SAFETY: randombytes_salsa20_random*() functions are
|
7
|
-
* not thread-safe.
|
8
|
-
* Always wrap them in a mutex if you need thread safety,
|
9
|
-
* and call randombytes_stir() after fork()ing.
|
10
|
-
*/
|
11
|
-
|
12
|
-
#include <stddef.h>
|
13
|
-
#include <stdint.h>
|
14
|
-
|
15
5
|
#include "export.h"
|
6
|
+
#include "randombytes.h"
|
16
7
|
|
17
8
|
#ifdef __cplusplus
|
18
9
|
extern "C" {
|
@@ -21,24 +12,6 @@ extern "C" {
|
|
21
12
|
SODIUM_EXPORT
|
22
13
|
extern struct randombytes_implementation randombytes_salsa20_implementation;
|
23
14
|
|
24
|
-
SODIUM_EXPORT
|
25
|
-
const char *randombytes_salsa20_implementation_name(void);
|
26
|
-
|
27
|
-
SODIUM_EXPORT
|
28
|
-
uint32_t randombytes_salsa20_random(void);
|
29
|
-
|
30
|
-
SODIUM_EXPORT
|
31
|
-
void randombytes_salsa20_random_stir(void);
|
32
|
-
|
33
|
-
SODIUM_EXPORT
|
34
|
-
uint32_t randombytes_salsa20_random_uniform(const uint32_t upper_bound);
|
35
|
-
|
36
|
-
SODIUM_EXPORT
|
37
|
-
void randombytes_salsa20_random_buf(void * const buf, const size_t size);
|
38
|
-
|
39
|
-
SODIUM_EXPORT
|
40
|
-
int randombytes_salsa20_random_close(void);
|
41
|
-
|
42
15
|
#ifdef __cplusplus
|
43
16
|
}
|
44
17
|
#endif
|
@@ -2,16 +2,8 @@
|
|
2
2
|
#ifndef randombytes_sysrandom_H
|
3
3
|
#define randombytes_sysrandom_H
|
4
4
|
|
5
|
-
/*
|
6
|
-
* THREAD SAFETY: randombytes_sysrandom() functions are thread-safe,
|
7
|
-
* provided that you called sodium_init() once before using any
|
8
|
-
* other libsodium function.
|
9
|
-
*/
|
10
|
-
|
11
|
-
#include <stddef.h>
|
12
|
-
#include <stdint.h>
|
13
|
-
|
14
5
|
#include "export.h"
|
6
|
+
#include "randombytes.h"
|
15
7
|
|
16
8
|
#ifdef __cplusplus
|
17
9
|
extern "C" {
|
@@ -20,24 +12,6 @@ extern "C" {
|
|
20
12
|
SODIUM_EXPORT
|
21
13
|
extern struct randombytes_implementation randombytes_sysrandom_implementation;
|
22
14
|
|
23
|
-
SODIUM_EXPORT
|
24
|
-
const char *randombytes_sysrandom_implementation_name(void);
|
25
|
-
|
26
|
-
SODIUM_EXPORT
|
27
|
-
uint32_t randombytes_sysrandom(void);
|
28
|
-
|
29
|
-
SODIUM_EXPORT
|
30
|
-
void randombytes_sysrandom_stir(void);
|
31
|
-
|
32
|
-
SODIUM_EXPORT
|
33
|
-
uint32_t randombytes_sysrandom_uniform(const uint32_t upper_bound);
|
34
|
-
|
35
|
-
SODIUM_EXPORT
|
36
|
-
void randombytes_sysrandom_buf(void * const buf, const size_t size);
|
37
|
-
|
38
|
-
SODIUM_EXPORT
|
39
|
-
int randombytes_sysrandom_close(void);
|
40
|
-
|
41
15
|
#ifdef __cplusplus
|
42
16
|
}
|
43
17
|
#endif
|
@@ -40,9 +40,15 @@ int sodium_compare(const unsigned char *b1_, const unsigned char *b2_,
|
|
40
40
|
size_t len)
|
41
41
|
__attribute__ ((warn_unused_result));
|
42
42
|
|
43
|
+
SODIUM_EXPORT
|
44
|
+
int sodium_is_zero(const unsigned char *n, const size_t nlen);
|
45
|
+
|
43
46
|
SODIUM_EXPORT
|
44
47
|
void sodium_increment(unsigned char *n, const size_t nlen);
|
45
48
|
|
49
|
+
SODIUM_EXPORT
|
50
|
+
void sodium_add(unsigned char *a, const unsigned char *b, const size_t len);
|
51
|
+
|
46
52
|
SODIUM_EXPORT
|
47
53
|
char *sodium_bin2hex(char * const hex, const size_t hex_maxlen,
|
48
54
|
const unsigned char * const bin, const size_t bin_len);
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# include "randombytes.h"
|
11
11
|
# include "randombytes_nativeclient.h"
|
12
12
|
|
13
|
-
void
|
13
|
+
static void
|
14
14
|
randombytes_nativeclient_buf(void * const buf, const size_t size)
|
15
15
|
{
|
16
16
|
size_t readnb;
|
@@ -21,7 +21,7 @@ randombytes_nativeclient_buf(void * const buf, const size_t size)
|
|
21
21
|
assert(readnb == size);
|
22
22
|
}
|
23
23
|
|
24
|
-
uint32_t
|
24
|
+
static uint32_t
|
25
25
|
randombytes_nativeclient_random(void)
|
26
26
|
{
|
27
27
|
uint32_t r;
|
@@ -31,7 +31,7 @@ randombytes_nativeclient_random(void)
|
|
31
31
|
return r;
|
32
32
|
}
|
33
33
|
|
34
|
-
const char *
|
34
|
+
static const char *
|
35
35
|
randombytes_nativeclient_implementation_name(void)
|
36
36
|
{
|
37
37
|
return "nativeclient";
|
@@ -20,7 +20,7 @@
|
|
20
20
|
#endif
|
21
21
|
|
22
22
|
#include "crypto_core_salsa20.h"
|
23
|
-
#include "
|
23
|
+
#include "crypto_generichash.h"
|
24
24
|
#include "crypto_stream_salsa20.h"
|
25
25
|
#include "randombytes.h"
|
26
26
|
#include "randombytes_salsa20_random.h"
|
@@ -38,14 +38,17 @@ BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
|
|
38
38
|
#endif
|
39
39
|
|
40
40
|
#define SALSA20_RANDOM_BLOCK_SIZE crypto_core_salsa20_OUTPUTBYTES
|
41
|
-
#define
|
42
|
-
#define SHA512_MIN_PAD_SIZE (1U + 16U)
|
41
|
+
#define HASH_BLOCK_SIZE 128U
|
43
42
|
#define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1])
|
44
43
|
|
45
44
|
#if defined(__OpenBSD__) || defined(__CloudABI__)
|
46
45
|
# define HAVE_SAFE_ARC4RANDOM 1
|
47
46
|
#endif
|
48
47
|
|
48
|
+
#ifndef SSIZE_MAX
|
49
|
+
# define SSIZE_MAX (SIZE_MAX / 2 - 1)
|
50
|
+
#endif
|
51
|
+
|
49
52
|
typedef struct Salsa20Random_ {
|
50
53
|
unsigned char key[crypto_stream_salsa20_KEYBYTES];
|
51
54
|
unsigned char rnd32[16U * SALSA20_RANDOM_BLOCK_SIZE];
|
@@ -98,6 +101,7 @@ safe_read(const int fd, void * const buf_, size_t size)
|
|
98
101
|
ssize_t readnb;
|
99
102
|
|
100
103
|
assert(size > (size_t) 0U);
|
104
|
+
assert(size <= SSIZE_MAX);
|
101
105
|
do {
|
102
106
|
while ((readnb = read(fd, buf, size)) < (ssize_t) 0 &&
|
103
107
|
(errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */
|
@@ -251,18 +255,19 @@ randombytes_salsa20_random_rekey(const unsigned char * const mix)
|
|
251
255
|
}
|
252
256
|
}
|
253
257
|
|
254
|
-
void
|
258
|
+
static void
|
255
259
|
randombytes_salsa20_random_stir(void)
|
256
260
|
{
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
+
/* constant to personalize the hash function */
|
262
|
+
const unsigned char hsigma[crypto_generichash_KEYBYTES] = {
|
263
|
+
0x54, 0x68, 0x69, 0x73, 0x49, 0x73, 0x4a, 0x75,
|
264
|
+
0x73, 0x74, 0x41, 0x54, 0x68, 0x69, 0x72, 0x74,
|
265
|
+
0x79, 0x54, 0x77, 0x6f, 0x42, 0x79, 0x74, 0x65,
|
266
|
+
0x73, 0x53, 0x65, 0x65, 0x64, 0x2e, 0x2e, 0x2e
|
261
267
|
};
|
262
|
-
unsigned char m0[
|
263
|
-
|
264
|
-
|
265
|
-
size_t sizeof_k0 = sizeof m0 - crypto_auth_hmacsha512256_BYTES;
|
268
|
+
unsigned char m0[crypto_stream_salsa20_KEYBYTES + HASH_BLOCK_SIZE];
|
269
|
+
unsigned char *k0 = m0 + crypto_stream_salsa20_KEYBYTES;
|
270
|
+
size_t sizeof_k0 = sizeof m0 - crypto_stream_salsa20_KEYBYTES;
|
266
271
|
|
267
272
|
memset(stream.rnd32, 0, sizeof stream.rnd32);
|
268
273
|
stream.rnd32_outleft = (size_t) 0U;
|
@@ -297,8 +302,10 @@ randombytes_salsa20_random_stir(void)
|
|
297
302
|
abort(); /* LCOV_EXCL_LINE */
|
298
303
|
}
|
299
304
|
#endif
|
300
|
-
|
301
|
-
|
305
|
+
if (crypto_generichash(stream.key, sizeof stream.key, k0, sizeof_k0,
|
306
|
+
hsigma, sizeof hsigma) != 0) {
|
307
|
+
abort();
|
308
|
+
}
|
302
309
|
COMPILER_ASSERT(sizeof stream.key <= sizeof m0);
|
303
310
|
randombytes_salsa20_random_rekey(m0);
|
304
311
|
sodium_memzero(m0, sizeof m0);
|
@@ -323,35 +330,7 @@ randombytes_salsa20_random_stir_if_needed(void)
|
|
323
330
|
#endif
|
324
331
|
}
|
325
332
|
|
326
|
-
static
|
327
|
-
randombytes_salsa20_random_getword(void)
|
328
|
-
{
|
329
|
-
uint32_t val;
|
330
|
-
int ret;
|
331
|
-
|
332
|
-
COMPILER_ASSERT(sizeof stream.rnd32 >= (sizeof stream.key) + (sizeof val));
|
333
|
-
COMPILER_ASSERT(((sizeof stream.rnd32) - (sizeof stream.key))
|
334
|
-
% sizeof val == (size_t) 0U);
|
335
|
-
if (stream.rnd32_outleft <= (size_t) 0U) {
|
336
|
-
randombytes_salsa20_random_stir_if_needed();
|
337
|
-
COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_salsa20_NONCEBYTES);
|
338
|
-
ret = crypto_stream_salsa20((unsigned char *) stream.rnd32,
|
339
|
-
(unsigned long long) sizeof stream.rnd32,
|
340
|
-
(unsigned char *) &stream.nonce,
|
341
|
-
stream.key);
|
342
|
-
assert(ret == 0);
|
343
|
-
stream.rnd32_outleft = (sizeof stream.rnd32) - (sizeof stream.key);
|
344
|
-
randombytes_salsa20_random_rekey(&stream.rnd32[stream.rnd32_outleft]);
|
345
|
-
stream.nonce++;
|
346
|
-
}
|
347
|
-
stream.rnd32_outleft -= sizeof val;
|
348
|
-
memcpy(&val, &stream.rnd32[stream.rnd32_outleft], sizeof val);
|
349
|
-
memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof val);
|
350
|
-
|
351
|
-
return val;
|
352
|
-
}
|
353
|
-
|
354
|
-
int
|
333
|
+
static int
|
355
334
|
randombytes_salsa20_random_close(void)
|
356
335
|
{
|
357
336
|
int ret = -1;
|
@@ -386,13 +365,7 @@ randombytes_salsa20_random_close(void)
|
|
386
365
|
return ret;
|
387
366
|
}
|
388
367
|
|
389
|
-
|
390
|
-
randombytes_salsa20_random(void)
|
391
|
-
{
|
392
|
-
return randombytes_salsa20_random_getword();
|
393
|
-
}
|
394
|
-
|
395
|
-
void
|
368
|
+
static void
|
396
369
|
randombytes_salsa20_random_buf(void * const buf, const size_t size)
|
397
370
|
{
|
398
371
|
size_t i;
|
@@ -415,7 +388,41 @@ randombytes_salsa20_random_buf(void * const buf, const size_t size)
|
|
415
388
|
(unsigned char *) &stream.nonce, stream.key);
|
416
389
|
}
|
417
390
|
|
418
|
-
|
391
|
+
static uint32_t
|
392
|
+
randombytes_salsa20_random_getword(void)
|
393
|
+
{
|
394
|
+
uint32_t val;
|
395
|
+
int ret;
|
396
|
+
|
397
|
+
COMPILER_ASSERT(sizeof stream.rnd32 >= (sizeof stream.key) + (sizeof val));
|
398
|
+
COMPILER_ASSERT(((sizeof stream.rnd32) - (sizeof stream.key))
|
399
|
+
% sizeof val == (size_t) 0U);
|
400
|
+
if (stream.rnd32_outleft <= (size_t) 0U) {
|
401
|
+
randombytes_salsa20_random_stir_if_needed();
|
402
|
+
COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_salsa20_NONCEBYTES);
|
403
|
+
ret = crypto_stream_salsa20((unsigned char *) stream.rnd32,
|
404
|
+
(unsigned long long) sizeof stream.rnd32,
|
405
|
+
(unsigned char *) &stream.nonce,
|
406
|
+
stream.key);
|
407
|
+
assert(ret == 0);
|
408
|
+
stream.rnd32_outleft = (sizeof stream.rnd32) - (sizeof stream.key);
|
409
|
+
randombytes_salsa20_random_rekey(&stream.rnd32[stream.rnd32_outleft]);
|
410
|
+
stream.nonce++;
|
411
|
+
}
|
412
|
+
stream.rnd32_outleft -= sizeof val;
|
413
|
+
memcpy(&val, &stream.rnd32[stream.rnd32_outleft], sizeof val);
|
414
|
+
memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof val);
|
415
|
+
|
416
|
+
return val;
|
417
|
+
}
|
418
|
+
|
419
|
+
static uint32_t
|
420
|
+
randombytes_salsa20_random(void)
|
421
|
+
{
|
422
|
+
return randombytes_salsa20_random_getword();
|
423
|
+
}
|
424
|
+
|
425
|
+
static const char *
|
419
426
|
randombytes_salsa20_implementation_name(void)
|
420
427
|
{
|
421
428
|
return "salsa20";
|
@@ -37,26 +37,30 @@ BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
|
|
37
37
|
# define HAVE_SAFE_ARC4RANDOM 1
|
38
38
|
#endif
|
39
39
|
|
40
|
+
#ifndef SSIZE_MAX
|
41
|
+
# define SSIZE_MAX (SIZE_MAX / 2 - 1)
|
42
|
+
#endif
|
43
|
+
|
40
44
|
#ifdef HAVE_SAFE_ARC4RANDOM
|
41
45
|
|
42
|
-
uint32_t
|
46
|
+
static uint32_t
|
43
47
|
randombytes_sysrandom(void)
|
44
48
|
{
|
45
49
|
return arc4random();
|
46
50
|
}
|
47
51
|
|
48
|
-
void
|
52
|
+
static void
|
49
53
|
randombytes_sysrandom_stir(void)
|
50
54
|
{
|
51
55
|
}
|
52
56
|
|
53
|
-
void
|
57
|
+
static void
|
54
58
|
randombytes_sysrandom_buf(void * const buf, const size_t size)
|
55
59
|
{
|
56
60
|
return arc4random_buf(buf, size);
|
57
61
|
}
|
58
62
|
|
59
|
-
int
|
63
|
+
static int
|
60
64
|
randombytes_sysrandom_close(void)
|
61
65
|
{
|
62
66
|
return 0;
|
@@ -84,6 +88,7 @@ safe_read(const int fd, void * const buf_, size_t size)
|
|
84
88
|
ssize_t readnb;
|
85
89
|
|
86
90
|
assert(size > (size_t) 0U);
|
91
|
+
assert(size <= SSIZE_MAX);
|
87
92
|
do {
|
88
93
|
while ((readnb = read(fd, buf, size)) < (ssize_t) 0 &&
|
89
94
|
(errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */
|
@@ -214,7 +219,7 @@ randombytes_sysrandom_init(void)
|
|
214
219
|
}
|
215
220
|
#endif
|
216
221
|
|
217
|
-
void
|
222
|
+
static void
|
218
223
|
randombytes_sysrandom_stir(void)
|
219
224
|
{
|
220
225
|
if (stream.initialized == 0) {
|
@@ -231,7 +236,7 @@ randombytes_sysrandom_stir_if_needed(void)
|
|
231
236
|
}
|
232
237
|
}
|
233
238
|
|
234
|
-
int
|
239
|
+
static int
|
235
240
|
randombytes_sysrandom_close(void)
|
236
241
|
{
|
237
242
|
int ret = -1;
|
@@ -257,17 +262,7 @@ randombytes_sysrandom_close(void)
|
|
257
262
|
return ret;
|
258
263
|
}
|
259
264
|
|
260
|
-
|
261
|
-
randombytes_sysrandom(void)
|
262
|
-
{
|
263
|
-
uint32_t r;
|
264
|
-
|
265
|
-
randombytes_sysrandom_buf(&r, sizeof r);
|
266
|
-
|
267
|
-
return r;
|
268
|
-
}
|
269
|
-
|
270
|
-
void
|
265
|
+
static void
|
271
266
|
randombytes_sysrandom_buf(void * const buf, const size_t size)
|
272
267
|
{
|
273
268
|
randombytes_sysrandom_stir_if_needed();
|
@@ -298,9 +293,19 @@ randombytes_sysrandom_buf(void * const buf, const size_t size)
|
|
298
293
|
#endif
|
299
294
|
}
|
300
295
|
|
296
|
+
static uint32_t
|
297
|
+
randombytes_sysrandom(void)
|
298
|
+
{
|
299
|
+
uint32_t r;
|
300
|
+
|
301
|
+
randombytes_sysrandom_buf(&r, sizeof r);
|
302
|
+
|
303
|
+
return r;
|
304
|
+
}
|
305
|
+
|
301
306
|
#endif /* __OpenBSD__ */
|
302
307
|
|
303
|
-
const char *
|
308
|
+
static const char *
|
304
309
|
randombytes_sysrandom_implementation_name(void)
|
305
310
|
{
|
306
311
|
return "sysrandom";
|