├── .dntrc ├── .gitignore ├── .gitmodules ├── .jsbeautifyrc ├── .jshintrc ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── binding.gyp ├── deps ├── libsodium │ ├── AUTHORS │ ├── ChangeLog │ ├── LICENSE │ ├── Makefile.am │ ├── README.markdown │ ├── THANKS │ ├── autogen.sh │ ├── builds │ │ ├── Makefile.am │ │ └── msvc │ │ │ ├── properties │ │ │ ├── Common.props │ │ │ ├── DLL.props │ │ │ ├── Debug.props │ │ │ ├── DebugDEXE.props │ │ │ ├── DebugDLL.props │ │ │ ├── DebugLEXE.props │ │ │ ├── DebugLIB.props │ │ │ ├── DebugLTCG.props │ │ │ ├── DebugSEXE.props │ │ │ ├── EXE.props │ │ │ ├── LIB.props │ │ │ ├── LTCG.props │ │ │ ├── Link.props │ │ │ ├── Messages.props │ │ │ ├── Output.props │ │ │ ├── Release.props │ │ │ ├── ReleaseDEXE.props │ │ │ ├── ReleaseDLL.props │ │ │ ├── ReleaseLEXE.props │ │ │ ├── ReleaseLIB.props │ │ │ ├── ReleaseLTCG.props │ │ │ ├── ReleaseSEXE.props │ │ │ ├── Win32.props │ │ │ └── x64.props │ │ │ ├── resource.h │ │ │ ├── resource.rc │ │ │ ├── version.h │ │ │ ├── vs2010 │ │ │ ├── libsodium.import.props │ │ │ ├── libsodium.import.xml │ │ │ ├── libsodium.sln │ │ │ └── libsodium │ │ │ │ ├── libsodium.props │ │ │ │ ├── libsodium.vcxproj │ │ │ │ ├── libsodium.vcxproj.filters │ │ │ │ └── libsodium.xml │ │ │ ├── vs2012 │ │ │ ├── libsodium.import.props │ │ │ ├── libsodium.import.xml │ │ │ ├── libsodium.sln │ │ │ └── libsodium │ │ │ │ ├── libsodium.props │ │ │ │ ├── libsodium.vcxproj │ │ │ │ ├── libsodium.vcxproj.filters │ │ │ │ └── libsodium.xml │ │ │ ├── vs2013 │ │ │ ├── libsodium.import.props │ │ │ ├── libsodium.import.xml │ │ │ ├── libsodium.sln │ │ │ └── libsodium │ │ │ │ ├── libsodium.props │ │ │ │ ├── libsodium.vcxproj │ │ │ │ ├── libsodium.vcxproj.filters │ │ │ │ └── libsodium.xml │ │ │ ├── vs2015 │ │ │ ├── libsodium.import.props │ │ │ ├── libsodium.import.xml │ │ │ ├── libsodium.sln │ │ │ └── libsodium │ │ │ │ ├── libsodium.props │ │ │ │ ├── libsodium.vcxproj │ │ │ │ ├── libsodium.vcxproj.filters │ │ │ │ └── libsodium.xml │ │ │ └── vs2017 │ │ │ ├── libsodium.import.props │ │ │ ├── libsodium.import.xml │ │ │ ├── libsodium.sln │ │ │ └── libsodium │ │ │ ├── libsodium.props │ │ │ ├── libsodium.vcxproj │ │ │ ├── libsodium.vcxproj.filters │ │ │ └── libsodium.xml │ ├── compile │ ├── config.guess │ ├── config.sub │ ├── configure.ac │ ├── contrib │ │ ├── Findsodium.cmake │ │ └── Makefile.am │ ├── depcomp │ ├── dist-build │ │ ├── Makefile.am │ │ ├── android-arm.sh │ │ ├── android-armv7-a.sh │ │ ├── android-armv8-a.sh │ │ ├── android-build.sh │ │ ├── android-mips32.sh │ │ ├── android-mips64.sh │ │ ├── android-x86.sh │ │ ├── android-x86_64.sh │ │ ├── emscripten.sh │ │ ├── ios.sh │ │ ├── msys2-win32.sh │ │ ├── msys2-win64.sh │ │ ├── nativeclient-pnacl.sh │ │ ├── nativeclient-x86.sh │ │ └── nativeclient-x86_64.sh │ ├── install-sh │ ├── libsodium-uninstalled.pc.in │ ├── libsodium.pc.in │ ├── libsodium.sln │ ├── libsodium.vcxproj │ ├── libsodium.vcxproj.filters │ ├── ltmain.sh │ ├── m4 │ │ ├── ax_check_catchable_abrt.m4 │ │ ├── ax_check_catchable_segv.m4 │ │ ├── ax_check_compile_flag.m4 │ │ ├── ax_check_define.m4 │ │ ├── ax_check_link_flag.m4 │ │ ├── ax_pthread.m4 │ │ ├── ax_tls.m4 │ │ ├── ax_valgrind_check.m4 │ │ └── ld-output-def.m4 │ ├── missing │ ├── msvc-scripts │ │ ├── Makefile.am │ │ ├── process.bat │ │ ├── rep.vbs │ │ └── sodium.props │ ├── src │ │ ├── Makefile.am │ │ └── libsodium │ │ │ ├── Makefile.am │ │ │ ├── crypto_aead │ │ │ ├── aes256gcm │ │ │ │ └── aesni │ │ │ │ │ └── aead_aes256gcm_aesni.c │ │ │ ├── chacha20poly1305 │ │ │ │ └── sodium │ │ │ │ │ └── aead_chacha20poly1305.c │ │ │ └── xchacha20poly1305 │ │ │ │ └── sodium │ │ │ │ └── aead_xchacha20poly1305.c │ │ │ ├── crypto_auth │ │ │ ├── crypto_auth.c │ │ │ ├── hmacsha256 │ │ │ │ └── auth_hmacsha256.c │ │ │ ├── hmacsha512 │ │ │ │ └── auth_hmacsha512.c │ │ │ └── hmacsha512256 │ │ │ │ └── auth_hmacsha512256.c │ │ │ ├── crypto_box │ │ │ ├── crypto_box.c │ │ │ ├── crypto_box_easy.c │ │ │ ├── crypto_box_seal.c │ │ │ ├── curve25519xchacha20poly1305 │ │ │ │ ├── box_curve25519xchacha20poly1305.c │ │ │ │ └── box_seal_curve25519xchacha20poly1305.c │ │ │ └── curve25519xsalsa20poly1305 │ │ │ │ └── box_curve25519xsalsa20poly1305.c │ │ │ ├── crypto_core │ │ │ ├── ed25519 │ │ │ │ ├── core_ed25519.c │ │ │ │ └── ref10 │ │ │ │ │ ├── ed25519_ref10.c │ │ │ │ │ ├── fe_25_5 │ │ │ │ │ ├── base.h │ │ │ │ │ ├── base2.h │ │ │ │ │ ├── constants.h │ │ │ │ │ └── fe.h │ │ │ │ │ └── fe_51 │ │ │ │ │ ├── base.h │ │ │ │ │ ├── base2.h │ │ │ │ │ ├── constants.h │ │ │ │ │ └── fe.h │ │ │ ├── hchacha20 │ │ │ │ └── core_hchacha20.c │ │ │ ├── hsalsa20 │ │ │ │ ├── core_hsalsa20.c │ │ │ │ └── ref2 │ │ │ │ │ └── core_hsalsa20_ref2.c │ │ │ └── salsa │ │ │ │ └── ref │ │ │ │ └── core_salsa_ref.c │ │ │ ├── crypto_generichash │ │ │ ├── blake2b │ │ │ │ ├── generichash_blake2.c │ │ │ │ └── ref │ │ │ │ │ ├── blake2.h │ │ │ │ │ ├── blake2b-compress-avx2.c │ │ │ │ │ ├── blake2b-compress-avx2.h │ │ │ │ │ ├── blake2b-compress-ref.c │ │ │ │ │ ├── blake2b-compress-sse41.c │ │ │ │ │ ├── blake2b-compress-sse41.h │ │ │ │ │ ├── blake2b-compress-ssse3.c │ │ │ │ │ ├── blake2b-compress-ssse3.h │ │ │ │ │ ├── blake2b-load-avx2.h │ │ │ │ │ ├── blake2b-load-sse2.h │ │ │ │ │ ├── blake2b-load-sse41.h │ │ │ │ │ ├── blake2b-ref.c │ │ │ │ │ └── generichash_blake2b.c │ │ │ └── crypto_generichash.c │ │ │ ├── crypto_hash │ │ │ ├── crypto_hash.c │ │ │ ├── sha256 │ │ │ │ ├── cp │ │ │ │ │ └── hash_sha256_cp.c │ │ │ │ └── hash_sha256.c │ │ │ └── sha512 │ │ │ │ ├── cp │ │ │ │ └── hash_sha512_cp.c │ │ │ │ └── hash_sha512.c │ │ │ ├── crypto_kdf │ │ │ ├── blake2b │ │ │ │ └── kdf_blake2b.c │ │ │ └── crypto_kdf.c │ │ │ ├── crypto_kx │ │ │ └── crypto_kx.c │ │ │ ├── crypto_onetimeauth │ │ │ ├── crypto_onetimeauth.c │ │ │ └── poly1305 │ │ │ │ ├── donna │ │ │ │ ├── poly1305_donna.c │ │ │ │ ├── poly1305_donna.h │ │ │ │ ├── poly1305_donna32.h │ │ │ │ └── poly1305_donna64.h │ │ │ │ ├── onetimeauth_poly1305.c │ │ │ │ ├── onetimeauth_poly1305.h │ │ │ │ └── sse2 │ │ │ │ ├── poly1305_sse2.c │ │ │ │ └── poly1305_sse2.h │ │ │ ├── crypto_pwhash │ │ │ ├── argon2 │ │ │ │ ├── argon2-core.c │ │ │ │ ├── argon2-core.h │ │ │ │ ├── argon2-encoding.c │ │ │ │ ├── argon2-encoding.h │ │ │ │ ├── argon2-fill-block-avx2.c │ │ │ │ ├── argon2-fill-block-avx512f.c │ │ │ │ ├── argon2-fill-block-ref.c │ │ │ │ ├── argon2-fill-block-ssse3.c │ │ │ │ ├── argon2.c │ │ │ │ ├── argon2.h │ │ │ │ ├── blake2b-long.c │ │ │ │ ├── blake2b-long.h │ │ │ │ ├── blamka-round-avx2.h │ │ │ │ ├── blamka-round-avx512f.h │ │ │ │ ├── blamka-round-ref.h │ │ │ │ ├── blamka-round-ssse3.h │ │ │ │ ├── pwhash_argon2i.c │ │ │ │ └── pwhash_argon2id.c │ │ │ ├── crypto_pwhash.c │ │ │ └── scryptsalsa208sha256 │ │ │ │ ├── crypto_scrypt-common.c │ │ │ │ ├── crypto_scrypt.h │ │ │ │ ├── nosse │ │ │ │ └── pwhash_scryptsalsa208sha256_nosse.c │ │ │ │ ├── pbkdf2-sha256.c │ │ │ │ ├── pbkdf2-sha256.h │ │ │ │ ├── pwhash_scryptsalsa208sha256.c │ │ │ │ ├── scrypt_platform.c │ │ │ │ └── sse │ │ │ │ └── pwhash_scryptsalsa208sha256_sse.c │ │ │ ├── crypto_scalarmult │ │ │ ├── crypto_scalarmult.c │ │ │ ├── curve25519 │ │ │ │ ├── ref10 │ │ │ │ │ ├── x25519_ref10.c │ │ │ │ │ └── x25519_ref10.h │ │ │ │ ├── sandy2x │ │ │ │ │ ├── consts.S │ │ │ │ │ ├── consts_namespace.h │ │ │ │ │ ├── curve25519_sandy2x.c │ │ │ │ │ ├── curve25519_sandy2x.h │ │ │ │ │ ├── fe.h │ │ │ │ │ ├── fe51.h │ │ │ │ │ ├── fe51_invert.c │ │ │ │ │ ├── fe51_mul.S │ │ │ │ │ ├── fe51_namespace.h │ │ │ │ │ ├── fe51_nsquare.S │ │ │ │ │ ├── fe51_pack.S │ │ │ │ │ ├── fe_frombytes_sandy2x.c │ │ │ │ │ ├── ladder.S │ │ │ │ │ ├── ladder.h │ │ │ │ │ ├── ladder_base.S │ │ │ │ │ ├── ladder_base.h │ │ │ │ │ ├── ladder_base_namespace.h │ │ │ │ │ ├── ladder_namespace.h │ │ │ │ │ └── sandy2x.S │ │ │ │ ├── scalarmult_curve25519.c │ │ │ │ └── scalarmult_curve25519.h │ │ │ └── ed25519 │ │ │ │ └── ref10 │ │ │ │ └── scalarmult_ed25519_ref10.c │ │ │ ├── crypto_secretbox │ │ │ ├── crypto_secretbox.c │ │ │ ├── crypto_secretbox_easy.c │ │ │ ├── xchacha20poly1305 │ │ │ │ └── secretbox_xchacha20poly1305.c │ │ │ └── xsalsa20poly1305 │ │ │ │ └── secretbox_xsalsa20poly1305.c │ │ │ ├── crypto_secretstream │ │ │ └── xchacha20poly1305 │ │ │ │ └── secretstream_xchacha20poly1305.c │ │ │ ├── crypto_shorthash │ │ │ ├── crypto_shorthash.c │ │ │ └── siphash24 │ │ │ │ ├── ref │ │ │ │ ├── shorthash_siphash24_ref.c │ │ │ │ ├── shorthash_siphash_ref.h │ │ │ │ └── shorthash_siphashx24_ref.c │ │ │ │ ├── shorthash_siphash24.c │ │ │ │ └── shorthash_siphashx24.c │ │ │ ├── crypto_sign │ │ │ ├── crypto_sign.c │ │ │ └── ed25519 │ │ │ │ ├── ref10 │ │ │ │ ├── keypair.c │ │ │ │ ├── obsolete.c │ │ │ │ ├── open.c │ │ │ │ ├── sign.c │ │ │ │ └── sign_ed25519_ref10.h │ │ │ │ └── sign_ed25519.c │ │ │ ├── crypto_stream │ │ │ ├── chacha20 │ │ │ │ ├── dolbeau │ │ │ │ │ ├── chacha20_dolbeau-avx2.c │ │ │ │ │ ├── chacha20_dolbeau-avx2.h │ │ │ │ │ ├── chacha20_dolbeau-ssse3.c │ │ │ │ │ ├── chacha20_dolbeau-ssse3.h │ │ │ │ │ ├── u0.h │ │ │ │ │ ├── u1.h │ │ │ │ │ ├── u4.h │ │ │ │ │ └── u8.h │ │ │ │ ├── ref │ │ │ │ │ ├── chacha20_ref.c │ │ │ │ │ └── chacha20_ref.h │ │ │ │ ├── stream_chacha20.c │ │ │ │ └── stream_chacha20.h │ │ │ ├── crypto_stream.c │ │ │ ├── salsa20 │ │ │ │ ├── ref │ │ │ │ │ ├── salsa20_ref.c │ │ │ │ │ └── salsa20_ref.h │ │ │ │ ├── stream_salsa20.c │ │ │ │ ├── stream_salsa20.h │ │ │ │ ├── xmm6 │ │ │ │ │ ├── salsa20_xmm6-asm.S │ │ │ │ │ ├── salsa20_xmm6.c │ │ │ │ │ └── salsa20_xmm6.h │ │ │ │ └── xmm6int │ │ │ │ │ ├── salsa20_xmm6int-avx2.c │ │ │ │ │ ├── salsa20_xmm6int-avx2.h │ │ │ │ │ ├── salsa20_xmm6int-sse2.c │ │ │ │ │ ├── salsa20_xmm6int-sse2.h │ │ │ │ │ ├── u0.h │ │ │ │ │ ├── u1.h │ │ │ │ │ ├── u4.h │ │ │ │ │ └── u8.h │ │ │ ├── salsa2012 │ │ │ │ ├── ref │ │ │ │ │ └── stream_salsa2012_ref.c │ │ │ │ └── stream_salsa2012.c │ │ │ ├── salsa208 │ │ │ │ ├── ref │ │ │ │ │ └── stream_salsa208_ref.c │ │ │ │ └── stream_salsa208.c │ │ │ ├── xchacha20 │ │ │ │ └── stream_xchacha20.c │ │ │ └── xsalsa20 │ │ │ │ └── stream_xsalsa20.c │ │ │ ├── crypto_verify │ │ │ └── sodium │ │ │ │ └── verify.c │ │ │ ├── include │ │ │ ├── Makefile.am │ │ │ ├── sodium.h │ │ │ └── sodium │ │ │ │ ├── core.h │ │ │ │ ├── crypto_aead_aes256gcm.h │ │ │ │ ├── crypto_aead_chacha20poly1305.h │ │ │ │ ├── crypto_aead_xchacha20poly1305.h │ │ │ │ ├── crypto_auth.h │ │ │ │ ├── crypto_auth_hmacsha256.h │ │ │ │ ├── crypto_auth_hmacsha512.h │ │ │ │ ├── crypto_auth_hmacsha512256.h │ │ │ │ ├── crypto_box.h │ │ │ │ ├── crypto_box_curve25519xchacha20poly1305.h │ │ │ │ ├── crypto_box_curve25519xsalsa20poly1305.h │ │ │ │ ├── crypto_core_ed25519.h │ │ │ │ ├── crypto_core_hchacha20.h │ │ │ │ ├── crypto_core_hsalsa20.h │ │ │ │ ├── crypto_core_salsa20.h │ │ │ │ ├── crypto_core_salsa2012.h │ │ │ │ ├── crypto_core_salsa208.h │ │ │ │ ├── crypto_generichash.h │ │ │ │ ├── crypto_generichash_blake2b.h │ │ │ │ ├── crypto_hash.h │ │ │ │ ├── crypto_hash_sha256.h │ │ │ │ ├── crypto_hash_sha512.h │ │ │ │ ├── crypto_kdf.h │ │ │ │ ├── crypto_kdf_blake2b.h │ │ │ │ ├── crypto_kx.h │ │ │ │ ├── crypto_onetimeauth.h │ │ │ │ ├── crypto_onetimeauth_poly1305.h │ │ │ │ ├── crypto_pwhash.h │ │ │ │ ├── crypto_pwhash_argon2i.h │ │ │ │ ├── crypto_pwhash_argon2id.h │ │ │ │ ├── crypto_pwhash_scryptsalsa208sha256.h │ │ │ │ ├── crypto_scalarmult.h │ │ │ │ ├── crypto_scalarmult_curve25519.h │ │ │ │ ├── crypto_scalarmult_ed25519.h │ │ │ │ ├── crypto_secretbox.h │ │ │ │ ├── crypto_secretbox_xchacha20poly1305.h │ │ │ │ ├── crypto_secretbox_xsalsa20poly1305.h │ │ │ │ ├── crypto_secretstream_xchacha20poly1305.h │ │ │ │ ├── crypto_shorthash.h │ │ │ │ ├── crypto_shorthash_siphash24.h │ │ │ │ ├── crypto_sign.h │ │ │ │ ├── crypto_sign_ed25519.h │ │ │ │ ├── crypto_sign_edwards25519sha512batch.h │ │ │ │ ├── crypto_stream.h │ │ │ │ ├── crypto_stream_chacha20.h │ │ │ │ ├── crypto_stream_salsa20.h │ │ │ │ ├── crypto_stream_salsa2012.h │ │ │ │ ├── crypto_stream_salsa208.h │ │ │ │ ├── crypto_stream_xchacha20.h │ │ │ │ ├── crypto_stream_xsalsa20.h │ │ │ │ ├── crypto_verify_16.h │ │ │ │ ├── crypto_verify_32.h │ │ │ │ ├── crypto_verify_64.h │ │ │ │ ├── export.h │ │ │ │ ├── private │ │ │ │ ├── common.h │ │ │ │ ├── ed25519_ref10.h │ │ │ │ ├── ed25519_ref10_fe_25_5.h │ │ │ │ ├── ed25519_ref10_fe_51.h │ │ │ │ ├── implementations.h │ │ │ │ ├── mutex.h │ │ │ │ └── sse2_64_32.h │ │ │ │ ├── randombytes.h │ │ │ │ ├── randombytes_nativeclient.h │ │ │ │ ├── randombytes_salsa20_random.h │ │ │ │ ├── randombytes_sysrandom.h │ │ │ │ ├── runtime.h │ │ │ │ ├── utils.h │ │ │ │ └── version.h.in │ │ │ ├── randombytes │ │ │ ├── nativeclient │ │ │ │ └── randombytes_nativeclient.c │ │ │ ├── randombytes.c │ │ │ ├── salsa20 │ │ │ │ └── randombytes_salsa20_random.c │ │ │ └── sysrandom │ │ │ │ └── randombytes_sysrandom.c │ │ │ └── sodium │ │ │ ├── codecs.c │ │ │ ├── core.c │ │ │ ├── runtime.c │ │ │ ├── utils.c │ │ │ └── version.c │ └── test │ │ ├── Makefile.am │ │ ├── default │ │ ├── Makefile.am │ │ ├── aead_aes256gcm.c │ │ ├── aead_aes256gcm.exp │ │ ├── aead_chacha20poly1305.c │ │ ├── aead_chacha20poly1305.exp │ │ ├── aead_xchacha20poly1305.c │ │ ├── aead_xchacha20poly1305.exp │ │ ├── auth.c │ │ ├── auth.exp │ │ ├── auth2.c │ │ ├── auth2.exp │ │ ├── auth3.c │ │ ├── auth3.exp │ │ ├── auth5.c │ │ ├── auth5.exp │ │ ├── auth6.c │ │ ├── auth6.exp │ │ ├── auth7.c │ │ ├── auth7.exp │ │ ├── box.c │ │ ├── box.exp │ │ ├── box2.c │ │ ├── box2.exp │ │ ├── box7.c │ │ ├── box7.exp │ │ ├── box8.c │ │ ├── box8.exp │ │ ├── box_easy.c │ │ ├── box_easy.exp │ │ ├── box_easy2.c │ │ ├── box_easy2.exp │ │ ├── box_seal.c │ │ ├── box_seal.exp │ │ ├── box_seed.c │ │ ├── box_seed.exp │ │ ├── chacha20.c │ │ ├── chacha20.exp │ │ ├── cmptest.h │ │ ├── codecs.c │ │ ├── codecs.exp │ │ ├── core1.c │ │ ├── core1.exp │ │ ├── core2.c │ │ ├── core2.exp │ │ ├── core3.c │ │ ├── core3.exp │ │ ├── core4.c │ │ ├── core4.exp │ │ ├── core5.c │ │ ├── core5.exp │ │ ├── core6.c │ │ ├── core6.exp │ │ ├── core_ed25519.c │ │ ├── core_ed25519.exp │ │ ├── ed25519_convert.c │ │ ├── ed25519_convert.exp │ │ ├── generichash.c │ │ ├── generichash.exp │ │ ├── generichash2.c │ │ ├── generichash2.exp │ │ ├── generichash3.c │ │ ├── generichash3.exp │ │ ├── hash.c │ │ ├── hash.exp │ │ ├── hash2.exp │ │ ├── hash3.c │ │ ├── hash3.exp │ │ ├── kdf.c │ │ ├── kdf.exp │ │ ├── keygen.c │ │ ├── keygen.exp │ │ ├── kx.c │ │ ├── kx.exp │ │ ├── metamorphic.c │ │ ├── metamorphic.exp │ │ ├── misuse.c │ │ ├── misuse.exp │ │ ├── onetimeauth.c │ │ ├── onetimeauth.exp │ │ ├── onetimeauth2.c │ │ ├── onetimeauth2.exp │ │ ├── onetimeauth7.c │ │ ├── onetimeauth7.exp │ │ ├── pre.js.inc │ │ ├── pwhash_argon2i.c │ │ ├── pwhash_argon2i.exp │ │ ├── pwhash_argon2id.c │ │ ├── pwhash_argon2id.exp │ │ ├── pwhash_scrypt.c │ │ ├── pwhash_scrypt.exp │ │ ├── pwhash_scrypt_ll.c │ │ ├── pwhash_scrypt_ll.exp │ │ ├── randombytes.c │ │ ├── randombytes.exp │ │ ├── scalarmult.c │ │ ├── scalarmult.exp │ │ ├── scalarmult2.c │ │ ├── scalarmult2.exp │ │ ├── scalarmult5.c │ │ ├── scalarmult5.exp │ │ ├── scalarmult6.c │ │ ├── scalarmult6.exp │ │ ├── scalarmult7.c │ │ ├── scalarmult7.exp │ │ ├── scalarmult_ed25519.c │ │ ├── scalarmult_ed25519.exp │ │ ├── secretbox.c │ │ ├── secretbox.exp │ │ ├── secretbox2.c │ │ ├── secretbox2.exp │ │ ├── secretbox7.c │ │ ├── secretbox7.exp │ │ ├── secretbox8.c │ │ ├── secretbox8.exp │ │ ├── secretbox_easy.c │ │ ├── secretbox_easy.exp │ │ ├── secretbox_easy2.c │ │ ├── secretbox_easy2.exp │ │ ├── secretstream.c │ │ ├── secretstream.exp │ │ ├── shorthash.c │ │ ├── shorthash.exp │ │ ├── sign.c │ │ ├── sign.exp │ │ ├── siphashx24.c │ │ ├── siphashx24.exp │ │ ├── sodium_core.c │ │ ├── sodium_core.exp │ │ ├── sodium_utils.c │ │ ├── sodium_utils.exp │ │ ├── sodium_utils2.c │ │ ├── sodium_utils2.exp │ │ ├── sodium_utils3.c │ │ ├── sodium_utils3.exp │ │ ├── sodium_version.c │ │ ├── sodium_version.exp │ │ ├── stream.c │ │ ├── stream.exp │ │ ├── stream2.c │ │ ├── stream2.exp │ │ ├── stream3.c │ │ ├── stream3.exp │ │ ├── stream4.c │ │ ├── stream4.exp │ │ ├── verify1.c │ │ ├── verify1.exp │ │ ├── wintest.bat │ │ ├── xchacha20.c │ │ └── xchacha20.exp │ │ └── quirks │ │ └── quirks.h └── symbols.txt ├── docs ├── auth.md ├── box.md ├── crypto-base-buffer.md ├── crypto-base.md ├── generichash.md ├── key-manager.md ├── low-level-api.md ├── not implemented.md ├── onetime-auth.md ├── ported-functions.md ├── pwhash.md ├── secretbox.md ├── sign.md ├── sodium.md ├── stream.md └── toBuffer.md ├── examples ├── ECDH.js ├── generichash.js ├── low-level-api.js └── pwhash.js ├── exported_functions.js ├── index.js ├── install.js ├── lib ├── auth.js ├── box.js ├── crypto-base-buffer.js ├── ecdh.js ├── keys │ ├── auth-key.js │ ├── box-key.js │ ├── dh-key.js │ ├── keypair.js │ ├── onetime-key.js │ ├── secretbox-key.js │ ├── sign-key.js │ └── stream-key.js ├── nonces │ ├── box-nonce.js │ ├── secretbox-nonce.js │ └── stream-nonce.js ├── onetime-auth.js ├── secretbox.js ├── sign.js ├── sodium.js ├── stream.js └── toBuffer.js ├── out.c ├── package-lock.json ├── package.json ├── src ├── crypto_aead.cc ├── crypto_auth.cc ├── crypto_auth_algos.cc ├── crypto_box.cc ├── crypto_box_curve25519xsalsa20.cc ├── crypto_box_curve25519xsalsa20poly1305.cc ├── crypto_core.cc ├── crypto_generichash.cc ├── crypto_generichash_blake2b.cc ├── crypto_hash.cc ├── crypto_hash_sha256.cc ├── crypto_hash_sha512.cc ├── crypto_onetimeauth.cc ├── crypto_onetimeauth_poly1305.cc ├── crypto_pwhash.cc ├── crypto_pwhash_algos.cc ├── crypto_scalarmult.cc ├── crypto_scalarmult_curve25519.cc ├── crypto_secretbox.cc ├── crypto_secretbox_xsalsa20poly1305.cc ├── crypto_shorthash.cc ├── crypto_shorthash_siphash24.cc ├── crypto_sign.cc ├── crypto_sign_ed25519.cc ├── crypto_stream.cc ├── crypto_streams.cc ├── helpers.cc ├── include │ ├── crypto_aead.h │ ├── crypto_auth_algos.h │ ├── crypto_core.h │ ├── crypto_onetimeauth_poly1305.h │ ├── crypto_pwhash_algos.h │ ├── crypto_scalarmult_curve25519.h │ ├── crypto_sign_ed25519.h │ ├── crypto_streams.h │ ├── node_sodium.h │ └── node_sodium_register.h ├── randombytes.cc ├── sodium.cc └── sodium_runtime.cc └── test ├── test_aead_aes256gcm.js ├── test_auth.js ├── test_box.js ├── test_crypto-base-buffer.js ├── test_crypto_aead.js ├── test_crypto_auth.js ├── test_crypto_box.js ├── test_crypto_box_easy.js ├── test_crypto_constants.js ├── test_crypto_generichash.js ├── test_crypto_generichash_blake2b.js ├── test_crypto_hash.js ├── test_crypto_onetimeauth.js ├── test_crypto_pwhash.js ├── test_crypto_random.js ├── test_crypto_secretbox.js ├── test_crypto_sign.js ├── test_crypto_stream.js ├── test_crypto_string_comparisons.js ├── test_crypto_utils.js ├── test_crypto_version.js ├── test_dh.js ├── test_ecdh.js ├── test_key_all_key.js ├── test_key_all_keypair.js ├── test_key_keypair.js ├── test_large_numbers.js ├── test_libsodium_aead_aes256gcm.js ├── test_libsodium_aead_chacha20poly1305.js ├── test_libsodium_aead_xchacha20poly1305.js ├── test_libsodium_auth.js ├── test_libsodium_auth2.js ├── test_libsodium_auth3.js ├── test_libsodium_auth5.js ├── test_libsodium_auth6.js ├── test_libsodium_auth7.js ├── test_libsodium_box.js ├── test_libsodium_box2.js ├── test_libsodium_box7.js ├── test_libsodium_box8.js ├── test_libsodium_box_easy.js ├── test_libsodium_box_easy2.js ├── test_libsodium_box_seal.js ├── test_libsodium_box_seed.js ├── test_libsodium_core1.js ├── test_libsodium_core2.js ├── test_libsodium_generichash.js ├── test_libsodium_hash.js ├── test_libsodium_onetimeauth2.js ├── test_libsodium_onetimeauth7.js ├── test_libsodium_pwhash_argon2i.js ├── test_libsodium_pwhash_argon2id.js ├── test_libsodium_pwhash_scrypt.js ├── test_libsodium_pwhash_scrypt_ll.js ├── test_nonces_all.js ├── test_onetime_auth.js ├── test_randombytes.js ├── test_secretbox.js ├── test_sign.js ├── test_sodium.js ├── test_sodium_algos_auth.js ├── test_sodium_auth.js ├── test_sodium_auth2.js ├── test_sodium_auth5.js ├── test_stream.js └── test_toBuffer.js /.dntrc: -------------------------------------------------------------------------------- 1 | ## DNT config file 2 | ## see https://github.com/rvagg/dnt 3 | 4 | NODE_VERSIONS="master v0.12.4 v0.10.38 v3.3.0 v4.0.0 v5.8.0" 5 | OUTPUT_PREFIX="sodium-" 6 | TEST_CMD="\ 7 | cd /dnt/ && \ 8 | npm install && \ 9 | node-gyp --nodedir /usr/src/node/ rebuild && \ 10 | make test; \ 11 | " 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libsodium"] 2 | path = libsodium 3 | url = https://github.com/jedisct1/libsodium.git 4 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "esversion": 6, 3 | "node": true 4 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "6.9.1" 5 | - "8.11.4" 6 | - "9.2.0" 7 | - "10.13.0" 8 | - "11.1.0" 9 | 10 | matrix: 11 | include: 12 | - os: linux 13 | - os: osx 14 | osx_image: xcode9.1 15 | env: 16 | - CXX=g++ 17 | 18 | env: 19 | - CXX=g++-4.8 20 | 21 | addons: 22 | apt: 23 | sources: 24 | - ubuntu-toolchain-r-test 25 | packages: 26 | - g++-4.8 27 | 28 | before_install: 29 | - export JOBS=max 30 | - export prebuild_compile=true 31 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi 32 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # node-sodium is an OPEN Open Source Project 2 | 3 | ----------------------------------------- 4 | 5 | ## What? 6 | 7 | Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. 8 | 9 | ## Rules 10 | 11 | There are a few basic ground-rules for contributors: 12 | 13 | 1. **No `--force` pushes** or modifying the Git history in any way. 14 | 1. **Non-master branches** ought to be used for ongoing work. 15 | 1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors. 16 | 1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor. 17 | 1. Contributors should attempt to adhere to the prevailing code-style. 18 | 19 | ## Releases 20 | 21 | Declaring formal releases remains the prerogative of the project maintainer. 22 | 23 | ## Changes to this arrangement 24 | 25 | This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change. 26 | 27 | ## Thanks 28 | Original Open Open Source License devised by @rvagg 29 | 30 | ----------------------------------------- 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Pedro Paixao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /deps/libsodium/LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | * ISC License 3 | * 4 | * Copyright (c) 2013-2017 5 | * Frank Denis 6 | * 7 | * Permission to use, copy, modify, and/or distribute this software for any 8 | * purpose with or without fee is hereby granted, provided that the above 9 | * copyright notice and this permission notice appear in all copies. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 | */ 19 | -------------------------------------------------------------------------------- /deps/libsodium/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | EXTRA_DIST = \ 4 | autogen.sh \ 5 | libsodium.sln \ 6 | libsodium.vcxproj \ 7 | libsodium.vcxproj.filters \ 8 | LICENSE \ 9 | README.markdown \ 10 | THANKS 11 | 12 | SUBDIRS = \ 13 | builds \ 14 | contrib \ 15 | dist-build \ 16 | msvc-scripts \ 17 | src \ 18 | test 19 | 20 | pkgconfigdir = $(libdir)/pkgconfig 21 | pkgconfig_DATA = @PACKAGE_NAME@.pc 22 | 23 | DISTCLEANFILES = $(pkgconfig_DATA) 24 | 25 | -------------------------------------------------------------------------------- /deps/libsodium/autogen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if glibtoolize --version > /dev/null 2>&1; then 4 | LIBTOOLIZE='glibtoolize' 5 | else 6 | LIBTOOLIZE='libtoolize' 7 | fi 8 | 9 | command -v command >/dev/null 2>&1 || { 10 | echo "command is required, but wasn't found on this system" 11 | exit 1 12 | } 13 | 14 | command -v $LIBTOOLIZE >/dev/null 2>&1 || { 15 | echo "libtool is required, but wasn't found on this system" 16 | exit 1 17 | } 18 | 19 | command -v autoconf >/dev/null 2>&1 || { 20 | echo "autoconf is required, but wasn't found on this system" 21 | exit 1 22 | } 23 | 24 | command -v automake >/dev/null 2>&1 || { 25 | echo "automake is required, but wasn't found on this system" 26 | exit 1 27 | } 28 | 29 | if autoreconf --version > /dev/null 2>&1 ; then 30 | exec autoreconf -ivf 31 | fi 32 | 33 | $LIBTOOLIZE && \ 34 | aclocal && \ 35 | automake --add-missing --force-missing --include-deps && \ 36 | autoconf 37 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/Common.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Common Settings 6 | Unicode 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | true 16 | UNICODE;_UNICODE;%(PreprocessorDefinitions) 17 | Level3 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/DLL.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Dynamic Library 6 | dynamic 7 | .dll 8 | 9 | 10 | 11 | 12 | _DLL;_WINDLL;%(PreprocessorDefinitions) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/Debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <_PropertySheetDisplayName>Debug Settings 10 | Debug 11 | 12 | 13 | 14 | 15 | EnableFastChecks 16 | ProgramDatabase 17 | true 18 | Disabled 19 | _DEBUG;%(PreprocessorDefinitions) 20 | 21 | 22 | _DEBUG;%(PreprocessorDefinitions) 23 | 24 | 25 | true 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/DebugDEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Debug Dynamic 6 | dynamic 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDebugDLL 17 | true 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/DebugDLL.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Dynamic Debug Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreadedDebugDLL 16 | true 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/DebugLEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Debug Link Time Code Generation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDebug 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/DebugLIB.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Debug Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | OldStyle 16 | MultiThreadedDebug 17 | true 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/DebugLTCG.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Debug Link Time Code Generation Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | OldStyle 16 | MultiThreadedDebug 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/DebugSEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Debug Static 6 | static 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDebug 17 | true 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/EXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Application 6 | true 7 | 8 | 9 | 10 | 11 | _CONSOLE;%(PreprocessorDefinitions) 12 | 13 | 14 | Console 15 | 16 | 17 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/LIB.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Library 6 | static 7 | .lib 8 | 9 | 10 | 11 | 12 | _LIB;%(PreprocessorDefinitions) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/LTCG.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Link Time Code Generation Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/Link.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Link Time Code Generation Settings 6 | ltcg 7 | 8 | 9 | 10 | 11 | true 12 | 13 | 14 | UseLinkTimeCodeGeneration 15 | 16 | 17 | true 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/Messages.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Build Messages 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/Output.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Output Settings 6 | 7 | $(ProjectDir)..\..\ 8 | $(ProjectDir)..\..\..\..\ 9 | $(ProjectDir)..\..\..\..\..\ 10 | $(ProjectDir)..\..\..\..\bin\$(PlatformName)\$(DebugOrRelease)\$(PlatformToolset)\$(DefaultLinkage)\ 11 | $(ProjectDir)..\..\..\..\obj\$(TargetName)\$(PlatformName)\$(DebugOrRelease)\$(PlatformToolset)\$(DefaultLinkage)\ 12 | $(OutDir) 13 | $(TargetName) 14 | $(TargetDir)$(TargetName)$(TargetExt) 15 | 16 | 17 | 18 | 19 | $(OutDir)$(TargetName).lib 20 | 21 | 22 | $(OutDir)$(TargetName).log 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/ReleaseDEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Release Dynamic 6 | dynamic 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDLL 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/ReleaseDLL.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Dynamic Release Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreadedDLL 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/ReleaseLEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Release Link Time Code Generation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreaded 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/ReleaseLIB.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Release Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreaded 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/ReleaseLTCG.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Release Link Time Code Generation Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreaded 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/ReleaseSEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Release Static 6 | static 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreaded 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/Win32.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>x86 Settings 6 | 7 | 8 | 9 | 10 | WIN32;_WIN32;%(PreprocessorDefinitions) 11 | 12 | 13 | Win32;%(PreprocessorDefinitions) 14 | 15 | 16 | MachineX86 17 | 18 | 19 | /MACHINE:X86 %(AdditionalOptions) 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/properties/x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>x64 Settings 6 | 7 | 8 | 9 | 10 | 13 | WIN32;_WIN32;WIN64;_WIN64;%(PreprocessorDefinitions) 14 | 15 | 16 | x64;%(PreprocessorDefinitions) 17 | 18 | 19 | MachineX64 20 | 21 | 22 | /MACHINE:X64 %(AdditionalOptions) 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Resource.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/version.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_version_H 3 | #define sodium_version_H 4 | 5 | #include "export.h" 6 | 7 | #define SODIUM_VERSION_STRING "1.0.16" 8 | 9 | #define SODIUM_LIBRARY_VERSION_MAJOR 10 10 | #define SODIUM_LIBRARY_VERSION_MINOR 1 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | SODIUM_EXPORT 17 | const char *sodium_version_string(void); 18 | 19 | SODIUM_EXPORT 20 | int sodium_library_version_major(void); 21 | 22 | SODIUM_EXPORT 23 | int sodium_library_version_minor(void); 24 | 25 | SODIUM_EXPORT 26 | int sodium_library_minimal(void); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2010/libsodium.import.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2010/libsodium/libsodium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2012/libsodium.import.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2012/libsodium/libsodium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2013/libsodium.import.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2013/libsodium/libsodium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2015/libsodium.import.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2015/libsodium/libsodium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2017/libsodium.import.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /deps/libsodium/builds/msvc/vs2017/libsodium/libsodium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deps/libsodium/contrib/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | EXTRA_DIST = \ 3 | Findsodium.cmake 4 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | EXTRA_DIST = \ 3 | android-build.sh \ 4 | android-arm.sh \ 5 | android-armv7-a.sh \ 6 | android-armv8-a.sh \ 7 | android-mips32.sh \ 8 | android-mips64.sh \ 9 | android-x86.sh \ 10 | android-x86_64.sh \ 11 | emscripten.sh \ 12 | ios.sh \ 13 | msys2-win32.sh \ 14 | msys2-win64.sh \ 15 | nativeclient-pnacl.sh \ 16 | nativeclient-x86.sh \ 17 | nativeclient-x86_64.sh 18 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/android-arm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TARGET_ARCH=armv6 3 | export CFLAGS="-Os -mthumb -marm -march=${TARGET_ARCH}" 4 | ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh" 5 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/android-armv7-a.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TARGET_ARCH=armv7-a 3 | export CFLAGS="-Os -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -marm -march=${TARGET_ARCH}" 4 | ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh" 5 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/android-armv8-a.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TARGET_ARCH=armv8-a 3 | export CFLAGS="-Os -march=${TARGET_ARCH}" 4 | NDK_PLATFORM=android-21 ARCH=arm64 HOST_COMPILER=aarch64-linux-android "$(dirname "$0")/android-build.sh" 5 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/android-mips32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TARGET_ARCH=mips32 3 | export CFLAGS="-Os" 4 | ARCH=mips HOST_COMPILER=mipsel-linux-android "$(dirname "$0")/android-build.sh" 5 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/android-mips64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TARGET_ARCH=mips64r6 3 | export CFLAGS="-Os -march=${TARGET_ARCH}" 4 | CC="mips64el-linux-android-gcc" NDK_PLATFORM=android-21 ARCH=mips64 HOST_COMPILER=mips64el-linux-android "$(dirname "$0")/android-build.sh" 5 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/android-x86.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TARGET_ARCH=i686 3 | export CFLAGS="-Os -march=${TARGET_ARCH}" 4 | ARCH=x86 HOST_COMPILER=i686-linux-android "$(dirname "$0")/android-build.sh" 5 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/android-x86_64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TARGET_ARCH=westmere 3 | export CFLAGS="-Os -march=${TARGET_ARCH}" 4 | NDK_PLATFORM=android-21 ARCH=x86_64 HOST_COMPILER=x86_64-linux-android "$(dirname "$0")/android-build.sh" 5 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/msys2-win32.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | export CFLAGS="-Ofast -fomit-frame-pointer -m32 -march=pentium3 -mtune=westmere" 4 | export PREFIX="$(pwd)/libsodium-win32" 5 | 6 | if (i686-w64-mingw32-gcc --version > /dev/null 2>&1) then 7 | echo MinGW found 8 | else 9 | echo Please install mingw-w64-i686-gcc >&2 10 | exit 11 | fi 12 | 13 | ./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \ 14 | --host=i686-w64-mingw32 && \ 15 | make clean && \ 16 | make && \ 17 | make check && \ 18 | make install 19 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/msys2-win64.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | export CFLAGS="-Ofast -fomit-frame-pointer -m64 -mtune=westmere" 4 | export PREFIX="$(pwd)/libsodium-win64" 5 | 6 | if (x86_64-w64-mingw32-gcc --version > /dev/null 2>&1) then 7 | echo MinGW found 8 | else 9 | echo Please install mingw-w64-x86_64-gcc >&2 10 | exit 11 | fi 12 | 13 | ./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \ 14 | --host=x86_64-w64-mingw32 && \ 15 | make clean && \ 16 | make && \ 17 | make check && \ 18 | make install 19 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/nativeclient-pnacl.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} 4 | export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_pnacl"} 5 | export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} 6 | export PREFIX="$(pwd)/libsodium-nativeclient" 7 | export PATH="${NACL_BIN}:$PATH" 8 | export AR=${AR-"pnacl-ar"} 9 | export AS=${AS-"pnacl-as"} 10 | export CC=${CC-"pnacl-clang"} 11 | export LD=${LD-"pnacl-ld"} 12 | export NM=${NM-"pnacl-nm"} 13 | export RANLIB=${RANLIB-"pnacl-ranlib"} 14 | export PNACL_FINALIZE=${PNACL_FINALIZE-"pnacl-finalize"} 15 | export PNACL_TRANSLATE=${PNACL_TRANSLATE-"pnacl-translate"} 16 | export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" 17 | 18 | mkdir -p $PREFIX || exit 1 19 | 20 | make distclean > /dev/null 21 | 22 | ./configure --enable-minimal \ 23 | --host=nacl \ 24 | --disable-ssp --without-pthreads \ 25 | --prefix="$PREFIX" || exit 1 26 | 27 | make -j3 check && make -j3 install || exit 1 28 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/nativeclient-x86.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} 4 | export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_x86_glibc"} 5 | export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} 6 | export PREFIX="$(pwd)/libsodium-nativeclient-x86" 7 | export PATH="${NACL_BIN}:$PATH" 8 | export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" 9 | 10 | mkdir -p $PREFIX || exit 1 11 | 12 | make distclean > /dev/null 13 | 14 | ./configure --enable-minimal \ 15 | --host=i686-nacl \ 16 | --disable-ssp --without-pthreads \ 17 | --prefix="$PREFIX" || exit 1 18 | 19 | make -j3 check && make -j3 install || exit 1 20 | -------------------------------------------------------------------------------- /deps/libsodium/dist-build/nativeclient-x86_64.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"} 4 | export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_x86_glibc"} 5 | export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"} 6 | export PREFIX="$(pwd)/libsodium-nativeclient-x86_64" 7 | export PATH="${NACL_BIN}:$PATH" 8 | export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr" 9 | 10 | mkdir -p $PREFIX || exit 1 11 | 12 | make distclean > /dev/null 13 | 14 | ./configure --enable-minimal \ 15 | --host=x86_64-nacl \ 16 | --disable-ssp --without-pthreads \ 17 | --prefix="$PREFIX" || exit 1 18 | 19 | make -j3 check && make -j3 install || exit 1 20 | -------------------------------------------------------------------------------- /deps/libsodium/libsodium-uninstalled.pc.in: -------------------------------------------------------------------------------- 1 | Name: @PACKAGE_NAME@ 2 | Version: @PACKAGE_VERSION@ 3 | Description: A modern and easy-to-use crypto library 4 | 5 | Libs: -L${pcfiledir}/src/libsodium -lsodium 6 | Cflags: -I${pcfiledir}/src/libsodium/include -I@top_srcdir@/src/libsodium/include -I@top_srcdir@/src/libsodium/include/sodium 7 | -------------------------------------------------------------------------------- /deps/libsodium/libsodium.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @PACKAGE_NAME@ 7 | Version: @PACKAGE_VERSION@ 8 | Description: A modern and easy-to-use crypto library 9 | 10 | Libs: -L${libdir} -lsodium 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /deps/libsodium/m4/ld-output-def.m4: -------------------------------------------------------------------------------- 1 | # ld-output-def.m4 serial 2 2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Simon Josefsson 8 | 9 | # gl_LD_OUTPUT_DEF() 10 | # ------------- 11 | # Check if linker supports -Wl,--output-def and define automake 12 | # conditional HAVE_LD_OUTPUT_DEF if it is. 13 | AC_DEFUN([gl_LD_OUTPUT_DEF], 14 | [ 15 | AC_CACHE_CHECK([if gcc/ld supports -Wl,--output-def], 16 | [gl_cv_ld_output_def], 17 | [if test "$enable_shared" = no; then 18 | gl_cv_ld_output_def="not needed, shared libraries are disabled" 19 | else 20 | gl_ldflags_save=$LDFLAGS 21 | LDFLAGS="-Wl,--output-def,conftest.def" 22 | AC_LINK_IFELSE([AC_LANG_PROGRAM([])], 23 | [gl_cv_ld_output_def=yes], 24 | [gl_cv_ld_output_def=no]) 25 | rm -f conftest.def 26 | LDFLAGS="$gl_ldflags_save" 27 | fi]) 28 | AM_CONDITIONAL([HAVE_LD_OUTPUT_DEF], test "x$gl_cv_ld_output_def" = "xyes") 29 | ]) 30 | -------------------------------------------------------------------------------- /deps/libsodium/msvc-scripts/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = \ 2 | process.bat \ 3 | rep.vbs \ 4 | sodium.props 5 | -------------------------------------------------------------------------------- /deps/libsodium/msvc-scripts/process.bat: -------------------------------------------------------------------------------- 1 | cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/1.0.16/ < src\libsodium\include\sodium\version.h.in > tmp 2 | cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MAJOR@/10/ < tmp > tmp2 3 | cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/1/ < tmp2 > tmp3 4 | cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_MINIMAL_DEF@// < tmp3 > src\libsodium\include\sodium\version.h 5 | del tmp tmp2 tmp3 6 | -------------------------------------------------------------------------------- /deps/libsodium/msvc-scripts/rep.vbs: -------------------------------------------------------------------------------- 1 | Dim pat, patparts, rxp, inp 2 | pat = WScript.Arguments(0) 3 | patparts = Split(pat, "/") 4 | Set rxp = new RegExp 5 | rxp.Global = True 6 | rxp.Multiline = False 7 | rxp.Pattern = patparts(1) 8 | Do While Not WScript.StdIn.AtEndOfStream 9 | inp = WScript.StdIn.ReadLine() 10 | WScript.Echo rxp.Replace(inp, patparts(2)) 11 | Loop 12 | 13 | -------------------------------------------------------------------------------- /deps/libsodium/msvc-scripts/sodium.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(SolutionDir);$(SolutionDir)src\libsodium\include\sodium;$(SolutionDir)src\libsodium\include;%(AdditionalIncludeDirectories) 9 | true 10 | UNICODE;_UNICODE;%(PreprocessorDefinitions) 11 | NATIVE_LITTLE_ENDIAN=1;%(PreprocessorDefinitions) 12 | inline=__inline;%(PreprocessorDefinitions) 13 | 14 | 15 | "$(SolutionDir)/msvc-scripts/process.bat" 16 | 17 | 18 | Process .in files 19 | 20 | 21 | "$(SolutionDir)/test/default/wintest.bat" $(Configuration) $(Platform) 22 | 23 | 24 | Run the test suite 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /deps/libsodium/src/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = \ 3 | libsodium 4 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_auth/crypto_auth.c: -------------------------------------------------------------------------------- 1 | 2 | #include "crypto_auth.h" 3 | #include "randombytes.h" 4 | 5 | size_t 6 | crypto_auth_bytes(void) 7 | { 8 | return crypto_auth_BYTES; 9 | } 10 | 11 | size_t 12 | crypto_auth_keybytes(void) 13 | { 14 | return crypto_auth_KEYBYTES; 15 | } 16 | 17 | const char * 18 | crypto_auth_primitive(void) 19 | { 20 | return crypto_auth_PRIMITIVE; 21 | } 22 | 23 | int 24 | crypto_auth(unsigned char *out, const unsigned char *in, 25 | unsigned long long inlen, const unsigned char *k) 26 | { 27 | return crypto_auth_hmacsha512256(out, in, inlen, k); 28 | } 29 | 30 | int 31 | crypto_auth_verify(const unsigned char *h, const unsigned char *in, 32 | unsigned long long inlen,const unsigned char *k) 33 | { 34 | return crypto_auth_hmacsha512256_verify(h, in, inlen, k); 35 | } 36 | 37 | void 38 | crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES]) 39 | { 40 | randombytes_buf(k, crypto_auth_KEYBYTES); 41 | } 42 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h: -------------------------------------------------------------------------------- 1 | /* 37095705934669439343138083508754565189542113879843219016388785533085940283555 */ 2 | static const fe25519 d = { 3 | -10913610, 13857413, -15372611, 6949391, 114729, -8787816, -6275908, -3247719, -18696448, -12055116 4 | }; 5 | 6 | /* 2 * d = 7 | * 16295367250680780974490674513165176452449235426866156013048779062215315747161 8 | */ 9 | static const fe25519 d2 = { 10 | -21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199 }; 11 | 12 | /* sqrt(-1) */ 13 | static const fe25519 sqrtm1 = { 14 | -32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482 15 | }; 16 | 17 | /* A = 486662 */ 18 | static const fe25519 curve25519_A = { 19 | 486662, 0, 0, 0, 0, 0, 0, 0, 0, 0 20 | }; 21 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h: -------------------------------------------------------------------------------- 1 | /* 37095705934669439343138083508754565189542113879843219016388785533085940283555 */ 2 | static const fe25519 d = { 3 | 929955233495203, 466365720129213, 1662059464998953, 2033849074728123, 1442794654840575 4 | }; 5 | 6 | /* 2 * d = 7 | * 16295367250680780974490674513165176452449235426866156013048779062215315747161 8 | */ 9 | static const fe25519 d2 = { 10 | 1859910466990425, 932731440258426, 1072319116312658, 1815898335770999, 633789495995903 11 | }; 12 | 13 | /* sqrt(-1) */ 14 | static const fe25519 sqrtm1 = { 15 | 1718705420411056, 234908883556509, 2233514472574048, 2117202627021982, 765476049583133 16 | }; 17 | 18 | /* A = 486662 */ 19 | static const fe25519 curve25519_A = { 20 | 486662, 0, 0, 0, 0 21 | }; 22 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c: -------------------------------------------------------------------------------- 1 | #include "crypto_core_hsalsa20.h" 2 | 3 | size_t 4 | crypto_core_hsalsa20_outputbytes(void) { 5 | return crypto_core_hsalsa20_OUTPUTBYTES; 6 | } 7 | 8 | size_t 9 | crypto_core_hsalsa20_inputbytes(void) { 10 | return crypto_core_hsalsa20_INPUTBYTES; 11 | } 12 | 13 | size_t 14 | crypto_core_hsalsa20_keybytes(void) { 15 | return crypto_core_hsalsa20_KEYBYTES; 16 | } 17 | 18 | size_t 19 | crypto_core_hsalsa20_constbytes(void) { 20 | return crypto_core_hsalsa20_CONSTBYTES; 21 | } 22 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_generichash/blake2b/generichash_blake2.c: -------------------------------------------------------------------------------- 1 | #include "crypto_generichash_blake2b.h" 2 | #include "randombytes.h" 3 | 4 | size_t 5 | crypto_generichash_blake2b_bytes_min(void) { 6 | return crypto_generichash_blake2b_BYTES_MIN; 7 | } 8 | 9 | size_t 10 | crypto_generichash_blake2b_bytes_max(void) { 11 | return crypto_generichash_blake2b_BYTES_MAX; 12 | } 13 | 14 | size_t 15 | crypto_generichash_blake2b_bytes(void) { 16 | return crypto_generichash_blake2b_BYTES; 17 | } 18 | 19 | size_t 20 | crypto_generichash_blake2b_keybytes_min(void) { 21 | return crypto_generichash_blake2b_KEYBYTES_MIN; 22 | } 23 | 24 | size_t 25 | crypto_generichash_blake2b_keybytes_max(void) { 26 | return crypto_generichash_blake2b_KEYBYTES_MAX; 27 | } 28 | 29 | size_t 30 | crypto_generichash_blake2b_keybytes(void) { 31 | return crypto_generichash_blake2b_KEYBYTES; 32 | } 33 | 34 | size_t 35 | crypto_generichash_blake2b_saltbytes(void) { 36 | return crypto_generichash_blake2b_SALTBYTES; 37 | } 38 | 39 | size_t 40 | crypto_generichash_blake2b_personalbytes(void) { 41 | return crypto_generichash_blake2b_PERSONALBYTES; 42 | } 43 | 44 | size_t 45 | crypto_generichash_blake2b_statebytes(void) 46 | { 47 | return (sizeof(crypto_generichash_blake2b_state) + (size_t) 63U) 48 | & ~(size_t) 63U; 49 | } 50 | 51 | void 52 | crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES]) 53 | { 54 | randombytes_buf(k, crypto_generichash_blake2b_KEYBYTES); 55 | } 56 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c: -------------------------------------------------------------------------------- 1 | 2 | #define BLAKE2_USE_SSSE3 3 | #define BLAKE2_USE_SSE41 4 | #define BLAKE2_USE_AVX2 5 | 6 | #include 7 | #include 8 | 9 | #include "blake2.h" 10 | #include "private/common.h" 11 | #include "private/sse2_64_32.h" 12 | 13 | #if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \ 14 | defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H) 15 | 16 | # ifdef __GNUC__ 17 | # pragma GCC target("sse2") 18 | # pragma GCC target("ssse3") 19 | # pragma GCC target("sse4.1") 20 | # pragma GCC target("avx2") 21 | # endif 22 | 23 | # include 24 | # include 25 | # include 26 | # include 27 | 28 | # include "blake2b-compress-avx2.h" 29 | 30 | CRYPTO_ALIGN(64) 31 | static const uint64_t blake2b_IV[8] = { 32 | 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 33 | 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 34 | 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL 35 | }; 36 | 37 | int 38 | blake2b_compress_avx2(blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES]) 39 | { 40 | __m256i a = LOADU(&S->h[0]); 41 | __m256i b = LOADU(&S->h[4]); 42 | BLAKE2B_COMPRESS_V1(a, b, block, S->t[0], S->t[1], S->f[0], S->f[1]); 43 | STOREU(&S->h[0], a); 44 | STOREU(&S->h[4], b); 45 | 46 | return 0; 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_hash/crypto_hash.c: -------------------------------------------------------------------------------- 1 | 2 | #include "crypto_hash.h" 3 | 4 | size_t 5 | crypto_hash_bytes(void) 6 | { 7 | return crypto_hash_BYTES; 8 | } 9 | 10 | int 11 | crypto_hash(unsigned char *out, const unsigned char *in, 12 | unsigned long long inlen) 13 | { 14 | return crypto_hash_sha512(out, in, inlen); 15 | } 16 | 17 | const char * 18 | crypto_hash_primitive(void) { 19 | return crypto_hash_PRIMITIVE; 20 | } 21 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256.c: -------------------------------------------------------------------------------- 1 | #include "crypto_hash_sha256.h" 2 | 3 | size_t 4 | crypto_hash_sha256_bytes(void) 5 | { 6 | return crypto_hash_sha256_BYTES; 7 | } 8 | 9 | size_t 10 | crypto_hash_sha256_statebytes(void) 11 | { 12 | return sizeof(crypto_hash_sha256_state); 13 | } 14 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512.c: -------------------------------------------------------------------------------- 1 | #include "crypto_hash_sha512.h" 2 | 3 | size_t 4 | crypto_hash_sha512_bytes(void) 5 | { 6 | return crypto_hash_sha512_BYTES; 7 | } 8 | 9 | size_t 10 | crypto_hash_sha512_statebytes(void) 11 | { 12 | return sizeof(crypto_hash_sha512_state); 13 | } 14 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_kdf/crypto_kdf.c: -------------------------------------------------------------------------------- 1 | 2 | #include "crypto_kdf.h" 3 | #include "randombytes.h" 4 | 5 | const char * 6 | crypto_kdf_primitive(void) 7 | { 8 | return crypto_kdf_PRIMITIVE; 9 | } 10 | 11 | size_t 12 | crypto_kdf_bytes_min(void) 13 | { 14 | return crypto_kdf_BYTES_MIN; 15 | } 16 | 17 | size_t 18 | crypto_kdf_bytes_max(void) 19 | { 20 | return crypto_kdf_BYTES_MAX; 21 | } 22 | 23 | size_t 24 | crypto_kdf_contextbytes(void) 25 | { 26 | return crypto_kdf_CONTEXTBYTES; 27 | } 28 | 29 | size_t 30 | crypto_kdf_keybytes(void) 31 | { 32 | return crypto_kdf_KEYBYTES; 33 | } 34 | 35 | int 36 | crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len, 37 | uint64_t subkey_id, 38 | const char ctx[crypto_kdf_CONTEXTBYTES], 39 | const unsigned char key[crypto_kdf_KEYBYTES]) 40 | { 41 | return crypto_kdf_blake2b_derive_from_key(subkey, subkey_len, 42 | subkey_id, ctx, key); 43 | } 44 | 45 | void 46 | crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES]) 47 | { 48 | randombytes_buf(k, crypto_kdf_KEYBYTES); 49 | } 50 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h: -------------------------------------------------------------------------------- 1 | #ifndef poly1305_donna_H 2 | #define poly1305_donna_H 3 | 4 | #include 5 | 6 | #include "../onetimeauth_poly1305.h" 7 | #include "crypto_onetimeauth_poly1305.h" 8 | 9 | extern struct crypto_onetimeauth_poly1305_implementation 10 | crypto_onetimeauth_poly1305_donna_implementation; 11 | 12 | #endif /* poly1305_donna_H */ 13 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef onetimeauth_poly1305_H 3 | #define onetimeauth_poly1305_H 4 | 5 | #include "crypto_onetimeauth_poly1305.h" 6 | 7 | typedef struct crypto_onetimeauth_poly1305_implementation { 8 | int (*onetimeauth)(unsigned char *out, const unsigned char *in, 9 | unsigned long long inlen, const unsigned char *k); 10 | int (*onetimeauth_verify)(const unsigned char *h, const unsigned char *in, 11 | unsigned long long inlen, const unsigned char *k); 12 | int (*onetimeauth_init)(crypto_onetimeauth_poly1305_state *state, 13 | const unsigned char * key); 14 | int (*onetimeauth_update)(crypto_onetimeauth_poly1305_state *state, 15 | const unsigned char * in, 16 | unsigned long long inlen); 17 | int (*onetimeauth_final)(crypto_onetimeauth_poly1305_state *state, 18 | unsigned char * out); 19 | } crypto_onetimeauth_poly1305_implementation; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h: -------------------------------------------------------------------------------- 1 | #ifndef poly1305_sse2_H 2 | #define poly1305_sse2_H 3 | 4 | #include 5 | 6 | #include "../onetimeauth_poly1305.h" 7 | #include "crypto_onetimeauth_poly1305.h" 8 | 9 | extern struct crypto_onetimeauth_poly1305_implementation 10 | crypto_onetimeauth_poly1305_sse2_implementation; 11 | 12 | #endif /* poly1305_sse2_H */ 13 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.h: -------------------------------------------------------------------------------- 1 | #ifndef argon2_encoding_H 2 | #define argon2_encoding_H 3 | 4 | #include "argon2.h" 5 | 6 | /* 7 | * encode an Argon2 hash string into the provided buffer. 'dst_len' 8 | * contains the size, in characters, of the 'dst' buffer; if 'dst_len' 9 | * is less than the number of required characters (including the 10 | * terminating 0), then this function returns 0. 11 | * 12 | * if ctx->outlen is 0, then the hash string will be a salt string 13 | * (no output). if ctx->saltlen is also 0, then the string will be a 14 | * parameter-only string (no salt and no output). 15 | * 16 | * On success, ARGON2_OK is returned. 17 | * 18 | * No other parameters are checked 19 | */ 20 | int encode_string(char *dst, size_t dst_len, argon2_context *ctx, 21 | argon2_type type); 22 | 23 | /* 24 | * Decodes an Argon2 hash string into the provided structure 'ctx'. 25 | * The fields ctx.saltlen, ctx.adlen, ctx.outlen set the maximal salt, ad, out 26 | * length values 27 | * that are allowed; invalid input string causes an error 28 | * 29 | * Returned value is ARGON2_OK on success. 30 | */ 31 | int decode_string(argon2_context *ctx, const char *str, argon2_type type); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.h: -------------------------------------------------------------------------------- 1 | #ifndef blake2b_long_H 2 | #define blake2b_long_H 3 | 4 | #include 5 | 6 | int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c: -------------------------------------------------------------------------------- 1 | 2 | #include "crypto_scalarmult.h" 3 | 4 | const char * 5 | crypto_scalarmult_primitive(void) 6 | { 7 | return crypto_scalarmult_PRIMITIVE; 8 | } 9 | 10 | int 11 | crypto_scalarmult_base(unsigned char *q, const unsigned char *n) 12 | { 13 | return crypto_scalarmult_curve25519_base(q, n); 14 | } 15 | 16 | int 17 | crypto_scalarmult(unsigned char *q, const unsigned char *n, 18 | const unsigned char *p) 19 | { 20 | return crypto_scalarmult_curve25519(q, n, p); 21 | } 22 | 23 | size_t 24 | crypto_scalarmult_bytes(void) 25 | { 26 | return crypto_scalarmult_BYTES; 27 | } 28 | 29 | size_t 30 | crypto_scalarmult_scalarbytes(void) 31 | { 32 | return crypto_scalarmult_SCALARBYTES; 33 | } 34 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h: -------------------------------------------------------------------------------- 1 | #ifndef x25519_ref10_H 2 | #define x25519_ref10_H 3 | 4 | #include "crypto_scalarmult_curve25519.h" 5 | #include "../scalarmult_curve25519.h" 6 | 7 | extern struct crypto_scalarmult_curve25519_implementation 8 | crypto_scalarmult_curve25519_ref10_implementation; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S: -------------------------------------------------------------------------------- 1 | #ifdef IN_SANDY2X 2 | 3 | /* 4 | REDMASK51 is from amd64-51/consts.s. 5 | */ 6 | 7 | #include "consts_namespace.h" 8 | .data 9 | .p2align 4 10 | v0_0: .quad 0, 0 11 | v1_0: .quad 1, 0 12 | v2_1: .quad 2, 1 13 | v9_0: .quad 9, 0 14 | v9_9: .quad 9, 9 15 | v19_19: .quad 19, 19 16 | v38_1: .quad 38, 1 17 | v38_38: .quad 38, 38 18 | v121666_121666: .quad 121666, 121666 19 | m25: .quad 33554431, 33554431 20 | m26: .quad 67108863, 67108863 21 | subc0: .quad 0x07FFFFDA, 0x03FFFFFE 22 | subc2: .quad 0x07FFFFFE, 0x03FFFFFE 23 | REDMASK51: .quad 0x0007FFFFFFFFFFFF 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h: -------------------------------------------------------------------------------- 1 | #ifndef consts_namespace_H 2 | #define consts_namespace_H 3 | 4 | #define v0_0 crypto_scalarmult_curve25519_sandy2x_v0_0 5 | #define v1_0 crypto_scalarmult_curve25519_sandy2x_v1_0 6 | #define v2_1 crypto_scalarmult_curve25519_sandy2x_v2_1 7 | #define v9_0 crypto_scalarmult_curve25519_sandy2x_v9_0 8 | #define v9_9 crypto_scalarmult_curve25519_sandy2x_v9_9 9 | #define v19_19 crypto_scalarmult_curve25519_sandy2x_v19_19 10 | #define v38_1 crypto_scalarmult_curve25519_sandy2x_v38_1 11 | #define v38_38 crypto_scalarmult_curve25519_sandy2x_v38_38 12 | #define v121666_121666 crypto_scalarmult_curve25519_sandy2x_v121666_121666 13 | #define m25 crypto_scalarmult_curve25519_sandy2x_m25 14 | #define m26 crypto_scalarmult_curve25519_sandy2x_m26 15 | #define subc0 crypto_scalarmult_curve25519_sandy2x_subc0 16 | #define subc2 crypto_scalarmult_curve25519_sandy2x_subc2 17 | #define REDMASK51 crypto_scalarmult_curve25519_sandy2x_REDMASK51 18 | 19 | #endif /* ifndef consts_namespace_H */ 20 | 21 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h: -------------------------------------------------------------------------------- 1 | #ifndef curve25519_sandy2x_H 2 | #define curve25519_sandy2x_H 3 | 4 | #include "crypto_scalarmult_curve25519.h" 5 | 6 | extern struct crypto_scalarmult_curve25519_implementation 7 | crypto_scalarmult_curve25519_sandy2x_implementation; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is adapted from ref10/fe.h: 3 | All the redundant functions are removed. 4 | */ 5 | 6 | #ifndef fe_H 7 | #define fe_H 8 | 9 | #include 10 | #include 11 | 12 | typedef uint64_t fe[10]; 13 | 14 | /* 15 | fe means field element. 16 | Here the field is \Z/(2^255-19). 17 | An element t, entries t[0]...t[9], represents the integer 18 | t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. 19 | Bounds on each t[i] vary depending on context. 20 | */ 21 | 22 | #define fe_frombytes crypto_scalarmult_curve25519_sandy2x_fe_frombytes 23 | 24 | extern void fe_frombytes(fe, const unsigned char *); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is adapted from amd64-51/fe25519.h: 3 | 'fe25519' is renamed as 'fe51'; 4 | All the redundant functions are removed; 5 | New function fe51_nsquare is introduced. 6 | */ 7 | 8 | #ifndef fe51_H 9 | #define fe51_H 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | #include "fe51_namespace.h" 19 | 20 | typedef struct 21 | { 22 | uint64_t v[5]; 23 | } 24 | fe51; 25 | 26 | extern void fe51_pack(unsigned char *, const fe51 *); 27 | extern void fe51_mul(fe51 *, const fe51 *, const fe51 *); 28 | extern void fe51_nsquare(fe51 *, const fe51 *, int); 29 | extern void fe51_invert(fe51 *, const fe51 *); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h: -------------------------------------------------------------------------------- 1 | #ifndef fe51_namespace_H 2 | #define fe51_namespace_H 3 | 4 | #define fe51 crypto_scalarmult_curve25519_sandy2x_fe51 5 | #define _fe51 _crypto_scalarmult_curve25519_sandy2x_fe51 6 | #define fe51_pack crypto_scalarmult_curve25519_sandy2x_fe51_pack 7 | #define _fe51_pack _crypto_scalarmult_curve25519_sandy2x_fe51_pack 8 | #define fe51_mul crypto_scalarmult_curve25519_sandy2x_fe51_mul 9 | #define _fe51_mul _crypto_scalarmult_curve25519_sandy2x_fe51_mul 10 | #define fe51_nsquare crypto_scalarmult_curve25519_sandy2x_fe51_nsquare 11 | #define _fe51_nsquare _crypto_scalarmult_curve25519_sandy2x_fe51_nsquare 12 | 13 | #define fe51_invert crypto_scalarmult_curve25519_sandy2x_fe51_invert 14 | 15 | #endif /* ifndef fe51_namespace_H */ 16 | 17 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h: -------------------------------------------------------------------------------- 1 | #ifndef ladder_H 2 | #define ladder_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "fe.h" 9 | #include "ladder_namespace.h" 10 | 11 | extern void ladder(fe *, const unsigned char *); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* ifndef ladder_H */ 18 | 19 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.h: -------------------------------------------------------------------------------- 1 | #ifndef ladder_base_H 2 | #define ladder_base_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "fe.h" 9 | #include "ladder_base_namespace.h" 10 | 11 | extern void ladder_base(fe *, const unsigned char *); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* ifndef ladder_base_H */ 18 | 19 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base_namespace.h: -------------------------------------------------------------------------------- 1 | #ifndef ladder_base_namespace_H 2 | #define ladder_base_namespace_H 3 | 4 | #define ladder_base crypto_scalarmult_curve25519_sandy2x_ladder_base 5 | #define _ladder_base _crypto_scalarmult_curve25519_sandy2x_ladder_base 6 | 7 | #endif /* ifndef ladder_base_namespace_H */ 8 | 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h: -------------------------------------------------------------------------------- 1 | #ifndef ladder_namespace_H 2 | #define ladder_namespace_H 3 | 4 | #define ladder crypto_scalarmult_curve25519_sandy2x_ladder 5 | #define _ladder _crypto_scalarmult_curve25519_sandy2x_ladder 6 | 7 | #endif /* ifndef ladder_namespace_H */ 8 | 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S: -------------------------------------------------------------------------------- 1 | 2 | #ifdef HAVE_AVX_ASM 3 | 4 | #define IN_SANDY2X 5 | 6 | #include "consts.S" 7 | #include "fe51_mul.S" 8 | #include "fe51_nsquare.S" 9 | #include "fe51_pack.S" 10 | #include "ladder.S" 11 | #include "ladder_base.S" 12 | 13 | #if defined(__linux__) && defined(__ELF__) 14 | .section .note.GNU-stack,"",%progbits 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef scalarmult_poly1305_H 3 | #define scalarmult_poly1305_H 4 | 5 | typedef struct crypto_scalarmult_curve25519_implementation { 6 | int (*mult)(unsigned char *q, const unsigned char *n, 7 | const unsigned char *p); 8 | int (*mult_base)(unsigned char *q, const unsigned char *n); 9 | } crypto_scalarmult_curve25519_implementation; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c: -------------------------------------------------------------------------------- 1 | 2 | #include "crypto_shorthash.h" 3 | #include "randombytes.h" 4 | 5 | size_t 6 | crypto_shorthash_bytes(void) 7 | { 8 | return crypto_shorthash_BYTES; 9 | } 10 | 11 | size_t 12 | crypto_shorthash_keybytes(void) 13 | { 14 | return crypto_shorthash_KEYBYTES; 15 | } 16 | 17 | const char * 18 | crypto_shorthash_primitive(void) 19 | { 20 | return crypto_shorthash_PRIMITIVE; 21 | } 22 | 23 | int 24 | crypto_shorthash(unsigned char *out, const unsigned char *in, 25 | unsigned long long inlen, const unsigned char *k) 26 | { 27 | return crypto_shorthash_siphash24(out, in, inlen, k); 28 | } 29 | 30 | void 31 | crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]) 32 | { 33 | randombytes_buf(k, crypto_shorthash_KEYBYTES); 34 | } 35 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash_ref.h: -------------------------------------------------------------------------------- 1 | #ifndef shorthash_siphash_H 2 | #define shorthash_siphash_H 3 | 4 | #include "private/common.h" 5 | 6 | #define SIPROUND \ 7 | do { \ 8 | v0 += v1; \ 9 | v1 = ROTL64(v1, 13); \ 10 | v1 ^= v0; \ 11 | v0 = ROTL64(v0, 32); \ 12 | v2 += v3; \ 13 | v3 = ROTL64(v3, 16); \ 14 | v3 ^= v2; \ 15 | v0 += v3; \ 16 | v3 = ROTL64(v3, 21); \ 17 | v3 ^= v0; \ 18 | v2 += v1; \ 19 | v1 = ROTL64(v1, 17); \ 20 | v1 ^= v2; \ 21 | v2 = ROTL64(v2, 32); \ 22 | } while (0) 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c: -------------------------------------------------------------------------------- 1 | #include "crypto_shorthash_siphash24.h" 2 | 3 | size_t 4 | crypto_shorthash_siphash24_bytes(void) { 5 | return crypto_shorthash_siphash24_BYTES; 6 | } 7 | 8 | size_t 9 | crypto_shorthash_siphash24_keybytes(void) { 10 | return crypto_shorthash_siphash24_KEYBYTES; 11 | } 12 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphashx24.c: -------------------------------------------------------------------------------- 1 | #include "crypto_shorthash_siphash24.h" 2 | 3 | size_t 4 | crypto_shorthash_siphashx24_bytes(void) { 5 | return crypto_shorthash_siphashx24_BYTES; 6 | } 7 | 8 | size_t 9 | crypto_shorthash_siphashx24_keybytes(void) { 10 | return crypto_shorthash_siphashx24_KEYBYTES; 11 | } 12 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign_ed25519_ref10.h: -------------------------------------------------------------------------------- 1 | #ifndef sign_ed25519_ref10_H 2 | #define sign_ed25519_ref10_H 3 | 4 | void _crypto_sign_ed25519_ref10_hinit(crypto_hash_sha512_state *hs, 5 | int prehashed); 6 | 7 | int _crypto_sign_ed25519_detached(unsigned char *sig, 8 | unsigned long long *siglen_p, 9 | const unsigned char *m, 10 | unsigned long long mlen, 11 | const unsigned char *sk, int prehashed); 12 | 13 | int _crypto_sign_ed25519_verify_detached(const unsigned char *sig, 14 | const unsigned char *m, 15 | unsigned long long mlen, 16 | const unsigned char *pk, 17 | int prehashed); 18 | #endif 19 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "../stream_chacha20.h" 5 | #include "crypto_stream_chacha20.h" 6 | 7 | extern struct crypto_stream_chacha20_implementation 8 | crypto_stream_chacha20_dolbeau_avx2_implementation; 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "../stream_chacha20.h" 5 | #include "crypto_stream_chacha20.h" 6 | 7 | extern struct crypto_stream_chacha20_implementation 8 | crypto_stream_chacha20_dolbeau_ssse3_implementation; 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "../stream_chacha20.h" 5 | #include "crypto_stream_chacha20.h" 6 | 7 | extern struct crypto_stream_chacha20_implementation 8 | crypto_stream_chacha20_ref_implementation; 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef stream_chacha20_H 3 | #define stream_chacha20_H 4 | 5 | #include 6 | 7 | typedef struct crypto_stream_chacha20_implementation { 8 | int (*stream)(unsigned char *c, unsigned long long clen, 9 | const unsigned char *n, const unsigned char *k); 10 | int (*stream_ietf)(unsigned char *c, unsigned long long clen, 11 | const unsigned char *n, const unsigned char *k); 12 | int (*stream_xor_ic)(unsigned char *c, const unsigned char *m, 13 | unsigned long long mlen, 14 | const unsigned char *n, uint64_t ic, 15 | const unsigned char *k); 16 | int (*stream_ietf_xor_ic)(unsigned char *c, const unsigned char *m, 17 | unsigned long long mlen, 18 | const unsigned char *n, uint32_t ic, 19 | const unsigned char *k); 20 | } crypto_stream_chacha20_implementation; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/crypto_stream.c: -------------------------------------------------------------------------------- 1 | 2 | #include "crypto_stream.h" 3 | #include "randombytes.h" 4 | 5 | size_t 6 | crypto_stream_keybytes(void) 7 | { 8 | return crypto_stream_KEYBYTES; 9 | } 10 | 11 | size_t 12 | crypto_stream_noncebytes(void) 13 | { 14 | return crypto_stream_NONCEBYTES; 15 | } 16 | 17 | size_t 18 | crypto_stream_messagebytes_max(void) 19 | { 20 | return crypto_stream_MESSAGEBYTES_MAX; 21 | } 22 | 23 | const char * 24 | crypto_stream_primitive(void) 25 | { 26 | return crypto_stream_PRIMITIVE; 27 | } 28 | 29 | int 30 | crypto_stream(unsigned char *c, unsigned long long clen, 31 | const unsigned char *n, const unsigned char *k) 32 | { 33 | return crypto_stream_xsalsa20(c, clen, n, k); 34 | } 35 | 36 | 37 | int 38 | crypto_stream_xor(unsigned char *c, const unsigned char *m, 39 | unsigned long long mlen, const unsigned char *n, 40 | const unsigned char *k) 41 | { 42 | return crypto_stream_xsalsa20_xor(c, m, mlen, n, k); 43 | } 44 | 45 | void 46 | crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]) 47 | { 48 | randombytes_buf(k, crypto_stream_KEYBYTES); 49 | } 50 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "../stream_salsa20.h" 5 | #include "crypto_stream_salsa20.h" 6 | 7 | extern struct crypto_stream_salsa20_implementation 8 | crypto_stream_salsa20_ref_implementation; 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef stream_salsa20_H 3 | #define stream_salsa20_H 4 | 5 | #include 6 | 7 | typedef struct crypto_stream_salsa20_implementation { 8 | int (*stream)(unsigned char *c, unsigned long long clen, 9 | const unsigned char *n, const unsigned char *k); 10 | int (*stream_xor_ic)(unsigned char *c, const unsigned char *m, 11 | unsigned long long mlen, 12 | const unsigned char *n, uint64_t ic, 13 | const unsigned char *k); 14 | } crypto_stream_salsa20_implementation; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "utils.h" 5 | 6 | #include "../stream_salsa20.h" 7 | #include "salsa20_xmm6.h" 8 | 9 | #ifdef HAVE_AMD64_ASM 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | extern int stream_salsa20_xmm6(unsigned char *c, unsigned long long clen, 15 | const unsigned char *n, const unsigned char *k); 16 | 17 | extern int stream_salsa20_xmm6_xor_ic(unsigned char *c, const unsigned char *m, 18 | unsigned long long mlen, 19 | const unsigned char *n, 20 | uint64_t ic, const unsigned char *k); 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | struct crypto_stream_salsa20_implementation 26 | crypto_stream_salsa20_xmm6_implementation = { 27 | SODIUM_C99(.stream =) stream_salsa20_xmm6, 28 | SODIUM_C99(.stream_xor_ic =) stream_salsa20_xmm6_xor_ic, 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "../stream_salsa20.h" 5 | #include "crypto_stream_salsa20.h" 6 | 7 | extern struct crypto_stream_salsa20_implementation 8 | crypto_stream_salsa20_xmm6_implementation; 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "../stream_salsa20.h" 5 | #include "crypto_stream_salsa20.h" 6 | 7 | extern struct crypto_stream_salsa20_implementation 8 | crypto_stream_salsa20_xmm6int_avx2_implementation; 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "../stream_salsa20.h" 5 | #include "crypto_stream_salsa20.h" 6 | 7 | extern struct crypto_stream_salsa20_implementation 8 | crypto_stream_salsa20_xmm6int_sse2_implementation; 9 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c: -------------------------------------------------------------------------------- 1 | #include "crypto_stream_salsa2012.h" 2 | #include "randombytes.h" 3 | 4 | size_t 5 | crypto_stream_salsa2012_keybytes(void) 6 | { 7 | return crypto_stream_salsa2012_KEYBYTES; 8 | } 9 | 10 | size_t 11 | crypto_stream_salsa2012_noncebytes(void) 12 | { 13 | return crypto_stream_salsa2012_NONCEBYTES; 14 | } 15 | 16 | size_t 17 | crypto_stream_salsa2012_messagebytes_max(void) 18 | { 19 | return crypto_stream_salsa2012_MESSAGEBYTES_MAX; 20 | } 21 | 22 | void 23 | crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]) 24 | { 25 | randombytes_buf(k, crypto_stream_salsa2012_KEYBYTES); 26 | } 27 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208.c: -------------------------------------------------------------------------------- 1 | #include "crypto_stream_salsa208.h" 2 | #include "randombytes.h" 3 | 4 | size_t 5 | crypto_stream_salsa208_keybytes(void) 6 | { 7 | return crypto_stream_salsa208_KEYBYTES; 8 | } 9 | 10 | size_t 11 | crypto_stream_salsa208_noncebytes(void) 12 | { 13 | return crypto_stream_salsa208_NONCEBYTES; 14 | } 15 | 16 | size_t 17 | crypto_stream_salsa208_messagebytes_max(void) 18 | { 19 | return crypto_stream_salsa208_MESSAGEBYTES_MAX; 20 | } 21 | 22 | void 23 | crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]) 24 | { 25 | randombytes_buf(k, crypto_stream_salsa208_KEYBYTES); 26 | } 27 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_core_H 3 | #define sodium_core_H 4 | 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | SODIUM_EXPORT 12 | int sodium_init(void) 13 | __attribute__ ((warn_unused_result)); 14 | 15 | /* ---- */ 16 | 17 | SODIUM_EXPORT 18 | int sodium_set_misuse_handler(void (*handler)(void)); 19 | 20 | SODIUM_EXPORT 21 | void sodium_misuse(void) 22 | __attribute__ ((noreturn)); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_auth.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_auth_H 2 | #define crypto_auth_H 3 | 4 | #include 5 | 6 | #include "crypto_auth_hmacsha512256.h" 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | # ifdef __GNUC__ 11 | # pragma GCC diagnostic ignored "-Wlong-long" 12 | # endif 13 | extern "C" { 14 | #endif 15 | 16 | #define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES 17 | SODIUM_EXPORT 18 | size_t crypto_auth_bytes(void); 19 | 20 | #define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES 21 | SODIUM_EXPORT 22 | size_t crypto_auth_keybytes(void); 23 | 24 | #define crypto_auth_PRIMITIVE "hmacsha512256" 25 | SODIUM_EXPORT 26 | const char *crypto_auth_primitive(void); 27 | 28 | SODIUM_EXPORT 29 | int crypto_auth(unsigned char *out, const unsigned char *in, 30 | unsigned long long inlen, const unsigned char *k); 31 | 32 | SODIUM_EXPORT 33 | int crypto_auth_verify(const unsigned char *h, const unsigned char *in, 34 | unsigned long long inlen, const unsigned char *k) 35 | __attribute__ ((warn_unused_result)); 36 | 37 | SODIUM_EXPORT 38 | void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES]); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_ed25519_H 2 | #define crypto_core_ed25519_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_ed25519_BYTES 32 12 | SODIUM_EXPORT 13 | size_t crypto_core_ed25519_bytes(void); 14 | 15 | #define crypto_core_ed25519_UNIFORMBYTES 32 16 | SODIUM_EXPORT 17 | size_t crypto_core_ed25519_uniformbytes(void); 18 | 19 | SODIUM_EXPORT 20 | int crypto_core_ed25519_is_valid_point(const unsigned char *p); 21 | 22 | SODIUM_EXPORT 23 | int crypto_core_ed25519_add(unsigned char *r, 24 | const unsigned char *p, const unsigned char *q); 25 | 26 | SODIUM_EXPORT 27 | int crypto_core_ed25519_sub(unsigned char *r, 28 | const unsigned char *p, const unsigned char *q); 29 | 30 | SODIUM_EXPORT 31 | int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_hchacha20_H 2 | #define crypto_core_hchacha20_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_hchacha20_OUTPUTBYTES 32U 12 | SODIUM_EXPORT 13 | size_t crypto_core_hchacha20_outputbytes(void); 14 | 15 | #define crypto_core_hchacha20_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_hchacha20_inputbytes(void); 18 | 19 | #define crypto_core_hchacha20_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_hchacha20_keybytes(void); 22 | 23 | #define crypto_core_hchacha20_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_hchacha20_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_hchacha20(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_hsalsa20_H 2 | #define crypto_core_hsalsa20_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_hsalsa20_OUTPUTBYTES 32U 12 | SODIUM_EXPORT 13 | size_t crypto_core_hsalsa20_outputbytes(void); 14 | 15 | #define crypto_core_hsalsa20_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_hsalsa20_inputbytes(void); 18 | 19 | #define crypto_core_hsalsa20_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_hsalsa20_keybytes(void); 22 | 23 | #define crypto_core_hsalsa20_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_hsalsa20_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_salsa20_H 2 | #define crypto_core_salsa20_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_salsa20_OUTPUTBYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_core_salsa20_outputbytes(void); 14 | 15 | #define crypto_core_salsa20_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_salsa20_inputbytes(void); 18 | 19 | #define crypto_core_salsa20_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_salsa20_keybytes(void); 22 | 23 | #define crypto_core_salsa20_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_salsa20_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_salsa20(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_salsa2012_H 2 | #define crypto_core_salsa2012_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_salsa2012_OUTPUTBYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_core_salsa2012_outputbytes(void); 14 | 15 | #define crypto_core_salsa2012_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_salsa2012_inputbytes(void); 18 | 19 | #define crypto_core_salsa2012_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_salsa2012_keybytes(void); 22 | 23 | #define crypto_core_salsa2012_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_salsa2012_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_salsa2012(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_salsa208_H 2 | #define crypto_core_salsa208_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_salsa208_OUTPUTBYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_core_salsa208_outputbytes(void) 14 | __attribute__ ((deprecated)); 15 | 16 | #define crypto_core_salsa208_INPUTBYTES 16U 17 | SODIUM_EXPORT 18 | size_t crypto_core_salsa208_inputbytes(void) 19 | __attribute__ ((deprecated)); 20 | 21 | #define crypto_core_salsa208_KEYBYTES 32U 22 | SODIUM_EXPORT 23 | size_t crypto_core_salsa208_keybytes(void) 24 | __attribute__ ((deprecated)); 25 | 26 | #define crypto_core_salsa208_CONSTBYTES 16U 27 | SODIUM_EXPORT 28 | size_t crypto_core_salsa208_constbytes(void) 29 | __attribute__ ((deprecated)); 30 | 31 | SODIUM_EXPORT 32 | int crypto_core_salsa208(unsigned char *out, const unsigned char *in, 33 | const unsigned char *k, const unsigned char *c); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_hash.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_hash_H 2 | #define crypto_hash_H 3 | 4 | /* 5 | * WARNING: Unless you absolutely need to use SHA512 for interoperatibility, 6 | * purposes, you might want to consider crypto_generichash() instead. 7 | * Unlike SHA512, crypto_generichash() is not vulnerable to length 8 | * extension attacks. 9 | */ 10 | 11 | #include 12 | 13 | #include "crypto_hash_sha512.h" 14 | #include "export.h" 15 | 16 | #ifdef __cplusplus 17 | # ifdef __GNUC__ 18 | # pragma GCC diagnostic ignored "-Wlong-long" 19 | # endif 20 | extern "C" { 21 | #endif 22 | 23 | #define crypto_hash_BYTES crypto_hash_sha512_BYTES 24 | SODIUM_EXPORT 25 | size_t crypto_hash_bytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_hash(unsigned char *out, const unsigned char *in, 29 | unsigned long long inlen); 30 | 31 | #define crypto_hash_PRIMITIVE "sha512" 32 | SODIUM_EXPORT 33 | const char *crypto_hash_primitive(void) 34 | __attribute__ ((warn_unused_result)); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_kdf.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_kdf_H 2 | #define crypto_kdf_H 3 | 4 | #include 5 | #include 6 | 7 | #include "crypto_kdf_blake2b.h" 8 | #include "export.h" 9 | 10 | #ifdef __cplusplus 11 | # ifdef __GNUC__ 12 | # pragma GCC diagnostic ignored "-Wlong-long" 13 | # endif 14 | extern "C" { 15 | #endif 16 | 17 | #define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN 18 | SODIUM_EXPORT 19 | size_t crypto_kdf_bytes_min(void); 20 | 21 | #define crypto_kdf_BYTES_MAX crypto_kdf_blake2b_BYTES_MAX 22 | SODIUM_EXPORT 23 | size_t crypto_kdf_bytes_max(void); 24 | 25 | #define crypto_kdf_CONTEXTBYTES crypto_kdf_blake2b_CONTEXTBYTES 26 | SODIUM_EXPORT 27 | size_t crypto_kdf_contextbytes(void); 28 | 29 | #define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES 30 | SODIUM_EXPORT 31 | size_t crypto_kdf_keybytes(void); 32 | 33 | #define crypto_kdf_PRIMITIVE "blake2b" 34 | SODIUM_EXPORT 35 | const char *crypto_kdf_primitive(void) 36 | __attribute__ ((warn_unused_result)); 37 | 38 | SODIUM_EXPORT 39 | int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len, 40 | uint64_t subkey_id, 41 | const char ctx[crypto_kdf_CONTEXTBYTES], 42 | const unsigned char key[crypto_kdf_KEYBYTES]); 43 | 44 | SODIUM_EXPORT 45 | void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES]); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_kdf_blake2b_H 2 | #define crypto_kdf_blake2b_H 3 | 4 | #include 5 | #include 6 | 7 | #include "crypto_kdf_blake2b.h" 8 | #include "export.h" 9 | 10 | #ifdef __cplusplus 11 | # ifdef __GNUC__ 12 | # pragma GCC diagnostic ignored "-Wlong-long" 13 | # endif 14 | extern "C" { 15 | #endif 16 | 17 | #define crypto_kdf_blake2b_BYTES_MIN 16 18 | SODIUM_EXPORT 19 | size_t crypto_kdf_blake2b_bytes_min(void); 20 | 21 | #define crypto_kdf_blake2b_BYTES_MAX 64 22 | SODIUM_EXPORT 23 | size_t crypto_kdf_blake2b_bytes_max(void); 24 | 25 | #define crypto_kdf_blake2b_CONTEXTBYTES 8 26 | SODIUM_EXPORT 27 | size_t crypto_kdf_blake2b_contextbytes(void); 28 | 29 | #define crypto_kdf_blake2b_KEYBYTES 32 30 | SODIUM_EXPORT 31 | size_t crypto_kdf_blake2b_keybytes(void); 32 | 33 | SODIUM_EXPORT 34 | int crypto_kdf_blake2b_derive_from_key(unsigned char *subkey, size_t subkey_len, 35 | uint64_t subkey_id, 36 | const char ctx[crypto_kdf_blake2b_CONTEXTBYTES], 37 | const unsigned char key[crypto_kdf_blake2b_KEYBYTES]); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_scalarmult_H 2 | #define crypto_scalarmult_H 3 | 4 | #include 5 | 6 | #include "crypto_scalarmult_curve25519.h" 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES 14 | SODIUM_EXPORT 15 | size_t crypto_scalarmult_bytes(void); 16 | 17 | #define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES 18 | SODIUM_EXPORT 19 | size_t crypto_scalarmult_scalarbytes(void); 20 | 21 | #define crypto_scalarmult_PRIMITIVE "curve25519" 22 | SODIUM_EXPORT 23 | const char *crypto_scalarmult_primitive(void); 24 | 25 | SODIUM_EXPORT 26 | int crypto_scalarmult_base(unsigned char *q, const unsigned char *n); 27 | 28 | /* 29 | * NOTE: Do not use the result of this function directly. 30 | * 31 | * Hash the result with the public keys in order to compute a shared 32 | * secret key: H(q || client_pk || server_pk) 33 | * 34 | * Or unless this is not an option, use the crypto_kx() API instead. 35 | */ 36 | SODIUM_EXPORT 37 | int crypto_scalarmult(unsigned char *q, const unsigned char *n, 38 | const unsigned char *p) 39 | __attribute__ ((warn_unused_result)); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_scalarmult_curve25519_H 2 | #define crypto_scalarmult_curve25519_H 3 | 4 | #include 5 | 6 | #include "export.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define crypto_scalarmult_curve25519_BYTES 32U 13 | SODIUM_EXPORT 14 | size_t crypto_scalarmult_curve25519_bytes(void); 15 | 16 | #define crypto_scalarmult_curve25519_SCALARBYTES 32U 17 | SODIUM_EXPORT 18 | size_t crypto_scalarmult_curve25519_scalarbytes(void); 19 | 20 | /* 21 | * NOTE: Do not use the result of this function directly. 22 | * 23 | * Hash the result with the public keys in order to compute a shared 24 | * secret key: H(q || client_pk || server_pk) 25 | * 26 | * Or unless this is not an option, use the crypto_kx() API instead. 27 | */ 28 | SODIUM_EXPORT 29 | int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n, 30 | const unsigned char *p) 31 | __attribute__ ((warn_unused_result)); 32 | 33 | SODIUM_EXPORT 34 | int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef crypto_scalarmult_ed25519_H 3 | #define crypto_scalarmult_ed25519_H 4 | 5 | #include 6 | 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define crypto_scalarmult_ed25519_BYTES 32U 14 | SODIUM_EXPORT 15 | size_t crypto_scalarmult_ed25519_bytes(void); 16 | 17 | #define crypto_scalarmult_ed25519_SCALARBYTES 32U 18 | SODIUM_EXPORT 19 | size_t crypto_scalarmult_ed25519_scalarbytes(void); 20 | 21 | /* 22 | * NOTE: Do not use the result of this function directly. 23 | * 24 | * Hash the result with the public keys in order to compute a shared 25 | * secret key: H(q || client_pk || server_pk) 26 | * 27 | * Or unless this is not an option, use the crypto_kx() API instead. 28 | */ 29 | SODIUM_EXPORT 30 | int crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n, 31 | const unsigned char *p) 32 | __attribute__ ((warn_unused_result)); 33 | 34 | SODIUM_EXPORT 35 | int crypto_scalarmult_ed25519_base(unsigned char *q, const unsigned char *n); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_shorthash.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_shorthash_H 2 | #define crypto_shorthash_H 3 | 4 | #include 5 | 6 | #include "crypto_shorthash_siphash24.h" 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | # ifdef __GNUC__ 11 | # pragma GCC diagnostic ignored "-Wlong-long" 12 | # endif 13 | extern "C" { 14 | #endif 15 | 16 | #define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES 17 | SODIUM_EXPORT 18 | size_t crypto_shorthash_bytes(void); 19 | 20 | #define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES 21 | SODIUM_EXPORT 22 | size_t crypto_shorthash_keybytes(void); 23 | 24 | #define crypto_shorthash_PRIMITIVE "siphash24" 25 | SODIUM_EXPORT 26 | const char *crypto_shorthash_primitive(void); 27 | 28 | SODIUM_EXPORT 29 | int crypto_shorthash(unsigned char *out, const unsigned char *in, 30 | unsigned long long inlen, const unsigned char *k); 31 | 32 | SODIUM_EXPORT 33 | void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_shorthash_siphash24_H 2 | #define crypto_shorthash_siphash24_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | # ifdef __GNUC__ 9 | # pragma GCC diagnostic ignored "-Wlong-long" 10 | # endif 11 | extern "C" { 12 | #endif 13 | 14 | /* -- 64-bit output -- */ 15 | 16 | #define crypto_shorthash_siphash24_BYTES 8U 17 | SODIUM_EXPORT 18 | size_t crypto_shorthash_siphash24_bytes(void); 19 | 20 | #define crypto_shorthash_siphash24_KEYBYTES 16U 21 | SODIUM_EXPORT 22 | size_t crypto_shorthash_siphash24_keybytes(void); 23 | 24 | SODIUM_EXPORT 25 | int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in, 26 | unsigned long long inlen, const unsigned char *k); 27 | 28 | #ifndef SODIUM_LIBRARY_MINIMAL 29 | /* -- 128-bit output -- */ 30 | 31 | #define crypto_shorthash_siphashx24_BYTES 16U 32 | SODIUM_EXPORT 33 | size_t crypto_shorthash_siphashx24_bytes(void); 34 | 35 | #define crypto_shorthash_siphashx24_KEYBYTES 16U 36 | SODIUM_EXPORT 37 | size_t crypto_shorthash_siphashx24_keybytes(void); 38 | 39 | SODIUM_EXPORT 40 | int crypto_shorthash_siphashx24(unsigned char *out, const unsigned char *in, 41 | unsigned long long inlen, const unsigned char *k); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_verify_16.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_verify_16_H 2 | #define crypto_verify_16_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_verify_16_BYTES 16U 12 | SODIUM_EXPORT 13 | size_t crypto_verify_16_bytes(void); 14 | 15 | SODIUM_EXPORT 16 | int crypto_verify_16(const unsigned char *x, const unsigned char *y) 17 | __attribute__ ((warn_unused_result)); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_verify_32.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_verify_32_H 2 | #define crypto_verify_32_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_verify_32_BYTES 32U 12 | SODIUM_EXPORT 13 | size_t crypto_verify_32_bytes(void); 14 | 15 | SODIUM_EXPORT 16 | int crypto_verify_32(const unsigned char *x, const unsigned char *y) 17 | __attribute__ ((warn_unused_result)); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/crypto_verify_64.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_verify_64_H 2 | #define crypto_verify_64_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_verify_64_BYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_verify_64_bytes(void); 14 | 15 | SODIUM_EXPORT 16 | int crypto_verify_64(const unsigned char *x, const unsigned char *y) 17 | __attribute__ ((warn_unused_result)); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/private/implementations.h: -------------------------------------------------------------------------------- 1 | #ifndef implementations_H 2 | #define implementations_H 3 | 4 | int _crypto_generichash_blake2b_pick_best_implementation(void); 5 | int _crypto_onetimeauth_poly1305_pick_best_implementation(void); 6 | int _crypto_pwhash_argon2_pick_best_implementation(void); 7 | int _crypto_scalarmult_curve25519_pick_best_implementation(void); 8 | int _crypto_stream_chacha20_pick_best_implementation(void); 9 | int _crypto_stream_salsa20_pick_best_implementation(void); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/private/mutex.h: -------------------------------------------------------------------------------- 1 | #ifndef mutex_H 2 | #define mutex_H 1 3 | 4 | extern int sodium_crit_enter(void); 5 | extern int sodium_crit_leave(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/private/sse2_64_32.h: -------------------------------------------------------------------------------- 1 | #ifndef sse2_64_32_H 2 | #define sse2_64_32_H 1 3 | 4 | #include "common.h" 5 | 6 | #ifdef HAVE_INTRIN_H 7 | # include 8 | #endif 9 | 10 | #if defined(HAVE_EMMINTRIN_H) && \ 11 | !(defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || \ 12 | defined(_M_X64) || defined(_M_AMD64)) 13 | 14 | # include 15 | # include 16 | 17 | # ifndef _mm_set_epi64x 18 | # define _mm_set_epi64x(Q0, Q1) sodium__mm_set_epi64x((Q0), (Q1)) 19 | static inline __m128i 20 | sodium__mm_set_epi64x(int64_t q1, int64_t q0) 21 | { 22 | union { int64_t as64; int32_t as32[2]; } x0, x1; 23 | x0.as64 = q0; x1.as64 = q1; 24 | return _mm_set_epi32(x1.as32[1], x1.as32[0], x0.as32[1], x0.as32[0]); 25 | } 26 | # endif 27 | 28 | # ifndef _mm_set1_epi64x 29 | # define _mm_set1_epi64x(Q) sodium__mm_set1_epi64x(Q) 30 | static inline __m128i 31 | sodium__mm_set1_epi64x(int64_t q) 32 | { 33 | return _mm_set_epi64x(q, q); 34 | } 35 | # endif 36 | 37 | # ifndef _mm_cvtsi64_si128 38 | # define _mm_cvtsi64_si128(Q) sodium__mm_cvtsi64_si128(Q) 39 | static inline __m128i 40 | sodium__mm_cvtsi64_si128(int64_t q) 41 | { 42 | union { int64_t as64; int32_t as32[2]; } x; 43 | x.as64 = q; 44 | return _mm_setr_epi32(x.as32[0], x.as32[1], 0, 0); 45 | } 46 | # endif 47 | 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef randombytes_nativeclient_H 3 | #define randombytes_nativeclient_H 4 | 5 | #ifdef __native_client__ 6 | 7 | # include "export.h" 8 | # include "randombytes.h" 9 | 10 | # ifdef __cplusplus 11 | extern "C" { 12 | # endif 13 | 14 | SODIUM_EXPORT 15 | extern struct randombytes_implementation randombytes_nativeclient_implementation; 16 | 17 | # ifdef __cplusplus 18 | } 19 | # endif 20 | 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef randombytes_salsa20_random_H 3 | #define randombytes_salsa20_random_H 4 | 5 | #include "export.h" 6 | #include "randombytes.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | SODIUM_EXPORT 13 | extern struct randombytes_implementation randombytes_salsa20_implementation; 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef randombytes_sysrandom_H 3 | #define randombytes_sysrandom_H 4 | 5 | #include "export.h" 6 | #include "randombytes.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | SODIUM_EXPORT 13 | extern struct randombytes_implementation randombytes_sysrandom_implementation; 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/runtime.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_runtime_H 3 | #define sodium_runtime_H 4 | 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | SODIUM_EXPORT_WEAK 12 | int sodium_runtime_has_neon(void); 13 | 14 | SODIUM_EXPORT_WEAK 15 | int sodium_runtime_has_sse2(void); 16 | 17 | SODIUM_EXPORT_WEAK 18 | int sodium_runtime_has_sse3(void); 19 | 20 | SODIUM_EXPORT_WEAK 21 | int sodium_runtime_has_ssse3(void); 22 | 23 | SODIUM_EXPORT_WEAK 24 | int sodium_runtime_has_sse41(void); 25 | 26 | SODIUM_EXPORT_WEAK 27 | int sodium_runtime_has_avx(void); 28 | 29 | SODIUM_EXPORT_WEAK 30 | int sodium_runtime_has_avx2(void); 31 | 32 | SODIUM_EXPORT_WEAK 33 | int sodium_runtime_has_avx512f(void); 34 | 35 | SODIUM_EXPORT_WEAK 36 | int sodium_runtime_has_pclmul(void); 37 | 38 | SODIUM_EXPORT_WEAK 39 | int sodium_runtime_has_aesni(void); 40 | 41 | SODIUM_EXPORT_WEAK 42 | int sodium_runtime_has_rdrand(void); 43 | 44 | /* ------------------------------------------------------------------------- */ 45 | 46 | int _sodium_runtime_get_cpu_features(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/include/sodium/version.h.in: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_version_H 3 | #define sodium_version_H 4 | 5 | #include "export.h" 6 | 7 | #define SODIUM_VERSION_STRING "@VERSION@" 8 | 9 | #define SODIUM_LIBRARY_VERSION_MAJOR @SODIUM_LIBRARY_VERSION_MAJOR@ 10 | #define SODIUM_LIBRARY_VERSION_MINOR @SODIUM_LIBRARY_VERSION_MINOR@ 11 | @SODIUM_LIBRARY_MINIMAL_DEF@ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | SODIUM_EXPORT 18 | const char *sodium_version_string(void); 19 | 20 | SODIUM_EXPORT 21 | int sodium_library_version_major(void); 22 | 23 | SODIUM_EXPORT 24 | int sodium_library_version_minor(void); 25 | 26 | SODIUM_EXPORT 27 | int sodium_library_minimal(void); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /deps/libsodium/src/libsodium/sodium/version.c: -------------------------------------------------------------------------------- 1 | 2 | #include "version.h" 3 | 4 | const char * 5 | sodium_version_string(void) 6 | { 7 | return SODIUM_VERSION_STRING; 8 | } 9 | 10 | int 11 | sodium_library_version_major(void) 12 | { 13 | return SODIUM_LIBRARY_VERSION_MAJOR; 14 | } 15 | 16 | int 17 | sodium_library_version_minor(void) 18 | { 19 | return SODIUM_LIBRARY_VERSION_MINOR; 20 | } 21 | 22 | int 23 | sodium_library_minimal(void) 24 | { 25 | #ifdef SODIUM_LIBRARY_MINIMAL 26 | return 1; 27 | #else 28 | return 0; 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /deps/libsodium/test/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = \ 2 | default 3 | 4 | EXTRA_DIST = \ 5 | quirks/quirks.h 6 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/aead_aes256gcm.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth.exp: -------------------------------------------------------------------------------- 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 | 6 | ,0x7b,0x9d,0x83,0x38,0xeb,0x1e,0x3d,0xdd 7 | ,0xba,0x8a,0x9a,0x35,0x08,0xd0,0x34,0xa1 8 | ,0xec,0xbe,0x75,0x11,0x37,0xfa,0x1b,0xcb 9 | ,0xa0,0xf9,0x2a,0x3e,0x6d,0xfc,0x79,0x80 10 | ,0xb8,0x81,0xa8,0x64,0x5f,0x92,0x67,0x22 11 | ,0x74,0x37,0x96,0x4b,0xf3,0x07,0x0b,0xe2 12 | ,0xb3,0x36,0xb3,0xa3,0x20,0xf8,0x25,0xce 13 | ,0xc9,0x87,0x2d,0xb2,0x50,0x4b,0xf3,0x6d 14 | 15 | ,0x73,0xe0,0x0d,0xcb,0xf4,0xf8,0xa3,0x33 16 | ,0x30,0xac,0x52,0xed,0x2c,0xc9,0xd1,0xb2 17 | ,0xef,0xb1,0x77,0x13,0xd3,0xec,0xe3,0x96 18 | ,0x14,0x9f,0x37,0x65,0x3c,0xfe,0x70,0xe7 19 | ,0x1f,0x2c,0x6f,0x9a,0x62,0xc3,0xc5,0x3a 20 | ,0x31,0x8a,0x9a,0x0b,0x3b,0x78,0x60,0xa4 21 | ,0x31,0x6f,0x72,0x9b,0x8d,0x30,0x0f,0x15 22 | ,0x9b,0x2f,0x60,0x93,0xa8,0x60,0xc1,0xed 23 | ,0x62,0x27,0xe4,0xce,0x7c,0x7f,0xe7,0xa4 24 | ,0xba,0x9e,0x2a,0xc3,0x42,0xc3,0x5d,0x24 25 | ,0x03,0x3e,0x38,0x8c,0x9b,0xdc,0x29,0x9b 26 | ,0x4a,0x50,0x50,0xf6,0x71,0x70,0xf4,0x83 27 | ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 28 | ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 29 | ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 30 | ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 31 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth2.c: -------------------------------------------------------------------------------- 1 | /* "Test Case AUTH256-4" from RFC 4868 */ 2 | 3 | #define TEST_NAME "auth2" 4 | #include "cmptest.h" 5 | 6 | static unsigned char key[32] = { 7 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 8 | 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 9 | 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 10 | }; 11 | 12 | static unsigned char c[50] = { 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 13 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 14 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 15 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 16 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 17 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 18 | 0xcd, 0xcd }; 19 | 20 | static unsigned char a[32]; 21 | 22 | int 23 | main(void) 24 | { 25 | int i; 26 | 27 | crypto_auth_hmacsha256(a, c, sizeof c, key); 28 | for (i = 0; i < 32; ++i) { 29 | printf(",0x%02x", (unsigned int) a[i]); 30 | if (i % 8 == 7) 31 | printf("\n"); 32 | } 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth2.exp: -------------------------------------------------------------------------------- 1 | ,0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2 2 | ,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4 3 | ,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25 4 | ,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth3.c: -------------------------------------------------------------------------------- 1 | /* "Test Case AUTH256-4" from RFC 4868 */ 2 | 3 | #define TEST_NAME "auth3" 4 | #include "cmptest.h" 5 | 6 | static unsigned char key[32] = { 7 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 8 | 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 9 | 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 10 | }; 11 | 12 | static unsigned char c[50] = { 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 13 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 14 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 15 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 16 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 17 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 18 | 0xcd, 0xcd }; 19 | 20 | static unsigned char a[32] = { 0x37, 0x2e, 0xfc, 0xf9, 0xb4, 0x0b, 0x35, 0xc2, 21 | 0x11, 0x5b, 0x13, 0x46, 0x90, 0x3d, 0x2e, 0xf4, 22 | 0x2f, 0xce, 0xd4, 0x6f, 0x08, 0x46, 0xe7, 0x25, 23 | 0x7b, 0xb1, 0x56, 0xd3, 0xd7, 0xb3, 0x0d, 0x3f }; 24 | 25 | int 26 | main(void) 27 | { 28 | printf("%d\n", crypto_auth_hmacsha256_verify(a, c, sizeof c, key)); 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth3.exp: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth5.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "auth5" 3 | #include "cmptest.h" 4 | 5 | static unsigned char key[32]; 6 | static unsigned char c[1000]; 7 | static unsigned char a[32]; 8 | 9 | int 10 | main(void) 11 | { 12 | size_t clen; 13 | 14 | for (clen = 0; clen < 1000; ++clen) { 15 | crypto_auth_keygen(key); 16 | randombytes_buf(c, clen); 17 | crypto_auth(a, c, clen, key); 18 | if (crypto_auth_verify(a, c, clen, key) != 0) { 19 | printf("fail %u\n", (unsigned int) clen); 20 | return 100; 21 | } 22 | if (clen > 0) { 23 | c[rand() % clen] += 1 + (rand() % 255); 24 | if (crypto_auth_verify(a, c, clen, key) == 0) { 25 | printf("forgery %u\n", (unsigned int) clen); 26 | return 100; 27 | } 28 | a[rand() % sizeof a] += 1 + (rand() % 255); 29 | if (crypto_auth_verify(a, c, clen, key) == 0) { 30 | printf("forgery %u\n", (unsigned int) clen); 31 | return 100; 32 | } 33 | } 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth5.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/auth5.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth6.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "auth6" 3 | #include "cmptest.h" 4 | 5 | /* "Test Case 2" from RFC 4231 */ 6 | static unsigned char key[32] = "Jefe"; 7 | static unsigned char c[] = "what do ya want for nothing?"; 8 | 9 | static unsigned char a[64]; 10 | 11 | int 12 | main(void) 13 | { 14 | int i; 15 | 16 | crypto_auth_hmacsha512(a, c, sizeof c - 1U, key); 17 | for (i = 0; i < 64; ++i) { 18 | printf(",0x%02x", (unsigned int) a[i]); 19 | if (i % 8 == 7) 20 | printf("\n"); 21 | } 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth6.exp: -------------------------------------------------------------------------------- 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 9 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth7.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "auth7" 3 | #include "cmptest.h" 4 | 5 | static unsigned char key[32]; 6 | static unsigned char c[600]; 7 | static unsigned char a[64]; 8 | 9 | int 10 | main(void) 11 | { 12 | size_t clen; 13 | 14 | for (clen = 0; clen < sizeof c; ++clen) { 15 | crypto_auth_keygen(key); 16 | randombytes_buf(c, clen); 17 | crypto_auth_hmacsha512(a, c, clen, key); 18 | if (crypto_auth_hmacsha512_verify(a, c, clen, key) != 0) { 19 | printf("fail %u\n", (unsigned int) clen); 20 | return 100; 21 | } 22 | if (clen > 0) { 23 | c[(size_t) rand() % clen] += 1 + (rand() % 255); 24 | if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) { 25 | printf("forgery %u\n", (unsigned int) clen); 26 | return 100; 27 | } 28 | a[rand() % sizeof a] += 1 + (rand() % 255); 29 | if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) { 30 | printf("forgery %u\n", (unsigned int) clen); 31 | return 100; 32 | } 33 | } 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/auth7.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/auth7.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/box2.exp: -------------------------------------------------------------------------------- 1 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 2 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b 3 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 4 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc 5 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a 6 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 7 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 8 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 9 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d 10 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 11 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a 12 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde 13 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd 14 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 15 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 16 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 17 | ,0x5e,0x07,0x05 18 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 19 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b 20 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 21 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc 22 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a 23 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 24 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 25 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 26 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d 27 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 28 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a 29 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde 30 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd 31 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 32 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 33 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 34 | ,0x5e,0x07,0x05 35 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/box7.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/box7.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/box8.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/box8.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/box_easy.exp: -------------------------------------------------------------------------------- 1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74,0xe3,0x55,0xa5 2 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80,0x8e 3 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80,0x8e 4 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/box_easy2.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | 0 6 | 0 7 | OK 8 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/box_seal.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "box_seal" 3 | #include "cmptest.h" 4 | 5 | int 6 | main(void) 7 | { 8 | unsigned char pk[crypto_box_PUBLICKEYBYTES]; 9 | unsigned char sk[crypto_box_SECRETKEYBYTES]; 10 | unsigned char *c; 11 | unsigned char *m; 12 | unsigned char *m2; 13 | size_t m_len; 14 | size_t c_len; 15 | 16 | crypto_box_keypair(pk, sk); 17 | m_len = (size_t) randombytes_uniform(1000); 18 | c_len = crypto_box_SEALBYTES + m_len; 19 | m = (unsigned char *) sodium_malloc(m_len); 20 | m2 = (unsigned char *) sodium_malloc(m_len); 21 | c = (unsigned char *) sodium_malloc(c_len); 22 | randombytes_buf(m, m_len); 23 | if (crypto_box_seal(c, m, m_len, pk) != 0) { 24 | printf("crypto_box_seal() failure\n"); 25 | return 1; 26 | } 27 | if (crypto_box_seal_open(m2, c, c_len, pk, sk) != 0) { 28 | printf("crypto_box_seal_open() failure\n"); 29 | return 1; 30 | } 31 | printf("%d\n", memcmp(m, m2, m_len)); 32 | 33 | printf("%d\n", crypto_box_seal_open(m, c, 0U, pk, sk)); 34 | printf("%d\n", crypto_box_seal_open(m, c, c_len - 1U, pk, sk)); 35 | printf("%d\n", crypto_box_seal_open(m, c, c_len, sk, pk)); 36 | 37 | sodium_free(c); 38 | sodium_free(m); 39 | sodium_free(m2); 40 | 41 | assert(crypto_box_sealbytes() == crypto_box_SEALBYTES); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/box_seal.exp: -------------------------------------------------------------------------------- 1 | 0 2 | -1 3 | -1 4 | -1 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/box_seed.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "box_seed" 3 | #include "cmptest.h" 4 | 5 | static unsigned char seed[32] = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 6 | 0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2, 7 | 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 8 | 0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 9 | 0x1d, 0xb9, 0x2c, 0x2a }; 10 | 11 | int 12 | main(void) 13 | { 14 | int i; 15 | unsigned char sk[32]; 16 | unsigned char pk[32]; 17 | 18 | crypto_box_seed_keypair(pk, sk, seed); 19 | for (i = 0; i < 32; ++i) { 20 | printf(",0x%02x", (unsigned int) pk[i]); 21 | if (i % 8 == 7) 22 | printf("\n"); 23 | } 24 | for (i = 0; i < 32; ++i) { 25 | printf(",0x%02x", (unsigned int) sk[i]); 26 | if (i % 8 == 7) 27 | printf("\n"); 28 | } 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/box_seed.exp: -------------------------------------------------------------------------------- 1 | ,0xed,0x77,0x49,0xb4,0xd9,0x89,0xf6,0x95 2 | ,0x7f,0x3b,0xfd,0xe6,0xc5,0x67,0x67,0xe9 3 | ,0x88,0xe2,0x1c,0x9f,0x87,0x84,0xd9,0x1d 4 | ,0x61,0x00,0x11,0xcd,0x55,0x3f,0x9b,0x06 5 | ,0xac,0xcd,0x44,0xeb,0x8e,0x93,0x31,0x9c 6 | ,0x05,0x70,0xbc,0x11,0x00,0x5c,0x0e,0x01 7 | ,0x89,0xd3,0x4f,0xf0,0x2f,0x6c,0x17,0x77 8 | ,0x34,0x11,0xad,0x19,0x12,0x93,0xc9,0x8f 9 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/codecs.exp: -------------------------------------------------------------------------------- 1 | 30313233343536373839414243444546 2 | 4:cafe6942 3 | dt1: 11 4 | 4:cafe6942 5 | dt2: 2 6 | dt3: 11 7 | dt4: 11 8 | dt5: 11 9 | dt6: 11 10 | +/DxMDEyMzQ1Njc4OUFCQ0RFRmFi 11 | +/DxMDEyMzQ1Njc4OUFCQ0RFRmFiYw 12 | -_DxMDEyMzQ1Njc4OUFCQ0RFRmFi 13 | -_DxMDEyMzQ1Njc4OUFCQ0RFRmFiYw 14 | 15 | YQ== 16 | YWI= 17 | YWJj 18 | 19 | YQ 20 | YWI 21 | YWJj 22 | [] 23 | [BpcyBhIGpvdXJu 24 | ZXkgaW50by Bzb3VuZA==] 25 | [This is a journey into sound] 26 | [This is a journ] 27 | [ 28 | ZXkgaW50by Bzb3VuZA==] 29 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core1.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "core1" 3 | #include "cmptest.h" 4 | 5 | static unsigned char shared[32] = { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 6 | 0xe1, 0x72, 0x8e, 0x3b, 0xf4, 0x80, 0x35, 7 | 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 8 | 0xd1, 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 9 | 0x1e, 0x16, 0x17, 0x42 }; 10 | 11 | static unsigned char zero[32]; 12 | 13 | static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33, 14 | 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b }; 15 | 16 | static unsigned char firstkey[32]; 17 | 18 | int 19 | main(void) 20 | { 21 | int i; 22 | 23 | crypto_core_hsalsa20(firstkey, zero, shared, c); 24 | for (i = 0; i < 32; ++i) { 25 | if (i > 0) { 26 | printf(","); 27 | } else { 28 | printf(" "); 29 | } 30 | printf("0x%02x", (unsigned int) firstkey[i]); 31 | if (i % 8 == 7) { 32 | printf("\n"); 33 | } 34 | } 35 | assert(crypto_core_hsalsa20_outputbytes() > 0U); 36 | assert(crypto_core_hsalsa20_inputbytes() > 0U); 37 | assert(crypto_core_hsalsa20_keybytes() > 0U); 38 | assert(crypto_core_hsalsa20_constbytes() > 0U); 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core1.exp: -------------------------------------------------------------------------------- 1 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 2 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 3 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 4 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core2.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "core2" 3 | #include "cmptest.h" 4 | 5 | static unsigned char firstkey[32] = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 6 | 0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a, 7 | 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 8 | 0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 9 | 0x44, 0xf6, 0x83, 0x89 }; 10 | 11 | static unsigned char nonceprefix[16] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 12 | 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, 13 | 0x75, 0xfc, 0x73, 0xd6 }; 14 | 15 | static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33, 16 | 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b }; 17 | 18 | static unsigned char secondkey[32]; 19 | 20 | int 21 | main(void) 22 | { 23 | int i; 24 | 25 | crypto_core_hsalsa20(secondkey, nonceprefix, firstkey, c); 26 | for (i = 0; i < 32; ++i) { 27 | if (i > 0) { 28 | printf(","); 29 | } else { 30 | printf(" "); 31 | } 32 | printf("0x%02x", (unsigned int) secondkey[i]); 33 | if (i % 8 == 7) { 34 | printf("\n"); 35 | } 36 | } 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core2.exp: -------------------------------------------------------------------------------- 1 | 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 2 | ,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 3 | ,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 4 | ,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core3.exp: -------------------------------------------------------------------------------- 1 | 662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 2 | a4e3147dddd2ba7775939b50208a22eb3277d4e4bad8a1cfbc999c6bd392b638 3 | 017421baa9959cbe894bd003ec87938254f47c1e757eb66cf89c353d0c2b68de 4 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core4.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "core4" 3 | #include "cmptest.h" 4 | 5 | static unsigned char k[32] = { 1, 2, 3, 4, 5, 6, 7, 8, 6 | 9, 10, 11, 12, 13, 14, 15, 16, 7 | 201, 202, 203, 204, 205, 206, 207, 208, 8 | 209, 210, 211, 212, 213, 214, 215, 216 }; 9 | 10 | static unsigned char in[16] = { 101, 102, 103, 104, 105, 106, 107, 108, 11 | 109, 110, 111, 112, 113, 114, 115, 116 }; 12 | 13 | static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51, 14 | 50, 45, 98, 121, 116, 101, 32, 107 }; 15 | 16 | static unsigned char out[64]; 17 | 18 | int 19 | main(void) 20 | { 21 | int i; 22 | 23 | crypto_core_salsa20(out, in, k, c); 24 | for (i = 0; i < 64; ++i) { 25 | if (i > 0) { 26 | printf(","); 27 | } else { 28 | printf(" "); 29 | } 30 | printf("%3u", (unsigned int) out[i]); 31 | if (i % 8 == 7) { 32 | printf("\n"); 33 | } 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core4.exp: -------------------------------------------------------------------------------- 1 | 69, 37, 68, 39, 41, 15,107,193 2 | ,255,139,122, 6,170,233,217, 98 3 | , 89,144,182,106, 21, 51,200, 65 4 | ,239, 49,222, 34,215,114, 40,126 5 | ,104,197, 7,225,197,153, 31, 2 6 | ,102, 78, 76,176, 84,245,246,184 7 | ,177,160,133,130, 6, 72,149,119 8 | ,192,195,132,236,234,103,246, 74 9 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core5.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "core5" 3 | #include "cmptest.h" 4 | 5 | static unsigned char k[32] = { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c, 6 | 0x12, 0x6f, 0x90, 0x02, 0x79, 0x01, 0xd8, 0x0f, 7 | 0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36, 0xcf, 0x3b, 8 | 0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 }; 9 | 10 | static unsigned char in[16] = { 11 | 0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b, 12 | 0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52 13 | }; 14 | 15 | static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51, 16 | 50, 45, 98, 121, 116, 101, 32, 107 }; 17 | 18 | unsigned char out[32]; 19 | 20 | int 21 | main(void) 22 | { 23 | int i; 24 | 25 | crypto_core_hsalsa20(out, in, k, c); 26 | for (i = 0; i < 32; ++i) { 27 | printf(",0x%02x", (unsigned int) out[i]); 28 | if (i % 8 == 7) { 29 | printf("\n"); 30 | } 31 | } 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core5.exp: -------------------------------------------------------------------------------- 1 | ,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40 2 | ,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45 3 | ,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94 4 | ,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core6.exp: -------------------------------------------------------------------------------- 1 | ,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40 2 | ,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45 3 | ,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94 4 | ,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/core_ed25519.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/ed25519_convert.exp: -------------------------------------------------------------------------------- 1 | curve25519 pk: [f1814f0e8ff1043d8a44d25babff3cedcae6c22c3edaa48f857ae70de2baae50] 2 | curve25519 sk: [8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166] 3 | ok 4 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/hash.exp: -------------------------------------------------------------------------------- 1 | 24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 2 | a77abe1ccf8f5497e228fbc0acd73a521ededb21b89726684a6ebbc3baa32361aca5a244daa84f24bf19c68baf78e6907625a659b15479eb7bd426fc62aafa73 3 | 12a61f4e173fb3a11c05d6471f74728f76231b4a5fcd9667cef3af87a3ae4dc2 4 | 71cc8123fef8c236e451d3c3ddf1adae9aa6cd9521e7041769d737024900a03a 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/hash2.exp: -------------------------------------------------------------------------------- 1 | 24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/hash3.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "hash3" 3 | #include "cmptest.h" 4 | 5 | static unsigned char x[] = "testing\n"; 6 | static unsigned char h[crypto_hash_BYTES]; 7 | 8 | int 9 | main(void) 10 | { 11 | size_t i; 12 | 13 | crypto_hash(h, x, sizeof x - 1U); 14 | for (i = 0; i < crypto_hash_BYTES; ++i) { 15 | printf("%02x", (unsigned int) h[i]); 16 | } 17 | printf("\n"); 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/hash3.exp: -------------------------------------------------------------------------------- 1 | 24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/keygen.exp: -------------------------------------------------------------------------------- 1 | tv_keygen: ok 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/kx.exp: -------------------------------------------------------------------------------- 1 | client_pk: [0e0216223f147143d32615a91189c288c1728cba3cc5f9f621b1026e03d83129] 2 | client_sk: [cb2f5160fc1f7e05a55ef49d340b48da2e5a78099d53393351cd579dd42503d6] 3 | server_rx: [62c8f4fa81800abd0577d99918d129b65deb789af8c8351f391feb0cbf238604] 4 | server_tx: [749519c68059bce69f7cfcc7b387a3de1a1e8237d110991323bf62870115731a] 5 | client_rx: [749519c68059bce69f7cfcc7b387a3de1a1e8237d110991323bf62870115731a] 6 | client_tx: [62c8f4fa81800abd0577d99918d129b65deb789af8c8351f391feb0cbf238604] 7 | tv_kx: ok 8 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/metamorphic.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/misuse.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/misuse.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/onetimeauth.exp: -------------------------------------------------------------------------------- 1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 2 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 3 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 4 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/onetimeauth2.exp: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/onetimeauth7.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "onetimeauth7" 3 | #include "cmptest.h" 4 | 5 | static unsigned char key[32]; 6 | static unsigned char c[1000]; 7 | static unsigned char a[16]; 8 | 9 | int 10 | main(void) 11 | { 12 | int clen; 13 | 14 | for (clen = 0; clen < 1000; ++clen) { 15 | crypto_onetimeauth_keygen(key); 16 | randombytes_buf(c, clen); 17 | crypto_onetimeauth(a, c, clen, key); 18 | if (crypto_onetimeauth_verify(a, c, clen, key) != 0) { 19 | printf("fail %d\n", clen); 20 | return 100; 21 | } 22 | if (clen > 0) { 23 | c[rand() % clen] += 1 + (rand() % 255); 24 | if (crypto_onetimeauth_verify(a, c, clen, key) == 0) { 25 | printf("forgery %d\n", clen); 26 | return 100; 27 | } 28 | a[rand() % sizeof a] += 1 + (rand() % 255); 29 | if (crypto_onetimeauth_verify(a, c, clen, key) == 0) { 30 | printf("forgery %d\n", clen); 31 | return 100; 32 | } 33 | } 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/onetimeauth7.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/onetimeauth7.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/pre.js.inc: -------------------------------------------------------------------------------- 1 | try { 2 | this['Module'] = Module; 3 | Module.test; 4 | } catch(e) { 5 | this['Module'] = Module = {}; 6 | } 7 | if (typeof process === 'object') { 8 | Module['preRun'] = Module['preRun'] || []; 9 | Module['preRun'].push(function() { 10 | FS.init(); 11 | FS.mkdir('/test-data'); 12 | FS.mount(NODEFS, { root: '.' }, '/test-data'); 13 | }); 14 | } else { 15 | Module['print'] = function(x) { 16 | var event = new Event('test-output'); 17 | event.data = x; 18 | window.dispatchEvent(event); 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/pwhash_scrypt_ll.exp: -------------------------------------------------------------------------------- 1 | scrypt('', '', 16, 1, 1, 64) = 2 | 77 d6 57 62 38 65 7b 20 3b 19 ca 42 c1 8a 04 97 3 | f1 6b 48 44 e3 07 4a e8 df df fa 3f ed e2 14 42 4 | fc d0 06 9d ed 09 48 f8 32 6a 75 3a 0f c8 1f 17 5 | e8 d3 e0 fb 2e 0d 36 28 cf 35 e2 0c 38 d1 89 06 6 | scrypt('password', 'NaCl', 1024, 8, 16, 64) = 7 | fd ba be 1c 9d 34 72 00 78 56 e7 19 0d 01 e9 fe 8 | 7c 6a d7 cb c8 23 78 30 e7 73 76 63 4b 37 31 62 9 | 2e af 30 d9 2e 22 a3 88 6f f1 09 27 9d 98 30 da 10 | c7 27 af b9 4a 83 ee 6d 83 60 cb df a2 cc 06 40 11 | scrypt('pleaseletmein', 'SodiumChloride', 16384, 8, 1, 64) = 12 | 70 23 bd cb 3a fd 73 48 46 1c 06 cd 81 fd 38 eb 13 | fd a8 fb ba 90 4f 8e 3e a9 b5 43 f6 54 5d a1 f2 14 | d5 43 29 55 61 3f 0f cf 62 d4 97 05 24 2a 9a f9 15 | e6 1e 85 dc 0d 65 1e 40 df cf 01 7b 45 57 58 87 16 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/randombytes.exp: -------------------------------------------------------------------------------- 1 | 0d8e6cc68715648926732e7ea73250cfaf2d58422083904c841a8ba33b986111f346ba50723a68ae283524a6bded09f83be6b80595856f72e25b86918e8b114bafb94bc8abedd73daab454576b7c5833eb0bf982a1bb4587a5c970ff0810ca3b791d7e12 (deterministic) 2 | OK 3 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult.exp: -------------------------------------------------------------------------------- 1 | 8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a 2 | de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f 3 | 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742 4 | 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult2.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "scalarmult2" 3 | #include "cmptest.h" 4 | 5 | static unsigned char bobsk[32] = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 6 | 0x4b, 0x79, 0xe1, 0x7f, 0x8b, 0x83, 0x80, 7 | 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 8 | 0x18, 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 9 | 0xff, 0x88, 0xe0, 0xeb }; 10 | 11 | static unsigned char bobpk[32]; 12 | 13 | int 14 | main(void) 15 | { 16 | int i; 17 | 18 | crypto_scalarmult_base(bobpk, bobsk); 19 | 20 | for (i = 0; i < 32; ++i) { 21 | if (i > 0) { 22 | printf(","); 23 | } else { 24 | printf(" "); 25 | } 26 | printf("0x%02x", (unsigned int) bobpk[i]); 27 | if (i % 8 == 7) { 28 | printf("\n"); 29 | } 30 | } 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult2.exp: -------------------------------------------------------------------------------- 1 | 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 2 | ,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 3 | ,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d 4 | ,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult5.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "scalarmult5" 3 | #include "cmptest.h" 4 | 5 | static unsigned char alicesk[32] = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 6 | 0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2, 7 | 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 8 | 0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 9 | 0x1d, 0xb9, 0x2c, 0x2a }; 10 | 11 | static unsigned char bobpk[32] = { 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 12 | 0xb4, 0xd3, 0x5b, 0x61, 0xc2, 0xec, 0xe4, 13 | 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 14 | 0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 15 | 0x6f, 0x88, 0x2b, 0x4f }; 16 | 17 | static unsigned char k[32]; 18 | 19 | int 20 | main(void) 21 | { 22 | int i; 23 | int ret; 24 | 25 | ret = crypto_scalarmult(k, alicesk, bobpk); 26 | assert(ret == 0); 27 | 28 | for (i = 0; i < 32; ++i) { 29 | if (i > 0) { 30 | printf(","); 31 | } else { 32 | printf(" "); 33 | } 34 | printf("0x%02x", (unsigned int) k[i]); 35 | if (i % 8 == 7) { 36 | printf("\n"); 37 | } 38 | } 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult5.exp: -------------------------------------------------------------------------------- 1 | 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 2 | ,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 3 | ,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 4 | ,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult6.exp: -------------------------------------------------------------------------------- 1 | 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 2 | ,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 3 | ,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 4 | ,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult7.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "scalarmult7" 3 | #include "cmptest.h" 4 | 5 | static unsigned char p1[32] = { 6 | 0x72, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d, 7 | 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 8 | 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0xea 9 | }; 10 | 11 | static unsigned char p2[32] = { 12 | 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d, 13 | 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 14 | 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a 15 | }; 16 | 17 | static unsigned char scalar[32]; 18 | static unsigned char out1[32]; 19 | static unsigned char out2[32]; 20 | 21 | int 22 | main(void) 23 | { 24 | int ret; 25 | 26 | scalar[0] = 1U; 27 | ret = crypto_scalarmult_curve25519(out1, scalar, p1); 28 | assert(ret == 0); 29 | ret = crypto_scalarmult_curve25519(out2, scalar, p2); 30 | assert(ret == 0); 31 | printf("%d\n", !!memcmp(out1, out2, 32)); 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult7.exp: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/scalarmult_ed25519.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/secretbox2.exp: -------------------------------------------------------------------------------- 1 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 2 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b 3 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 4 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc 5 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a 6 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 7 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 8 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 9 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d 10 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 11 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a 12 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde 13 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd 14 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 15 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 16 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 17 | ,0x5e,0x07,0x05 18 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/secretbox7.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "secretbox7" 3 | #include "cmptest.h" 4 | 5 | static unsigned char k[crypto_secretbox_KEYBYTES]; 6 | static unsigned char n[crypto_secretbox_NONCEBYTES]; 7 | static unsigned char m[10000]; 8 | static unsigned char c[10000]; 9 | static unsigned char m2[10000]; 10 | 11 | int 12 | main(void) 13 | { 14 | size_t mlen; 15 | size_t i; 16 | 17 | for (mlen = 0; mlen < 1000 && mlen + crypto_secretbox_ZEROBYTES < sizeof m; 18 | ++mlen) { 19 | crypto_secretbox_keygen(k); 20 | randombytes_buf(n, crypto_secretbox_NONCEBYTES); 21 | randombytes_buf(m + crypto_secretbox_ZEROBYTES, mlen); 22 | crypto_secretbox(c, m, mlen + crypto_secretbox_ZEROBYTES, n, k); 23 | if (crypto_secretbox_open(m2, c, mlen + crypto_secretbox_ZEROBYTES, n, 24 | k) == 0) { 25 | for (i = 0; i < mlen + crypto_secretbox_ZEROBYTES; ++i) { 26 | if (m2[i] != m[i]) { 27 | printf("bad decryption\n"); 28 | break; 29 | } 30 | } 31 | } else { 32 | printf("ciphertext fails verification\n"); 33 | } 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/secretbox7.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/secretbox7.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/secretbox8.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "secretbox8" 3 | #include "cmptest.h" 4 | 5 | static unsigned char k[crypto_secretbox_KEYBYTES]; 6 | static unsigned char n[crypto_secretbox_NONCEBYTES]; 7 | static unsigned char m[10000]; 8 | static unsigned char c[10000]; 9 | static unsigned char m2[10000]; 10 | 11 | int 12 | main(void) 13 | { 14 | size_t mlen; 15 | size_t i; 16 | int caught; 17 | 18 | for (mlen = 0; mlen < 1000 && mlen + crypto_secretbox_ZEROBYTES < sizeof m; 19 | ++mlen) { 20 | crypto_secretbox_keygen(k); 21 | randombytes_buf(n, crypto_secretbox_NONCEBYTES); 22 | randombytes_buf(m + crypto_secretbox_ZEROBYTES, mlen); 23 | crypto_secretbox(c, m, mlen + crypto_secretbox_ZEROBYTES, n, k); 24 | caught = 0; 25 | while (caught < 10) { 26 | c[rand() % (mlen + crypto_secretbox_ZEROBYTES)] = rand(); 27 | if (crypto_secretbox_open(m2, c, mlen + crypto_secretbox_ZEROBYTES, 28 | n, k) == 0) { 29 | for (i = 0; i < mlen + crypto_secretbox_ZEROBYTES; ++i) { 30 | if (m2[i] != m[i]) { 31 | printf("forgery\n"); 32 | return 100; 33 | } 34 | } 35 | } else { 36 | ++caught; 37 | } 38 | } 39 | } 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/secretbox8.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paixaop/node-sodium/6d7a02f2a52e6707c5db8c96bec6c853b1d9afcf/deps/libsodium/test/default/secretbox8.exp -------------------------------------------------------------------------------- /deps/libsodium/test/default/secretbox_easy2.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | 0 6 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/secretstream.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/shorthash.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "shorthash" 3 | #include "cmptest.h" 4 | 5 | #define MAXLEN 64 6 | 7 | int 8 | main(void) 9 | { 10 | unsigned char in[MAXLEN]; 11 | unsigned char out[crypto_shorthash_BYTES]; 12 | unsigned char k[crypto_shorthash_KEYBYTES]; 13 | size_t i; 14 | size_t j; 15 | 16 | for (i = 0; i < crypto_shorthash_KEYBYTES; ++i) { 17 | k[i] = (unsigned char) i; 18 | } 19 | for (i = 0; i < MAXLEN; ++i) { 20 | in[i] = (unsigned char) i; 21 | crypto_shorthash(out, in, (unsigned long long) i, k); 22 | for (j = 0; j < crypto_shorthash_BYTES; ++j) { 23 | printf("%02x", (unsigned int) out[j]); 24 | } 25 | printf("\n"); 26 | } 27 | assert(crypto_shorthash_bytes() > 0); 28 | assert(crypto_shorthash_keybytes() > 0); 29 | assert(strcmp(crypto_shorthash_primitive(), "siphash24") == 0); 30 | assert(crypto_shorthash_bytes() == crypto_shorthash_siphash24_bytes()); 31 | assert(crypto_shorthash_keybytes() == 32 | crypto_shorthash_siphash24_keybytes()); 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/shorthash.exp: -------------------------------------------------------------------------------- 1 | 310e0edd47db6f72 2 | fd67dc93c539f874 3 | 5a4fa9d909806c0d 4 | 2d7efbd796666785 5 | b7877127e09427cf 6 | 8da699cd64557618 7 | cee3fe586e46c9cb 8 | 37d1018bf50002ab 9 | 6224939a79f5f593 10 | b0e4a90bdf82009e 11 | f3b9dd94c5bb5d7a 12 | a7ad6b22462fb3f4 13 | fbe50e86bc8f1e75 14 | 903d84c02756ea14 15 | eef27a8e90ca23f7 16 | e545be4961ca29a1 17 | db9bc2577fcc2a3f 18 | 9447be2cf5e99a69 19 | 9cd38d96f0b3c14b 20 | bd6179a71dc96dbb 21 | 98eea21af25cd6be 22 | c7673b2eb0cbf2d0 23 | 883ea3e395675393 24 | c8ce5ccd8c030ca8 25 | 94af49f6c650adb8 26 | eab8858ade92e1bc 27 | f315bb5bb835d817 28 | adcf6b0763612e2f 29 | a5c91da7acaa4dde 30 | 716595876650a2a6 31 | 28ef495c53a387ad 32 | 42c341d8fa92d832 33 | ce7cf2722f512771 34 | e37859f94623f3a7 35 | 381205bb1ab0e012 36 | ae97a10fd434e015 37 | b4a31508beff4d31 38 | 81396229f0907902 39 | 4d0cf49ee5d4dcca 40 | 5c73336a76d8bf9a 41 | d0a704536ba93e0e 42 | 925958fcd6420cad 43 | a915c29bc8067318 44 | 952b79f3bc0aa6d4 45 | f21df2e41d4535f9 46 | 87577519048f53a9 47 | 10a56cf5dfcd9adb 48 | eb75095ccd986cd0 49 | 51a9cb9ecba312e6 50 | 96afadfc2ce666c7 51 | 72fe52975a4364ee 52 | 5a1645b276d592a1 53 | b274cb8ebf87870a 54 | 6f9bb4203de7b381 55 | eaecb2a30b22a87f 56 | 9924a43cc1315724 57 | bd838d3aafbf8db7 58 | 0b1a2a3265d51aea 59 | 135079a3231ce660 60 | 932b2846e4d70666 61 | e1915f5cb1eca46c 62 | f325965ca16d629f 63 | 575ff28e60381be5 64 | 724506eb4c328a95 65 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sign.exp: -------------------------------------------------------------------------------- 1 | 1024 tests 2 | ed25519ph sig: [10c5411e40bd10170fb890d4dfdb6d338c8cb11d2764a216ee54df10977dcdefd8ff755b1eeb3f16fce80e40e7aafc99083dbff43d5031baf04157b48423960d] 3 | ed25519ph tv sig: [98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406] 4 | pk: [b5076a8474a832daee4dd5b4040983b6623b5f344aca57d4d6ee4baf3f259e6e] 5 | sk: [421151a459faeade3d247115f94aedae42318124095afabe4d1451a559faedeeb5076a8474a832daee4dd5b4040983b6623b5f344aca57d4d6ee4baf3f259e6e] 6 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/siphashx24.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "siphashx24" 3 | #include "cmptest.h" 4 | 5 | #define MAXLEN 64 6 | 7 | int 8 | main(void) 9 | { 10 | unsigned char in[MAXLEN]; 11 | unsigned char out[crypto_shorthash_siphashx24_BYTES]; 12 | unsigned char k[crypto_shorthash_siphashx24_KEYBYTES]; 13 | size_t i; 14 | size_t j; 15 | 16 | for (i = 0; i < crypto_shorthash_siphashx24_KEYBYTES; ++i) { 17 | k[i] = (unsigned char) i; 18 | } 19 | for (i = 0; i < MAXLEN; ++i) { 20 | in[i] = (unsigned char) i; 21 | crypto_shorthash_siphashx24(out, in, (unsigned long long) i, k); 22 | for (j = 0; j < crypto_shorthash_siphashx24_BYTES; ++j) { 23 | printf("%02x", (unsigned int) out[j]); 24 | } 25 | printf("\n"); 26 | } 27 | assert(crypto_shorthash_siphashx24_KEYBYTES >= crypto_shorthash_siphash24_KEYBYTES); 28 | assert(crypto_shorthash_siphashx24_BYTES > crypto_shorthash_siphash24_BYTES); 29 | assert(crypto_shorthash_siphashx24_bytes() == crypto_shorthash_siphashx24_BYTES); 30 | assert(crypto_shorthash_siphashx24_keybytes() == crypto_shorthash_siphashx24_KEYBYTES); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sodium_core.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "sodium_core" 3 | #include "cmptest.h" 4 | 5 | static void 6 | misuse_handler(void) 7 | { 8 | printf("misuse_handler()\n"); 9 | exit(0); 10 | } 11 | 12 | int 13 | main(void) 14 | { 15 | sodium_set_misuse_handler(NULL); 16 | sodium_set_misuse_handler(misuse_handler); 17 | sodium_set_misuse_handler(NULL); 18 | 19 | assert(sodium_init() == 1); 20 | 21 | (void) sodium_runtime_has_neon(); 22 | (void) sodium_runtime_has_sse2(); 23 | (void) sodium_runtime_has_sse3(); 24 | (void) sodium_runtime_has_ssse3(); 25 | (void) sodium_runtime_has_sse41(); 26 | (void) sodium_runtime_has_avx(); 27 | (void) sodium_runtime_has_avx2(); 28 | (void) sodium_runtime_has_avx512f(); 29 | (void) sodium_runtime_has_pclmul(); 30 | (void) sodium_runtime_has_aesni(); 31 | (void) sodium_runtime_has_rdrand(); 32 | 33 | sodium_set_misuse_handler(misuse_handler); 34 | #ifndef __EMSCRIPTEN__ 35 | sodium_misuse(); 36 | printf("Misuse handler returned\n"); 37 | #else 38 | printf("misuse_handler()\n"); 39 | #endif 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sodium_core.exp: -------------------------------------------------------------------------------- 1 | misuse_handler() 2 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sodium_utils.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | -1 4 | 0 5 | 0 6 | 010000000000000000000000000000000000000000000000 7 | 000000000000000000000000000000000000000000000000 8 | 010100000000000000000000000000000000000000000000 9 | 020000000000000000000000000000000000000000000000 10 | 0001ff000000000000000000000000000000000000000000 11 | 000000000000fffefefefefefefefefefefefefefefefefe 12 | 00000000000000000000fffefefefefefefefefefefefefe 13 | 00000000000000000000000000000000000000000000fffe 14 | fcfffffffffffbfdfefefefefefefefefefefefefefefefe 15 | fcfffffffffffffffffffbfdfefefefefefefefefefefefe 16 | fcfffffffffffffffffffffffffffffffffffffffffffbfd 17 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sodium_utils2.exp: -------------------------------------------------------------------------------- 1 | OK 2 | Intentional segfault / bus error caught 3 | OK 4 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sodium_utils3.exp: -------------------------------------------------------------------------------- 1 | Intentional segfault / bus error caught 2 | OK 3 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sodium_version.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "sodium_version" 3 | #include "cmptest.h" 4 | 5 | int 6 | main(void) 7 | { 8 | printf("%d\n", sodium_version_string() != NULL); 9 | printf("%d\n", sodium_library_version_major() > 0); 10 | printf("%d\n", sodium_library_version_minor() >= 0); 11 | #ifdef SODIUM_LIBRARY_MINIMAL 12 | assert(sodium_library_minimal() == 1); 13 | #else 14 | assert(sodium_library_minimal() == 0); 15 | #endif 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/sodium_version.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/stream2.exp: -------------------------------------------------------------------------------- 1 | 662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 2 | 0cc9ffaf60a99d221b548e9762385a231121ab226d1c610d2661ced26b6ad5ee 3 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/stream3.c: -------------------------------------------------------------------------------- 1 | 2 | #define TEST_NAME "stream3" 3 | #include "cmptest.h" 4 | 5 | static unsigned char firstkey[32] = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 6 | 0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a, 7 | 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 8 | 0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 9 | 0x44, 0xf6, 0x83, 0x89 }; 10 | 11 | static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 12 | 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, 13 | 0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19, 14 | 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 }; 15 | 16 | static unsigned char rs[32]; 17 | 18 | int 19 | main(void) 20 | { 21 | int i; 22 | 23 | crypto_stream(rs, 32, nonce, firstkey); 24 | 25 | for (i = 0; i < 32; ++i) { 26 | printf(",0x%02x", (unsigned int) rs[i]); 27 | if (i % 8 == 7) 28 | printf("\n"); 29 | } 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/stream3.exp: -------------------------------------------------------------------------------- 1 | ,0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 2 | ,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 3 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 4 | ,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 5 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/stream4.exp: -------------------------------------------------------------------------------- 1 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 2 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce 3 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 4 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a 5 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b 6 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 7 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 8 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 9 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a 10 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae 11 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea 12 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda 13 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde 14 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 15 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 16 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 17 | ,0xe3,0x55,0xa5 18 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/verify1.exp: -------------------------------------------------------------------------------- 1 | OK 2 | OK 3 | -------------------------------------------------------------------------------- /deps/libsodium/test/default/xchacha20.exp: -------------------------------------------------------------------------------- 1 | tv_hchacha20: ok 2 | 3e34c160a966ddfbd52d38f6a440a77256c1134ad54653db427dfdfc72f0f995768039052ec2ec4e6fe02c655d7d95681fabd417c087ad17f177510ba09d4cfe7beb8f7c9b8330d746310f9e29583e9ef240156015faafeb24a4d002d6337b7bcec8b54a64ef704e1ae3247d79625d267cbacd1c90e4a2df2f72d4090babf88c90e65a086c464ec1753c49d3b8ad02f2a3c0808e1695c5d77cec6f6f12578ae4ed077a2046e06644d14af65ae90f2869a6f1f910b83a7a3cfec8dd390621a511 3 | tv_stream_xchacha20: ok 4 | tv_secretbox_xchacha20: ok 5 | tv_box_xchacha20poly1305: ok 6 | -------------------------------------------------------------------------------- /deps/libsodium/test/quirks/quirks.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | /* C++Builder defines a "random" macro */ 5 | #undef random 6 | 7 | #ifdef __native_client__ 8 | # define memset(dst, c, n) xmemset(dst, c, n) 9 | 10 | static void * 11 | xmemset(void *dst, int c, size_t n) 12 | { 13 | unsigned char * dst_ = (unsigned char *) dst; 14 | const unsigned char c_ = (unsigned char) c; 15 | size_t i; 16 | 17 | for (i = 0; i < n; i++) { 18 | dst_[i] = c_; 19 | } 20 | return dst; 21 | } 22 | #endif 23 | 24 | #ifdef __EMSCRIPTEN__ 25 | # define strcmp(s1, s2) xstrcmp(s1, s2) 26 | 27 | static int 28 | strcmp(const char *s1, const char *s2) 29 | { 30 | while (*s1 == *s2++) { 31 | if (*s1++ == 0) { 32 | return 0; 33 | } 34 | } 35 | return *(unsigned char *) s1 - *(unsigned char *) --s2; 36 | } 37 | #endif 38 | 39 | #ifdef _WIN32 40 | static void 41 | srandom(unsigned seed) 42 | { 43 | srand(seed); 44 | } 45 | 46 | static long 47 | random(void) 48 | { 49 | return (long) rand(); 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /docs/key-manager.md: -------------------------------------------------------------------------------- 1 | # Key Management 2 | 3 | To help with the key management tasks it is possible to use node-sodium's key manager, which can store one or more keys for your application 4 | 5 | This is a full Javascript implementation meant to be used server side, where assurance that direct memory access is not available to remote users. 6 | You should not use this functionality if you plan on deploying node-sodium in an environment where users can read nodeJS's memory space, as it can compromize keying information. 7 | 8 | ## Key File 9 | 10 | Keys can be written and read from the key file. This is a JSON formated file where all the keys are encrypted using a, what else, Sodium strem cypher. 11 | 12 | Format: 13 | 14 | { 15 | nonce: 123123123123, 16 | 17 | keys: { 18 | "key_alias_1" : { 19 | type: key_type, 20 | key: { 21 | 22 | } 23 | }, 24 | "key_alias_2" : { 25 | type: key_type, 26 | key: { 27 | ... 28 | }, 29 | 30 | ... 31 | } 32 | } 33 | } 34 | 35 | ## saveKey(keyObject, keyAlias) 36 | 37 | ## getKey(keyAlias) 38 | 39 | ## saveKeys(fileName) 40 | 41 | ## loadKeys(fileName, secretPassword) -------------------------------------------------------------------------------- /docs/not implemented.md: -------------------------------------------------------------------------------- 1 | This functions from Libsodium have not yet been implemented in node-sodium 2 | If you really need them please create a pull request and I will merge it in. Thank you for supporting the effort! 3 | 4 | * randombytes_implementation_name 5 | * randombytes_set_implementation 6 | * sodium_allocarray 7 | * sodium_free 8 | * sodium_malloc 9 | * sodium_mlock 10 | * sodium_mprotect_noaccess 11 | * sodium_mprotect_readonly 12 | * sodium_mprotect_readwrite 13 | * sodium_munlock 14 | 15 | Deprecated Functions 16 | 17 | * crypto_sign_edwards25519sha512batch 18 | * crypto_sign_edwards25519sha512batch_keypair 19 | * crypto_sign_edwards25519sha512batch_open 20 | 21 | -------------------------------------------------------------------------------- /docs/ported-functions.md: -------------------------------------------------------------------------------- 1 | 2 | # Ported Functions 3 | 4 | List of all functions ported by node-sodium 5 | 6 | ## Version 7 | * version 8 | * version_minor 9 | * version_major 10 | 11 | ## Utilities 12 | * memzero 13 | * memcmp 14 | * crypto_verify_16 15 | * crypto_verify_32 16 | 17 | ## Random 18 | * randombytes_buf 19 | * randombytes_close 20 | * randombytes_stir 21 | * randombytes_random 22 | * randombytes_uniform 23 | 24 | ## Hash 25 | * crypto_hash 26 | * crypto_hash_sha512 27 | * crypto_hash_sha256 28 | 29 | ## Auth 30 | * crypto_auth 31 | * crypto_auth_verify 32 | 33 | ## One Time Auth 34 | * crypto_onetimeauth 35 | * crypto_onetimeauth_verify 36 | 37 | ## Stream 38 | * crypto_stream 39 | * crypto_stream_xor 40 | 41 | ## Secret Box 42 | * crypto_secretbox 43 | * crypto_secretbox_open 44 | 45 | ## Sign 46 | * crypto_sign 47 | * crypto_sign_keypair 48 | * crypto_sign_open 49 | * crypto_sign_detached 50 | * crypto_sign_verify_detached 51 | * crypto_sign_ed25519_pk_to_curve25519 52 | * crypto_sign_ed25519_sk_to_curve25519 53 | 54 | ## Box 55 | * crypto_box 56 | * crypto_box_easy 57 | * crypto_box_keypair 58 | * crypto_box_open 59 | * crypto_box_open_easy 60 | * crypto_box_beforenm 61 | * crypto_box_afternm 62 | * crypto_box_open_afternm 63 | 64 | ## ShortHash 65 | * crypto_shorthash 66 | 67 | ## Scalar Mult 68 | * crypto_scalarmult 69 | * crypto_scalarmult_base 70 | -------------------------------------------------------------------------------- /docs/stream.md: -------------------------------------------------------------------------------- 1 | exports(\[secretKey\]) 2 | ---------------------- 3 | **Parameters** 4 | 5 | **[secretKey]**: *String|Buffer|Array*, A valid stream secret key 6 | 7 | primitive() 8 | ----------- 9 | String name of the default crypto primitive used in stream operations 10 | 11 | key() 12 | ----- 13 | Get the auth-key secret key object 14 | 15 | 16 | setEncoding(encoding) 17 | --------------------- 18 | Set the default encoding to use in all string conversions 19 | 20 | 21 | **Parameters** 22 | 23 | **encoding**: *String*, encoding to use 24 | 25 | getEncoding() 26 | ------------- 27 | Get the current default encoding 28 | 29 | 30 | encrypt(message, \[encoding\]) 31 | ---------------------------- 32 | Encrypt the message 33 | 34 | 35 | 36 | **Parameters** 37 | 38 | **message**: *string|Buffer|Array*, message to authenticate 39 | 40 | **[encoding**: *String*, ] If v is a string you can specify the encoding 41 | 42 | decrypt(cipherText, nonce, \[encoding\]) 43 | ---------------------------------------- 44 | The decrypt function verifies and decrypts a cipherText using the 45 | secret key and a nonce. 46 | The function returns the resulting plaintext m. 47 | 48 | 49 | 50 | **Parameters** 51 | 52 | **cipherText**: *Buffer|String|Array*, the encrypted message 53 | 54 | **nonce**: *Buffer|String|Array*, the nonce used to encrypt 55 | 56 | **[encoding]**: *String*, the encoding to return the plainText 57 | 58 | -------------------------------------------------------------------------------- /docs/toBuffer.md: -------------------------------------------------------------------------------- 1 | toBuffer(value, \[encoding\]) 2 | ----------------------------- 3 | Convert value into a buffer 4 | 5 | 6 | 7 | **Parameters** 8 | 9 | **value**: *String|Buffer|Array*, a buffer, and array of bytes or a string that you want to convert to a buffer 10 | 11 | **[encoding]**: *String*, encoding to use in conversion if value is a string. Defaults to 'hex' 12 | 13 | -------------------------------------------------------------------------------- /examples/generichash.js: -------------------------------------------------------------------------------- 1 | var sodium = require('sodium').api; 2 | 3 | function generateKey (len) { 4 | var key = Buffer.allocUnsafe(len); 5 | sodium.randombytes_buf(key, len); 6 | return key 7 | } 8 | 9 | var message = Buffer.from('Time flies like an arrow; fruit flies like a banana.') 10 | var key1 = generateKey(sodium.crypto_generichash_KEYBYTES); 11 | var hash1 = sodium.crypto_generichash(sodium.crypto_generichash_BYTES, message, key1); 12 | console.log(' crypto_generichash:', hash1.toString('base64')); 13 | 14 | // Streaming API for larger files or data streams 15 | var chunk1 = Buffer.from('One must acknowledge with cryptography '); 16 | var chunk2 = Buffer.from('no amount of violence will ever solve a math problem.'); 17 | var key2 = generateKey(sodium.crypto_generichash_KEYBYTES); 18 | 19 | var state = sodium.crypto_generichash_init(key2, sodium.crypto_generichash_BYTES); 20 | state = sodium.crypto_generichash_update(state, chunk1); 21 | state = sodium.crypto_generichash_update(state, chunk2); 22 | var hash2 = sodium.crypto_generichash_final(state, sodium.crypto_generichash_BYTES); 23 | console.log('Generichash streaming API:', hash2.toString('base64')); 24 | 25 | -------------------------------------------------------------------------------- /examples/low-level-api.js: -------------------------------------------------------------------------------- 1 | var sodium = require('sodium').api; 2 | 3 | 4 | // Generate keys 5 | var sender = sodium.crypto_box_keypair(); 6 | var receiver = sodium.crypto_box_keypair(); 7 | 8 | // Generate random nonce 9 | var nonce = Buffer.allocUnsafe(sodium.crypto_box_NONCEBYTES); 10 | sodium.randombytes_buf(nonce); 11 | 12 | // Encrypt 13 | var plainText = Buffer.from('this is a message'); 14 | var cipherMsg = sodium.crypto_box(plainText, nonce, receiver.publicKey, sender.secretKey); 15 | 16 | // Decrypt 17 | var plainBuffer = sodium.crypto_box_open(cipherMsg, nonce, sender.publicKey, 18 | receiver.secretKey); 19 | 20 | // We should get the same plainText! 21 | if (plainBuffer.toString() == plainText) { 22 | console.log("Message decrypted correctly"); 23 | } 24 | -------------------------------------------------------------------------------- /examples/pwhash.js: -------------------------------------------------------------------------------- 1 | var sodium = require('sodium').api; 2 | 3 | process.stdout.write('Password: '); 4 | process.stdin.resume(); 5 | process.stdin.setEncoding('utf8'); 6 | 7 | process.stdin.on('data', function (input) { 8 | var password = Buffer.from('a password', 'utf8'); 9 | var inPass = Buffer.from(input.trim(), 'utf8'); 10 | 11 | var hash = sodium.crypto_pwhash_str( 12 | password, 13 | sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE, 14 | sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE); 15 | 16 | var isValid = sodium.crypto_pwhash_str_verify(hash, inPass); 17 | console.log(isValid ? 'Correct.' : 'Incorrect.'); 18 | 19 | process.exit(); 20 | }); 21 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | /* jslint node: true */ 5 | 'use strict'; 6 | 7 | module.exports = require('./lib/sodium'); 8 | -------------------------------------------------------------------------------- /lib/ecdh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | * 4 | * Documentation of crypto http://nacl.cr.yp.to/box.html 5 | * @ 6 | * @test ../test/test_ecdh.js 7 | */ 8 | /* jslint node: true */ 9 | 'use strict'; 10 | 11 | var binding = require('../build/Release/sodium'); 12 | var DHKey = require('./keys/dh-key'); 13 | 14 | module.exports = function ECDH(publicKey, secretKey) { 15 | var self = this; 16 | 17 | self.iSecret = undefined; 18 | self.iSessionKey = undefined; 19 | 20 | self.iKey = new DHKey(publicKey, secretKey); 21 | 22 | self.secret = function () { 23 | if (!self.iSecret) { 24 | self.iSecret = binding.crypto_scalarmult(self.iKey.sk().get(), self 25 | .iKey.pk().get()); 26 | } 27 | return self.iSecret; 28 | }; 29 | 30 | self.reset = function () { 31 | self.iSecret = undefined; 32 | self.iSessionKey = undefined; 33 | }; 34 | 35 | self.sessionKey = function () { 36 | if (!self.iSecret) { 37 | self.iSecret = binding.crypto_scalarmult(self.iKey.sk().get(), self 38 | .iKey.pk().get()); 39 | } 40 | if (!self.iSessionKey) { 41 | self.iSessionKey = binding.crypto_hash_sha256(self.iSecret); 42 | } 43 | return self.iSessionKey; 44 | }; 45 | }; 46 | -------------------------------------------------------------------------------- /lib/keys/auth-key.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | /* jslint node: true */ 5 | 'use strict'; 6 | 7 | var util = require('util'); 8 | var binding = require('../../build/Release/sodium'); 9 | var CryptoBaseBuffer = require('../crypto-base-buffer'); 10 | 11 | /** 12 | * Message Authentication Secret Key 13 | * 14 | * @param {String|Buffer|Array} key secret key 15 | */ 16 | var Auth = function AuthKey(key, encoding) { 17 | var self = this; 18 | 19 | CryptoBaseBuffer.call(this); 20 | 21 | self.init({ 22 | expectedSize: binding.crypto_auth_KEYBYTES, 23 | buffer: key, 24 | encoding: encoding, 25 | type: 'AuthKey' 26 | }); 27 | 28 | self.setValidEncodings(['hex', 'base64']); 29 | 30 | }; 31 | util.inherits(Auth, CryptoBaseBuffer); 32 | module.exports = Auth; -------------------------------------------------------------------------------- /lib/keys/box-key.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | /* jslint node: true */ 5 | 'use strict'; 6 | 7 | var util = require('util'); 8 | var binding = require('../../build/Release/sodium'); 9 | var KeyPair = require('./keypair'); 10 | 11 | var Box = function BoxKey(publicKey, secretKey, encoding) { 12 | var self = this; 13 | 14 | KeyPair.call(this); 15 | 16 | self.init({ 17 | publicKeySize : binding.crypto_box_PUBLICKEYBYTES, 18 | secretKeySize : binding.crypto_box_SECRETKEYBYTES, 19 | publicKey : publicKey, 20 | secretKey : secretKey, 21 | type: 'BoxKey' 22 | }); 23 | 24 | self.generate = function() { 25 | var keys = binding.crypto_box_keypair(); 26 | self.secretKey.set(keys.secretKey); 27 | self.publicKey.set(keys.publicKey); 28 | }; 29 | 30 | 31 | if( !publicKey || !secretKey || 32 | !self.isValid({ 'publicKey': publicKey, 'secretKey': secretKey }) ) { 33 | 34 | // Generate the keys 35 | self.generate(); 36 | } 37 | }; 38 | util.inherits(Box, KeyPair); 39 | module.exports = Box; -------------------------------------------------------------------------------- /lib/keys/onetime-key.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | var util = require('util'); 5 | var binding = require('../../build/Release/sodium'); 6 | var CryptoBaseBuffer = require('../crypto-base-buffer'); 7 | 8 | var OneTime = function OneTimeAuthKey(key, encoding) { 9 | var self = this; 10 | 11 | CryptoBaseBuffer.call(this); 12 | 13 | self.init({ 14 | expectedSize: binding.crypto_onetimeauth_KEYBYTES, 15 | buffer: key, 16 | encoding: encoding, 17 | type: 'OneTimeAuthKey' 18 | }); 19 | self.setValidEncodings(['hex', 'base64']); 20 | 21 | }; 22 | util.inherits(OneTime, CryptoBaseBuffer); 23 | module.exports = OneTime; -------------------------------------------------------------------------------- /lib/keys/secretbox-key.js: -------------------------------------------------------------------------------- 1 | var util = require('util'); 2 | var binding = require('../../build/Release/sodium'); 3 | var CryptoBaseBuffer = require('../crypto-base-buffer'); 4 | 5 | var SecretBox = function SecretBoxKey(key, encoding) { 6 | var self = this; 7 | 8 | CryptoBaseBuffer.call(this); 9 | 10 | self.init({ 11 | expectedSize: binding.crypto_secretbox_KEYBYTES, 12 | buffer: key, 13 | encoding: encoding, 14 | type: 'SecretBoxKey' 15 | }); 16 | 17 | self.setValidEncodings(['hex', 'base64']); 18 | 19 | }; 20 | util.inherits(SecretBox, CryptoBaseBuffer); 21 | module.exports = SecretBox; -------------------------------------------------------------------------------- /lib/keys/sign-key.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | var util = require('util'); 5 | var binding = require('../../build/Release/sodium'); 6 | var KeyPair = require('./keypair'); 7 | var toBuffer = require('../toBuffer'); 8 | 9 | var Sign = function SignKey(publicKey, secretKey, encoding) { 10 | var self = this; 11 | 12 | KeyPair.call(this); 13 | 14 | self.init({ 15 | publicKeySize: binding.crypto_sign_PUBLICKEYBYTES, 16 | secretKeySize: binding.crypto_sign_SECRETKEYBYTES, 17 | publicKey: publicKey, 18 | secretKey: secretKey, 19 | encoding: encoding, 20 | type: 'SignKey' 21 | }); 22 | 23 | self.generate = function() { 24 | var keys = binding.crypto_sign_keypair(); 25 | self.secretKey.set(keys.secretKey); 26 | self.publicKey.set(keys.publicKey); 27 | }; 28 | 29 | if( !publicKey || !secretKey || 30 | !self.isValid({ 'publicKey': publicKey, 'secretKey': secretKey }) ) { 31 | 32 | // Generate the keys 33 | self.generate(); 34 | } 35 | }; 36 | util.inherits(Sign, KeyPair); 37 | 38 | Sign.fromSeed = function(seed, encoding) { 39 | encoding = String(encoding) || 'utf8'; 40 | 41 | var buf = toBuffer(seed, encoding); 42 | 43 | var keys = binding.crypto_sign_seed_keypair(buf); 44 | return new Sign(keys.publicKey, keys.secretKey, undefined); 45 | }; 46 | 47 | module.exports = Sign; -------------------------------------------------------------------------------- /lib/keys/stream-key.js: -------------------------------------------------------------------------------- 1 | var util = require('util'); 2 | var binding = require('../../build/Release/sodium'); 3 | var CryptoBaseBuffer = require('../crypto-base-buffer'); 4 | 5 | var Stream = function StreamKey(key, encoding) { 6 | var self = this; 7 | 8 | CryptoBaseBuffer.call(this); 9 | 10 | self.init({ 11 | expectedSize: binding.crypto_stream_KEYBYTES, 12 | buffer: key, 13 | encoding: encoding, 14 | type: 'StreamKey' 15 | }); 16 | 17 | self.setValidEncodings(['hex', 'base64']); 18 | 19 | }; 20 | 21 | util.inherits(Stream, CryptoBaseBuffer); 22 | module.exports = Stream; -------------------------------------------------------------------------------- /lib/nonces/box-nonce.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/3/13. 3 | */ 4 | /* jslint node: true */ 5 | 'use strict'; 6 | 7 | var util = require('util'); 8 | var binding = require('../../build/Release/sodium'); 9 | var CryptoBaseBuffer = require('../crypto-base-buffer'); 10 | 11 | var Box = function BoxNonce(nonce, encoding) { 12 | var self = this; 13 | 14 | CryptoBaseBuffer.call(this); 15 | 16 | self.setValidEncodings(['hex', 'base64']); 17 | 18 | self.init({ 19 | expectedSize: binding.crypto_box_NONCEBYTES, 20 | buffer: nonce, 21 | encoding: encoding, 22 | type: 'BoxNonce' 23 | }); 24 | 25 | }; 26 | util.inherits(Box, CryptoBaseBuffer); 27 | module.exports = Box; -------------------------------------------------------------------------------- /lib/nonces/secretbox-nonce.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/3/13. 3 | */ 4 | /* jslint node: true */ 5 | 'use strict'; 6 | 7 | var util = require('util'); 8 | var binding = require('../../build/Release/sodium'); 9 | var CryptoBaseBuffer = require('../crypto-base-buffer'); 10 | 11 | var SecretBox = function SecretBoxNonce(nonce, encoding) { 12 | var self = this; 13 | 14 | CryptoBaseBuffer.call(this); 15 | 16 | self.setValidEncodings(['hex', 'base64']); 17 | 18 | self.init({ 19 | expectedSize: binding.crypto_secretbox_NONCEBYTES, 20 | buffer: nonce, 21 | encoding: encoding, 22 | type: 'SecretBoxNonce' 23 | }); 24 | 25 | }; 26 | util.inherits(SecretBox, CryptoBaseBuffer); 27 | module.exports = SecretBox; -------------------------------------------------------------------------------- /lib/nonces/stream-nonce.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/3/13. 3 | */ 4 | /* jslint node: true */ 5 | 'use strict'; 6 | 7 | var util = require('util'); 8 | var binding = require('../../build/Release/sodium'); 9 | var CryptoBaseBuffer = require('../crypto-base-buffer'); 10 | 11 | var Stream = function StreamNonce(nonce, encoding) { 12 | var self = this; 13 | 14 | CryptoBaseBuffer.call(this); 15 | 16 | self.setValidEncodings(['hex', 'base64']); 17 | 18 | self.init({ 19 | expectedSize: binding.crypto_stream_NONCEBYTES, 20 | buffer: nonce, 21 | encoding: encoding, 22 | type: 'StreamNonce' 23 | }); 24 | 25 | }; 26 | util.inherits(Stream, CryptoBaseBuffer); 27 | module.exports = Stream; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sodium", 3 | "version": "3.0.2", 4 | "libsodium_version": "1.0.16", 5 | "author": "Pedro Paixao ", 6 | "license": "MIT", 7 | "main": "index.js", 8 | "description": "Lib Sodium port for node.js", 9 | "dependencies": { 10 | "node-addon-api": "*" 11 | }, 12 | "devDependencies": { 13 | "istanbul": ">=0.4.5", 14 | "mdextract": "^1.0.0", 15 | "mocha": ">=5.2.0", 16 | "mocha-istanbul": "^0.3.0", 17 | "node-gyp": "^3.8.0" 18 | }, 19 | "scripts": { 20 | "test": "make test", 21 | "preinstall": "node install.js --preinstall", 22 | "install": "node install.js --install" 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "https://github.com/paixaop/node-sodium" 27 | }, 28 | "keywords": [ 29 | "encryption", 30 | "ed25519", 31 | "curve25519", 32 | "NaCl", 33 | "libsodium", 34 | "crypto", 35 | "unique", 36 | "stamp" 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /src/crypto_auth.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | #include "crypto_auth_algos.h" 10 | 11 | NAPI_METHOD_FROM_INT(crypto_auth_bytes) 12 | NAPI_METHOD_FROM_INT(crypto_auth_keybytes) 13 | NAPI_METHOD_FROM_STRING(crypto_auth_primitive) 14 | 15 | /** 16 | * Register function calls in node binding 17 | */ 18 | void register_crypto_auth(Napi::Env env, Napi::Object exports) { 19 | 20 | // Auth 21 | EXPORT_ALIAS(crypto_auth, crypto_auth_hmacsha512256); 22 | EXPORT_ALIAS(crypto_auth_verify, crypto_auth_hmacsha512256_verify); 23 | EXPORT_ALIAS(crypto_auth_keygen, crypto_auth_hmacsha512256_keygen); 24 | 25 | EXPORT(crypto_auth_bytes); 26 | EXPORT(crypto_auth_keybytes); 27 | EXPORT(crypto_auth_primitive); 28 | 29 | EXPORT_INT(crypto_auth_BYTES); 30 | EXPORT_INT(crypto_auth_KEYBYTES); 31 | EXPORT_STRING(crypto_auth_PRIMITIVE); 32 | } -------------------------------------------------------------------------------- /src/crypto_auth_algos.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | #include "crypto_auth_algos.h" 10 | 11 | CRYPTO_AUTH_DEF(hmacsha256) 12 | CRYPTO_AUTH_DEF(hmacsha512) 13 | CRYPTO_AUTH_DEF(hmacsha512256) 14 | 15 | /** 16 | * Register function calls in node binding 17 | */ 18 | void register_crypto_auth_algos(Napi::Env env, Napi::Object exports) { 19 | 20 | METHOD_AND_PROPS(hmacsha256); 21 | METHOD_AND_PROPS(hmacsha512); 22 | METHOD_AND_PROPS(hmacsha512256); 23 | } -------------------------------------------------------------------------------- /src/crypto_core.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | #include "crypto_core.h" 10 | 11 | CRYPTO_CORE_DEF(hchacha20) 12 | CRYPTO_CORE_DEF(hsalsa20) 13 | CRYPTO_CORE_DEF(salsa20) 14 | CRYPTO_CORE_DEF(salsa2012) 15 | CRYPTO_CORE_DEF(salsa208) 16 | 17 | /** 18 | * Register function calls in node binding 19 | */ 20 | void register_crypto_core(Napi::Env env, Napi::Object exports) { 21 | 22 | METHOD_AND_PROPS(hchacha20); 23 | METHOD_AND_PROPS(hsalsa20); 24 | METHOD_AND_PROPS(salsa20); 25 | METHOD_AND_PROPS(salsa2012); 26 | METHOD_AND_PROPS(salsa208); 27 | } -------------------------------------------------------------------------------- /src/crypto_hash.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | 10 | /** 11 | * int crypto_hash( 12 | * unsigned char * hbuf, 13 | * const unsigned char * msg, 14 | * unsigned long long mlen) 15 | */ 16 | NAPI_METHOD(crypto_hash) { 17 | Napi::Env env = info.Env(); 18 | 19 | ARGS(1, "argument message must be a buffer"); 20 | ARG_TO_UCHAR_BUFFER(msg); 21 | 22 | NEW_BUFFER_AND_PTR(hash, crypto_hash_BYTES); 23 | 24 | if( crypto_hash(hash_ptr, msg, msg_size) == 0 ) { 25 | return hash; 26 | } else { 27 | return NAPI_NULL; 28 | } 29 | } 30 | 31 | NAPI_METHOD_FROM_INT(crypto_hash_bytes) 32 | NAPI_METHOD_FROM_STRING(crypto_hash_primitive) 33 | 34 | /** 35 | * Register function calls in node binding 36 | */ 37 | void register_crypto_hash(Napi::Env env, Napi::Object exports) { 38 | 39 | // Hash 40 | EXPORT(crypto_hash); 41 | EXPORT(crypto_hash_bytes); 42 | EXPORT(crypto_hash_primitive); 43 | EXPORT_INT(crypto_hash_BYTES); 44 | EXPORT_STRING(crypto_hash_PRIMITIVE); 45 | } -------------------------------------------------------------------------------- /src/crypto_onetimeauth.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | #include "crypto_onetimeauth_poly1305.h" 10 | 11 | /** 12 | * Register function calls in node binding 13 | */ 14 | void register_crypto_onetimeauth(Napi::Env env, Napi::Object exports) { 15 | 16 | EXPORT_ALIAS(crypto_onetimeauth, crypto_onetimeauth_poly1305); 17 | EXPORT_ALIAS(crypto_onetimeauth_verify, crypto_onetimeauth_poly1305_verify); 18 | EXPORT_ALIAS(crypto_onetimeauth_init, crypto_onetimeauth_poly1305_init); 19 | EXPORT_ALIAS(crypto_onetimeauth_update, crypto_onetimeauth_poly1305_update); 20 | EXPORT_ALIAS(crypto_onetimeauth_final, crypto_onetimeauth_poly1305_final); 21 | EXPORT_ALIAS(crypto_onetimeauth_keygen, crypto_onetimeauth_poly1305_keygen); 22 | 23 | EXPORT_INT(crypto_onetimeauth_BYTES); 24 | EXPORT_INT(crypto_onetimeauth_KEYBYTES); 25 | EXPORT_STRING(crypto_onetimeauth_PRIMITIVE); 26 | } -------------------------------------------------------------------------------- /src/crypto_scalarmult.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | #include "crypto_scalarmult_curve25519.h" 10 | 11 | /** 12 | * Register function calls in node binding 13 | */ 14 | void register_crypto_scalarmult(Napi::Env env, Napi::Object exports) { 15 | 16 | // Scalar Mult 17 | EXPORT_ALIAS(crypto_scalarmult, crypto_scalarmult_curve25519); 18 | EXPORT_ALIAS(crypto_scalarmult_base, crypto_scalarmult_curve25519_base); 19 | 20 | EXPORT_INT(crypto_scalarmult_SCALARBYTES); 21 | EXPORT_INT(crypto_scalarmult_BYTES); 22 | EXPORT_STRING(crypto_scalarmult_PRIMITIVE); 23 | } -------------------------------------------------------------------------------- /src/crypto_sign.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | #include "crypto_sign_ed25519.h" 10 | 11 | 12 | /** 13 | * Register function calls in node binding 14 | */ 15 | void register_crypto_sign(Napi::Env env, Napi::Object exports) { 16 | 17 | // Sign 18 | EXPORT_ALIAS(crypto_sign, crypto_sign_ed25519); 19 | EXPORT_ALIAS(crypto_sign_open, crypto_sign_ed25519_open); 20 | EXPORT_ALIAS(crypto_sign_detached, crypto_sign_ed25519_detached); 21 | EXPORT_ALIAS(crypto_sign_verify_detached, crypto_sign_ed25519_verify_detached); 22 | EXPORT_ALIAS(crypto_sign_keypair, crypto_sign_ed25519_keypair); 23 | EXPORT_ALIAS(crypto_sign_seed_keypair, crypto_sign_ed25519_seed_keypair); 24 | 25 | EXPORT_INT(crypto_sign_SEEDBYTES); 26 | EXPORT_INT(crypto_sign_BYTES); 27 | EXPORT_INT(crypto_sign_PUBLICKEYBYTES); 28 | EXPORT_INT(crypto_sign_SECRETKEYBYTES); 29 | EXPORT_STRING(crypto_sign_PRIMITIVE); 30 | } 31 | -------------------------------------------------------------------------------- /src/crypto_stream.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #include "node_sodium.h" 9 | 10 | #include "crypto_streams.h" 11 | 12 | NAPI_METHOD_FROM_INT(crypto_stream_keybytes) 13 | NAPI_METHOD_FROM_INT(crypto_stream_noncebytes) 14 | NAPI_METHOD_FROM_STRING(crypto_stream_primitive) 15 | 16 | /** 17 | * Register function calls in node binding 18 | */ 19 | void register_crypto_stream(Napi::Env env, Napi::Object exports) { 20 | 21 | // Stream 22 | EXPORT_ALIAS(crypto_stream, crypto_stream_xsalsa20); 23 | EXPORT_ALIAS(crypto_stream_xor, crypto_stream_xsalsa20_xor); 24 | 25 | EXPORT(crypto_stream_keybytes); 26 | EXPORT(crypto_stream_noncebytes); 27 | EXPORT(crypto_stream_primitive); 28 | 29 | EXPORT_INT(crypto_stream_KEYBYTES); 30 | EXPORT_INT(crypto_stream_NONCEBYTES); 31 | EXPORT_STRING(crypto_stream_PRIMITIVE); 32 | } -------------------------------------------------------------------------------- /src/include/crypto_onetimeauth_poly1305.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #ifndef __CRYPTO_ONETIMEAUTH_POLY1305_H__ 9 | #define __CRYPTO_ONETIMEAUTH_POLY1305_H__ 10 | 11 | #include "node_sodium.h" 12 | 13 | NAPI_METHOD(crypto_onetimeauth_poly1305); 14 | NAPI_METHOD(crypto_onetimeauth_poly1305_verify); 15 | NAPI_METHOD(crypto_onetimeauth_poly1305_init); 16 | NAPI_METHOD(crypto_onetimeauth_poly1305_update); 17 | NAPI_METHOD(crypto_onetimeauth_poly1305_final); 18 | NAPI_METHOD(crypto_onetimeauth_poly1305_keygen); 19 | 20 | #endif -------------------------------------------------------------------------------- /src/include/crypto_scalarmult_curve25519.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #ifndef __CRYPTO_SCALARMULT_CURVE25519_H__ 9 | #define __CRYPTO_SCALARMULT_CURVE25519_H__ 10 | 11 | #include "node_sodium.h" 12 | 13 | NAPI_METHOD(crypto_scalarmult_curve25519); 14 | NAPI_METHOD(crypto_scalarmult_curve25519_base); 15 | 16 | #endif -------------------------------------------------------------------------------- /src/include/crypto_sign_ed25519.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Node Native Module for Lib Sodium 3 | * 4 | * @Author Pedro Paixao 5 | * @email paixaop at gmail dot com 6 | * @License MIT 7 | */ 8 | #ifndef __CRYPTO_SIGN_ED25519_H__ 9 | #define __CRYPTO_SIGN_ED25519_H__ 10 | 11 | #include "node_sodium.h" 12 | 13 | NAPI_METHOD(crypto_sign_ed25519); 14 | NAPI_METHOD(crypto_sign_ed25519_open); 15 | NAPI_METHOD(crypto_sign_ed25519_detached); 16 | NAPI_METHOD(crypto_sign_ed25519_verify_detached); 17 | NAPI_METHOD(crypto_sign_ed25519_keypair); 18 | NAPI_METHOD(crypto_sign_ed25519_seed_keypair); 19 | NAPI_METHOD(crypto_sign_ed25519_pk_to_curve25519); 20 | NAPI_METHOD(crypto_sign_ed25519_sk_to_curve25519); 21 | NAPI_METHOD(crypto_sign_ed25519_sk_to_seed); 22 | NAPI_METHOD(crypto_sign_ed25519_sk_to_pk); 23 | 24 | #endif -------------------------------------------------------------------------------- /test/test_crypto_utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 10/31/13. 3 | */ 4 | "use strict"; 5 | 6 | var assert = require('assert'); 7 | var sodium = require('../build/Release/sodium'); 8 | 9 | describe('Utils', function() { 10 | it('should zero a buffer', function(done) { 11 | var buf = Buffer.alloc(100, 1); 12 | sodium.memzero(buf); 13 | for(var i=0; i< buf.length; i++) { 14 | assert.equal(buf[i],0); 15 | } 16 | done(); 17 | }); 18 | }); 19 | 20 | describe("memzero verify parameters", function () { 21 | var buf = Buffer.allocUnsafe(100); 22 | it('bad param 1 string', function(done) { 23 | buf = "token"; 24 | assert.throws(function() { 25 | sodium.memzero(buf); 26 | }); 27 | done(); 28 | }); 29 | it('bad param 1 number', function(done) { 30 | buf = 123; 31 | assert.throws(function() { 32 | sodium.memzero(buf); 33 | }); 34 | done(); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /test/test_crypto_version.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 10/31/13. 3 | */ 4 | "use strict"; 5 | 6 | var assert = require('assert'); 7 | var sodium = require('../build/Release/sodium'); 8 | 9 | describe('Version', function() { 10 | it('should return a string', function(done) { 11 | var v = sodium.sodium_version_string(); 12 | assert.equal(typeof v,'string'); 13 | done(); 14 | }) 15 | 16 | it('Minor should return an integer', function(done) { 17 | assert.equal(typeof sodium.sodium_library_version_minor(),'number'); 18 | done(); 19 | }); 20 | 21 | it('Major should return an integer', function(done) { 22 | assert.equal(typeof sodium.sodium_library_version_major(),'number'); 23 | done(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /test/test_dh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Test Group Key Exchanges 3 | */ 4 | var assert = require('assert'); 5 | var Sodium = require('../lib/sodium'); 6 | if (process.env.COVERAGE) { 7 | Sodium = require('../lib-cov/sodium'); 8 | } 9 | 10 | describe('DH Group Key Exchange', function () { 11 | it('should work for a groupd', function (done) { 12 | 13 | var a = new Sodium.Key.ECDH("", Sodium.Hash.sha256(Buffer.from( 14 | "9549937362"))); 15 | var b = new Sodium.Key.ECDH("", Sodium.Hash.sha256(Buffer.from( 16 | "9542584444"))); 17 | 18 | var abDH = new Sodium.ECDH(b.pk(), a.sk()).secret(); 19 | var baDH = new Sodium.ECDH(a.pk(), b.sk()).secret(); 20 | 21 | assert.deepEqual(abDH,baDH); 22 | 23 | done(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /test/test_ecdh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | var assert = require('assert'); 5 | var sodium = require('../build/Release/sodium'); 6 | 7 | var ECDH = require('../lib/ecdh'); 8 | var DHKey = require('../lib/keys/dh-key'); 9 | if (process.env.COVERAGE) { 10 | ECDH = require('../lib-cov/ecdh'); 11 | DHKey = require('../lib-cov/keys/dh-key'); 12 | } 13 | 14 | describe("ECDH", function () { 15 | it("should calculate the same secret", function (done) { 16 | var bob = new DHKey(); 17 | var alice = new DHKey(); 18 | 19 | var aliceDH = new ECDH(bob.pk().get(), alice.sk().get()); 20 | var bobDH = new ECDH(alice.pk().get(), bob.sk().get()); 21 | 22 | var bobSecret = bobDH.secret(); 23 | var aliceSecret = aliceDH.secret(); 24 | 25 | assert.deepEqual(bobSecret,aliceSecret); 26 | done(); 27 | }); 28 | 29 | it("should calculate the same session key", function (done) { 30 | var bob = new DHKey(); 31 | var alice = new DHKey(); 32 | 33 | var aliceDH = new ECDH(bob.pk().get(), alice.sk().get()); 34 | var bobDH = new ECDH(alice.pk().get(), bob.sk().get()); 35 | 36 | var bobSecret = bobDH.sessionKey(); 37 | var aliceSecret = aliceDH.sessionKey(); 38 | 39 | assert.deepEqual(bobSecret, aliceSecret); 40 | done(); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/test_key_keypair.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | var assert = require('assert'); 5 | var crypto = require('crypto'); 6 | 7 | var Key = require('../lib/keys/keypair'); 8 | if (process.env.COVERAGE) { 9 | Key = require('../lib-cov/keys/keypair'); 10 | } 11 | 12 | describe("KeyPair", function () { 13 | it('generate should throw', function(done) { 14 | var key = new Key(); 15 | assert.throws(function() { 16 | key.init(); 17 | }); 18 | done(); 19 | }); 20 | 21 | it('generate should throw', function(done) { 22 | var key = new Key(); 23 | assert.throws(function() { 24 | key.generate(); 25 | }); 26 | done(); 27 | }); 28 | 29 | }); -------------------------------------------------------------------------------- /test/test_libsodium_auth2.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | var expected = Buffer.from([ 5 | 0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2, 6 | 0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4, 7 | 0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25, 8 | 0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f 9 | ]); 10 | 11 | 12 | var key = Buffer.from([ 13 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 14 | 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 15 | 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 16 | ]); 17 | 18 | var c = Buffer.from([ 19 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 20 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 21 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 22 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 23 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 24 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 25 | 0xcd, 0xcd 26 | ]); 27 | 28 | 29 | describe("libsodium_auth2", function () { 30 | it('crypto_auth_hmacsha256', function() { 31 | var result = sodium.crypto_auth_hmacsha256(c, key); 32 | assert(result.equals(expected)); 33 | }); 34 | }); 35 | 36 | -------------------------------------------------------------------------------- /test/test_libsodium_auth3.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | var expected = Buffer.from([ 5 | 0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2, 6 | 0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4, 7 | 0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25, 8 | 0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f 9 | ]); 10 | 11 | 12 | var key = Buffer.from([ 13 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 14 | 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 15 | 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 16 | ]); 17 | 18 | var c = Buffer.from([ 19 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 20 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 21 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 22 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 23 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 24 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 25 | 0xcd, 0xcd 26 | ]); 27 | 28 | var a = Buffer.from([ 29 | 0x37, 0x2e, 0xfc, 0xf9, 0xb4, 0x0b, 0x35, 0xc2, 30 | 0x11, 0x5b, 0x13, 0x46, 0x90, 0x3d, 0x2e, 0xf4, 31 | 0x2f, 0xce, 0xd4, 0x6f, 0x08, 0x46, 0xe7, 0x25, 32 | 0x7b, 0xb1, 0x56, 0xd3, 0xd7, 0xb3, 0x0d, 0x3f 33 | ]); 34 | 35 | describe("libsodium_auth3", function () { 36 | it('crypto_auth_hmacsha256_verify', function() { 37 | var result = sodium.crypto_auth_hmacsha256_verify(a, c, key); 38 | assert(result == 0); 39 | }); 40 | }); 41 | 42 | -------------------------------------------------------------------------------- /test/test_libsodium_auth5.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | describe("libsodium_auth5", function () { 5 | it('crypto_auth_keygen, verify', function() { 6 | for (var clen = 0; clen < 1000; ++clen) { 7 | var key = sodium.crypto_auth_keygen(); 8 | var c = Buffer.allocUnsafe(clen); 9 | sodium.randombytes_buf(c); 10 | 11 | var a = sodium.crypto_auth(c, key); 12 | 13 | assert(sodium.crypto_auth_verify(a, c, key) == 0); 14 | 15 | if (clen > 0) { 16 | var r = Math.floor((1000 * Math.random()) % clen); 17 | c[ r % clen] += 1 + (1000 * Math.random() % 255); 18 | assert(sodium.crypto_auth_verify(a, c, key) != 0); 19 | 20 | var r2 = Math.floor((1000 * Math.random()) % a.length); 21 | a[r2] += 1 + (1000 * Math.random() % 255); 22 | assert(sodium.crypto_auth_verify(a, c, key) != 0); 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /test/test_libsodium_auth6.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | 5 | var expected = Buffer.from([ 6 | 0x16,0x4b,0x7a,0x7b,0xfc,0xf8,0x19,0xe2, 7 | 0xe3,0x95,0xfb,0xe7,0x3b,0x56,0xe0,0xa3, 8 | 0x87,0xbd,0x64,0x22,0x2e,0x83,0x1f,0xd6, 9 | 0x10,0x27,0x0c,0xd7,0xea,0x25,0x05,0x54, 10 | 0x97,0x58,0xbf,0x75,0xc0,0x5a,0x99,0x4a, 11 | 0x6d,0x03,0x4f,0x65,0xf8,0xf0,0xe6,0xfd, 12 | 0xca,0xea,0xb1,0xa3,0x4d,0x4a,0x6b,0x4b, 13 | 0x63,0x6e,0x07,0x0a,0x38,0xbc,0xe7,0x37 14 | ]); 15 | 16 | 17 | var tKey = Buffer.from("Jefe"); 18 | var key = Buffer.alloc(32).fill(0); 19 | tKey.copy(key); 20 | 21 | var c = Buffer.from("what do ya want for nothing?"); 22 | 23 | describe("libsodium_auth5", function () { 24 | it('crypto_auth_hmacsha512', function() { 25 | var result = sodium.crypto_auth_hmacsha512(c, key); 26 | assert(result.equals(expected)); 27 | }) 28 | }); 29 | 30 | -------------------------------------------------------------------------------- /test/test_libsodium_auth7.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | describe("libsodium_auth7", function () { 5 | it('crypto_auth_hmacsha512, verify', function() { 6 | for (var clen = 0; clen < 1000; ++clen) { 7 | var key = sodium.crypto_auth_keygen(); 8 | var c = Buffer.allocUnsafe(clen); 9 | sodium.randombytes_buf(c); 10 | 11 | var a = sodium.crypto_auth_hmacsha512(c, key); 12 | 13 | assert(sodium.crypto_auth_hmacsha512_verify(a, c, key) == 0); 14 | 15 | if (clen > 0) { 16 | var r = Math.floor((1000 * Math.random()) % clen); 17 | c[ r % clen] += 1 + (1000 * Math.random() % 255); 18 | assert(sodium.crypto_auth_hmacsha512_verify(a, c, key) != 0); 19 | 20 | var r2 = Math.floor((1000 * Math.random()) % a.length); 21 | a[r2] += 1 + (1000 * Math.random() % 255); 22 | assert(sodium.crypto_auth_hmacsha512_verify(a, c, key) != 0); 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /test/test_libsodium_box7.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | 5 | describe("libsodium_box7", function () { 6 | it('crypto_box_keypair', function() { 7 | 8 | var alice = sodium.crypto_box_keypair(); 9 | var bob = sodium.crypto_box_keypair(); 10 | var mlen_max = 1000; 11 | var n = Buffer.alloc(sodium.crypto_box_NONCEBYTES).fill(0); 12 | 13 | for (var mlen = 0; mlen + sodium.crypto_box_ZEROBYTES <= mlen_max; mlen++) { 14 | sodium.randombytes_buf(n); 15 | var rbytes = Buffer.alloc(mlen); 16 | sodium.randombytes_buf(rbytes); 17 | var m = Buffer.alloc(sodium.crypto_box_ZEROBYTES + mlen).fill(0); 18 | var m2 = Buffer.alloc(sodium.crypto_box_ZEROBYTES + mlen).fill(0); 19 | rbytes.copy(m, sodium.crypto_box_ZEROBYTES, 0, mlen); 20 | 21 | var c = sodium.crypto_box(m, n, bob.publicKey, alice.secretKey); 22 | assert(c !== null); 23 | 24 | var m2 = sodium.crypto_box_open(c, n, alice.publicKey, 25 | bob.secretKey); 26 | 27 | assert(m.equals(m2)); 28 | } 29 | }); 30 | }); 31 | 32 | -------------------------------------------------------------------------------- /test/test_libsodium_box_seal.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | 5 | describe("libsodium_box_seal", function () { 6 | it('should seal and open message', function() { 7 | var keys = sodium.crypto_box_keypair(); 8 | 9 | var m_len = sodium.randombytes_uniform(1000); 10 | m = Buffer.allocUnsafe(m_len); 11 | sodium.randombytes_buf(m); 12 | 13 | var c = sodium.crypto_box_seal(m, keys.publicKey); 14 | assert( c !== null ); 15 | 16 | var m2 = sodium.crypto_box_seal_open(c, keys.publicKey, keys.secretKey); 17 | assert( m2 !== null); 18 | assert(m.equals(m2)); 19 | 20 | assert.throws(function() { 21 | m2 = sodium.crypto_box_seal_open(null, keys.publicKey, keys.secretKey); 22 | }); 23 | 24 | m2 = sodium.crypto_box_seal_open(c, keys.secretKey, keys.publicKey); 25 | assert(m2 == null); 26 | 27 | var c2 = c.slice(0, c.length - 1); 28 | m2 = sodium.crypto_box_seal_open(c2, keys.publicKey, keys.secretKey); 29 | assert(m2 == null); 30 | 31 | assert(sodium.crypto_box_SEALBYTES > 0); 32 | }); 33 | }); 34 | 35 | -------------------------------------------------------------------------------- /test/test_libsodium_box_seed.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | var expected1 = Buffer.from([ 5 | 0xed,0x77,0x49,0xb4,0xd9,0x89,0xf6,0x95, 6 | 0x7f,0x3b,0xfd,0xe6,0xc5,0x67,0x67,0xe9, 7 | 0x88,0xe2,0x1c,0x9f,0x87,0x84,0xd9,0x1d, 8 | 0x61,0x00,0x11,0xcd,0x55,0x3f,0x9b,0x06, 9 | ]); 10 | 11 | var expected2 = Buffer.from([ 12 | 0xac,0xcd,0x44,0xeb,0x8e,0x93,0x31,0x9c, 13 | 0x05,0x70,0xbc,0x11,0x00,0x5c,0x0e,0x01, 14 | 0x89,0xd3,0x4f,0xf0,0x2f,0x6c,0x17,0x77, 15 | 0x34,0x11,0xad,0x19,0x12,0x93,0xc9,0x8f, 16 | 17 | ]); 18 | 19 | 20 | var seed = Buffer.from([ 21 | 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 22 | 0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2, 23 | 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 24 | 0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 25 | 0x1d, 0xb9, 0x2c, 0x2a 26 | ]); 27 | 28 | describe("libsodium_auth3", function () { 29 | it('crypto_box_seed_keypair key generation', function() { 30 | var keys = sodium.crypto_box_seed_keypair(seed); 31 | assert(keys.publicKey.equals(expected1)); 32 | assert(keys.secretKey.equals(expected2)); 33 | }); 34 | }); 35 | 36 | -------------------------------------------------------------------------------- /test/test_libsodium_core1.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | var shared = Buffer.from([ 5 | 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 6 | 0xe1, 0x72, 0x8e, 0x3b, 0xf4, 0x80, 0x35, 7 | 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 8 | 0xd1, 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 9 | 0x1e, 0x16, 0x17, 0x42 10 | ]); 11 | 12 | var c = Buffer.from([ 13 | 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33, 14 | 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b 15 | ]); 16 | 17 | var expected= Buffer.from([ 18 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4, 19 | 0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7, 20 | 0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2, 21 | 0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 22 | ]); 23 | 24 | describe("libsodium_core1", function () { 25 | it('crypto_core_hsalsa20', function() { 26 | var zero = Buffer.alloc(16); 27 | var fisrtKey = sodium.crypto_core_hsalsa20(zero, shared, c); 28 | assert(fisrtKey.equals(expected)); 29 | 30 | assert(sodium.crypto_core_hsalsa20_outputbytes() > 0); 31 | assert(sodium.crypto_core_hsalsa20_inputbytes() > 0); 32 | assert(sodium.crypto_core_hsalsa20_keybytes() > 0); 33 | assert(sodium.crypto_core_hsalsa20_constbytes() > 0); 34 | }); 35 | }); 36 | 37 | -------------------------------------------------------------------------------- /test/test_libsodium_core2.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | var firstKey = Buffer.from([ 5 | 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 6 | 0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a, 7 | 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 8 | 0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 9 | 0x44, 0xf6, 0x83, 0x89 10 | ]); 11 | 12 | var nonceprefix = Buffer.from([ 13 | 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 14 | 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, 15 | 0x75, 0xfc, 0x73, 0xd6 16 | ]); 17 | 18 | var c = Buffer.from([ 19 | 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33, 20 | 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b 21 | ]); 22 | 23 | var expected= Buffer.from([ 24 | 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9, 25 | 0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88, 26 | 0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9, 27 | 0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 28 | ]); 29 | 30 | describe("libsodium_core1", function () { 31 | it('crypto_core_hsalsa20', function() { 32 | var zero = Buffer.alloc(16); 33 | var secondKey = sodium.crypto_core_hsalsa20(nonceprefix, firstKey, c); 34 | assert(secondKey.equals(expected)); 35 | }); 36 | }); 37 | 38 | -------------------------------------------------------------------------------- /test/test_libsodium_onetimeauth7.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var sodium = require('../build/Release/sodium'); 3 | 4 | var rs = Buffer.from([ 5 | 0xee, 0xa6, 0xa7, 0x25, 0x1c, 0x1e, 0x72, 0x91, 0x6d, 0x11, 0xc2, 6 | 0xcb, 0x21, 0x4d, 0x3c, 0x25, 0x25, 0x39, 0x12, 0x1d, 0x8e, 0x23, 7 | 0x4e, 0x65, 0x2d, 0x65, 0x1f, 0xa4, 0xc8, 0xcf, 0xf8, 0x80 8 | ]); 9 | 10 | 11 | describe("libsodium_onetimeauth7", function () { 12 | it('crypto_onetimeauth_verify', function() { 13 | for (var clen = 0; clen < 1000; ++clen) { 14 | var key = sodium.crypto_onetimeauth_keygen(); 15 | var c = Buffer.alloc(clen); 16 | sodium.randombytes_buf(c); 17 | var a = sodium.crypto_onetimeauth(c, key); 18 | 19 | var result = sodium.crypto_onetimeauth_verify(a, c, key); 20 | assert(result); 21 | 22 | if (clen > 0) { 23 | var i = Math.floor(Math.random() * Math.floor(clen)); 24 | c[i] += 1; 25 | assert(!sodium.crypto_onetimeauth_verify(a, c, key)); 26 | 27 | i = Math.floor(Math.random() * Math.floor(a.length)); 28 | a[i] += 1; 29 | assert(!sodium.crypto_onetimeauth_verify(a, c, key)); 30 | } 31 | } 32 | }); 33 | }); 34 | 35 | -------------------------------------------------------------------------------- /test/test_sodium_auth5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 07/25/16. 3 | */ 4 | var assert = require('assert'); 5 | var sodium = require('../build/Release/sodium'); 6 | 7 | describe("Auth5", function() { 8 | var key = Buffer.alloc(32); 9 | 10 | it("Test random vectors", function(done) { 11 | for (var clen = 0; clen < 1000; ++clen) { 12 | sodium.randombytes_buf(key); 13 | c = Buffer.allocUnsafe(clen); 14 | sodium.randombytes_buf(c); 15 | var a = sodium.crypto_auth(c, key); 16 | assert.equal(sodium.crypto_auth_verify(a, c, key), 0); 17 | 18 | if( clen>0) { 19 | c[sodium.randombytes_uniform(clen)] += 1 + (sodium.randombytes_uniform(255)); 20 | assert.notEqual(sodium.crypto_auth_verify(a, c, key), 0); 21 | 22 | a[sodium.randombytes_uniform(a.length)] += 1 + (sodium.randombytes_uniform(255)); 23 | assert.notEqual(sodium.crypto_auth_verify(a, c, key), 0); 24 | } 25 | } 26 | done(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /test/test_stream.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by bmf on 11/2/13. 3 | */ 4 | var assert = require('assert'); 5 | var sodium = require('../build/Release/sodium'); 6 | 7 | var Stream = require('../lib/stream'); 8 | if (process.env.COVERAGE) { 9 | Stream = require('../lib-cov/stream'); 10 | } 11 | 12 | describe("Stream", function () { 13 | it("encryp/decrypt message", function (done) { 14 | var stream = new Stream(); 15 | 16 | var cTxt = stream.encrypt("This is a test", "utf8"); 17 | var checkMsg = stream.decrypt(cTxt); 18 | assert.equal(checkMsg.toString('utf8'), "This is a test"); 19 | done(); 20 | }); 21 | 22 | it("should return a stream buffer", function (done) { 23 | var stream = new Stream(); 24 | 25 | var s = stream.generate(100); 26 | assert.equal(typeof s, 'object'); 27 | assert.notEqual(typeof s.stream, 'undefined'); 28 | assert.notEqual(typeof s.nonce, 'undefined'); 29 | //assert.equal(s.stream.length, 100); 30 | //assert.equal(s.nonce.length, sodium.crypto_stream_NONCEBYTES); 31 | done(); 32 | }); 33 | 34 | }); --------------------------------------------------------------------------------