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,10 @@
|
|
1
|
+
#include "api.h"
|
2
|
+
#include "crypto_verify_64.h"
|
3
|
+
|
4
|
+
int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
|
5
|
+
unsigned long long inlen, const unsigned char *k)
|
6
|
+
{
|
7
|
+
unsigned char correct[64];
|
8
|
+
crypto_auth(correct,in,inlen,k);
|
9
|
+
return crypto_verify_64(h,correct);
|
10
|
+
}
|
@@ -5,6 +5,5 @@
|
|
5
5
|
#define crypto_auth_verify crypto_auth_hmacsha512256_verify
|
6
6
|
#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
|
7
7
|
#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
|
8
|
-
#define crypto_auth_PRIMITIVE "hmacsha512256"
|
9
8
|
#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512256_IMPLEMENTATION
|
10
9
|
#define crypto_auth_VERSION crypto_auth_hmacsha512256_VERSION
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
#include "api.h"
|
3
|
+
#include "crypto_auth_hmacsha512256.h"
|
4
|
+
#include "crypto_auth_hmacsha512.h"
|
5
|
+
#include "crypto_hash_sha512.h"
|
6
|
+
#include "utils.h"
|
7
|
+
|
8
|
+
#include <sys/types.h>
|
9
|
+
|
10
|
+
#include <stdint.h>
|
11
|
+
#include <string.h>
|
12
|
+
|
13
|
+
int
|
14
|
+
crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
|
15
|
+
const unsigned char *key,
|
16
|
+
size_t keylen)
|
17
|
+
{
|
18
|
+
return crypto_auth_hmacsha512_init((crypto_auth_hmacsha512_state *) state,
|
19
|
+
key, keylen);
|
20
|
+
}
|
21
|
+
|
22
|
+
int
|
23
|
+
crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
|
24
|
+
const unsigned char *in,
|
25
|
+
unsigned long long inlen)
|
26
|
+
{
|
27
|
+
return crypto_auth_hmacsha512_update((crypto_auth_hmacsha512_state *) state,
|
28
|
+
in, inlen);
|
29
|
+
}
|
30
|
+
|
31
|
+
int
|
32
|
+
crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
|
33
|
+
unsigned char *out)
|
34
|
+
{
|
35
|
+
unsigned char out0[64];
|
36
|
+
|
37
|
+
crypto_auth_hmacsha512_final((crypto_auth_hmacsha512_state *) state, out0);
|
38
|
+
memcpy(out, out0, 32);
|
39
|
+
|
40
|
+
return 0;
|
41
|
+
}
|
42
|
+
|
43
|
+
int
|
44
|
+
crypto_auth(unsigned char *out, const unsigned char *in,
|
45
|
+
unsigned long long inlen, const unsigned char *k)
|
46
|
+
{
|
47
|
+
crypto_auth_hmacsha512256_state state;
|
48
|
+
|
49
|
+
crypto_auth_hmacsha512256_init(&state, k, crypto_auth_KEYBYTES);
|
50
|
+
crypto_auth_hmacsha512256_update(&state, in, inlen);
|
51
|
+
crypto_auth_hmacsha512256_final(&state, out);
|
52
|
+
|
53
|
+
return 0;
|
54
|
+
}
|
data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/{ref → cp}/verify_hmacsha512256.c
RENAMED
@@ -1,7 +1,8 @@
|
|
1
1
|
#include "api.h"
|
2
2
|
#include "crypto_verify_32.h"
|
3
3
|
|
4
|
-
int crypto_auth_verify(const unsigned char *h,const unsigned char *in,
|
4
|
+
int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
|
5
|
+
unsigned long long inlen, const unsigned char *k)
|
5
6
|
{
|
6
7
|
unsigned char correct[32];
|
7
8
|
crypto_auth(correct,in,inlen,k);
|
@@ -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_box.h"
|
9
|
+
#include "utils.h"
|
10
|
+
|
11
|
+
int
|
12
|
+
crypto_box_easy(unsigned char *c, const unsigned char *m,
|
13
|
+
unsigned long long mlen, const unsigned char *n,
|
14
|
+
const unsigned char *pk, const unsigned char *sk)
|
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_box_ZEROBYTES) {
|
23
|
+
return -1;
|
24
|
+
}
|
25
|
+
(void) sizeof(char[crypto_box_ZEROBYTES >=
|
26
|
+
crypto_box_BOXZEROBYTES ? 1 : -1]);
|
27
|
+
m_boxed_len = (size_t) mlen + crypto_box_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_box_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_box_ZEROBYTES);
|
37
|
+
sodium_mlock(m_boxed, m_boxed_len);
|
38
|
+
memcpy(m_boxed + crypto_box_ZEROBYTES, m, mlen);
|
39
|
+
rc = crypto_box(c_boxed, m_boxed, m_boxed_len, n, pk, sk);
|
40
|
+
sodium_munlock(m_boxed, m_boxed_len);
|
41
|
+
free(m_boxed);
|
42
|
+
if (rc != 0) {
|
43
|
+
free(c_boxed);
|
44
|
+
return -1;
|
45
|
+
}
|
46
|
+
assert(m_boxed_len - crypto_box_BOXZEROBYTES ==
|
47
|
+
mlen + crypto_box_MACBYTES);
|
48
|
+
memcpy(c, c_boxed + crypto_box_BOXZEROBYTES, mlen + crypto_box_MACBYTES);
|
49
|
+
free(c_boxed);
|
50
|
+
|
51
|
+
return 0;
|
52
|
+
}
|
53
|
+
|
54
|
+
int
|
55
|
+
crypto_box_open_easy(unsigned char *m, const unsigned char *c,
|
56
|
+
unsigned long long clen, const unsigned char *n,
|
57
|
+
const unsigned char *pk, const unsigned char *sk)
|
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
|
+
if (clen < crypto_box_MACBYTES ||
|
66
|
+
clen > SIZE_MAX - crypto_box_BOXZEROBYTES) {
|
67
|
+
return -1;
|
68
|
+
}
|
69
|
+
c_boxed_len = clen + crypto_box_BOXZEROBYTES;
|
70
|
+
if ((c_boxed = (unsigned char *) malloc(c_boxed_len)) == NULL) {
|
71
|
+
return -1;
|
72
|
+
}
|
73
|
+
memset(c_boxed, 0, crypto_box_BOXZEROBYTES);
|
74
|
+
memcpy(c_boxed + crypto_box_BOXZEROBYTES, c, clen);
|
75
|
+
m_boxed_len = c_boxed_len + crypto_box_MACBYTES;
|
76
|
+
if ((m_boxed = (unsigned char *) malloc(m_boxed_len)) == NULL) {
|
77
|
+
free(c_boxed);
|
78
|
+
return -1;
|
79
|
+
}
|
80
|
+
sodium_mlock(m_boxed, m_boxed_len);
|
81
|
+
rc = crypto_box_open(m_boxed, c_boxed,
|
82
|
+
(unsigned long long) c_boxed_len, n, pk, sk);
|
83
|
+
free(c_boxed);
|
84
|
+
if (rc != 0) {
|
85
|
+
sodium_munlock(m_boxed, m_boxed_len);
|
86
|
+
free(m_boxed);
|
87
|
+
return -1;
|
88
|
+
}
|
89
|
+
memcpy(m, m_boxed + crypto_box_ZEROBYTES, clen - crypto_box_MACBYTES);
|
90
|
+
sodium_munlock(m_boxed, m_boxed_len);
|
91
|
+
free(m_boxed);
|
92
|
+
|
93
|
+
return 0;
|
94
|
+
}
|
@@ -14,6 +14,5 @@
|
|
14
14
|
#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
|
15
15
|
#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
|
16
16
|
#define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES)
|
17
|
-
#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
|
18
17
|
#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION
|
19
18
|
#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION
|
@@ -6,6 +6,5 @@
|
|
6
6
|
#define crypto_core_INPUTBYTES crypto_core_hsalsa20_INPUTBYTES
|
7
7
|
#define crypto_core_KEYBYTES crypto_core_hsalsa20_KEYBYTES
|
8
8
|
#define crypto_core_CONSTBYTES crypto_core_hsalsa20_CONSTBYTES
|
9
|
-
#define crypto_core_PRIMITIVE "hsalsa20"
|
10
9
|
#define crypto_core_IMPLEMENTATION crypto_core_hsalsa20_IMPLEMENTATION
|
11
10
|
#define crypto_core_VERSION crypto_core_hsalsa20_VERSION
|
@@ -6,6 +6,5 @@
|
|
6
6
|
#define crypto_core_INPUTBYTES crypto_core_salsa20_INPUTBYTES
|
7
7
|
#define crypto_core_KEYBYTES crypto_core_salsa20_KEYBYTES
|
8
8
|
#define crypto_core_CONSTBYTES crypto_core_salsa20_CONSTBYTES
|
9
|
-
#define crypto_core_PRIMITIVE "salsa20"
|
10
9
|
#define crypto_core_IMPLEMENTATION crypto_core_salsa20_IMPLEMENTATION
|
11
10
|
#define crypto_core_VERSION crypto_core_salsa20_VERSION
|
@@ -6,6 +6,5 @@
|
|
6
6
|
#define crypto_core_INPUTBYTES crypto_core_salsa2012_INPUTBYTES
|
7
7
|
#define crypto_core_KEYBYTES crypto_core_salsa2012_KEYBYTES
|
8
8
|
#define crypto_core_CONSTBYTES crypto_core_salsa2012_CONSTBYTES
|
9
|
-
#define crypto_core_PRIMITIVE "salsa2012"
|
10
9
|
#define crypto_core_IMPLEMENTATION crypto_core_salsa2012_IMPLEMENTATION
|
11
10
|
#define crypto_core_VERSION crypto_core_salsa2012_VERSION
|
@@ -6,6 +6,5 @@
|
|
6
6
|
#define crypto_core_INPUTBYTES crypto_core_salsa208_INPUTBYTES
|
7
7
|
#define crypto_core_KEYBYTES crypto_core_salsa208_KEYBYTES
|
8
8
|
#define crypto_core_CONSTBYTES crypto_core_salsa208_CONSTBYTES
|
9
|
-
#define crypto_core_PRIMITIVE "salsa208"
|
10
9
|
#define crypto_core_IMPLEMENTATION crypto_core_salsa208_IMPLEMENTATION
|
11
10
|
#define crypto_core_VERSION crypto_core_salsa208_VERSION
|
@@ -10,6 +10,11 @@ crypto_generichash_blake2b_bytes_max(void) {
|
|
10
10
|
return crypto_generichash_blake2b_BYTES_MAX;
|
11
11
|
}
|
12
12
|
|
13
|
+
size_t
|
14
|
+
crypto_generichash_blake2b_bytes(void) {
|
15
|
+
return crypto_generichash_blake2b_BYTES;
|
16
|
+
}
|
17
|
+
|
13
18
|
size_t
|
14
19
|
crypto_generichash_blake2b_keybytes_min(void) {
|
15
20
|
return crypto_generichash_blake2b_KEYBYTES_MIN;
|
@@ -21,11 +26,16 @@ crypto_generichash_blake2b_keybytes_max(void) {
|
|
21
26
|
}
|
22
27
|
|
23
28
|
size_t
|
24
|
-
|
25
|
-
return
|
29
|
+
crypto_generichash_blake2b_keybytes(void) {
|
30
|
+
return crypto_generichash_blake2b_KEYBYTES;
|
26
31
|
}
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
return
|
33
|
+
size_t
|
34
|
+
crypto_generichash_blake2b_saltbytes(void) {
|
35
|
+
return crypto_generichash_blake2b_SALTBYTES;
|
36
|
+
}
|
37
|
+
|
38
|
+
size_t
|
39
|
+
crypto_generichash_blake2b_personalbytes(void) {
|
40
|
+
return crypto_generichash_blake2b_PERSONALBYTES;
|
31
41
|
}
|
@@ -19,12 +19,15 @@
|
|
19
19
|
|
20
20
|
#include "crypto_generichash_blake2b.h"
|
21
21
|
|
22
|
-
#define blake2b_init_param
|
23
|
-
#define blake2b_init
|
24
|
-
#define
|
25
|
-
#define
|
26
|
-
#define
|
27
|
-
#define
|
22
|
+
#define blake2b_init_param crypto_generichash_blake2b__init_param
|
23
|
+
#define blake2b_init crypto_generichash_blake2b__init
|
24
|
+
#define blake2b_init_salt_personal crypto_generichash_blake2b__init_salt_personal
|
25
|
+
#define blake2b_init_key crypto_generichash_blake2b__init_key
|
26
|
+
#define blake2b_init_key_salt_personal crypto_generichash_blake2b__init_key_salt_personal
|
27
|
+
#define blake2b_update crypto_generichash_blake2b__update
|
28
|
+
#define blake2b_final crypto_generichash_blake2b__final
|
29
|
+
#define blake2b crypto_generichash_blake2b__blake2b
|
30
|
+
#define blake2b_salt_personal crypto_generichash_blake2b__blake2b_salt_personal
|
28
31
|
|
29
32
|
#if defined(_MSC_VER)
|
30
33
|
#define ALIGN(x) __declspec(align(x))
|
@@ -134,7 +137,11 @@ typedef crypto_generichash_blake2b_state blake2b_state;
|
|
134
137
|
int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen );
|
135
138
|
|
136
139
|
int blake2b_init( blake2b_state *S, const uint8_t outlen );
|
140
|
+
int blake2b_init_salt_personal( blake2b_state *S, const uint8_t outlen,
|
141
|
+
const void *personal, const void *salt );
|
137
142
|
int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
|
143
|
+
int blake2b_init_key_salt_personal( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen,
|
144
|
+
const void *salt, const void *personal );
|
138
145
|
int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
|
139
146
|
int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen );
|
140
147
|
int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen );
|
@@ -152,6 +159,7 @@ typedef crypto_generichash_blake2b_state blake2b_state;
|
|
152
159
|
// Simple API
|
153
160
|
int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
|
154
161
|
int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
|
162
|
+
int blake2b_salt_personal( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen, const void *salt, const void *personal );
|
155
163
|
|
156
164
|
int blake2sp( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
|
157
165
|
int blake2bp( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
|
@@ -184,6 +184,34 @@ int blake2b_init( blake2b_state *S, const uint8_t outlen )
|
|
184
184
|
return blake2b_init_param( S, P );
|
185
185
|
}
|
186
186
|
|
187
|
+
int blake2b_init_salt_personal( blake2b_state *S, const uint8_t outlen,
|
188
|
+
const void *salt, const void *personal )
|
189
|
+
{
|
190
|
+
blake2b_param P[1];
|
191
|
+
|
192
|
+
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
|
193
|
+
|
194
|
+
P->digest_length = outlen;
|
195
|
+
P->key_length = 0;
|
196
|
+
P->fanout = 1;
|
197
|
+
P->depth = 1;
|
198
|
+
store32( &P->leaf_length, 0 );
|
199
|
+
store64( &P->node_offset, 0 );
|
200
|
+
P->node_depth = 0;
|
201
|
+
P->inner_length = 0;
|
202
|
+
memset( P->reserved, 0, sizeof( P->reserved ) );
|
203
|
+
if (salt != NULL) {
|
204
|
+
blake2b_param_set_salt( P, (const uint8_t *) salt );
|
205
|
+
} else {
|
206
|
+
memset( P->salt, 0, sizeof( P->salt ) );
|
207
|
+
}
|
208
|
+
if (personal != NULL) {
|
209
|
+
blake2b_param_set_personal( P, (const uint8_t *) personal );
|
210
|
+
} else {
|
211
|
+
memset( P->personal, 0, sizeof( P->personal ) );
|
212
|
+
}
|
213
|
+
return blake2b_init_param( S, P );
|
214
|
+
}
|
187
215
|
|
188
216
|
int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen )
|
189
217
|
{
|
@@ -217,6 +245,47 @@ int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, c
|
|
217
245
|
return 0;
|
218
246
|
}
|
219
247
|
|
248
|
+
int blake2b_init_key_salt_personal( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen,
|
249
|
+
const void *salt, const void *personal )
|
250
|
+
{
|
251
|
+
blake2b_param P[1];
|
252
|
+
|
253
|
+
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
|
254
|
+
|
255
|
+
if ( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
|
256
|
+
|
257
|
+
P->digest_length = outlen;
|
258
|
+
P->key_length = keylen;
|
259
|
+
P->fanout = 1;
|
260
|
+
P->depth = 1;
|
261
|
+
store32( &P->leaf_length, 0 );
|
262
|
+
store64( &P->node_offset, 0 );
|
263
|
+
P->node_depth = 0;
|
264
|
+
P->inner_length = 0;
|
265
|
+
memset( P->reserved, 0, sizeof( P->reserved ) );
|
266
|
+
if (salt != NULL) {
|
267
|
+
blake2b_param_set_salt( P, (const uint8_t *) salt );
|
268
|
+
} else {
|
269
|
+
memset( P->salt, 0, sizeof( P->salt ) );
|
270
|
+
}
|
271
|
+
if (personal != NULL) {
|
272
|
+
blake2b_param_set_personal( P, (const uint8_t *) personal );
|
273
|
+
} else {
|
274
|
+
memset( P->personal, 0, sizeof( P->personal ) );
|
275
|
+
}
|
276
|
+
|
277
|
+
if( blake2b_init_param( S, P ) < 0 ) return -1;
|
278
|
+
|
279
|
+
{
|
280
|
+
uint8_t block[BLAKE2B_BLOCKBYTES];
|
281
|
+
memset( block, 0, BLAKE2B_BLOCKBYTES );
|
282
|
+
memcpy( block, key, keylen );
|
283
|
+
blake2b_update( S, block, BLAKE2B_BLOCKBYTES );
|
284
|
+
secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
|
285
|
+
}
|
286
|
+
return 0;
|
287
|
+
}
|
288
|
+
|
220
289
|
static int blake2b_compress( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] )
|
221
290
|
{
|
222
291
|
uint64_t m[16];
|
@@ -362,3 +431,29 @@ int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen
|
|
362
431
|
blake2b_final( S, out, outlen );
|
363
432
|
return 0;
|
364
433
|
}
|
434
|
+
|
435
|
+
int blake2b_salt_personal( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen,
|
436
|
+
const void *salt, const void *personal )
|
437
|
+
{
|
438
|
+
blake2b_state S[1];
|
439
|
+
|
440
|
+
/* Verify parameters */
|
441
|
+
if ( NULL == in ) return -1;
|
442
|
+
|
443
|
+
if ( NULL == out ) return -1;
|
444
|
+
|
445
|
+
if( NULL == key ) keylen = 0;
|
446
|
+
|
447
|
+
if( keylen > 0 )
|
448
|
+
{
|
449
|
+
if( blake2b_init_key_salt_personal( S, outlen, key, keylen, salt, personal ) < 0 ) return -1;
|
450
|
+
}
|
451
|
+
else
|
452
|
+
{
|
453
|
+
if( blake2b_init_salt_personal( S, outlen, salt, personal ) < 0 ) return -1;
|
454
|
+
}
|
455
|
+
|
456
|
+
blake2b_update( S, ( const uint8_t * )in, inlen );
|
457
|
+
blake2b_final( S, out, outlen );
|
458
|
+
return 0;
|
459
|
+
}
|