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
@@ -1,10 +1,17 @@
|
|
1
|
-
|
1
|
+
#ifndef __STDC_WANT_LIB_EXT1__
|
2
|
+
# define __STDC_WANT_LIB_EXT1__ 1
|
3
|
+
#endif
|
4
|
+
#include <errno.h>
|
2
5
|
#include <limits.h>
|
3
6
|
#include <stddef.h>
|
4
7
|
#include <stdint.h>
|
5
8
|
#include <stdlib.h>
|
6
9
|
#include <string.h>
|
7
10
|
|
11
|
+
#ifdef HAVE_SYS_MMAN_H
|
12
|
+
# include <sys/mman.h>
|
13
|
+
#endif
|
14
|
+
|
8
15
|
#include "utils.h"
|
9
16
|
#include "randombytes.h"
|
10
17
|
#ifdef _WIN32
|
@@ -17,6 +24,12 @@ sodium_memzero(void * const pnt, const size_t len)
|
|
17
24
|
{
|
18
25
|
#ifdef HAVE_SECUREZEROMEMORY
|
19
26
|
SecureZeroMemory(pnt, len);
|
27
|
+
#elif defined(HAVE_MEMSET_S)
|
28
|
+
if (memset_s(pnt, (rsize_t) len, 0, (rsize_t) len) != 0) {
|
29
|
+
abort();
|
30
|
+
}
|
31
|
+
#elif defined(HAVE_EXPLICIT_BZERO)
|
32
|
+
explicit_bzero(pnt, len);
|
20
33
|
#else
|
21
34
|
volatile unsigned char *pnt_ = (volatile unsigned char *) pnt;
|
22
35
|
size_t i = (size_t) 0U;
|
@@ -28,17 +41,17 @@ sodium_memzero(void * const pnt, const size_t len)
|
|
28
41
|
}
|
29
42
|
|
30
43
|
int
|
31
|
-
sodium_memcmp(const void * const b1_, const void * const b2_, size_t
|
44
|
+
sodium_memcmp(const void * const b1_, const void * const b2_, size_t len)
|
32
45
|
{
|
33
46
|
const unsigned char *b1 = (const unsigned char *) b1_;
|
34
47
|
const unsigned char *b2 = (const unsigned char *) b2_;
|
35
48
|
size_t i;
|
36
49
|
unsigned char d = (unsigned char) 0U;
|
37
50
|
|
38
|
-
for (i = 0U; i <
|
51
|
+
for (i = 0U; i < len; i++) {
|
39
52
|
d |= b1[i] ^ b2[i];
|
40
53
|
}
|
41
|
-
return (int) d;
|
54
|
+
return (int) ((1 & ((d - 1) >> 8)) - 1);
|
42
55
|
}
|
43
56
|
|
44
57
|
unsigned char *
|
@@ -70,8 +83,8 @@ _sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len)
|
|
70
83
|
}
|
71
84
|
|
72
85
|
char *
|
73
|
-
sodium_bin2hex(char * const hex, const size_t
|
74
|
-
const unsigned char *bin, const size_t
|
86
|
+
sodium_bin2hex(char * const hex, const size_t hex_maxlen,
|
87
|
+
const unsigned char * const bin, const size_t bin_len)
|
75
88
|
{
|
76
89
|
static const char hexdigits[16] = {
|
77
90
|
'0', '1', '2', '3', '4', '5', '6', '7',
|
@@ -80,10 +93,10 @@ sodium_bin2hex(char * const hex, const size_t hexlen,
|
|
80
93
|
size_t i = (size_t) 0U;
|
81
94
|
size_t j = (size_t) 0U;
|
82
95
|
|
83
|
-
if (
|
96
|
+
if (bin_len >= SIZE_MAX / 2 || hex_maxlen < bin_len * 2U) {
|
84
97
|
abort();
|
85
98
|
}
|
86
|
-
while (i <
|
99
|
+
while (i < bin_len) {
|
87
100
|
hex[j++] = hexdigits[bin[i] >> 4];
|
88
101
|
hex[j++] = hexdigits[bin[i] & 0xf];
|
89
102
|
i++;
|
@@ -92,3 +105,82 @@ sodium_bin2hex(char * const hex, const size_t hexlen,
|
|
92
105
|
|
93
106
|
return hex;
|
94
107
|
}
|
108
|
+
|
109
|
+
int
|
110
|
+
sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen,
|
111
|
+
const char * const hex, const size_t hex_len,
|
112
|
+
const char * const ignore, size_t * const bin_len,
|
113
|
+
const char ** const hex_end)
|
114
|
+
{
|
115
|
+
size_t bin_pos = (size_t) 0U;
|
116
|
+
size_t hex_pos = (size_t) 0U;
|
117
|
+
int ret = 0;
|
118
|
+
unsigned char c;
|
119
|
+
unsigned char c_acc = 0U;
|
120
|
+
unsigned char c_num;
|
121
|
+
unsigned char c_val;
|
122
|
+
unsigned char state = 0U;
|
123
|
+
|
124
|
+
while (hex_pos < hex_len) {
|
125
|
+
c = (unsigned char) hex[hex_pos];
|
126
|
+
if ((c_num = c ^ 48U) < 10U) {
|
127
|
+
c_val = c_num;
|
128
|
+
} else if ((c_num = (c & ~32U)) > 64 && c_num < 71U) {
|
129
|
+
c_val = c_num - 55U;
|
130
|
+
} else if (ignore != NULL && strchr(ignore, c) != NULL && state == 0U) {
|
131
|
+
hex_pos++;
|
132
|
+
continue;
|
133
|
+
} else {
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
if (bin_pos >= bin_maxlen) {
|
137
|
+
ret = -1;
|
138
|
+
errno = ERANGE;
|
139
|
+
break;
|
140
|
+
}
|
141
|
+
if (state == 0U) {
|
142
|
+
c_acc = c_val * 16U;
|
143
|
+
} else {
|
144
|
+
bin[bin_pos++] = c_acc | c_val;
|
145
|
+
}
|
146
|
+
state = ~state;
|
147
|
+
hex_pos++;
|
148
|
+
}
|
149
|
+
if (state != 0U) {
|
150
|
+
hex_pos--;
|
151
|
+
}
|
152
|
+
if (hex_end != NULL) {
|
153
|
+
*hex_end = &hex[hex_pos];
|
154
|
+
}
|
155
|
+
if (bin_len != NULL) {
|
156
|
+
*bin_len = bin_pos;
|
157
|
+
}
|
158
|
+
return ret;
|
159
|
+
}
|
160
|
+
|
161
|
+
int
|
162
|
+
sodium_mlock(void * const addr, const size_t len)
|
163
|
+
{
|
164
|
+
#ifdef HAVE_MLOCK
|
165
|
+
return mlock(addr, len);
|
166
|
+
#elif defined(HAVE_VIRTUALLOCK)
|
167
|
+
return -(VirtualLock(addr, len) == 0);
|
168
|
+
#else
|
169
|
+
errno = ENOSYS;
|
170
|
+
return -1;
|
171
|
+
#endif
|
172
|
+
}
|
173
|
+
|
174
|
+
int
|
175
|
+
sodium_munlock(void * const addr, const size_t len)
|
176
|
+
{
|
177
|
+
sodium_memzero(addr, len);
|
178
|
+
#ifdef HAVE_MLOCK
|
179
|
+
return munlock(addr, len);
|
180
|
+
#elif defined(HAVE_VIRTUALLOCK)
|
181
|
+
return -(VirtualUnlock(addr, len) == 0);
|
182
|
+
#else
|
183
|
+
errno = ENOSYS;
|
184
|
+
return -1;
|
185
|
+
#endif
|
186
|
+
}
|
@@ -6,10 +6,14 @@ EXTRA_DIST = \
|
|
6
6
|
auth2.exp \
|
7
7
|
auth3.exp \
|
8
8
|
auth5.exp \
|
9
|
+
auth6.exp \
|
10
|
+
auth7.exp \
|
9
11
|
box.exp \
|
10
12
|
box2.exp \
|
11
13
|
box7.exp \
|
12
14
|
box8.exp \
|
15
|
+
box_easy.exp \
|
16
|
+
box_easy2.exp \
|
13
17
|
core1.exp \
|
14
18
|
core2.exp \
|
15
19
|
core3.exp \
|
@@ -18,12 +22,14 @@ EXTRA_DIST = \
|
|
18
22
|
core6.exp \
|
19
23
|
generichash.exp \
|
20
24
|
generichash2.exp \
|
25
|
+
generichash3.exp \
|
21
26
|
hash.exp \
|
22
27
|
hash2.exp \
|
23
28
|
hash3.exp \
|
24
29
|
onetimeauth.exp \
|
25
30
|
onetimeauth2.exp \
|
26
31
|
onetimeauth7.exp \
|
32
|
+
pwhash.exp \
|
27
33
|
scalarmult.exp \
|
28
34
|
scalarmult2.exp \
|
29
35
|
scalarmult5.exp \
|
@@ -34,7 +40,10 @@ EXTRA_DIST = \
|
|
34
40
|
secretbox2.exp \
|
35
41
|
secretbox7.exp \
|
36
42
|
secretbox8.exp \
|
43
|
+
secretbox_easy.exp \
|
44
|
+
secretbox_easy2.exp \
|
37
45
|
shorthash.exp \
|
46
|
+
sign.exp \
|
38
47
|
sodium_core.exp \
|
39
48
|
sodium_utils.exp \
|
40
49
|
sodium_version.exp \
|
@@ -43,17 +52,22 @@ EXTRA_DIST = \
|
|
43
52
|
stream3.exp \
|
44
53
|
stream4.exp \
|
45
54
|
stream5.exp \
|
46
|
-
stream6.exp
|
55
|
+
stream6.exp \
|
56
|
+
verify1.exp
|
47
57
|
|
48
58
|
DISTCLEANFILES = \
|
49
59
|
auth.res \
|
50
60
|
auth2.res \
|
51
61
|
auth3.res \
|
52
62
|
auth5.res \
|
63
|
+
auth6.res \
|
64
|
+
auth7.res \
|
53
65
|
box.res \
|
54
66
|
box2.res \
|
55
67
|
box7.res \
|
56
68
|
box8.res \
|
69
|
+
box_easy.res \
|
70
|
+
box_easy2.res \
|
57
71
|
core1.res \
|
58
72
|
core2.res \
|
59
73
|
core3.res \
|
@@ -62,12 +76,14 @@ DISTCLEANFILES = \
|
|
62
76
|
core6.res \
|
63
77
|
generichash.res \
|
64
78
|
generichash2.res \
|
79
|
+
generichash3.res \
|
65
80
|
hash.res \
|
66
81
|
hash2.res \
|
67
82
|
hash3.res \
|
68
83
|
onetimeauth.res \
|
69
84
|
onetimeauth2.res \
|
70
85
|
onetimeauth7.res \
|
86
|
+
pwhash.res \
|
71
87
|
scalarmult.res \
|
72
88
|
scalarmult2.res \
|
73
89
|
scalarmult5.res \
|
@@ -78,7 +94,10 @@ DISTCLEANFILES = \
|
|
78
94
|
secretbox2.res \
|
79
95
|
secretbox7.res \
|
80
96
|
secretbox8.res \
|
97
|
+
secretbox_easy.res \
|
98
|
+
secretbox_easy2.res \
|
81
99
|
shorthash.res \
|
100
|
+
sign.res \
|
82
101
|
sodium_core.res \
|
83
102
|
sodium_utils.res \
|
84
103
|
sodium_version.res \
|
@@ -87,7 +106,8 @@ DISTCLEANFILES = \
|
|
87
106
|
stream3.res \
|
88
107
|
stream4.res \
|
89
108
|
stream5.res \
|
90
|
-
stream6.res
|
109
|
+
stream6.res \
|
110
|
+
verify1.res
|
91
111
|
|
92
112
|
AM_CPPFLAGS = \
|
93
113
|
-DTEST_SRCDIR=\"@srcdir@\" \
|
@@ -102,10 +122,14 @@ TESTS_TARGETS = \
|
|
102
122
|
auth2 \
|
103
123
|
auth3 \
|
104
124
|
auth5 \
|
125
|
+
auth6 \
|
126
|
+
auth7 \
|
105
127
|
box \
|
106
128
|
box2 \
|
107
129
|
box7 \
|
108
130
|
box8 \
|
131
|
+
box_easy \
|
132
|
+
box_easy2 \
|
109
133
|
core1 \
|
110
134
|
core2 \
|
111
135
|
core3 \
|
@@ -114,11 +138,13 @@ TESTS_TARGETS = \
|
|
114
138
|
core6 \
|
115
139
|
generichash \
|
116
140
|
generichash2 \
|
141
|
+
generichash3 \
|
117
142
|
hash \
|
118
143
|
hash3 \
|
119
144
|
onetimeauth \
|
120
145
|
onetimeauth2 \
|
121
146
|
onetimeauth7 \
|
147
|
+
pwhash \
|
122
148
|
randombytes \
|
123
149
|
scalarmult \
|
124
150
|
scalarmult2 \
|
@@ -130,7 +156,10 @@ TESTS_TARGETS = \
|
|
130
156
|
secretbox2 \
|
131
157
|
secretbox7 \
|
132
158
|
secretbox8 \
|
159
|
+
secretbox_easy \
|
160
|
+
secretbox_easy2 \
|
133
161
|
shorthash \
|
162
|
+
sign \
|
134
163
|
sodium_core \
|
135
164
|
sodium_utils \
|
136
165
|
sodium_version \
|
@@ -139,7 +168,8 @@ TESTS_TARGETS = \
|
|
139
168
|
stream3 \
|
140
169
|
stream4 \
|
141
170
|
stream5 \
|
142
|
-
stream6
|
171
|
+
stream6 \
|
172
|
+
verify1
|
143
173
|
|
144
174
|
check_PROGRAMS = $(TESTS_TARGETS)
|
145
175
|
|
@@ -160,6 +190,12 @@ auth3_LDADD = $(TESTS_LDADD)
|
|
160
190
|
auth5_SOURCE = cmptest.h auth5.c windows/windows-quirks.h
|
161
191
|
auth5_LDADD = $(TESTS_LDADD)
|
162
192
|
|
193
|
+
auth6_SOURCE = cmptest.h auth6.c windows/windows-quirks.h
|
194
|
+
auth6_LDADD = $(TESTS_LDADD)
|
195
|
+
|
196
|
+
auth7_SOURCE = cmptest.h auth7.c windows/windows-quirks.h
|
197
|
+
auth7_LDADD = $(TESTS_LDADD)
|
198
|
+
|
163
199
|
box_SOURCE = cmptest.h box.c
|
164
200
|
box_LDADD = $(TESTS_LDADD)
|
165
201
|
|
@@ -172,6 +208,12 @@ box7_LDADD = $(TESTS_LDADD)
|
|
172
208
|
box8_SOURCE = cmptest.h box8.c
|
173
209
|
box8_LDADD = $(TESTS_LDADD)
|
174
210
|
|
211
|
+
box_easy_SOURCE = cmptest.h box_easy.c
|
212
|
+
box_easy_LDADD = $(TESTS_LDADD)
|
213
|
+
|
214
|
+
box_easy2_SOURCE = cmptest.h box_easy2.c
|
215
|
+
box_easy2_LDADD = $(TESTS_LDADD)
|
216
|
+
|
175
217
|
core1_SOURCE = cmptest.h core1.c
|
176
218
|
core1_LDADD = $(TESTS_LDADD)
|
177
219
|
|
@@ -196,6 +238,9 @@ generichash_LDADD = $(TESTS_LDADD)
|
|
196
238
|
generichash2_SOURCE = cmptest.h generichash2.c
|
197
239
|
generichash2_LDADD = $(TESTS_LDADD)
|
198
240
|
|
241
|
+
generichash3_SOURCE = cmptest.h generichash3.c
|
242
|
+
generichash3_LDADD = $(TESTS_LDADD)
|
243
|
+
|
199
244
|
hash_SOURCE = cmptest.h hash.c
|
200
245
|
hash_LDADD = $(TESTS_LDADD)
|
201
246
|
|
@@ -211,6 +256,9 @@ onetimeauth2_LDADD = $(TESTS_LDADD)
|
|
211
256
|
onetimeauth7_SOURCE = cmptest.h onetimeauth7.c
|
212
257
|
onetimeauth7_LDADD = $(TESTS_LDADD)
|
213
258
|
|
259
|
+
pwhash_SOURCE = cmptest.h pwhash.c
|
260
|
+
pwhash_LDADD = $(TESTS_LDADD)
|
261
|
+
|
214
262
|
randombytes_SOURCE = randombytes.c
|
215
263
|
randombytes_LDADD = $(TESTS_LDADD)
|
216
264
|
|
@@ -244,9 +292,18 @@ secretbox7_LDADD = $(TESTS_LDADD)
|
|
244
292
|
secretbox8_SOURCE = cmptest.h secretbox8.c
|
245
293
|
secretbox8_LDADD = $(TESTS_LDADD)
|
246
294
|
|
295
|
+
secretbox_easy_SOURCE = cmptest.h secretbox_easy.c
|
296
|
+
secretbox_easy_LDADD = $(TESTS_LDADD)
|
297
|
+
|
298
|
+
secretbox_easy2_SOURCE = cmptest.h secretbox_easy2.c
|
299
|
+
secretbox_easy2_LDADD = $(TESTS_LDADD)
|
300
|
+
|
247
301
|
shorthash_SOURCE = cmptest.h shorthash.c
|
248
302
|
shorthash_LDADD = $(TESTS_LDADD)
|
249
303
|
|
304
|
+
sign_SOURCE = cmptest.h sign.c
|
305
|
+
sign_LDADD = $(TESTS_LDADD)
|
306
|
+
|
250
307
|
sodium_core_SOURCE = cmptest.h sodium_core.c
|
251
308
|
sodium_core_LDADD = $(TESTS_LDADD)
|
252
309
|
|
@@ -274,4 +331,7 @@ stream5_LDADD = $(TESTS_LDADD)
|
|
274
331
|
stream6_SOURCE = cmptest.h stream6.c
|
275
332
|
stream6_LDADD = $(TESTS_LDADD)
|
276
333
|
|
334
|
+
verify1_SOURCE = cmptest.h verify1.c
|
335
|
+
verify1_LDADD = $(TESTS_LDADD)
|
336
|
+
|
277
337
|
verify: check
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
|
3
|
+
#define TEST_NAME "auth6"
|
4
|
+
#include "cmptest.h"
|
5
|
+
|
6
|
+
/* "Test Case 2" from RFC 4231 */
|
7
|
+
unsigned char key[32] = "Jefe";
|
8
|
+
unsigned char c[] = "what do ya want for nothing?";
|
9
|
+
|
10
|
+
unsigned char a[64];
|
11
|
+
|
12
|
+
int main(void)
|
13
|
+
{
|
14
|
+
int i;
|
15
|
+
crypto_auth_hmacsha512(a,c,sizeof c - 1U,key);
|
16
|
+
for (i = 0;i < 64;++i) {
|
17
|
+
printf(",0x%02x",(unsigned int) a[i]);
|
18
|
+
if (i % 8 == 7) printf("\n");
|
19
|
+
}
|
20
|
+
return 0;
|
21
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
,0x16,0x4b,0x7a,0x7b,0xfc,0xf8,0x19,0xe2
|
2
|
+
,0xe3,0x95,0xfb,0xe7,0x3b,0x56,0xe0,0xa3
|
3
|
+
,0x87,0xbd,0x64,0x22,0x2e,0x83,0x1f,0xd6
|
4
|
+
,0x10,0x27,0x0c,0xd7,0xea,0x25,0x05,0x54
|
5
|
+
,0x97,0x58,0xbf,0x75,0xc0,0x5a,0x99,0x4a
|
6
|
+
,0x6d,0x03,0x4f,0x65,0xf8,0xf0,0xe6,0xfd
|
7
|
+
,0xca,0xea,0xb1,0xa3,0x4d,0x4a,0x6b,0x4b
|
8
|
+
,0x63,0x6e,0x07,0x0a,0x38,0xbc,0xe7,0x37
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <stdlib.h>
|
3
|
+
#include "windows/windows-quirks.h"
|
4
|
+
|
5
|
+
#define TEST_NAME "auth7"
|
6
|
+
#include "cmptest.h"
|
7
|
+
|
8
|
+
unsigned char key[32];
|
9
|
+
unsigned char c[10000];
|
10
|
+
unsigned char a[64];
|
11
|
+
|
12
|
+
int main(void)
|
13
|
+
{
|
14
|
+
int clen;
|
15
|
+
for (clen = 0;clen < 10000;++clen) {
|
16
|
+
randombytes(key,sizeof key);
|
17
|
+
randombytes(c,clen);
|
18
|
+
crypto_auth_hmacsha512(a,c,clen,key);
|
19
|
+
if (crypto_auth_hmacsha512_verify(a,c,clen,key) != 0) {
|
20
|
+
printf("fail %d\n",clen);
|
21
|
+
return 100;
|
22
|
+
}
|
23
|
+
if (clen > 0) {
|
24
|
+
c[rand() % clen] += 1 + (rand() % 255);
|
25
|
+
if (crypto_auth_hmacsha512_verify(a,c,clen,key) == 0) {
|
26
|
+
printf("forgery %d\n",clen);
|
27
|
+
return 100;
|
28
|
+
}
|
29
|
+
a[rand() % sizeof a] += 1 + (rand() % 255);
|
30
|
+
if (crypto_auth_hmacsha512_verify(a,c,clen,key) == 0) {
|
31
|
+
printf("forgery %d\n",clen);
|
32
|
+
return 100;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return 0;
|
37
|
+
}
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
|
3
|
+
#define TEST_NAME "box_easy"
|
4
|
+
#include "cmptest.h"
|
5
|
+
|
6
|
+
unsigned char alicesk[32] = {
|
7
|
+
0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d
|
8
|
+
,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45
|
9
|
+
,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a
|
10
|
+
,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a
|
11
|
+
} ;
|
12
|
+
|
13
|
+
unsigned char bobpk[32] = {
|
14
|
+
0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4
|
15
|
+
,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37
|
16
|
+
,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d
|
17
|
+
,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f
|
18
|
+
} ;
|
19
|
+
|
20
|
+
unsigned char nonce[24] = {
|
21
|
+
0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73
|
22
|
+
,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6
|
23
|
+
,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37
|
24
|
+
} ;
|
25
|
+
|
26
|
+
unsigned char m[131] = {
|
27
|
+
0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5
|
28
|
+
,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b
|
29
|
+
,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4
|
30
|
+
,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc
|
31
|
+
,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a
|
32
|
+
,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29
|
33
|
+
,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4
|
34
|
+
,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31
|
35
|
+
,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d
|
36
|
+
,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57
|
37
|
+
,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a
|
38
|
+
,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde
|
39
|
+
,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd
|
40
|
+
,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52
|
41
|
+
,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40
|
42
|
+
,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64
|
43
|
+
,0x5e,0x07,0x05
|
44
|
+
} ;
|
45
|
+
|
46
|
+
unsigned char c[147 + crypto_box_MACBYTES];
|
47
|
+
|
48
|
+
int main(void)
|
49
|
+
{
|
50
|
+
int i;
|
51
|
+
|
52
|
+
crypto_box_easy(c, m, 131, nonce, bobpk, alicesk);
|
53
|
+
for (i = 0; i < 131 + crypto_box_MACBYTES; ++i) {
|
54
|
+
printf(",0x%02x",(unsigned int) c[i]);
|
55
|
+
if (i % 8 == 7) printf("\n");
|
56
|
+
}
|
57
|
+
printf("\n");
|
58
|
+
return 0;
|
59
|
+
}
|