rbnacl-libsodium 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbnacl/libsodium/version.rb +1 -1
- data/vendor/libsodium/AUTHORS +14 -9
- data/vendor/libsodium/ChangeLog +26 -0
- data/vendor/libsodium/LICENSE +1 -1
- data/vendor/libsodium/Makefile.am +1 -0
- data/vendor/libsodium/README.markdown +185 -46
- data/vendor/libsodium/THANKS +10 -0
- data/vendor/libsodium/builds/msvc/properties/Common.props +21 -0
- data/vendor/libsodium/builds/msvc/properties/DLL.props +16 -0
- data/vendor/libsodium/builds/msvc/properties/Debug.props +29 -0
- data/vendor/libsodium/builds/msvc/properties/DebugDEXE.props +21 -0
- data/vendor/libsodium/builds/msvc/properties/DebugDLL.props +20 -0
- data/vendor/libsodium/builds/msvc/properties/DebugLEXE.props +20 -0
- data/vendor/libsodium/builds/msvc/properties/DebugLIB.props +20 -0
- data/vendor/libsodium/builds/msvc/properties/DebugLTCG.props +19 -0
- data/vendor/libsodium/builds/msvc/properties/DebugSEXE.props +21 -0
- data/vendor/libsodium/builds/msvc/properties/EXE.props +17 -0
- data/vendor/libsodium/builds/msvc/properties/LIB.props +16 -0
- data/vendor/libsodium/builds/msvc/properties/LTCG.props +13 -0
- data/vendor/libsodium/builds/msvc/properties/Link.props +21 -0
- data/vendor/libsodium/builds/msvc/properties/Messages.props +15 -0
- data/vendor/libsodium/builds/msvc/properties/Output.props +30 -0
- data/vendor/libsodium/builds/msvc/properties/Release.props +41 -0
- data/vendor/libsodium/builds/msvc/properties/ReleaseDEXE.props +20 -0
- data/vendor/libsodium/builds/msvc/properties/ReleaseDLL.props +19 -0
- data/vendor/libsodium/builds/msvc/properties/ReleaseLEXE.props +20 -0
- data/vendor/libsodium/builds/msvc/properties/ReleaseLIB.props +19 -0
- data/vendor/libsodium/builds/msvc/properties/ReleaseLTCG.props +19 -0
- data/vendor/libsodium/builds/msvc/properties/ReleaseSEXE.props +20 -0
- data/vendor/libsodium/builds/msvc/properties/Win32.props +20 -0
- data/vendor/libsodium/builds/msvc/properties/x64.props +23 -0
- data/vendor/libsodium/builds/msvc/resource.h +0 -0
- data/vendor/libsodium/builds/msvc/resource.rc +0 -0
- data/vendor/libsodium/builds/msvc/version.h +29 -0
- data/vendor/libsodium/builds/msvc/vs2010/libsodium.import.props +52 -0
- data/vendor/libsodium/builds/msvc/vs2010/libsodium.import.xml +17 -0
- data/vendor/libsodium/builds/msvc/vs2010/libsodium.sln +79 -0
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.props +43 -0
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +345 -0
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +1037 -0
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.xml +15 -0
- data/vendor/libsodium/builds/msvc/vs2010/test/test.props +37 -0
- data/vendor/libsodium/builds/msvc/vs2010/test/test.runner.bat +78 -0
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +220 -0
- data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +168 -0
- data/vendor/libsodium/builds/msvc/vs2012/libsodium.import.props +52 -0
- data/vendor/libsodium/builds/msvc/vs2012/libsodium.import.xml +17 -0
- data/vendor/libsodium/builds/msvc/vs2012/libsodium.sln +79 -0
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.props +43 -0
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +345 -0
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +1037 -0
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.xml +15 -0
- data/vendor/libsodium/builds/msvc/vs2012/test/test.props +37 -0
- data/vendor/libsodium/builds/msvc/vs2012/test/test.runner.bat +78 -0
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +220 -0
- data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +168 -0
- data/vendor/libsodium/builds/msvc/vs2013/libsodium.import.props +52 -0
- data/vendor/libsodium/builds/msvc/vs2013/libsodium.import.xml +17 -0
- data/vendor/libsodium/builds/msvc/vs2013/libsodium.sln +81 -0
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.props +43 -0
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +345 -0
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +1037 -0
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.xml +15 -0
- data/vendor/libsodium/builds/msvc/vs2013/test/test.props +37 -0
- data/vendor/libsodium/builds/msvc/vs2013/test/test.runner.bat +78 -0
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +220 -0
- data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +168 -0
- data/vendor/libsodium/configure.ac +87 -68
- data/vendor/libsodium/dist-build/Makefile.am +10 -0
- data/vendor/libsodium/dist-build/android-arm.sh +3 -0
- data/vendor/libsodium/dist-build/android-armv7.sh +3 -0
- data/vendor/libsodium/dist-build/android-build.sh +37 -0
- data/vendor/libsodium/dist-build/android-mips.sh +3 -0
- data/vendor/libsodium/dist-build/android-x86.sh +3 -0
- data/vendor/libsodium/dist-build/emscripten.sh +13 -0
- data/vendor/libsodium/dist-build/{iphone.sh → ios.sh} +2 -2
- data/vendor/libsodium/dist-build/msys2-win32.sh +10 -0
- data/vendor/libsodium/dist-build/msys2-win64.sh +10 -0
- data/vendor/libsodium/libsodium.vcxproj +25 -13
- data/vendor/libsodium/libsodium.vcxproj.filters +60 -24
- data/vendor/libsodium/msvc-scripts/process.bat +3 -7
- data/vendor/libsodium/packaging/nuget/package.bat +13 -0
- data/vendor/libsodium/packaging/nuget/package.config +4 -0
- data/vendor/libsodium/packaging/nuget/package.gsl +255 -0
- data/vendor/libsodium/packaging/nuget/package.nuspec +93 -0
- data/vendor/libsodium/packaging/nuget/package.targets +128 -0
- data/vendor/libsodium/packaging/nuget/package.xml +22 -0
- data/vendor/libsodium/src/libsodium/Makefile.am +32 -20
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/{ref → cp}/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c +110 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/{ref → cp}/verify_hmacsha256.c +0 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h +9 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c +110 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c +10 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/{ref → cp}/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c +54 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/{ref → cp}/verify_hmacsha512256.c +2 -1
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +94 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c +15 -5
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h +0 -2
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +14 -6
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +95 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c +50 -3
- data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +4 -10
- data/vendor/libsodium/src/libsodium/crypto_hash/crypto_hash.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/{ref → cp}/api.h +3 -1
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +294 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/{ref → cp}/api.h +3 -1
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +321 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +51 -127
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +12 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +221 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +209 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c +1 -140
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt-common.c +250 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/crypto_scrypt.h +100 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c +302 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.c +94 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pbkdf2-sha256.h +45 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c +172 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/scrypt_platform.c +96 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c +391 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sysendian.h +146 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h +2 -2
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +39 -9
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/api.h +2 -2
- data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c +6 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +94 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +6 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +5 -3
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +28 -18
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +14 -9
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +21 -21
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +6 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +42 -42
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-be.h +4 -4
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-le.h +4 -4
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256-ctr.c +15 -14
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/ecrypt-sync.h +1 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +153 -160
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h +2 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +9 -3
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +9 -3
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h +0 -1
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c +0 -5
- data/vendor/libsodium/src/libsodium/crypto_verify/64/ref/api.h +2 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c +72 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c +6 -0
- data/vendor/libsodium/src/libsodium/include/Makefile.am +6 -7
- data/vendor/libsodium/src/libsodium/include/sodium.h +4 -3
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +31 -9
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +58 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +26 -9
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +13 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +38 -24
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h +6 -11
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h +6 -11
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h +6 -11
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +6 -11
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash.h +7 -8
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +36 -16
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash.h +13 -4
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +25 -7
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +25 -7
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +5 -5
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_donna.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h +48 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +31 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +17 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +21 -11
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +8 -7
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +16 -17
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +18 -14
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +18 -18
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +19 -18
- data/vendor/libsodium/src/libsodium/include/sodium/{crypto_stream_salsa20.h.in → crypto_stream_salsa20.h} +8 -19
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +8 -8
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +8 -8
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +10 -11
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_16.h +1 -4
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_32.h +1 -4
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_64.h +22 -0
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +3 -0
- data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +27 -0
- data/vendor/libsodium/src/libsodium/include/sodium/utils.h +15 -3
- data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +3 -1
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +18 -7
- data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +57 -9
- data/vendor/libsodium/src/libsodium/sodium/compat.c +62 -0
- data/vendor/libsodium/src/libsodium/sodium/core.c +2 -0
- data/vendor/libsodium/src/libsodium/sodium/runtime.c +134 -0
- data/vendor/libsodium/src/libsodium/sodium/utils.c +100 -8
- data/vendor/libsodium/test/default/Makefile.am +63 -3
- data/vendor/libsodium/test/default/auth6.c +21 -0
- data/vendor/libsodium/test/default/auth6.exp +8 -0
- data/vendor/libsodium/test/default/auth7.c +37 -0
- data/vendor/libsodium/test/default/auth7.exp +0 -0
- data/vendor/libsodium/test/default/box_easy.c +59 -0
- data/vendor/libsodium/test/default/box_easy.exp +19 -0
- data/vendor/libsodium/test/default/box_easy2.c +31 -0
- data/vendor/libsodium/test/default/box_easy2.exp +1 -0
- data/vendor/libsodium/test/default/cmptest.h +7 -1
- data/vendor/libsodium/test/default/generichash3.c +36 -0
- data/vendor/libsodium/test/default/generichash3.exp +64 -0
- data/vendor/libsodium/test/default/pwhash.c +59 -0
- data/vendor/libsodium/test/default/pwhash.exp +2 -0
- data/vendor/libsodium/test/default/scalarmult7.c +0 -2
- data/vendor/libsodium/test/default/scalarmult8.c +0 -2
- data/vendor/libsodium/test/default/secretbox_easy.c +51 -0
- data/vendor/libsodium/test/default/secretbox_easy.exp +19 -0
- data/vendor/libsodium/test/default/secretbox_easy2.c +27 -0
- data/vendor/libsodium/test/default/secretbox_easy2.exp +1 -0
- data/vendor/libsodium/test/default/sign.c +1106 -0
- data/vendor/libsodium/test/default/sign.exp +3 -0
- data/vendor/libsodium/test/default/sodium_utils.c +8 -0
- data/vendor/libsodium/test/default/sodium_utils.exp +2 -1
- data/vendor/libsodium/test/default/sodium_version.c +1 -1
- data/vendor/libsodium/test/default/verify1.c +34 -0
- data/vendor/libsodium/test/default/verify1.exp +6 -0
- metadata +138 -33
- data/vendor/libsodium/dist-build/android.sh +0 -48
- data/vendor/libsodium/dist-build/msys.sh +0 -9
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/hmac_hmacsha256.c +0 -83
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c +0 -86
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/ref/hash_sha256.c +0 -69
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/ref/hash_sha512.c +0 -71
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/checksum +0 -1
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256_api.c +0 -16
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/api.h +0 -9
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/blocks_sha256.c +0 -212
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/checksum +0 -1
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512_api.c +0 -16
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/api.h +0 -9
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/blocks_sha512.c +0 -239
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/try.c +0 -78
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/api.h +0 -8
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/auth_poly1305_53.c +0 -1661
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/verify_poly1305_53.c +0 -10
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/portable-jane.h +0 -772
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha256.h +0 -32
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha512.h +0 -32
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_53.h +0 -34
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in +0 -44
@@ -0,0 +1,146 @@
|
|
1
|
+
#ifndef _SYSENDIAN_H_
|
2
|
+
#define _SYSENDIAN_H_
|
3
|
+
|
4
|
+
#include <stdint.h>
|
5
|
+
|
6
|
+
/* Avoid namespace collisions with BSD <sys/endian.h>. */
|
7
|
+
#define be16dec scrypt_be16dec
|
8
|
+
#define be16enc scrypt_be16enc
|
9
|
+
#define be32dec scrypt_be32dec
|
10
|
+
#define be32enc scrypt_be32enc
|
11
|
+
#define be64dec scrypt_be64dec
|
12
|
+
#define be64enc scrypt_be64enc
|
13
|
+
#define le16dec scrypt_le16dec
|
14
|
+
#define le16enc scrypt_le16enc
|
15
|
+
#define le32dec scrypt_le32dec
|
16
|
+
#define le32enc scrypt_le32enc
|
17
|
+
#define le64dec scrypt_le64dec
|
18
|
+
#define le64enc scrypt_le64enc
|
19
|
+
|
20
|
+
static inline uint16_t
|
21
|
+
be16dec(const void *pp)
|
22
|
+
{
|
23
|
+
const uint8_t *p = (uint8_t const *)pp;
|
24
|
+
|
25
|
+
return ((uint16_t)(p[1]) + ((uint16_t)(p[0]) << 8));
|
26
|
+
}
|
27
|
+
|
28
|
+
static inline void
|
29
|
+
be16enc(void *pp, uint16_t x)
|
30
|
+
{
|
31
|
+
uint8_t * p = (uint8_t *)pp;
|
32
|
+
|
33
|
+
p[1] = x & 0xff;
|
34
|
+
p[0] = (x >> 8) & 0xff;
|
35
|
+
}
|
36
|
+
|
37
|
+
static inline uint32_t
|
38
|
+
be32dec(const void *pp)
|
39
|
+
{
|
40
|
+
const uint8_t *p = (uint8_t const *)pp;
|
41
|
+
|
42
|
+
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
|
43
|
+
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
|
44
|
+
}
|
45
|
+
|
46
|
+
static inline void
|
47
|
+
be32enc(void *pp, uint32_t x)
|
48
|
+
{
|
49
|
+
uint8_t * p = (uint8_t *)pp;
|
50
|
+
|
51
|
+
p[3] = x & 0xff;
|
52
|
+
p[2] = (x >> 8) & 0xff;
|
53
|
+
p[1] = (x >> 16) & 0xff;
|
54
|
+
p[0] = (x >> 24) & 0xff;
|
55
|
+
}
|
56
|
+
|
57
|
+
static inline uint64_t
|
58
|
+
be64dec(const void *pp)
|
59
|
+
{
|
60
|
+
const uint8_t *p = (uint8_t const *)pp;
|
61
|
+
|
62
|
+
return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) +
|
63
|
+
((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) +
|
64
|
+
((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) +
|
65
|
+
((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56));
|
66
|
+
}
|
67
|
+
|
68
|
+
static inline void
|
69
|
+
be64enc(void *pp, uint64_t x)
|
70
|
+
{
|
71
|
+
uint8_t * p = (uint8_t *)pp;
|
72
|
+
|
73
|
+
p[7] = x & 0xff;
|
74
|
+
p[6] = (x >> 8) & 0xff;
|
75
|
+
p[5] = (x >> 16) & 0xff;
|
76
|
+
p[4] = (x >> 24) & 0xff;
|
77
|
+
p[3] = (x >> 32) & 0xff;
|
78
|
+
p[2] = (x >> 40) & 0xff;
|
79
|
+
p[1] = (x >> 48) & 0xff;
|
80
|
+
p[0] = (x >> 56) & 0xff;
|
81
|
+
}
|
82
|
+
|
83
|
+
static inline uint16_t
|
84
|
+
le16dec(const void *pp)
|
85
|
+
{
|
86
|
+
const uint8_t *p = (uint8_t const *)pp;
|
87
|
+
|
88
|
+
return ((uint16_t)(p[0]) + ((uint16_t)(p[1]) << 8));
|
89
|
+
}
|
90
|
+
|
91
|
+
static inline void
|
92
|
+
le16enc(void *pp, uint16_t x)
|
93
|
+
{
|
94
|
+
uint8_t * p = (uint8_t *)pp;
|
95
|
+
|
96
|
+
p[0] = x & 0xff;
|
97
|
+
p[1] = (x >> 8) & 0xff;
|
98
|
+
}
|
99
|
+
|
100
|
+
static inline uint32_t
|
101
|
+
le32dec(const void *pp)
|
102
|
+
{
|
103
|
+
const uint8_t *p = (uint8_t const *)pp;
|
104
|
+
|
105
|
+
return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
|
106
|
+
((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
|
107
|
+
}
|
108
|
+
|
109
|
+
static inline void
|
110
|
+
le32enc(void *pp, uint32_t x)
|
111
|
+
{
|
112
|
+
uint8_t * p = (uint8_t *)pp;
|
113
|
+
|
114
|
+
p[0] = x & 0xff;
|
115
|
+
p[1] = (x >> 8) & 0xff;
|
116
|
+
p[2] = (x >> 16) & 0xff;
|
117
|
+
p[3] = (x >> 24) & 0xff;
|
118
|
+
}
|
119
|
+
|
120
|
+
static inline uint64_t
|
121
|
+
le64dec(const void *pp)
|
122
|
+
{
|
123
|
+
const uint8_t *p = (uint8_t const *)pp;
|
124
|
+
|
125
|
+
return ((uint64_t)(p[0]) + ((uint64_t)(p[1]) << 8) +
|
126
|
+
((uint64_t)(p[2]) << 16) + ((uint64_t)(p[3]) << 24) +
|
127
|
+
((uint64_t)(p[4]) << 32) + ((uint64_t)(p[5]) << 40) +
|
128
|
+
((uint64_t)(p[6]) << 48) + ((uint64_t)(p[7]) << 56));
|
129
|
+
}
|
130
|
+
|
131
|
+
static inline void
|
132
|
+
le64enc(void *pp, uint64_t x)
|
133
|
+
{
|
134
|
+
uint8_t * p = (uint8_t *)pp;
|
135
|
+
|
136
|
+
p[0] = x & 0xff;
|
137
|
+
p[1] = (x >> 8) & 0xff;
|
138
|
+
p[2] = (x >> 16) & 0xff;
|
139
|
+
p[3] = (x >> 24) & 0xff;
|
140
|
+
p[4] = (x >> 32) & 0xff;
|
141
|
+
p[5] = (x >> 40) & 0xff;
|
142
|
+
p[6] = (x >> 48) & 0xff;
|
143
|
+
p[7] = (x >> 56) & 0xff;
|
144
|
+
}
|
145
|
+
|
146
|
+
#endif /* !_SYSENDIAN_H_ */
|
@@ -4,6 +4,6 @@
|
|
4
4
|
#define crypto_scalarmult_curve25519_implementation_name \
|
5
5
|
crypto_scalarmult_curve25519_donna_c64_implementation_name
|
6
6
|
|
7
|
-
#define crypto_scalarmult
|
8
|
-
#define crypto_scalarmult_base
|
7
|
+
#define crypto_scalarmult crypto_scalarmult_curve25519
|
8
|
+
#define crypto_scalarmult_base crypto_scalarmult_curve25519_base
|
9
9
|
|
@@ -189,14 +189,44 @@ fsquare_times(felem output, const felem in, limb count) {
|
|
189
189
|
output[4] = r4;
|
190
190
|
}
|
191
191
|
|
192
|
+
#if !defined(CPU_ALIGNED_ACCESS_REQUIRED) && defined(NATIVE_LITTLE_ENDIAN)
|
193
|
+
# define U8TO64(p) (*((const uint64_t *) (p)))
|
194
|
+
# define U64TO8(p, v) (*((uint64_t *) (p)) = (v))
|
195
|
+
#else
|
196
|
+
static force_inline uint64_t
|
197
|
+
U8TO64(const unsigned char *p) {
|
198
|
+
return
|
199
|
+
(((uint64_t)(p[0] & 0xff) ) |
|
200
|
+
((uint64_t)(p[1] & 0xff) << 8) |
|
201
|
+
((uint64_t)(p[2] & 0xff) << 16) |
|
202
|
+
((uint64_t)(p[3] & 0xff) << 24) |
|
203
|
+
((uint64_t)(p[4] & 0xff) << 32) |
|
204
|
+
((uint64_t)(p[5] & 0xff) << 40) |
|
205
|
+
((uint64_t)(p[6] & 0xff) << 48) |
|
206
|
+
((uint64_t)(p[7] & 0xff) << 56));
|
207
|
+
}
|
208
|
+
|
209
|
+
static force_inline void
|
210
|
+
U64TO8(unsigned char *p, uint64_t v) {
|
211
|
+
p[0] = (v ) & 0xff;
|
212
|
+
p[1] = (v >> 8) & 0xff;
|
213
|
+
p[2] = (v >> 16) & 0xff;
|
214
|
+
p[3] = (v >> 24) & 0xff;
|
215
|
+
p[4] = (v >> 32) & 0xff;
|
216
|
+
p[5] = (v >> 40) & 0xff;
|
217
|
+
p[6] = (v >> 48) & 0xff;
|
218
|
+
p[7] = (v >> 56) & 0xff;
|
219
|
+
}
|
220
|
+
#endif
|
221
|
+
|
192
222
|
/* Take a little-endian, 32-byte number and expand it into polynomial form */
|
193
223
|
static void
|
194
224
|
fexpand(limb *output, const u8 *in) {
|
195
|
-
output[0] =
|
196
|
-
output[1] = (
|
197
|
-
output[2] = (
|
198
|
-
output[3] = (
|
199
|
-
output[4] = (
|
225
|
+
output[0] = U8TO64(in) & 0x7ffffffffffff;
|
226
|
+
output[1] = (U8TO64(in+6) >> 3) & 0x7ffffffffffff;
|
227
|
+
output[2] = (U8TO64(in+12) >> 6) & 0x7ffffffffffff;
|
228
|
+
output[3] = (U8TO64(in+19) >> 1) & 0x7ffffffffffff;
|
229
|
+
output[4] = (U8TO64(in+25) >> 4) & 0xfffffffffffff;
|
200
230
|
}
|
201
231
|
|
202
232
|
/* Take a fully reduced polynomial form number and contract it into a
|
@@ -251,10 +281,10 @@ fcontract(u8 *output, const felem input) {
|
|
251
281
|
t[4] += t[3] >> 51; t[3] &= 0x7ffffffffffff;
|
252
282
|
t[4] &= 0x7ffffffffffff;
|
253
283
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
284
|
+
U64TO8(output, t[0] | (t[1] << 51));
|
285
|
+
U64TO8(output + 8, (t[1] >> 13) | (t[2] << 38));
|
286
|
+
U64TO8(output + 16, (t[2] >> 26) | (t[3] << 25));
|
287
|
+
U64TO8(output + 24, (t[3] >> 39) | (t[4] << 12));
|
258
288
|
}
|
259
289
|
|
260
290
|
/* Input: Q, Q', Q-Q'
|
@@ -4,5 +4,5 @@
|
|
4
4
|
#define crypto_scalarmult_curve25519_implementation_name \
|
5
5
|
crypto_scalarmult_curve25519_ref_implementation_name
|
6
6
|
|
7
|
-
#define crypto_scalarmult
|
8
|
-
#define crypto_scalarmult_base
|
7
|
+
#define crypto_scalarmult crypto_scalarmult_curve25519
|
8
|
+
#define crypto_scalarmult_base crypto_scalarmult_curve25519_base
|
@@ -0,0 +1,94 @@
|
|
1
|
+
|
2
|
+
#include <assert.h>
|
3
|
+
#include <limits.h>
|
4
|
+
#include <stdint.h>
|
5
|
+
#include <stdlib.h>
|
6
|
+
#include <string.h>
|
7
|
+
|
8
|
+
#include "crypto_secretbox.h"
|
9
|
+
#include "utils.h"
|
10
|
+
|
11
|
+
int
|
12
|
+
crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
|
13
|
+
unsigned long long mlen, const unsigned char *n,
|
14
|
+
const unsigned char *k)
|
15
|
+
{
|
16
|
+
unsigned char *c_boxed;
|
17
|
+
unsigned char *m_boxed;
|
18
|
+
size_t c_boxed_len;
|
19
|
+
size_t m_boxed_len;
|
20
|
+
int rc;
|
21
|
+
|
22
|
+
if (mlen > SIZE_MAX - crypto_secretbox_ZEROBYTES) {
|
23
|
+
return -1;
|
24
|
+
}
|
25
|
+
(void) sizeof(char[crypto_secretbox_ZEROBYTES >=
|
26
|
+
crypto_secretbox_BOXZEROBYTES ? 1 : -1]);
|
27
|
+
m_boxed_len = (size_t) mlen + crypto_secretbox_ZEROBYTES;
|
28
|
+
if ((m_boxed = (unsigned char *) malloc((size_t) m_boxed_len)) == NULL) {
|
29
|
+
return -1;
|
30
|
+
}
|
31
|
+
c_boxed_len = (size_t) mlen + crypto_secretbox_ZEROBYTES;
|
32
|
+
if ((c_boxed = (unsigned char *) malloc(c_boxed_len)) == NULL) {
|
33
|
+
free(m_boxed);
|
34
|
+
return -1;
|
35
|
+
}
|
36
|
+
memset(m_boxed, 0, crypto_secretbox_ZEROBYTES);
|
37
|
+
memcpy(m_boxed + crypto_secretbox_ZEROBYTES, m, mlen);
|
38
|
+
rc = crypto_secretbox(c_boxed, m_boxed, m_boxed_len, n, k);
|
39
|
+
sodium_memzero(m_boxed, m_boxed_len);
|
40
|
+
free(m_boxed);
|
41
|
+
if (rc != 0) {
|
42
|
+
free(c_boxed);
|
43
|
+
return -1;
|
44
|
+
}
|
45
|
+
assert(m_boxed_len - crypto_secretbox_BOXZEROBYTES ==
|
46
|
+
mlen + crypto_secretbox_MACBYTES);
|
47
|
+
memcpy(c, c_boxed + crypto_secretbox_BOXZEROBYTES,
|
48
|
+
mlen + crypto_secretbox_MACBYTES);
|
49
|
+
free(c_boxed);
|
50
|
+
|
51
|
+
return 0;
|
52
|
+
}
|
53
|
+
|
54
|
+
int
|
55
|
+
crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
|
56
|
+
unsigned long long clen, const unsigned char *n,
|
57
|
+
const unsigned char *k)
|
58
|
+
{
|
59
|
+
unsigned char *c_boxed;
|
60
|
+
unsigned char *m_boxed;
|
61
|
+
size_t c_boxed_len;
|
62
|
+
size_t m_boxed_len;
|
63
|
+
int rc;
|
64
|
+
|
65
|
+
(void) sizeof(int[crypto_secretbox_BOXZEROBYTES + crypto_secretbox_MACBYTES
|
66
|
+
== crypto_secretbox_ZEROBYTES]);
|
67
|
+
if (clen < crypto_secretbox_MACBYTES ||
|
68
|
+
clen > SIZE_MAX - crypto_secretbox_BOXZEROBYTES) {
|
69
|
+
return -1;
|
70
|
+
}
|
71
|
+
c_boxed_len = clen + crypto_secretbox_BOXZEROBYTES;
|
72
|
+
if ((c_boxed = (unsigned char *) malloc(c_boxed_len)) == NULL) {
|
73
|
+
return -1;
|
74
|
+
}
|
75
|
+
memset(c_boxed, 0, crypto_secretbox_BOXZEROBYTES);
|
76
|
+
memcpy(c_boxed + crypto_secretbox_BOXZEROBYTES, c, clen);
|
77
|
+
m_boxed_len = c_boxed_len + crypto_secretbox_MACBYTES;
|
78
|
+
if ((m_boxed = (unsigned char *) malloc(m_boxed_len)) == NULL) {
|
79
|
+
free(c_boxed);
|
80
|
+
return -1;
|
81
|
+
}
|
82
|
+
rc = crypto_secretbox_open(m_boxed, c_boxed,
|
83
|
+
(unsigned long long) c_boxed_len, n, k);
|
84
|
+
free(c_boxed);
|
85
|
+
if (rc != 0) {
|
86
|
+
free(m_boxed);
|
87
|
+
return -1;
|
88
|
+
}
|
89
|
+
memcpy(m, m_boxed + crypto_secretbox_ZEROBYTES,
|
90
|
+
clen - crypto_secretbox_MACBYTES);
|
91
|
+
free(m_boxed);
|
92
|
+
|
93
|
+
return 0;
|
94
|
+
}
|
@@ -7,6 +7,5 @@
|
|
7
7
|
#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
|
8
8
|
#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
|
9
9
|
#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
|
10
|
-
#define crypto_secretbox_PRIMITIVE "xsalsa20poly1305"
|
11
10
|
#define crypto_secretbox_IMPLEMENTATION crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION
|
12
11
|
#define crypto_secretbox_VERSION crypto_secretbox_xsalsa20poly1305_VERSION
|
@@ -20,7 +20,7 @@ crypto_secretbox_xsalsa20poly1305_boxzerobytes(void) {
|
|
20
20
|
return crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
|
21
21
|
}
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
return
|
23
|
+
size_t
|
24
|
+
crypto_secretbox_xsalsa20poly1305_macbytes(void) {
|
25
|
+
return crypto_secretbox_xsalsa20poly1305_MACBYTES;
|
26
26
|
}
|
@@ -3,6 +3,5 @@
|
|
3
3
|
|
4
4
|
#define crypto_shorthash crypto_shorthash_siphash24
|
5
5
|
#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES
|
6
|
-
#define crypto_shorthash_PRIMITIVE "siphash24"
|
7
6
|
#define crypto_shorthash_IMPLEMENTATION crypto_shorthash_siphash24_IMPLEMENTATION
|
8
7
|
#define crypto_shorthash_VERSION crypto_shorthash_siphash24_VERSION
|
@@ -5,7 +5,7 @@ crypto_shorthash_siphash24_bytes(void) {
|
|
5
5
|
return crypto_shorthash_siphash24_BYTES;
|
6
6
|
}
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
return
|
8
|
+
size_t
|
9
|
+
crypto_shorthash_siphash24_keybytes(void) {
|
10
|
+
return crypto_shorthash_siphash24_KEYBYTES;
|
11
11
|
}
|
@@ -9,6 +9,5 @@
|
|
9
9
|
#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
|
10
10
|
#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
|
11
11
|
#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
|
12
|
-
#define crypto_sign_PRIMITIVE "ed25519"
|
13
12
|
#define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION
|
14
13
|
#define crypto_sign_VERSION crypto_sign_ed25519_VERSION
|
@@ -1,3 +1,6 @@
|
|
1
|
+
|
2
|
+
#include <string.h>
|
3
|
+
|
1
4
|
#include "api.h"
|
2
5
|
#include "randombytes.h"
|
3
6
|
#include "crypto_hash_sha512.h"
|
@@ -7,7 +10,6 @@ int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
|
|
7
10
|
const unsigned char *seed)
|
8
11
|
{
|
9
12
|
ge_p3 A;
|
10
|
-
int i;
|
11
13
|
|
12
14
|
crypto_hash_sha512(sk,seed,32);
|
13
15
|
sk[0] &= 248;
|
@@ -17,8 +19,8 @@ int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
|
|
17
19
|
ge_scalarmult_base(&A,sk);
|
18
20
|
ge_p3_tobytes(pk,&A);
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
memmove(sk, seed, 32);
|
23
|
+
memmove(sk + 32, pk, 32);
|
22
24
|
return 0;
|
23
25
|
}
|
24
26
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
|
2
|
+
#include <string.h>
|
3
|
+
|
1
4
|
#include "api.h"
|
2
5
|
#include "crypto_hash_sha512.h"
|
3
6
|
#include "crypto_verify_32.h"
|
@@ -10,31 +13,38 @@ int crypto_sign_open(
|
|
10
13
|
const unsigned char *pk
|
11
14
|
)
|
12
15
|
{
|
16
|
+
crypto_hash_sha512_state hs;
|
13
17
|
unsigned char h[64];
|
14
|
-
unsigned char
|
18
|
+
unsigned char rcheck[32];
|
19
|
+
unsigned int i;
|
20
|
+
unsigned char d = 0;
|
15
21
|
ge_p3 A;
|
16
22
|
ge_p2 R;
|
17
|
-
unsigned long long i;
|
18
23
|
|
19
|
-
|
20
|
-
if (
|
21
|
-
if (
|
22
|
-
|
24
|
+
if (smlen < 64) goto badsig;
|
25
|
+
if (sm[63] & 224) goto badsig;
|
26
|
+
if (ge_frombytes_negate_vartime(&A,pk) != 0) goto badsig;
|
27
|
+
|
28
|
+
for (i = 0; i < 32; ++i) d |= pk[i];
|
29
|
+
if (d == 0) return -1;
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
|
31
|
+
crypto_hash_sha512_init(&hs);
|
32
|
+
crypto_hash_sha512_update(&hs, sm, 32);
|
33
|
+
crypto_hash_sha512_update(&hs, pk, 32);
|
34
|
+
crypto_hash_sha512_update(&hs, sm + 64, smlen - 64);
|
35
|
+
crypto_hash_sha512_final(&hs, h);
|
27
36
|
sc_reduce(h);
|
28
37
|
|
29
|
-
ge_double_scalarmult_vartime(&R,h,&A,sm
|
30
|
-
ge_tobytes(
|
31
|
-
if (crypto_verify_32(
|
32
|
-
|
33
|
-
|
38
|
+
ge_double_scalarmult_vartime(&R,h,&A,sm+32);
|
39
|
+
ge_tobytes(rcheck,&R);
|
40
|
+
if (crypto_verify_32(rcheck,sm) == 0) {
|
41
|
+
memmove(m, sm + 64,smlen - 64);
|
42
|
+
*mlen = smlen - 64;
|
43
|
+
return 0;
|
34
44
|
}
|
35
45
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
return
|
46
|
+
badsig:
|
47
|
+
*mlen = 0;
|
48
|
+
memset(m, 0, smlen - 64);
|
49
|
+
return -1;
|
40
50
|
}
|