├── .gitignore
├── .travis.yml
├── .uncrustify.cfg
├── COPYING
├── Changes
├── INSTALL
├── LICENSE
├── Makefile.am
├── Makefile.in
├── README.md
├── acl
├── chn.acl
└── local.acl
├── aclocal.m4
├── auto
├── ar-lib
├── compile
├── config.guess
├── config.sub
├── depcomp
├── install-sh
├── ltmain.sh
└── missing
├── autogen.sh
├── config.h.in
├── configure
├── configure.ac
├── debian
├── README.Debian
├── changelog
├── compat
├── config.json
├── control
├── copyright
├── docs
├── install
├── rules
├── shadowsocks-libev.default
└── shadowsocks-libev.init
├── docker
├── Dockerfile
├── README.md
└── entrypoint
├── libcork
├── COPYING
├── Makefile.am
├── Makefile.in
├── README.markdown
├── cli
│ └── commands.c
├── core
│ ├── allocator.c
│ ├── error.c
│ ├── gc.c
│ ├── hash.c
│ ├── ip-address.c
│ ├── mempool.c
│ ├── timestamp.c
│ └── u128.c
├── ds
│ ├── array.c
│ ├── bitset.c
│ ├── buffer.c
│ ├── dllist.c
│ ├── file-stream.c
│ ├── hash-table.c
│ ├── managed-buffer.c
│ ├── ring-buffer.c
│ └── slice.c
├── include
│ └── libcork
│ │ ├── cli.h
│ │ ├── cli
│ │ └── commands.h
│ │ ├── config.h
│ │ ├── config
│ │ ├── arch.h
│ │ ├── bsd.h
│ │ ├── config.h
│ │ ├── gcc.h
│ │ ├── linux.h
│ │ ├── macosx.h
│ │ └── mingw32.h
│ │ ├── core.h
│ │ ├── core
│ │ ├── allocator.h
│ │ ├── api.h
│ │ ├── attributes.h
│ │ ├── byte-order.h
│ │ ├── callbacks.h
│ │ ├── error.h
│ │ ├── gc.h
│ │ ├── hash.h
│ │ ├── id.h
│ │ ├── mempool.h
│ │ ├── net-addresses.h
│ │ ├── timestamp.h
│ │ ├── types.h
│ │ └── u128.h
│ │ ├── ds.h
│ │ ├── ds
│ │ ├── array.h
│ │ ├── bitset.h
│ │ ├── buffer.h
│ │ ├── dllist.h
│ │ ├── hash-table.h
│ │ ├── managed-buffer.h
│ │ ├── ring-buffer.h
│ │ ├── slice.h
│ │ └── stream.h
│ │ ├── helpers
│ │ ├── errors.h
│ │ ├── gc.h
│ │ └── posix.h
│ │ ├── os.h
│ │ ├── os
│ │ ├── files.h
│ │ ├── process.h
│ │ └── subprocess.h
│ │ ├── threads.h
│ │ └── threads
│ │ ├── atomics.h
│ │ └── basics.h
├── posix
│ ├── directory-walker.c
│ ├── env.c
│ ├── exec.c
│ ├── files.c
│ ├── process.c
│ └── subprocess.c
└── pthreads
│ └── thread.c
├── libev
├── Changes
├── LICENSE
├── Makefile.am
├── Makefile.in
├── README
├── Symbols.ev
├── Symbols.event
├── aclocal.m4
├── autogen.sh
├── configure.ac
├── ev++.h
├── ev.3
├── ev.c
├── ev.h
├── ev.pod
├── ev_epoll.c
├── ev_kqueue.c
├── ev_poll.c
├── ev_port.c
├── ev_select.c
├── ev_vars.h
├── ev_win32.c
├── ev_wrap.h
├── event.c
├── event.h
└── libev.m4
├── libipset
├── LICENSE.txt
├── Makefile.am
├── Makefile.in
├── README.markdown
├── bdd
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── assignments.c
│ ├── basics.c
│ ├── bdd-iterator.c
│ ├── expanded.c
│ ├── reachable.c
│ ├── read.c
│ └── write.c
├── general.c
├── include
│ └── ipset
│ │ ├── bdd
│ │ └── nodes.h
│ │ ├── bits.h
│ │ ├── errors.h
│ │ ├── ipset.h
│ │ └── logging.h
├── map
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── allocation.c
│ ├── inspection-template.c.in
│ ├── inspection.c
│ ├── ipv4_map.c
│ ├── ipv6_map.c
│ └── storage.c
└── set
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── allocation.c
│ ├── inspection-template.c.in
│ ├── inspection.c
│ ├── ipv4_set.c
│ ├── ipv6_set.c
│ ├── iterator.c
│ └── storage.c
├── libsodium
├── .gitignore
├── .travis.yml
├── AUTHORS
├── ChangeLog
├── LICENSE
├── Makefile.am
├── Makefile.in
├── README
├── README.markdown
├── THANKS
├── autogen.sh
├── build-aux
│ ├── config.guess
│ ├── config.sub
│ ├── depcomp
│ ├── install-sh
│ ├── ltmain.sh
│ └── missing
├── builds
│ ├── .gitignore
│ └── msvc
│ │ ├── build
│ │ ├── buildall.bat
│ │ └── buildbase.bat
│ │ ├── 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
│ │ └── test
│ │ │ ├── test.props
│ │ │ ├── test.runner.bat
│ │ │ ├── test.vcxproj
│ │ │ └── test.vcxproj.filters
│ │ ├── vs2012
│ │ ├── libsodium.import.props
│ │ ├── libsodium.import.xml
│ │ ├── libsodium.sln
│ │ ├── libsodium
│ │ │ ├── libsodium.props
│ │ │ ├── libsodium.vcxproj
│ │ │ ├── libsodium.vcxproj.filters
│ │ │ └── libsodium.xml
│ │ └── test
│ │ │ ├── test.props
│ │ │ ├── test.runner.bat
│ │ │ ├── test.vcxproj
│ │ │ └── test.vcxproj.filters
│ │ └── vs2013
│ │ ├── libsodium.import.props
│ │ ├── libsodium.import.xml
│ │ ├── libsodium.sln
│ │ ├── libsodium
│ │ ├── libsodium.props
│ │ ├── libsodium.vcxproj
│ │ ├── libsodium.vcxproj.filters
│ │ └── libsodium.xml
│ │ └── test
│ │ ├── test.props
│ │ ├── test.runner.bat
│ │ ├── test.vcxproj
│ │ └── test.vcxproj.filters
├── configure
├── configure.ac
├── dist-build
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── android-arm.sh
│ ├── android-armv7.sh
│ ├── android-build.sh
│ ├── android-mips.sh
│ ├── android-x86.sh
│ ├── emscripten.sh
│ ├── ios.sh
│ ├── msys2-win32.sh
│ └── msys2-win64.sh
├── libsodium.pc.in
├── libsodium.sln
├── libsodium.vcxproj
├── libsodium.vcxproj.filters
├── logo.png
├── m4
│ ├── ax_check_compile_flag.m4
│ ├── ax_check_gnu_make.m4
│ ├── ax_check_link_flag.m4
│ ├── ld-output-def.m4
│ └── pkg.m4
├── msvc-scripts
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── process.bat
│ ├── rep.vbs
│ └── sodium.props
├── packaging
│ └── nuget
│ │ ├── .gitignore
│ │ ├── package.bat
│ │ ├── package.config
│ │ ├── package.gsl
│ │ ├── package.nuspec
│ │ ├── package.targets
│ │ └── package.xml
├── src
│ ├── Makefile.am
│ ├── Makefile.in
│ └── libsodium
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── crypto_aead
│ │ └── chacha20poly1305
│ │ │ └── sodium
│ │ │ └── aead_chacha20poly1305.c
│ │ ├── crypto_auth
│ │ ├── crypto_auth.c
│ │ ├── hmacsha256
│ │ │ ├── auth_hmacsha256_api.c
│ │ │ ├── checksum
│ │ │ └── cp
│ │ │ │ ├── api.h
│ │ │ │ ├── hmac_hmacsha256.c
│ │ │ │ └── verify_hmacsha256.c
│ │ ├── hmacsha512
│ │ │ ├── auth_hmacsha512_api.c
│ │ │ └── cp
│ │ │ │ ├── api.h
│ │ │ │ ├── hmac_hmacsha512.c
│ │ │ │ └── verify_hmacsha512.c
│ │ └── hmacsha512256
│ │ │ ├── auth_hmacsha512256_api.c
│ │ │ ├── checksum
│ │ │ └── cp
│ │ │ ├── api.h
│ │ │ ├── hmac_hmacsha512256.c
│ │ │ └── verify_hmacsha512256.c
│ │ ├── crypto_box
│ │ ├── crypto_box.c
│ │ ├── crypto_box_easy.c
│ │ └── curve25519xsalsa20poly1305
│ │ │ ├── box_curve25519xsalsa20poly1305_api.c
│ │ │ ├── checksum
│ │ │ └── ref
│ │ │ ├── after_curve25519xsalsa20poly1305.c
│ │ │ ├── api.h
│ │ │ ├── before_curve25519xsalsa20poly1305.c
│ │ │ ├── box_curve25519xsalsa20poly1305.c
│ │ │ └── keypair_curve25519xsalsa20poly1305.c
│ │ ├── crypto_core
│ │ ├── hsalsa20
│ │ │ ├── checksum
│ │ │ ├── core_hsalsa20_api.c
│ │ │ └── ref2
│ │ │ │ ├── api.h
│ │ │ │ └── core_hsalsa20.c
│ │ ├── salsa20
│ │ │ ├── checksum
│ │ │ ├── core_salsa20_api.c
│ │ │ └── ref
│ │ │ │ ├── api.h
│ │ │ │ └── core_salsa20.c
│ │ ├── salsa2012
│ │ │ ├── checksum
│ │ │ ├── core_salsa2012_api.c
│ │ │ └── ref
│ │ │ │ ├── api.h
│ │ │ │ └── core_salsa2012.c
│ │ └── salsa208
│ │ │ ├── checksum
│ │ │ ├── core_salsa208_api.c
│ │ │ └── ref
│ │ │ ├── api.h
│ │ │ └── core_salsa208.c
│ │ ├── crypto_generichash
│ │ ├── blake2
│ │ │ ├── generichash_blake2_api.c
│ │ │ └── ref
│ │ │ │ ├── api.h
│ │ │ │ ├── blake2-impl.h
│ │ │ │ ├── blake2.h
│ │ │ │ ├── blake2b-ref.c
│ │ │ │ └── generichash_blake2b.c
│ │ └── crypto_generichash.c
│ │ ├── crypto_hash
│ │ ├── crypto_hash.c
│ │ ├── sha256
│ │ │ ├── checksum
│ │ │ ├── cp
│ │ │ │ ├── api.h
│ │ │ │ └── hash_sha256.c
│ │ │ └── hash_sha256_api.c
│ │ └── sha512
│ │ │ ├── checksum
│ │ │ ├── cp
│ │ │ ├── api.h
│ │ │ └── hash_sha512.c
│ │ │ └── hash_sha512_api.c
│ │ ├── crypto_onetimeauth
│ │ ├── crypto_onetimeauth.c
│ │ └── poly1305
│ │ │ ├── donna
│ │ │ ├── auth_poly1305_donna.c
│ │ │ ├── poly1305_donna.h
│ │ │ ├── poly1305_donna32.h
│ │ │ ├── poly1305_donna64.h
│ │ │ └── verify_poly1305_donna.c
│ │ │ ├── onetimeauth_poly1305.c
│ │ │ ├── onetimeauth_poly1305_api.c
│ │ │ └── onetimeauth_poly1305_try.c
│ │ ├── crypto_pwhash
│ │ └── 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
│ │ │ └── sysendian.h
│ │ ├── crypto_scalarmult
│ │ ├── crypto_scalarmult.c
│ │ └── curve25519
│ │ │ ├── checksum
│ │ │ ├── donna_c64
│ │ │ ├── api.h
│ │ │ ├── base_curve25519_donna_c64.c
│ │ │ └── smult_curve25519_donna_c64.c
│ │ │ ├── ref10
│ │ │ ├── api.h
│ │ │ ├── base_curve25519_ref10.c
│ │ │ ├── fe.h
│ │ │ ├── fe_0_curve25519_ref10.c
│ │ │ ├── fe_1_curve25519_ref10.c
│ │ │ ├── fe_add_curve25519_ref10.c
│ │ │ ├── fe_copy_curve25519_ref10.c
│ │ │ ├── fe_cswap_curve25519_ref10.c
│ │ │ ├── fe_frombytes_curve25519_ref10.c
│ │ │ ├── fe_invert_curve25519_ref10.c
│ │ │ ├── fe_mul121666_curve25519_ref10.c
│ │ │ ├── fe_mul_curve25519_ref10.c
│ │ │ ├── fe_sq_curve25519_ref10.c
│ │ │ ├── fe_sub_curve25519_ref10.c
│ │ │ ├── fe_tobytes_curve25519_ref10.c
│ │ │ ├── montgomery.h
│ │ │ ├── pow225521.h
│ │ │ └── scalarmult_curve25519_ref10.c
│ │ │ └── scalarmult_curve25519_api.c
│ │ ├── crypto_secretbox
│ │ ├── crypto_secretbox.c
│ │ ├── crypto_secretbox_easy.c
│ │ └── xsalsa20poly1305
│ │ │ ├── checksum
│ │ │ ├── ref
│ │ │ ├── api.h
│ │ │ └── box_xsalsa20poly1305.c
│ │ │ └── secretbox_xsalsa20poly1305_api.c
│ │ ├── crypto_shorthash
│ │ ├── crypto_shorthash.c
│ │ └── siphash24
│ │ │ ├── ref
│ │ │ ├── api.h
│ │ │ └── shorthash_siphash24.c
│ │ │ └── shorthash_siphash24_api.c
│ │ ├── crypto_sign
│ │ ├── crypto_sign.c
│ │ ├── ed25519
│ │ │ ├── description
│ │ │ ├── ref10
│ │ │ │ ├── api.h
│ │ │ │ ├── base.h
│ │ │ │ ├── base2.h
│ │ │ │ ├── d.h
│ │ │ │ ├── d2.h
│ │ │ │ ├── fe.h
│ │ │ │ ├── fe_0.c
│ │ │ │ ├── fe_1.c
│ │ │ │ ├── fe_add.c
│ │ │ │ ├── fe_cmov.c
│ │ │ │ ├── fe_copy.c
│ │ │ │ ├── fe_frombytes.c
│ │ │ │ ├── fe_invert.c
│ │ │ │ ├── fe_isnegative.c
│ │ │ │ ├── fe_isnonzero.c
│ │ │ │ ├── fe_mul.c
│ │ │ │ ├── fe_neg.c
│ │ │ │ ├── fe_pow22523.c
│ │ │ │ ├── fe_sq.c
│ │ │ │ ├── fe_sq2.c
│ │ │ │ ├── fe_sub.c
│ │ │ │ ├── fe_tobytes.c
│ │ │ │ ├── ge.h
│ │ │ │ ├── ge_add.c
│ │ │ │ ├── ge_add.h
│ │ │ │ ├── ge_double_scalarmult.c
│ │ │ │ ├── ge_frombytes.c
│ │ │ │ ├── ge_madd.c
│ │ │ │ ├── ge_madd.h
│ │ │ │ ├── ge_msub.c
│ │ │ │ ├── ge_msub.h
│ │ │ │ ├── ge_p1p1_to_p2.c
│ │ │ │ ├── ge_p1p1_to_p3.c
│ │ │ │ ├── ge_p2_0.c
│ │ │ │ ├── ge_p2_dbl.c
│ │ │ │ ├── ge_p2_dbl.h
│ │ │ │ ├── ge_p3_0.c
│ │ │ │ ├── ge_p3_dbl.c
│ │ │ │ ├── ge_p3_to_cached.c
│ │ │ │ ├── ge_p3_to_p2.c
│ │ │ │ ├── ge_p3_tobytes.c
│ │ │ │ ├── ge_precomp_0.c
│ │ │ │ ├── ge_scalarmult_base.c
│ │ │ │ ├── ge_sub.c
│ │ │ │ ├── ge_sub.h
│ │ │ │ ├── ge_tobytes.c
│ │ │ │ ├── keypair.c
│ │ │ │ ├── open.c
│ │ │ │ ├── pow22523.h
│ │ │ │ ├── pow225521.h
│ │ │ │ ├── sc.h
│ │ │ │ ├── sc_muladd.c
│ │ │ │ ├── sc_reduce.c
│ │ │ │ ├── sign.c
│ │ │ │ └── sqrtm1.h
│ │ │ └── sign_ed25519_api.c
│ │ └── edwards25519sha512batch
│ │ │ ├── ref
│ │ │ ├── api.h
│ │ │ ├── fe25519.h
│ │ │ ├── fe25519_edwards25519sha512batch.c
│ │ │ ├── ge25519.h
│ │ │ ├── ge25519_edwards25519sha512batch.c
│ │ │ ├── sc25519.h
│ │ │ ├── sc25519_edwards25519sha512batch.c
│ │ │ └── sign_edwards25519sha512batch.c
│ │ │ └── sign_edwards25519sha512batch_api.c
│ │ ├── crypto_stream
│ │ ├── aes128ctr
│ │ │ ├── checksum
│ │ │ ├── portable
│ │ │ │ ├── afternm_aes128ctr.c
│ │ │ │ ├── api.h
│ │ │ │ ├── beforenm_aes128ctr.c
│ │ │ │ ├── common.h
│ │ │ │ ├── common_aes128ctr.c
│ │ │ │ ├── consts.h
│ │ │ │ ├── consts_aes128ctr.c
│ │ │ │ ├── int128.h
│ │ │ │ ├── int128_aes128ctr.c
│ │ │ │ ├── stream_aes128ctr.c
│ │ │ │ ├── types.h
│ │ │ │ └── xor_afternm_aes128ctr.c
│ │ │ └── stream_aes128ctr_api.c
│ │ ├── chacha20
│ │ │ ├── ref
│ │ │ │ ├── api.h
│ │ │ │ └── stream_chacha20_ref.c
│ │ │ └── stream_chacha20_api.c
│ │ ├── crypto_stream.c
│ │ ├── salsa20
│ │ │ ├── amd64_xmm6
│ │ │ │ ├── api.h
│ │ │ │ └── stream_salsa20_amd64_xmm6.S
│ │ │ ├── checksum
│ │ │ ├── ref
│ │ │ │ ├── api.h
│ │ │ │ ├── stream_salsa20_ref.c
│ │ │ │ └── xor_salsa20_ref.c
│ │ │ └── stream_salsa20_api.c
│ │ ├── salsa2012
│ │ │ ├── checksum
│ │ │ ├── ref
│ │ │ │ ├── api.h
│ │ │ │ ├── stream_salsa2012.c
│ │ │ │ └── xor_salsa2012.c
│ │ │ └── stream_salsa2012_api.c
│ │ ├── salsa208
│ │ │ ├── checksum
│ │ │ ├── ref
│ │ │ │ ├── api.h
│ │ │ │ ├── stream_salsa208.c
│ │ │ │ └── xor_salsa208.c
│ │ │ └── stream_salsa208_api.c
│ │ └── xsalsa20
│ │ │ ├── checksum
│ │ │ ├── ref
│ │ │ ├── api.h
│ │ │ ├── stream_xsalsa20.c
│ │ │ └── xor_xsalsa20.c
│ │ │ └── stream_xsalsa20_api.c
│ │ ├── crypto_verify
│ │ ├── 16
│ │ │ ├── checksum
│ │ │ ├── ref
│ │ │ │ ├── api.h
│ │ │ │ └── verify_16.c
│ │ │ └── verify_16_api.c
│ │ ├── 32
│ │ │ ├── checksum
│ │ │ ├── ref
│ │ │ │ ├── api.h
│ │ │ │ └── verify_32.c
│ │ │ └── verify_32_api.c
│ │ └── 64
│ │ │ ├── ref
│ │ │ ├── api.h
│ │ │ └── verify_64.c
│ │ │ └── verify_64_api.c
│ │ ├── include
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── sodium.h
│ │ └── sodium
│ │ │ ├── core.h
│ │ │ ├── crypto_aead_chacha20poly1305.h
│ │ │ ├── crypto_auth.h
│ │ │ ├── crypto_auth_hmacsha256.h
│ │ │ ├── crypto_auth_hmacsha512.h
│ │ │ ├── crypto_auth_hmacsha512256.h
│ │ │ ├── crypto_box.h
│ │ │ ├── crypto_box_curve25519xsalsa20poly1305.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_int32.h
│ │ │ ├── crypto_int64.h
│ │ │ ├── crypto_onetimeauth.h
│ │ │ ├── crypto_onetimeauth_poly1305.h
│ │ │ ├── crypto_pwhash_scryptsalsa208sha256.h
│ │ │ ├── crypto_scalarmult.h
│ │ │ ├── crypto_scalarmult_curve25519.h
│ │ │ ├── crypto_secretbox.h
│ │ │ ├── crypto_secretbox_xsalsa20poly1305.h
│ │ │ ├── crypto_shorthash.h
│ │ │ ├── crypto_shorthash_siphash24.h
│ │ │ ├── crypto_sign.h
│ │ │ ├── crypto_sign_ed25519.h
│ │ │ ├── crypto_sign_edwards25519sha512batch.h
│ │ │ ├── crypto_stream.h
│ │ │ ├── crypto_stream_aes128ctr.h
│ │ │ ├── crypto_stream_chacha20.h
│ │ │ ├── crypto_stream_salsa20.h
│ │ │ ├── crypto_stream_salsa2012.h
│ │ │ ├── crypto_stream_salsa208.h
│ │ │ ├── crypto_stream_xsalsa20.h
│ │ │ ├── crypto_uint16.h
│ │ │ ├── crypto_uint32.h
│ │ │ ├── crypto_uint64.h
│ │ │ ├── crypto_uint8.h
│ │ │ ├── crypto_verify_16.h
│ │ │ ├── crypto_verify_32.h
│ │ │ ├── crypto_verify_64.h
│ │ │ ├── export.h
│ │ │ ├── randombytes.h
│ │ │ ├── randombytes_salsa20_random.h
│ │ │ ├── randombytes_sysrandom.h
│ │ │ ├── runtime.h
│ │ │ ├── utils.h
│ │ │ ├── version.h
│ │ │ └── version.h.in
│ │ ├── randombytes
│ │ ├── randombytes.c
│ │ ├── salsa20
│ │ │ └── randombytes_salsa20_random.c
│ │ └── sysrandom
│ │ │ └── randombytes_sysrandom.c
│ │ └── sodium
│ │ ├── core.c
│ │ ├── runtime.c
│ │ ├── utils.c
│ │ └── version.c
└── test
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── default
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── aead_chacha20poly1305.c
│ ├── auth.c
│ ├── auth2.c
│ ├── auth3.c
│ ├── auth5.c
│ ├── auth6.c
│ ├── auth7.c
│ ├── box.c
│ ├── box2.c
│ ├── box7.c
│ ├── box8.c
│ ├── box_easy.c
│ ├── box_easy2.c
│ ├── box_seed.c
│ ├── chacha20.c
│ ├── cmptest.h
│ ├── core1.c
│ ├── core2.c
│ ├── core3.c
│ ├── core4.c
│ ├── core5.c
│ ├── core6.c
│ ├── ed25519_convert.c
│ ├── generichash.c
│ ├── generichash2.c
│ ├── generichash3.c
│ ├── hash.c
│ ├── hash3.c
│ ├── onetimeauth.c
│ ├── onetimeauth2.c
│ ├── onetimeauth7.c
│ ├── pre.js
│ ├── pwhash.c
│ ├── pwhash_scrypt_ll.c
│ ├── randombytes.c
│ ├── scalarmult.c
│ ├── scalarmult2.c
│ ├── scalarmult5.c
│ ├── scalarmult6.c
│ ├── scalarmult7.c
│ ├── secretbox.c
│ ├── secretbox2.c
│ ├── secretbox7.c
│ ├── secretbox8.c
│ ├── secretbox_easy.c
│ ├── secretbox_easy2.c
│ ├── shorthash.c
│ ├── sign.c
│ ├── sodium_core.c
│ ├── sodium_utils.c
│ ├── sodium_utils2.c
│ ├── sodium_utils3.c
│ ├── sodium_version.c
│ ├── stream.c
│ ├── stream2.c
│ ├── stream3.c
│ ├── stream4.c
│ ├── verify1.c
│ └── wintest.bat
│ └── quirks
│ └── windows
│ └── windows-quirks.h
├── libudns
├── COPYING.LGPL
├── Makefile.am
├── Makefile.in
├── NEWS
├── NOTES
├── TODO
├── dnsget.1
├── dnsget.c
├── ex-rdns.c
├── getopt.c
├── inet_XtoX.c
├── rblcheck.1
├── rblcheck.c
├── udns.3
├── udns.h
├── udns_XtoX.c
├── udns_bl.c
├── udns_codes.c
├── udns_dn.c
├── udns_dntosp.c
├── udns_init.c
├── udns_jran.c
├── udns_misc.c
├── udns_parse.c
├── udns_resolver.c
├── udns_rr_a.c
├── udns_rr_mx.c
├── udns_rr_naptr.c
├── udns_rr_ptr.c
├── udns_rr_srv.c
└── udns_rr_txt.c
├── m4
├── acx_pthread.m4
├── inet_ntop.m4
├── libtool.m4
├── ltoptions.m4
├── ltsugar.m4
├── ltversion.m4
├── lt~obsolete.m4
├── openssl.m4
└── polarssl.m4
├── openwrt
├── Makefile
└── files
│ ├── shadowsocks.init
│ └── shadowsocks.json
├── rpm
└── SOURCES
│ └── etc
│ └── init.d
│ └── shadowsocks-libev
├── scripts
└── generate.php
├── shadowsocks-libev.8
├── shadowsocks-libev.pc.in
└── src
├── Makefile.am
├── Makefile.in
├── acl.c
├── acl.h
├── bitcoin.c
├── bitcoin.h
├── cache.c
├── cache.h
├── common.h
├── encrypt.c
├── encrypt.h
├── jconf.c
├── jconf.h
├── json.c
├── json.h
├── local.c
├── local.h
├── netutils.c
├── netutils.h
├── redir.c
├── redir.h
├── resolv.c
├── resolv.h
├── server.c
├── server.h
├── shadowsocks.h
├── socks5.h
├── tunnel.c
├── tunnel.h
├── udprelay.c
├── udprelay.h
├── uthash.h
├── utils.c
├── utils.h
├── win32.c
└── win32.h
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .deps/
3 | /Makefile
4 | src/Makefile
5 | libev/Makefile
6 | libudns/Makefile
7 | libcork/Makefile
8 | libipset/Makefile
9 | autom4te.cache/
10 | /config.h
11 | config.log
12 | config.status
13 | libtool
14 | pid
15 | ss.*
16 | ss-*
17 | stamp-h1
18 | .libs
19 | .pc
20 | debian/shadowsocks-libev/
21 | debian/patches/
22 | debian/files
23 | debian/shadowsocks-libev.substvars
24 | debian/*.debhelper*
25 | .dirstamp
26 | shadowsocks-libev.pc
27 |
28 | # Ignore garbage of OS X
29 | *.DS_Store
30 |
31 | # Ignore vim cache
32 | *.swp
33 |
34 | # Do not edit the following section
35 | # Edit Compile Debug Document Distribute
36 | *~
37 | *.bak
38 | *.bin
39 | *.dll
40 | *.exe
41 | *-ISO*.bdf
42 | *-JIS*.bdf
43 | *-KOI8*.bdf
44 | *.kld
45 | *.ko
46 | *.ko.cmd
47 | *.lai
48 | *.l[oa]
49 | *.[oa]
50 | *.obj
51 | *.patch
52 | *.so
53 | *.pcf.gz
54 | *.pdb
55 | *.tar.bz2
56 | *.tar.gz
57 | #
58 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: c
2 | compiler:
3 | - gcc
4 | - clang
5 | script: "./configure && make"
6 | branches:
7 | only:
8 | - master
9 | notifications:
10 | recipients:
11 | - max.c.lv@gmail.com
12 | email:
13 | on_success: change
14 | on_failure: always
15 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | This program is free software: you can redistribute it and/or modify
2 | it under the terms of the GNU General Public License as published by
3 | the Free Software Foundation, either version 3 of the License, or
4 | (at your option) any later version.
5 |
6 | This program is distributed in the hope that it will be useful,
7 | but WITHOUT ANY WARRANTY; without even the implied warranty of
8 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 | GNU General Public License for more details.
10 |
11 | You should have received a copy of the GNU General Public License
12 | along with this program. If not, see .
13 |
--------------------------------------------------------------------------------
/Changes:
--------------------------------------------------------------------------------
1 | debian/changelog
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS = libsodium libcork libipset libudns libev src
2 |
3 | ACLOCAL_AMFLAGS = -I m4
4 | man_MANS = shadowsocks-libev.8
5 |
6 | pkgconfiglibdir = $(libdir)/pkgconfig
7 | pkgconfiglib_DATA = shadowsocks-libev.pc
8 |
--------------------------------------------------------------------------------
/acl/local.acl:
--------------------------------------------------------------------------------
1 | 127.0.0.1
2 | ::1
3 | 10.0.0.0/8
4 | 172.16.0.0/12
5 | 192.168.0.0/16
6 | fc00::/7
7 |
--------------------------------------------------------------------------------
/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | autoreconf --install --force
4 |
--------------------------------------------------------------------------------
/debian/README.Debian:
--------------------------------------------------------------------------------
1 | shadowsocks-libev for Debian
2 | ----------------------
3 |
4 |
5 |
6 | -- Max Lv Sat, 06 Apr 2013 16:59:15 +0800
7 |
--------------------------------------------------------------------------------
/debian/compat:
--------------------------------------------------------------------------------
1 | 7
2 |
--------------------------------------------------------------------------------
/debian/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "server":"127.0.0.1",
3 | "server_port":8388,
4 | "local_port":1080,
5 | "password":"barfoo!",
6 | "timeout":60,
7 | "method":null
8 | }
9 |
--------------------------------------------------------------------------------
/debian/control:
--------------------------------------------------------------------------------
1 | Source: shadowsocks-libev
2 | Section: net
3 | Priority: extra
4 | Maintainer: Max Lv
5 | Build-Depends: debhelper (>= 7.0.50~), libssl-dev (>= 0.9.8), autotools-dev, mime-support, gawk
6 | Standards-Version: 3.8.4
7 | Homepage: http://www.shadowsocks.org
8 | Vcs-Git: https://github.com/shadowsocks/shadowsocks-libev.git
9 | Vcs-Browser: https://github.com/shadowsocks/shadowsocks-libev
10 |
11 | Package: shadowsocks-libev
12 | Replaces: shadowsocks (<< 1.5.3-2)
13 | Breaks: shadowsocks (<< 1.5.3-2)
14 | Architecture: any
15 | Depends: ${shlibs:Depends}, ${misc:Depends}
16 | Description: A lightweight and secure socks5 proxy.
17 | Shadowsocks-libev is a lightweight and secure socks5 proxy for embedded devices and low end boxes.
18 |
--------------------------------------------------------------------------------
/debian/copyright:
--------------------------------------------------------------------------------
1 | This work was packaged for Debian by:
2 |
3 | Max Lv on Sat, 06 Apr 2013 16:59:15 +0800
4 |
5 | It was downloaded from:
6 |
7 | https://github.com/madeye/shadowsocks-libev
8 |
9 | Upstream Author(s):
10 |
11 | clowwindy
12 |
13 | Copyright:
14 |
15 | Copyright (C) 2013 Max Lv
16 |
17 | License:
18 |
19 | GPLv3
20 |
21 | The Debian packaging is:
22 |
23 | Copyright (C) 2013 Max Lv
24 |
--------------------------------------------------------------------------------
/debian/docs:
--------------------------------------------------------------------------------
1 | README.md
2 |
--------------------------------------------------------------------------------
/debian/install:
--------------------------------------------------------------------------------
1 | debian/config.json /etc/shadowsocks-libev
2 |
--------------------------------------------------------------------------------
/debian/rules:
--------------------------------------------------------------------------------
1 | #!/usr/bin/make -f
2 | # -*- makefile -*-
3 | # Sample debian/rules that uses debhelper.
4 | #
5 | # This file was originally written by Joey Hess and Craig Small.
6 | # As a special exception, when this file is copied by dh-make into a
7 | # dh-make output file, you may use that output file without restriction.
8 | # This special exception was added by Craig Small in version 0.37 of dh-make.
9 | #
10 | # Modified to make a template file for a multi-binary package with separated
11 | # build-arch and build-indep targets by Bill Allombert 2001
12 |
13 | # Uncomment this to turn on verbose mode.
14 | #export DH_VERBOSE=1
15 |
16 | # This has to be exported to make some magic below work.
17 | export DH_OPTIONS
18 |
19 | override_dh_auto_configure:
20 | dh_auto_configure -- \
21 | --enable-shared
22 |
23 | %:
24 | dh $@
25 |
--------------------------------------------------------------------------------
/debian/shadowsocks-libev.default:
--------------------------------------------------------------------------------
1 | # Defaults for redsocks initscript
2 | # sourced by /etc/init.d/redsocks
3 | # installed at /etc/default/redsocks by the maintainer scripts
4 |
5 | #
6 | # This is a POSIX shell fragment
7 | #
8 |
9 | # Enable during startup?
10 | START=yes
11 |
12 | # Configuration file
13 | CONFFILE="/etc/shadowsocks-libev/config.json"
14 |
15 | # Extra command line arguments
16 | DAEMON_ARGS=""
17 |
18 | # User and group to run the server as
19 | USER=root
20 | GROUP=root
21 |
22 | # Number of maximum file descriptors
23 | MAXFD=1024
24 |
--------------------------------------------------------------------------------
/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:latest
2 |
3 | MAINTAINER Sah Lee
4 |
5 | ENV DEPENDENCIES git-core build-essential autoconf libtool libssl-dev
6 | ENV BASEDIR /tmp/shadowsocks-libev
7 | ENV PORT 8338
8 |
9 | # Set up building environment
10 | RUN apt-get update \
11 | && apt-get install -y $DEPENDENCIES
12 |
13 | # Get the latest code, build and install
14 | RUN git clone https://github.com/shadowsocks/shadowsocks-libev.git $BASEDIR
15 | WORKDIR $BASEDIR
16 | RUN ./configure \
17 | && make \
18 | && make install
19 |
20 | # Tear down building environment and delete git repository
21 | WORKDIR /
22 | RUN rm -rf $BASEDIR/shadowsocks-libev\
23 | && apt-get --purge autoremove -y $DEPENDENCIES
24 |
25 | # Port in the config file won't take affect. Instead we'll use 8388.
26 | EXPOSE $PORT
27 |
28 | # Override the host and port in the config file.
29 | ADD entrypoint /
30 | ENTRYPOINT ["/entrypoint"]
31 | CMD ["-h"]
32 |
--------------------------------------------------------------------------------
/libcork/core/hash.c:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2011, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #define CORK_HASH_ATTRIBUTES CORK_API
12 |
13 | #include "libcork/core/hash.h"
14 | #include "libcork/core/types.h"
15 |
16 | /* All of the following functions will be defined for us by libcork/core/hash.h:
17 | * cork_hash_buffer
18 | * cork_big_hash_buffer
19 | * cork_stable_hash_buffer
20 | */
21 |
--------------------------------------------------------------------------------
/libcork/include/libcork/cli.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CLI_H
12 | #define LIBCORK_CLI_H
13 |
14 | /*** include all of the parts ***/
15 |
16 | #include
17 |
18 | #endif /* LIBCORK_CLI_H */
19 |
--------------------------------------------------------------------------------
/libcork/include/libcork/config.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2011, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CONFIG_H
12 | #define LIBCORK_CONFIG_H
13 |
14 | /*** include all of the parts ***/
15 |
16 | #include
17 |
18 | #endif /* LIBCORK_CONFIG_H */
19 |
--------------------------------------------------------------------------------
/libcork/include/libcork/config/arch.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2012-2013, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CONFIG_ARCH_H
12 | #define LIBCORK_CONFIG_ARCH_H
13 |
14 |
15 | /*-----------------------------------------------------------------------
16 | * Platform
17 | */
18 |
19 | #if defined(__i386__) || defined(_M_IX86)
20 | #define CORK_CONFIG_ARCH_X86 1
21 | #else
22 | #define CORK_CONFIG_ARCH_X86 0
23 | #endif
24 |
25 | #if defined(__x86_64__) || defined(_M_X64)
26 | #define CORK_CONFIG_ARCH_X64 1
27 | #else
28 | #define CORK_CONFIG_ARCH_X64 0
29 | #endif
30 |
31 | #if defined(__powerpc__) || defined(__ppc__)
32 | /* GCC-ish compiler */
33 | #define CORK_CONFIG_ARCH_PPC 1
34 | #elif defined(_M_PPC)
35 | /* VS-ish compiler */
36 | #define CORK_CONFIG_ARCH_PPC 1
37 | #elif defined(_ARCH_PPC)
38 | /* Something called XL C/C++? */
39 | #define CORK_CONFIG_ARCH_PPC 1
40 | #else
41 | #define CORK_CONFIG_ARCH_PPC 0
42 | #endif
43 |
44 |
45 | #endif /* LIBCORK_CONFIG_ARCH_H */
46 |
--------------------------------------------------------------------------------
/libcork/include/libcork/config/bsd.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2013, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CONFIG_BSD_H
12 | #define LIBCORK_CONFIG_BSD_H
13 |
14 | /*-----------------------------------------------------------------------
15 | * Endianness
16 | */
17 |
18 | #include
19 |
20 | #if BYTE_ORDER == BIG_ENDIAN
21 | #define CORK_CONFIG_IS_BIG_ENDIAN 1
22 | #define CORK_CONFIG_IS_LITTLE_ENDIAN 0
23 | #elif BYTE_ORDER == LITTLE_ENDIAN
24 | #define CORK_CONFIG_IS_BIG_ENDIAN 0
25 | #define CORK_CONFIG_IS_LITTLE_ENDIAN 1
26 | #else
27 | #error "Cannot determine system endianness"
28 | #endif
29 |
30 | #define CORK_HAVE_REALLOCF 1
31 | #define CORK_HAVE_PTHREADS 1
32 |
33 |
34 | #endif /* LIBCORK_CONFIG_BSD_H */
35 |
--------------------------------------------------------------------------------
/libcork/include/libcork/config/linux.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2011, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CONFIG_LINUX_H
12 | #define LIBCORK_CONFIG_LINUX_H
13 |
14 | /*-----------------------------------------------------------------------
15 | * Endianness
16 | */
17 |
18 | #include
19 |
20 | #if __BYTE_ORDER == __BIG_ENDIAN
21 | #define CORK_CONFIG_IS_BIG_ENDIAN 1
22 | #define CORK_CONFIG_IS_LITTLE_ENDIAN 0
23 | #elif __BYTE_ORDER == __LITTLE_ENDIAN
24 | #define CORK_CONFIG_IS_BIG_ENDIAN 0
25 | #define CORK_CONFIG_IS_LITTLE_ENDIAN 1
26 | #else
27 | #error "Cannot determine system endianness"
28 | #endif
29 |
30 | #define CORK_HAVE_REALLOCF 0
31 | #define CORK_HAVE_PTHREADS 1
32 |
33 |
34 | #endif /* LIBCORK_CONFIG_LINUX_H */
35 |
--------------------------------------------------------------------------------
/libcork/include/libcork/config/macosx.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2011, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CONFIG_MACOSX_H
12 | #define LIBCORK_CONFIG_MACOSX_H
13 |
14 | /*-----------------------------------------------------------------------
15 | * Endianness
16 | */
17 |
18 | #include
19 |
20 | #if BYTE_ORDER == BIG_ENDIAN
21 | #define CORK_CONFIG_IS_BIG_ENDIAN 1
22 | #define CORK_CONFIG_IS_LITTLE_ENDIAN 0
23 | #elif BYTE_ORDER == LITTLE_ENDIAN
24 | #define CORK_CONFIG_IS_BIG_ENDIAN 0
25 | #define CORK_CONFIG_IS_LITTLE_ENDIAN 1
26 | #else
27 | #error "Cannot determine system endianness"
28 | #endif
29 |
30 | #define CORK_HAVE_REALLOCF 1
31 | #define CORK_HAVE_PTHREADS 1
32 |
33 |
34 | #endif /* LIBCORK_CONFIG_MACOSX_H */
35 |
--------------------------------------------------------------------------------
/libcork/include/libcork/core.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2011-2013, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license details.
7 | * ----------------------------------------------------------------------
8 | */
9 |
10 | #ifndef LIBCORK_CORE_H
11 | #define LIBCORK_CORE_H
12 |
13 | /*** include all of the parts ***/
14 |
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #endif /* LIBCORK_CORE_H */
30 |
--------------------------------------------------------------------------------
/libcork/include/libcork/core/api.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CORE_API_H
12 | #define LIBCORK_CORE_API_H
13 |
14 | #include
15 |
16 | /* If you're using libcork as a shared library, you don't need to do anything
17 | * special; the following will automatically set things up so that libcork's
18 | * public symbols are imported from the library. When we build the shared
19 | * library, we define this ourselves to export the symbols. */
20 |
21 | #if !defined(CORK_API)
22 | #define CORK_API CORK_IMPORT
23 | #endif
24 |
25 | #endif /* LIBCORK_CORE_API_H */
26 |
--------------------------------------------------------------------------------
/libcork/include/libcork/core/callbacks.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2013, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license details.
7 | * ----------------------------------------------------------------------
8 | */
9 |
10 | #ifndef LIBCORK_CORE_CALLBACKS_H
11 | #define LIBCORK_CORE_CALLBACKS_H
12 |
13 |
14 | #include
15 |
16 |
17 | typedef int
18 | (*cork_copy_f)(void *user_data, void *dest, const void *src);
19 |
20 | typedef void
21 | (*cork_done_f)(void *user_data, void *value);
22 |
23 | typedef void
24 | (*cork_free_f)(void *value);
25 |
26 | typedef cork_hash
27 | (*cork_hash_f)(void *user_data, const void *value);
28 |
29 | typedef bool
30 | (*cork_equals_f)(void *user_data, const void *value1, const void *value2);
31 |
32 | typedef void
33 | (*cork_init_f)(void *user_data, void *value);
34 |
35 | #define cork_free_user_data(parent) \
36 | ((parent)->free_user_data == NULL? (void) 0: \
37 | (parent)->free_user_data((parent)->user_data))
38 |
39 | typedef void *
40 | (*cork_new_f)(void *user_data);
41 |
42 |
43 | #endif /* LIBCORK_CORE_CALLBACKS_H */
44 |
--------------------------------------------------------------------------------
/libcork/include/libcork/core/id.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2013, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license details.
7 | * ----------------------------------------------------------------------
8 | */
9 |
10 | #ifndef LIBCORK_CORE_ID_H
11 | #define LIBCORK_CORE_ID_H
12 |
13 | #include
14 |
15 |
16 | struct cork_uid {
17 | const char *name;
18 | };
19 |
20 | typedef const struct cork_uid *cork_uid;
21 |
22 | #define CORK_UID_NONE ((cork_uid) NULL)
23 |
24 | #define cork_uid_define_named(c_name, name) \
25 | static const struct cork_uid c_name##__id = { name }; \
26 | static cork_uid c_name = &c_name##__id;
27 | #define cork_uid_define(c_name) \
28 | cork_uid_define_named(c_name, #c_name)
29 |
30 | #define cork_uid_equal(id1, id2) ((id1) == (id2))
31 | #define cork_uid_hash(id) ((cork_hash) (uintptr_t) (id))
32 | #define cork_uid_name(id) ((id)->name)
33 |
34 |
35 | #endif /* LIBCORK_CORE_ID_H */
36 |
--------------------------------------------------------------------------------
/libcork/include/libcork/ds.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2011, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_DS_H
12 | #define LIBCORK_DS_H
13 |
14 | /*** include all of the parts ***/
15 |
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #endif /* LIBCORK_DS_H */
27 |
--------------------------------------------------------------------------------
/libcork/include/libcork/helpers/gc.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2011-2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_HELPERS_REFCOUNT_H
12 | #define LIBCORK_HELPERS_REFCOUNT_H
13 |
14 |
15 | #include
16 | #include
17 |
18 |
19 | #define _free_(name) \
20 | static void \
21 | name##__free(void *obj)
22 |
23 |
24 | #define _recurse_(name) \
25 | static void \
26 | name##__recurse(struct cork_gc *gc, void *obj, \
27 | cork_gc_recurser recurse, void *ud)
28 |
29 |
30 | #define _gc_(name) \
31 | static struct cork_gc_obj_iface name##__gc = { \
32 | name##__free, name##__recurse \
33 | };
34 |
35 | #define _gc_no_free_(name) \
36 | static struct cork_gc_obj_iface name##__gc = { \
37 | NULL, name##__recurse \
38 | };
39 |
40 | #define _gc_no_recurse_(name) \
41 | static struct cork_gc_obj_iface name##__gc = { \
42 | name##__free, NULL \
43 | };
44 |
45 | #define _gc_leaf_(name) \
46 | static struct cork_gc_obj_iface name##__gc = { \
47 | NULL, NULL \
48 | };
49 |
50 |
51 | #endif /* LIBCORK_HELPERS_REFCOUNT_H */
52 |
--------------------------------------------------------------------------------
/libcork/include/libcork/os.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2012-2013, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_OS_H
12 | #define LIBCORK_OS_H
13 |
14 | /*** include all of the parts ***/
15 |
16 | #include
17 | #include
18 | #include
19 |
20 | #endif /* LIBCORK_OS_H */
21 |
--------------------------------------------------------------------------------
/libcork/include/libcork/os/process.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2013, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_CORE_PROCESS_H
12 | #define LIBCORK_CORE_PROCESS_H
13 |
14 | #include
15 |
16 |
17 | typedef void
18 | (*cork_cleanup_function)(void);
19 |
20 | CORK_API void
21 | cork_cleanup_at_exit_named(const char *name, int priority,
22 | cork_cleanup_function function);
23 |
24 | #define cork_cleanup_at_exit(priority, function) \
25 | cork_cleanup_at_exit_named(#function, priority, function)
26 |
27 |
28 | #endif /* LIBCORK_CORE_PROCESS_H */
29 |
--------------------------------------------------------------------------------
/libcork/include/libcork/threads.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the COPYING file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef LIBCORK_THREADS_H
12 | #define LIBCORK_THREADS_H
13 |
14 | /*** include all of the parts ***/
15 |
16 | #include
17 | #include
18 |
19 | #endif /* LIBCORK_THREADS_H */
20 |
--------------------------------------------------------------------------------
/libev/Makefile.am:
--------------------------------------------------------------------------------
1 | AUTOMAKE_OPTIONS = foreign
2 |
3 | VERSION_INFO = 4:0:0
4 |
5 | EXTRA_DIST = LICENSE Changes libev.m4 autogen.sh \
6 | ev_vars.h ev_wrap.h \
7 | ev_epoll.c ev_select.c ev_poll.c ev_kqueue.c ev_port.c ev_win32.c \
8 | ev.3 ev.pod Symbols.ev Symbols.event
9 |
10 | noinst_MANS = ev.3
11 |
12 | noinst_HEADERS = ev.h ev++.h event.h
13 |
14 | noinst_LTLIBRARIES = libev.la
15 |
16 | libev_la_SOURCES = ev.c event.c
17 | libev_la_LDFLAGS = -version-info $(VERSION_INFO)
18 |
19 | ev.3: ev.pod
20 | pod2man -n LIBEV -r "libev-$(VERSION)" -c "libev - high performance full featured event loop" -s3 <$< >$@
21 |
--------------------------------------------------------------------------------
/libev/Symbols.event:
--------------------------------------------------------------------------------
1 | event_active
2 | event_add
3 | event_base_dispatch
4 | event_base_free
5 | event_base_get_method
6 | event_base_loop
7 | event_base_loopexit
8 | event_base_new
9 | event_base_once
10 | event_base_priority_init
11 | event_base_set
12 | event_del
13 | event_dispatch
14 | event_get_callback
15 | event_get_method
16 | event_get_version
17 | event_init
18 | event_loop
19 | event_loopexit
20 | event_once
21 | event_pending
22 | event_priority_init
23 | event_priority_set
24 | event_set
25 |
--------------------------------------------------------------------------------
/libev/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | autoreconf --install --symlink --force
4 |
--------------------------------------------------------------------------------
/libev/configure.ac:
--------------------------------------------------------------------------------
1 | AC_INIT
2 |
3 | orig_CFLAGS="$CFLAGS"
4 |
5 | AC_CONFIG_SRCDIR([ev_epoll.c])
6 |
7 | AM_INIT_AUTOMAKE(libev,4.19) dnl also update ev.h!
8 | AC_CONFIG_HEADERS([config.h])
9 | AM_MAINTAINER_MODE
10 |
11 | AC_PROG_CC
12 |
13 | dnl Supply default CFLAGS, if not specified
14 | if test -z "$orig_CFLAGS"; then
15 | if test x$GCC = xyes; then
16 | CFLAGS="-g -O3"
17 | fi
18 | fi
19 |
20 | AC_PROG_INSTALL
21 | AC_PROG_LIBTOOL
22 |
23 | m4_include([libev.m4])
24 |
25 | AC_CONFIG_FILES([Makefile])
26 | AC_OUTPUT
27 |
--------------------------------------------------------------------------------
/libipset/README.markdown:
--------------------------------------------------------------------------------
1 | # ipset
2 |
3 | The ipset library provides C data types for storing sets of IP
4 | addresses, and maps of IP addresses to integers. It supports both
5 | IPv4 and IPv6 addresses. It's implemented using [Binary Decision
6 | Diagrams](http://en.wikipedia.org/wiki/Binary_decision_diagram)
7 | (BDDs), which (we hypothesize) makes it space efficient for large
8 | sets.
9 |
10 | Please see the INSTALL file for installation instructions.
11 |
--------------------------------------------------------------------------------
/libipset/bdd/Makefile.am:
--------------------------------------------------------------------------------
1 | # This file is part of libasyncns.
2 | #
3 | # Copyright 2005-2008 Lennart Poettering
4 | #
5 | # libasyncns is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU Lesser General Public License as
7 | # published by the Free Software Foundation, either version 2.1 of the
8 | # License, or (at your option) any later version.
9 | #
10 | # libasyncns is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | # Lesser General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Lesser General Public
16 | # License along with libasyncns. If not, see
17 | # .
18 |
19 | noinst_LTLIBRARIES = libipset.la
20 |
21 | bdd_src = bdd/assignments.c bdd/basics.c bdd/bdd-iterator.c bdd/expanded.c \
22 | bdd/reachable.c bdd/read.c bdd/write.c
23 | map_src = map/allocation.c map/inspection.c map/ipv4_map.c map/ipv6_map.c \
24 | map/storage.c
25 | set_src = set/allocation.c set/inspection.c set/ipv4_set.c set/ipv6_set.c \
26 | set/iterator.c set/storage.c
27 |
28 | libipset_la_SOURCES = ${bdd_src} ${map_src} ${set_src}
29 |
30 | libipset_la_LDFLAGS = -static
31 |
--------------------------------------------------------------------------------
/libipset/bdd/Makefile.in:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkevin/shadowsocks-libev/4de3eca03100eec228412413130db779113e783e/libipset/bdd/Makefile.in
--------------------------------------------------------------------------------
/libipset/general.c:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2009-2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the LICENSE.txt file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #include
12 |
13 | #include "ipset/bdd/nodes.h"
14 | #include "ipset/ipset.h"
15 |
16 |
17 | int
18 | ipset_init_library()
19 | {
20 | return 0;
21 | }
22 |
--------------------------------------------------------------------------------
/libipset/include/ipset/errors.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the LICENSE.txt file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef IPSET_ERRORS_H
12 | #define IPSET_ERRORS_H
13 |
14 |
15 | #include
16 |
17 |
18 | /*-----------------------------------------------------------------------
19 | * Error reporting
20 | */
21 |
22 | /* Hash of "ipset.h" */
23 | #define IPSET_ERROR 0xf2000181
24 |
25 | enum ipset_error {
26 | IPSET_IO_ERROR,
27 | IPSET_PARSE_ERROR
28 | };
29 |
30 |
31 | #endif /* IPSET_ERRORS_H */
32 |
--------------------------------------------------------------------------------
/libipset/include/ipset/logging.h:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2010-2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the LICENSE.txt file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #ifndef IPSET_LOGGING_H
12 | #define IPSET_LOGGING_H
13 |
14 |
15 | #if !defined(IPSET_DEBUG)
16 | #define IPSET_DEBUG 0
17 | #endif
18 |
19 | #if IPSET_DEBUG
20 | #include
21 | #define DEBUG(...) \
22 | do { \
23 | fprintf(stderr, __VA_ARGS__); \
24 | fprintf(stderr, "\n"); \
25 | } while (0)
26 | #else
27 | #define DEBUG(...) /* no debug messages */
28 | #endif
29 |
30 |
31 | #endif /* IPSET_LOGGING_H */
32 |
--------------------------------------------------------------------------------
/libipset/map/Makefile.am:
--------------------------------------------------------------------------------
1 | # This file is part of libasyncns.
2 | #
3 | # Copyright 2005-2008 Lennart Poettering
4 | #
5 | # libasyncns is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU Lesser General Public License as
7 | # published by the Free Software Foundation, either version 2.1 of the
8 | # License, or (at your option) any later version.
9 | #
10 | # libasyncns is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | # Lesser General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Lesser General Public
16 | # License along with libasyncns. If not, see
17 | # .
18 |
19 | noinst_LTLIBRARIES = libipset.la
20 |
21 | bdd_src = bdd/assignments.c bdd/basics.c bdd/bdd-iterator.c bdd/expanded.c \
22 | bdd/reachable.c bdd/read.c bdd/write.c
23 | map_src = map/allocation.c map/inspection.c map/ipv4_map.c map/ipv6_map.c \
24 | map/storage.c
25 | set_src = set/allocation.c set/inspection.c set/ipv4_set.c set/ipv6_set.c \
26 | set/iterator.c set/storage.c
27 |
28 | libipset_la_SOURCES = ${bdd_src} ${map_src} ${set_src}
29 |
30 | libipset_la_LDFLAGS = -static
31 |
--------------------------------------------------------------------------------
/libipset/map/Makefile.in:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkevin/shadowsocks-libev/4de3eca03100eec228412413130db779113e783e/libipset/map/Makefile.in
--------------------------------------------------------------------------------
/libipset/map/allocation.c:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2009-2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the LICENSE.txt file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #include
12 |
13 | #include "ipset/bdd/nodes.h"
14 | #include "ipset/ipset.h"
15 |
16 |
17 | void
18 | ipmap_init(struct ip_map *map, int default_value)
19 | {
20 | /* The map starts empty, so every value assignment should yield the
21 | * default. */
22 | map->cache = ipset_node_cache_new();
23 | map->default_bdd = ipset_terminal_node_id(default_value);
24 | map->map_bdd = map->default_bdd;
25 | }
26 |
27 |
28 | struct ip_map *
29 | ipmap_new(int default_value)
30 | {
31 | struct ip_map *result = cork_new(struct ip_map);
32 | ipmap_init(result, default_value);
33 | return result;
34 | }
35 |
36 |
37 | void
38 | ipmap_done(struct ip_map *map)
39 | {
40 | ipset_node_decref(map->cache, map->map_bdd);
41 | ipset_node_cache_free(map->cache);
42 | }
43 |
44 |
45 | void
46 | ipmap_free(struct ip_map *map)
47 | {
48 | ipmap_done(map);
49 | free(map);
50 | }
51 |
--------------------------------------------------------------------------------
/libipset/set/Makefile.am:
--------------------------------------------------------------------------------
1 | # This file is part of libasyncns.
2 | #
3 | # Copyright 2005-2008 Lennart Poettering
4 | #
5 | # libasyncns is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU Lesser General Public License as
7 | # published by the Free Software Foundation, either version 2.1 of the
8 | # License, or (at your option) any later version.
9 | #
10 | # libasyncns is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | # Lesser General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Lesser General Public
16 | # License along with libasyncns. If not, see
17 | # .
18 |
19 | noinst_LTLIBRARIES = libipset.la
20 |
21 | bdd_src = bdd/assignments.c bdd/basics.c bdd/bdd-iterator.c bdd/expanded.c \
22 | bdd/reachable.c bdd/read.c bdd/write.c
23 | map_src = map/allocation.c map/inspection.c map/ipv4_map.c map/ipv6_map.c \
24 | map/storage.c
25 | set_src = set/allocation.c set/inspection.c set/ipv4_set.c set/ipv6_set.c \
26 | set/iterator.c set/storage.c
27 |
28 | libipset_la_SOURCES = ${bdd_src} ${map_src} ${set_src}
29 |
30 | libipset_la_LDFLAGS = -static
31 |
--------------------------------------------------------------------------------
/libipset/set/Makefile.in:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkevin/shadowsocks-libev/4de3eca03100eec228412413130db779113e783e/libipset/set/Makefile.in
--------------------------------------------------------------------------------
/libipset/set/allocation.c:
--------------------------------------------------------------------------------
1 | /* -*- coding: utf-8 -*-
2 | * ----------------------------------------------------------------------
3 | * Copyright © 2009-2012, RedJack, LLC.
4 | * All rights reserved.
5 | *
6 | * Please see the LICENSE.txt file in this distribution for license
7 | * details.
8 | * ----------------------------------------------------------------------
9 | */
10 |
11 | #include
12 |
13 | #include "ipset/bdd/nodes.h"
14 | #include "ipset/ipset.h"
15 |
16 |
17 | void
18 | ipset_init(struct ip_set *set)
19 | {
20 | /* The set starts empty, so every value assignment should yield
21 | * false. */
22 | set->cache = ipset_node_cache_new();
23 | set->set_bdd = ipset_terminal_node_id(false);
24 | }
25 |
26 |
27 | struct ip_set *
28 | ipset_new(void)
29 | {
30 | struct ip_set *result = cork_new(struct ip_set);
31 | ipset_init(result);
32 | return result;
33 | }
34 |
35 |
36 | void
37 | ipset_done(struct ip_set *set)
38 | {
39 | ipset_node_decref(set->cache, set->set_bdd);
40 | ipset_node_cache_free(set->cache);
41 | }
42 |
43 |
44 | void
45 | ipset_free(struct ip_set *set)
46 | {
47 | ipset_done(set);
48 | free(set);
49 | }
50 |
--------------------------------------------------------------------------------
/libsodium/.travis.yml:
--------------------------------------------------------------------------------
1 | language: c
2 |
3 | os:
4 | - linux
5 | - osx
6 |
7 | compiler:
8 | - clang
9 | - gcc
10 | - g++
11 |
12 | before_script:
13 | - ./autogen.sh
14 |
15 | script:
16 | - ./configure --disable-dependency-tracking
17 | - make distcheck
18 | - make distclean
19 | - ./configure --disable-dependency-tracking --enable-minimal
20 | - make distcheck
21 |
22 | env:
23 | global:
24 | - secure: "P4qv8aX+nogLlSy0lTMDIR6I5OLXq+qMijB4s+oCLME5BL2xPAn3v0QG5IoHdnU0ncRc1tEYZxN3F48Rp+Q7+wEVqSBLFS3oXzfNHJGEYoiaAcPNWO0R1kF8rcy8AuoAEomNeYS+5vhzQtaXklNtx/250p6MgGuMsdpMsRUKS/U="
25 |
26 | addons:
27 | coverity_scan:
28 | project:
29 | name: "jedisct1/libsodium"
30 | description: "libsodium"
31 | notification_email: coverityscan@pureftpd.org
32 | build_command_prepend: "./autogen.sh ; ./configure"
33 | build_command: "make -j4"
34 | branch_pattern: coverity_scan
35 |
--------------------------------------------------------------------------------
/libsodium/LICENSE:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013-2014
3 | * Frank Denis
4 | *
5 | * Permission to use, copy, modify, and/or distribute this software for any
6 | * purpose with or without fee is hereby granted, provided that the above
7 | * copyright notice and this permission notice appear in all copies.
8 | *
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 | */
17 |
--------------------------------------------------------------------------------
/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 | dist-build \
14 | msvc-scripts \
15 | src
16 |
--------------------------------------------------------------------------------
/libsodium/README:
--------------------------------------------------------------------------------
1 | See README.markdown
2 |
--------------------------------------------------------------------------------
/libsodium/THANKS:
--------------------------------------------------------------------------------
1 | @alethia7
2 | @dnaq
3 | @joshjdevl
4 | @jshahbazi
5 | @lvh
6 | @neheb
7 | Amit Murthy (@amitmurthy)
8 | Bruno Oliveira (@abstractj)
9 | Christian Wiese (@morfoh)
10 | Chris Rebert (@cvrebert)
11 | Colm MacCárthaigh (@colmmacc)
12 | Donald Stufft (@dstufft)
13 | Douglas Campos (@qmx)
14 | Eric Voskuil (@evoskuil)
15 | Gabriel Handford (@gabriel)
16 | Jachym Holecek (@freza)
17 | Jan de Muijnck-Hughes (@jfdm)
18 | Jason McCampbell (@jasonmccampbell)
19 | Jeroen Habraken (@VeXocide)
20 | Joseph Abrahamson (@tel)
21 | Kenneth Ballenegger (@kballenegger)
22 | Loic Maury (@loicmaury)
23 | Michael Gorlick (@mgorlick)
24 | Michael Gregorowicz (@mgregoro)
25 | Omar Ayub (@electricFeel)
26 | Pedro Paixao (@paixaop)
27 | Ruben De Visscher (@rubendv)
28 | Samuel Neves (@sneves)
29 | Stefan Marsiske
30 | Stephan Touset (@stouset)
31 | Steve Gibson (@sggrc)
32 | Tony Arcieri (@bascule)
33 | Tony Garnock-Jones (@tonyg)
34 |
35 | FSF France
36 | Coverity, Inc.
37 | OpenDNS, Inc.
38 |
--------------------------------------------------------------------------------
/libsodium/autogen.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | if [ -x "`which autoreconf 2>/dev/null`" ] ; then
4 | exec autoreconf -ivf
5 | fi
6 |
7 | if glibtoolize --version > /dev/null 2>&1; then
8 | LIBTOOLIZE='glibtoolize'
9 | else
10 | LIBTOOLIZE='libtoolize'
11 | fi
12 |
13 | $LIBTOOLIZE && \
14 | aclocal && \
15 | automake --add-missing --force-missing --include-deps && \
16 | autoconf
17 |
--------------------------------------------------------------------------------
/libsodium/builds/.gitignore:
--------------------------------------------------------------------------------
1 | *.opensdf
2 | *.suo
3 | *.sdf
4 | *.vcxproj.user
5 | *.aps
6 | *.log
7 | !build
--------------------------------------------------------------------------------
/libsodium/builds/msvc/build/buildall.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | CALL buildbase.bat ..\vs2013\libsodium.sln 12
4 | ECHO.
5 | CALL buildbase.bat ..\vs2012\libsodium.sln 11
6 | ECHO.
7 | CALL buildbase.bat ..\vs2010\libsodium.sln 10
8 | ECHO.
9 |
10 | PAUSE
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/properties/Messages.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Build Messages
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/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 | MultiThreadedDebugDLL
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | MachineX86
14 |
15 |
16 | /MACHINE:X86 %(AdditionalOptions)
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/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 | MachineX64
17 |
18 |
19 | /MACHINE:X64 %(AdditionalOptions)
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkevin/shadowsocks-libev/4de3eca03100eec228412413130db779113e783e/libsodium/builds/msvc/resource.h
--------------------------------------------------------------------------------
/libsodium/builds/msvc/resource.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkevin/shadowsocks-libev/4de3eca03100eec228412413130db779113e783e/libsodium/builds/msvc/resource.rc
--------------------------------------------------------------------------------
/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.1"
8 |
9 | #define SODIUM_LIBRARY_VERSION_MAJOR 7
10 | #define SODIUM_LIBRARY_VERSION_MINOR 3
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 | #ifdef __cplusplus
26 | }
27 | #endif
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/vs2010/libsodium.import.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/vs2010/libsodium/libsodium.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/vs2012/libsodium.import.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/vs2012/libsodium/libsodium.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/vs2013/libsodium.import.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/libsodium/builds/msvc/vs2013/libsodium/libsodium.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/libsodium/dist-build/Makefile.am:
--------------------------------------------------------------------------------
1 |
2 | EXTRA_DIST = \
3 | android-build.sh \
4 | android-arm.sh \
5 | android-x86.sh \
6 | android-mips.sh \
7 | emscripten.sh \
8 | ios.sh \
9 | msys2-win32.sh \
10 | msys2-win64.sh
11 |
--------------------------------------------------------------------------------
/libsodium/dist-build/android-arm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | export CFLAGS="-Os -mthumb -marm -march=armv6"
3 | TARGET_ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"
4 |
--------------------------------------------------------------------------------
/libsodium/dist-build/android-armv7.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | export CFLAGS="-Os -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -marm -march=armv7-a"
3 | TARGET_ARCH=armv7 HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"
4 |
--------------------------------------------------------------------------------
/libsodium/dist-build/android-build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ -z "$ANDROID_NDK_HOME" ]; then
4 | echo "You should probably set ANDROID_NDK_HOME to the directory containing"
5 | echo "the Android NDK"
6 | exit
7 | fi
8 |
9 | if [ ! -f ./configure ]; then
10 | echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?"
11 | exit 1
12 | fi
13 |
14 | if [ "x$TARGET_ARCH" = 'x' ] || [ "x$HOST_COMPILER" = 'x' ]; then
15 | echo "You shouldn't use android-build.sh directly, use android-[arch].sh instead"
16 | exit 1
17 | fi
18 |
19 | export MAKE_TOOLCHAIN="${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh"
20 |
21 | export PREFIX="$(pwd)/libsodium-android-${TARGET_ARCH}"
22 | export TOOLCHAIN_DIR="$(pwd)/android-toolchain-${TARGET_ARCH}"
23 | export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"
24 |
25 | # Clean up before build
26 | rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}"
27 |
28 | $MAKE_TOOLCHAIN --platform="${NDK_PLATFORM:-android-14}" \
29 | --arch="$TARGET_ARCH" \
30 | --install-dir="$TOOLCHAIN_DIR" && \
31 | ./configure --host="${HOST_COMPILER}" \
32 | --with-sysroot="${TOOLCHAIN_DIR}/sysroot" \
33 | --prefix="${PREFIX}" \
34 | --enable-minimal \
35 | --disable-soname-versions && \
36 | make clean && \
37 | make -j3 install && \
38 | echo "libsodium has been installed into $PREFIX"
39 |
--------------------------------------------------------------------------------
/libsodium/dist-build/android-mips.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | export CFLAGS="-Os"
3 | TARGET_ARCH=mips HOST_COMPILER=mipsel-linux-android "$(dirname "$0")/android-build.sh"
4 |
--------------------------------------------------------------------------------
/libsodium/dist-build/android-x86.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | export CFLAGS="-Os"
3 | TARGET_ARCH=x86 HOST_COMPILER=i686-linux-android "$(dirname "$0")/android-build.sh"
4 |
--------------------------------------------------------------------------------
/libsodium/dist-build/ios.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | export XCODEDIR=$(xcode-select -p)
4 | export BASEDIR="${XCODEDIR}/Platforms/iPhoneOS.platform/Developer"
5 | export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
6 | export SDK="${BASEDIR}/SDKs/iPhoneOS.sdk"
7 | export IPHONEOS_VERSION_MIN="5.1.1"
8 | export CFLAGS="-Oz -mthumb -arch armv7 -isysroot ${SDK} -miphoneos-version-min=${IPHONEOS_VERSION_MIN}"
9 | export LDFLAGS="-mthumb -arch armv7 -isysroot ${SDK} -miphoneos-version-min=${IPHONEOS_VERSION_MIN}"
10 | export PREFIX="$(pwd)/libsodium-ios"
11 |
12 | ./configure --host=arm-apple-darwin10 \
13 | --disable-shared \
14 | --enable-minimal \
15 | --prefix="$PREFIX" && \
16 | make clean && \
17 | make -j3 install && \
18 | echo "libsodium has been installed into $PREFIX"
19 |
--------------------------------------------------------------------------------
/libsodium/dist-build/msys2-win32.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | export CFLAGS="-O3 -fomit-frame-pointer -m32 -march=pentium2 -mtune=nocona"
4 | export PREFIX="$(pwd)/libsodium-win32"
5 |
6 | ./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \
7 | --host=i686-w64-mingw32 && \
8 | make && \
9 | make check && \
10 | make install
11 |
--------------------------------------------------------------------------------
/libsodium/dist-build/msys2-win64.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | export CFLAGS="-O3 -fomit-frame-pointer -m64 -mtune=nocona"
4 | export PREFIX="$(pwd)/libsodium-win64"
5 |
6 | ./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \
7 | --host=x86_64-w64-mingw32 && \
8 | make && \
9 | make check && \
10 | make install
11 |
--------------------------------------------------------------------------------
/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 portable, cross-compilable, installable, packageable fork of NaCl, with a compatible API.
9 |
10 | Libs: -L${libdir} -lsodium
11 | Cflags: -I${includedir}
12 |
--------------------------------------------------------------------------------
/libsodium/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkevin/shadowsocks-libev/4de3eca03100eec228412413130db779113e783e/libsodium/logo.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/libsodium/msvc-scripts/Makefile.am:
--------------------------------------------------------------------------------
1 | EXTRA_DIST = \
2 | process.bat \
3 | rep.vbs \
4 | sodium.props
5 |
--------------------------------------------------------------------------------
/libsodium/msvc-scripts/process.bat:
--------------------------------------------------------------------------------
1 | cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/1.0.1/ < src\libsodium\include\sodium\version.h.in > tmp
2 | cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MAJOR@/7/ < tmp > tmp2
3 | cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/3/ < tmp2 > src\libsodium\include\sodium\version.h
4 | del tmp tmp2
5 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/libsodium/packaging/nuget/.gitignore:
--------------------------------------------------------------------------------
1 | *.nupkg
2 |
--------------------------------------------------------------------------------
/libsodium/packaging/nuget/package.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | ECHO Started nuget packaging build.
3 | ECHO.
4 | REM http://www.nuget.org/packages/gsl
5 | gsl -q -script:package.gsl package.config
6 | ECHO.
7 | REM http://nuget.codeplex.com/releases
8 | nuget pack package.nuspec -verbosity detailed
9 | ECHO.
10 | ECHO NOTE: Ignore warnings not applicable to native code: "Issue: Assembly outside lib folder."
11 | ECHO.
12 | ECHO Completed nuget packaging build. The package is in the following folder:
13 | CD
--------------------------------------------------------------------------------
/libsodium/packaging/nuget/package.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/libsodium/packaging/nuget/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/libsodium/src/Makefile.am:
--------------------------------------------------------------------------------
1 |
2 | SUBDIRS = \
3 | libsodium
4 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/crypto_auth.c:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_auth.h"
3 |
4 | size_t
5 | crypto_auth_bytes(void)
6 | {
7 | return crypto_auth_BYTES;
8 | }
9 |
10 | size_t
11 | crypto_auth_keybytes(void)
12 | {
13 | return crypto_auth_KEYBYTES;
14 | }
15 |
16 | const char *
17 | crypto_auth_primitive(void)
18 | {
19 | return crypto_auth_PRIMITIVE;
20 | }
21 |
22 | int
23 | crypto_auth(unsigned char *out, const unsigned char *in,
24 | unsigned long long inlen, const unsigned char *k)
25 | {
26 | return crypto_auth_hmacsha512256(out, in, inlen, k);
27 | }
28 |
29 | int
30 | crypto_auth_verify(const unsigned char *h, const unsigned char *in,
31 | unsigned long long inlen,const unsigned char *k)
32 | {
33 | return crypto_auth_hmacsha512256_verify(h, in, inlen, k);
34 | }
35 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_auth_hmacsha256.h"
2 |
3 | size_t
4 | crypto_auth_hmacsha256_bytes(void) {
5 | return crypto_auth_hmacsha256_BYTES;
6 | }
7 |
8 | size_t
9 | crypto_auth_hmacsha256_keybytes(void) {
10 | return crypto_auth_hmacsha256_KEYBYTES;
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha256/checksum:
--------------------------------------------------------------------------------
1 | 3bd7abd4f4dce04396f2ac7cb1cff70607f692411c49a1563b037d31e1662632
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_auth_hmacsha256.h"
3 |
4 | #define crypto_auth crypto_auth_hmacsha256
5 | #define crypto_auth_verify crypto_auth_hmacsha256_verify
6 | #define crypto_auth_BYTES crypto_auth_hmacsha256_BYTES
7 | #define crypto_auth_KEYBYTES crypto_auth_hmacsha256_KEYBYTES
8 | #define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha256_IMPLEMENTATION
9 | #define crypto_auth_VERSION crypto_auth_hmacsha256_VERSION
10 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 | #include "crypto_verify_32.h"
3 | #include "utils.h"
4 |
5 | int crypto_auth_verify(const unsigned char *h,const unsigned char *in,unsigned long long inlen,const unsigned char *k)
6 | {
7 | unsigned char correct[32];
8 | crypto_auth(correct,in,inlen,k);
9 | return crypto_verify_32(h,correct) | (-(h - correct == 0)) |
10 | sodium_memcmp(correct,h,32);
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_auth_hmacsha512.h"
2 |
3 | size_t
4 | crypto_auth_hmacsha512_bytes(void) {
5 | return crypto_auth_hmacsha512_BYTES;
6 | }
7 |
8 | size_t
9 | crypto_auth_hmacsha512_keybytes(void) {
10 | return crypto_auth_hmacsha512_KEYBYTES;
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_auth_hmacsha512.h"
3 |
4 | #define crypto_auth crypto_auth_hmacsha512
5 | #define crypto_auth_verify crypto_auth_hmacsha512_verify
6 | #define crypto_auth_BYTES crypto_auth_hmacsha512_BYTES
7 | #define crypto_auth_KEYBYTES crypto_auth_hmacsha512_KEYBYTES
8 | #define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512_IMPLEMENTATION
9 | #define crypto_auth_VERSION crypto_auth_hmacsha512_VERSION
10 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 | #include "crypto_verify_64.h"
3 | #include "utils.h"
4 |
5 | int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
6 | unsigned long long inlen, const unsigned char *k)
7 | {
8 | unsigned char correct[64];
9 | crypto_auth(correct,in,inlen,k);
10 | return crypto_verify_64(h,correct) | (-(h - correct == 0)) |
11 | sodium_memcmp(correct,h,64);
12 | }
13 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_auth_hmacsha512256.h"
2 |
3 | size_t
4 | crypto_auth_hmacsha512256_bytes(void) {
5 | return crypto_auth_hmacsha512256_BYTES;
6 | }
7 |
8 | size_t
9 | crypto_auth_hmacsha512256_keybytes(void) {
10 | return crypto_auth_hmacsha512256_KEYBYTES;
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha512256/checksum:
--------------------------------------------------------------------------------
1 | 2f5e8a6a0cac012d8d001351d7d583e69f91390df46305c3608e0c2893491886
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_auth_hmacsha512256.h"
3 |
4 | #define crypto_auth crypto_auth_hmacsha512256
5 | #define crypto_auth_verify crypto_auth_hmacsha512256_verify
6 | #define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
7 | #define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
8 | #define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512256_IMPLEMENTATION
9 | #define crypto_auth_VERSION crypto_auth_hmacsha512256_VERSION
10 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 | #include "crypto_verify_32.h"
3 | #include "utils.h"
4 |
5 | int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
6 | unsigned long long inlen, const unsigned char *k)
7 | {
8 | unsigned char correct[32];
9 | crypto_auth(correct,in,inlen,k);
10 | return crypto_verify_32(h,correct) | (-(h - correct == 0)) |
11 | sodium_memcmp(correct,h,32);
12 | }
13 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_box_curve25519xsalsa20poly1305.h"
2 |
3 | size_t
4 | crypto_box_curve25519xsalsa20poly1305_seedbytes(void) {
5 | return crypto_box_curve25519xsalsa20poly1305_SEEDBYTES;
6 | }
7 |
8 | size_t
9 | crypto_box_curve25519xsalsa20poly1305_publickeybytes(void) {
10 | return crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES;
11 | }
12 |
13 | size_t
14 | crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void) {
15 | return crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES;
16 | }
17 |
18 | size_t
19 | crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void) {
20 | return crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES;
21 | }
22 |
23 | size_t
24 | crypto_box_curve25519xsalsa20poly1305_noncebytes(void) {
25 | return crypto_box_curve25519xsalsa20poly1305_NONCEBYTES;
26 | }
27 |
28 | size_t
29 | crypto_box_curve25519xsalsa20poly1305_zerobytes(void) {
30 | return crypto_box_curve25519xsalsa20poly1305_ZEROBYTES;
31 | }
32 |
33 | size_t
34 | crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void) {
35 | return crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES;
36 | }
37 |
38 | size_t
39 | crypto_box_curve25519xsalsa20poly1305_macbytes(void) {
40 | return crypto_box_curve25519xsalsa20poly1305_MACBYTES;
41 | }
42 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/checksum:
--------------------------------------------------------------------------------
1 | 5fac7400caabc14a99c5c0bc13fb1df5e468e870382a3a1c
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 | #include "crypto_secretbox_xsalsa20poly1305.h"
3 |
4 | int crypto_box_afternm(
5 | unsigned char *c,
6 | const unsigned char *m,unsigned long long mlen,
7 | const unsigned char *n,
8 | const unsigned char *k
9 | )
10 | {
11 | return crypto_secretbox_xsalsa20poly1305(c,m,mlen,n,k);
12 | }
13 |
14 | int crypto_box_open_afternm(
15 | unsigned char *m,
16 | const unsigned char *c,unsigned long long clen,
17 | const unsigned char *n,
18 | const unsigned char *k
19 | )
20 | {
21 | return crypto_secretbox_xsalsa20poly1305_open(m,c,clen,n,k);
22 | }
23 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 | #include "crypto_core_hsalsa20.h"
3 | #include "crypto_scalarmult_curve25519.h"
4 |
5 | static const unsigned char sigma[16] = {
6 | 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
7 | };
8 | static const unsigned char n[16] = {0};
9 |
10 | int crypto_box_beforenm(
11 | unsigned char *k,
12 | const unsigned char *pk,
13 | const unsigned char *sk
14 | )
15 | {
16 | unsigned char s[32];
17 | crypto_scalarmult_curve25519(s,sk,pk);
18 | return crypto_core_hsalsa20(k,n,s,sigma);
19 | }
20 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 |
3 | int crypto_box(
4 | unsigned char *c,
5 | const unsigned char *m,unsigned long long mlen,
6 | const unsigned char *n,
7 | const unsigned char *pk,
8 | const unsigned char *sk
9 | )
10 | {
11 | unsigned char k[crypto_box_BEFORENMBYTES];
12 | crypto_box_beforenm(k,pk,sk);
13 | return crypto_box_afternm(c,m,mlen,n,k);
14 | }
15 |
16 | int crypto_box_open(
17 | unsigned char *m,
18 | const unsigned char *c,unsigned long long clen,
19 | const unsigned char *n,
20 | const unsigned char *pk,
21 | const unsigned char *sk
22 | )
23 | {
24 | unsigned char k[crypto_box_BEFORENMBYTES];
25 | crypto_box_beforenm(k,pk,sk);
26 | return crypto_box_open_afternm(m,c,clen,n,k);
27 | }
28 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "crypto_hash_sha512.h"
4 | #include "crypto_scalarmult_curve25519.h"
5 | #include "api.h"
6 | #include "randombytes.h"
7 |
8 | int crypto_box_seed_keypair(
9 | unsigned char *pk,
10 | unsigned char *sk,
11 | const unsigned char *seed
12 | )
13 | {
14 | unsigned char hash[64];
15 | crypto_hash_sha512(hash,seed,32);
16 | memmove(sk,hash,32);
17 | return crypto_scalarmult_curve25519_base(pk,sk);
18 | }
19 |
20 | int crypto_box_keypair(
21 | unsigned char *pk,
22 | unsigned char *sk
23 | )
24 | {
25 | randombytes_buf(sk,32);
26 | return crypto_scalarmult_curve25519_base(pk,sk);
27 | }
28 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/hsalsa20/checksum:
--------------------------------------------------------------------------------
1 | 28ebe700b5878570702a68740aa131e6fa907e58a3f6915cd183c6db3f7afd7a
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.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 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_core_hsalsa20.h"
3 |
4 | #define crypto_core crypto_core_hsalsa20
5 | #define crypto_core_OUTPUTBYTES crypto_core_hsalsa20_OUTPUTBYTES
6 | #define crypto_core_INPUTBYTES crypto_core_hsalsa20_INPUTBYTES
7 | #define crypto_core_KEYBYTES crypto_core_hsalsa20_KEYBYTES
8 | #define crypto_core_CONSTBYTES crypto_core_hsalsa20_CONSTBYTES
9 | #define crypto_core_IMPLEMENTATION crypto_core_hsalsa20_IMPLEMENTATION
10 | #define crypto_core_VERSION crypto_core_hsalsa20_VERSION
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa20/checksum:
--------------------------------------------------------------------------------
1 | 9d1ee8d84b974e648507ffd93829376c5b4420751710e44f6593abd8769378011d85ecda51ceb8f43661d3c65ef5b57c4f5bf8df76c8202784c8df8def61e6a6
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_core_salsa20.h"
2 |
3 | size_t
4 | crypto_core_salsa20_outputbytes(void) {
5 | return crypto_core_salsa20_OUTPUTBYTES;
6 | }
7 |
8 | size_t
9 | crypto_core_salsa20_inputbytes(void) {
10 | return crypto_core_salsa20_INPUTBYTES;
11 | }
12 |
13 | size_t
14 | crypto_core_salsa20_keybytes(void) {
15 | return crypto_core_salsa20_KEYBYTES;
16 | }
17 |
18 | size_t
19 | crypto_core_salsa20_constbytes(void) {
20 | return crypto_core_salsa20_CONSTBYTES;
21 | }
22 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_core_salsa20.h"
3 |
4 | #define crypto_core crypto_core_salsa20
5 | #define crypto_core_OUTPUTBYTES crypto_core_salsa20_OUTPUTBYTES
6 | #define crypto_core_INPUTBYTES crypto_core_salsa20_INPUTBYTES
7 | #define crypto_core_KEYBYTES crypto_core_salsa20_KEYBYTES
8 | #define crypto_core_CONSTBYTES crypto_core_salsa20_CONSTBYTES
9 | #define crypto_core_IMPLEMENTATION crypto_core_salsa20_IMPLEMENTATION
10 | #define crypto_core_VERSION crypto_core_salsa20_VERSION
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa2012/checksum:
--------------------------------------------------------------------------------
1 | f36d643f798efc0fca888d3ac4bdcc54c98a968c2da16bd5b8bfe9fe9025a6ca3a207e9362dc7cf17ddfc7477ee754d3f521b1df91640093754f7275b1a54293
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_core_salsa2012.h"
2 |
3 | size_t
4 | crypto_core_salsa2012_outputbytes(void) {
5 | return crypto_core_salsa2012_OUTPUTBYTES;
6 | }
7 |
8 | size_t
9 | crypto_core_salsa2012_inputbytes(void) {
10 | return crypto_core_salsa2012_INPUTBYTES;
11 | }
12 |
13 | size_t
14 | crypto_core_salsa2012_keybytes(void) {
15 | return crypto_core_salsa2012_KEYBYTES;
16 | }
17 |
18 | size_t
19 | crypto_core_salsa2012_constbytes(void) {
20 | return crypto_core_salsa2012_CONSTBYTES;
21 | }
22 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_core_salsa2012.h"
3 |
4 | #define crypto_core crypto_core_salsa2012
5 | #define crypto_core_OUTPUTBYTES crypto_core_salsa2012_OUTPUTBYTES
6 | #define crypto_core_INPUTBYTES crypto_core_salsa2012_INPUTBYTES
7 | #define crypto_core_KEYBYTES crypto_core_salsa2012_KEYBYTES
8 | #define crypto_core_CONSTBYTES crypto_core_salsa2012_CONSTBYTES
9 | #define crypto_core_IMPLEMENTATION crypto_core_salsa2012_IMPLEMENTATION
10 | #define crypto_core_VERSION crypto_core_salsa2012_VERSION
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa208/checksum:
--------------------------------------------------------------------------------
1 | 1e13ea9e74cb36989f7cbf4abc80b29154e1a8b150bd5244951318abea002a93ae9fe2abbcf7217526ac2a85b66c256ba9374b1257eda0c01816da328edfa11a
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_core_salsa208.h"
2 |
3 | size_t
4 | crypto_core_salsa208_outputbytes(void) {
5 | return crypto_core_salsa208_OUTPUTBYTES;
6 | }
7 |
8 | size_t
9 | crypto_core_salsa208_inputbytes(void) {
10 | return crypto_core_salsa208_INPUTBYTES;
11 | }
12 |
13 | size_t
14 | crypto_core_salsa208_keybytes(void) {
15 | return crypto_core_salsa208_KEYBYTES;
16 | }
17 |
18 | size_t
19 | crypto_core_salsa208_constbytes(void) {
20 | return crypto_core_salsa208_CONSTBYTES;
21 | }
22 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_core_salsa208.h"
3 |
4 | #define crypto_core crypto_core_salsa208
5 | #define crypto_core_OUTPUTBYTES crypto_core_salsa208_OUTPUTBYTES
6 | #define crypto_core_INPUTBYTES crypto_core_salsa208_INPUTBYTES
7 | #define crypto_core_KEYBYTES crypto_core_salsa208_KEYBYTES
8 | #define crypto_core_CONSTBYTES crypto_core_salsa208_CONSTBYTES
9 | #define crypto_core_IMPLEMENTATION crypto_core_salsa208_IMPLEMENTATION
10 | #define crypto_core_VERSION crypto_core_salsa208_VERSION
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_generichash_blake2b.h"
2 |
3 | size_t
4 | crypto_generichash_blake2b_bytes_min(void) {
5 | return crypto_generichash_blake2b_BYTES_MIN;
6 | }
7 |
8 | size_t
9 | crypto_generichash_blake2b_bytes_max(void) {
10 | return crypto_generichash_blake2b_BYTES_MAX;
11 | }
12 |
13 | size_t
14 | crypto_generichash_blake2b_bytes(void) {
15 | return crypto_generichash_blake2b_BYTES;
16 | }
17 |
18 | size_t
19 | crypto_generichash_blake2b_keybytes_min(void) {
20 | return crypto_generichash_blake2b_KEYBYTES_MIN;
21 | }
22 |
23 | size_t
24 | crypto_generichash_blake2b_keybytes_max(void) {
25 | return crypto_generichash_blake2b_KEYBYTES_MAX;
26 | }
27 |
28 | size_t
29 | crypto_generichash_blake2b_keybytes(void) {
30 | return crypto_generichash_blake2b_KEYBYTES;
31 | }
32 |
33 | size_t
34 | crypto_generichash_blake2b_saltbytes(void) {
35 | return crypto_generichash_blake2b_SALTBYTES;
36 | }
37 |
38 | size_t
39 | crypto_generichash_blake2b_personalbytes(void) {
40 | return crypto_generichash_blake2b_PERSONALBYTES;
41 | }
42 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_generichash_blake2b.h"
3 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_hash/sha256/checksum:
--------------------------------------------------------------------------------
1 | 86df8bd202b2a2b5fdc04a7f50a591e43a345849c12fef08d487109648a08e05
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_hash/sha256/cp/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_hash_sha256.h"
3 |
4 | #define crypto_hash crypto_hash_sha256
5 | #define crypto_hash_init crypto_hash_sha256_init
6 | #define crypto_hash_update crypto_hash_sha256_update
7 | #define crypto_hash_final crypto_hash_sha256_final
8 | #define crypto_hash_BYTES crypto_hash_sha256_BYTES
9 | #define crypto_hash_IMPLEMENTATION crypto_hash_sha256_IMPLEMENTATION
10 | #define crypto_hash_VERSION crypto_hash_sha256_VERSION
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_hash_sha256.h"
2 |
3 | size_t
4 | crypto_hash_sha256_bytes(void) {
5 | return crypto_hash_sha256_BYTES;
6 | }
7 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_hash/sha512/checksum:
--------------------------------------------------------------------------------
1 | 9a2a989e136a02c3362c98e6e1e0b52fab980a1dafbebe4dd5e44d15d061742e35fb686befd4e33c608d251c96e26c020f90d92bb7ec8a657f79bb8e0b00a473
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_hash/sha512/cp/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_hash_sha512.h"
3 |
4 | #define crypto_hash crypto_hash_sha512
5 | #define crypto_hash_init crypto_hash_sha512_init
6 | #define crypto_hash_update crypto_hash_sha512_update
7 | #define crypto_hash_final crypto_hash_sha512_final
8 | #define crypto_hash_BYTES crypto_hash_sha512_BYTES
9 | #define crypto_hash_IMPLEMENTATION crypto_hash_sha512_IMPLEMENTATION
10 | #define crypto_hash_VERSION crypto_hash_sha512_VERSION
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_hash_sha512.h"
2 |
3 | size_t
4 | crypto_hash_sha512_bytes(void) {
5 | return crypto_hash_sha512_BYTES;
6 | }
7 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c:
--------------------------------------------------------------------------------
1 | #include "crypto_onetimeauth_poly1305.h"
2 | #include "crypto_verify_16.h"
3 | #include "poly1305_donna.h"
4 |
5 | int
6 | crypto_onetimeauth_poly1305_donna_verify(const unsigned char *h,
7 | const unsigned char *in,
8 | unsigned long long inlen,
9 | const unsigned char *k)
10 | {
11 | unsigned char correct[16];
12 |
13 | crypto_onetimeauth_poly1305_donna(correct,in,inlen,k);
14 | return crypto_verify_16(h,correct);
15 | }
16 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_onetimeauth_poly1305.h"
2 |
3 | size_t
4 | crypto_onetimeauth_poly1305_bytes(void) {
5 | return crypto_onetimeauth_poly1305_BYTES;
6 | }
7 |
8 | size_t
9 | crypto_onetimeauth_poly1305_keybytes(void) {
10 | return crypto_onetimeauth_poly1305_KEYBYTES;
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 | #include "crypto_onetimeauth.h"
5 | #include "crypto_onetimeauth_poly1305.h"
6 | #include "utils.h"
7 | #include "donna/poly1305_donna.h"
8 |
9 | crypto_onetimeauth_poly1305_implementation *
10 | crypto_onetimeauth_pick_best_implementation(void)
11 | {
12 | return &crypto_onetimeauth_poly1305_donna_implementation;
13 | }
14 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_scalarmult.h"
3 |
4 | size_t
5 | crypto_scalarmult_bytes(void)
6 | {
7 | return crypto_scalarmult_BYTES;
8 | }
9 |
10 | size_t
11 | crypto_scalarmult_scalarbytes(void)
12 | {
13 | return crypto_scalarmult_SCALARBYTES;
14 | }
15 |
16 | const char *
17 | crypto_scalarmult_primitive(void)
18 | {
19 | return crypto_scalarmult_PRIMITIVE;
20 | }
21 |
22 | int
23 | crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
24 | {
25 | return crypto_scalarmult_curve25519_base(q, n);
26 | }
27 |
28 | int
29 | crypto_scalarmult(unsigned char *q, const unsigned char *n,
30 | const unsigned char *p)
31 | {
32 | return crypto_scalarmult_curve25519(q, n, p);
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/checksum:
--------------------------------------------------------------------------------
1 | dacdae4a0f12353dfc66757f2fd1fff538fe6616115dace9afb8016a55be2a52
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_scalarmult_curve25519.h"
3 |
4 | #define crypto_scalarmult_curve25519_implementation_name \
5 | crypto_scalarmult_curve25519_donna_c64_implementation_name
6 |
7 | #define crypto_scalarmult crypto_scalarmult_curve25519
8 | #define crypto_scalarmult_base crypto_scalarmult_curve25519_base
9 |
10 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c:
--------------------------------------------------------------------------------
1 |
2 | #include "api.h"
3 |
4 | #ifdef HAVE_TI_MODE
5 |
6 | static const unsigned char basepoint[32] = {9};
7 |
8 | int crypto_scalarmult_base(unsigned char *q,const unsigned char *n)
9 | {
10 | return crypto_scalarmult(q, n, basepoint);
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_scalarmult_curve25519.h"
3 |
4 | #define crypto_scalarmult crypto_scalarmult_curve25519
5 | #define crypto_scalarmult_base crypto_scalarmult_curve25519_base
6 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c:
--------------------------------------------------------------------------------
1 |
2 | #include "api.h"
3 | #include "crypto_scalarmult.h"
4 |
5 | #ifndef HAVE_TI_MODE
6 |
7 | static const unsigned char basepoint[32] = {9};
8 |
9 | int crypto_scalarmult_base(unsigned char *q,const unsigned char *n)
10 | {
11 | return crypto_scalarmult(q,n,basepoint);
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | #ifndef HAVE_TI_MODE
4 |
5 | /*
6 | h = 0
7 | */
8 |
9 | void fe_0(fe h)
10 | {
11 | h[0] = 0;
12 | h[1] = 0;
13 | h[2] = 0;
14 | h[3] = 0;
15 | h[4] = 0;
16 | h[5] = 0;
17 | h[6] = 0;
18 | h[7] = 0;
19 | h[8] = 0;
20 | h[9] = 0;
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | #ifndef HAVE_TI_MODE
4 |
5 | /*
6 | h = 1
7 | */
8 |
9 | void fe_1(fe h)
10 | {
11 | h[0] = 1;
12 | h[1] = 0;
13 | h[2] = 0;
14 | h[3] = 0;
15 | h[4] = 0;
16 | h[5] = 0;
17 | h[6] = 0;
18 | h[7] = 0;
19 | h[8] = 0;
20 | h[9] = 0;
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | #ifndef HAVE_TI_MODE
4 |
5 | /*
6 | h = f
7 | */
8 |
9 | void fe_copy(fe h,fe f)
10 | {
11 | crypto_int32 f0 = f[0];
12 | crypto_int32 f1 = f[1];
13 | crypto_int32 f2 = f[2];
14 | crypto_int32 f3 = f[3];
15 | crypto_int32 f4 = f[4];
16 | crypto_int32 f5 = f[5];
17 | crypto_int32 f6 = f[6];
18 | crypto_int32 f7 = f[7];
19 | crypto_int32 f8 = f[8];
20 | crypto_int32 f9 = f[9];
21 | h[0] = f0;
22 | h[1] = f1;
23 | h[2] = f2;
24 | h[3] = f3;
25 | h[4] = f4;
26 | h[5] = f5;
27 | h[6] = f6;
28 | h[7] = f7;
29 | h[8] = f8;
30 | h[9] = f9;
31 | }
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | #ifndef HAVE_TI_MODE
4 |
5 | void fe_invert(fe out,fe z)
6 | {
7 | fe t0;
8 | fe t1;
9 | fe t2;
10 | fe t3;
11 | int i;
12 |
13 | #include "pow225521.h"
14 |
15 | return;
16 | }
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c:
--------------------------------------------------------------------------------
1 |
2 | #include "api.h"
3 | #include "crypto_scalarmult.h"
4 | #include "fe.h"
5 |
6 | #ifndef HAVE_TI_MODE
7 |
8 | int crypto_scalarmult(unsigned char *q,
9 | const unsigned char *n,
10 | const unsigned char *p)
11 | {
12 | unsigned char e[32];
13 | unsigned int i;
14 | fe x1;
15 | fe x2;
16 | fe z2;
17 | fe x3;
18 | fe z3;
19 | fe tmp0;
20 | fe tmp1;
21 | int pos;
22 | unsigned int swap;
23 | unsigned int b;
24 |
25 | for (i = 0;i < 32;++i) e[i] = n[i];
26 | e[0] &= 248;
27 | e[31] &= 127;
28 | e[31] |= 64;
29 | fe_frombytes(x1,p);
30 | fe_1(x2);
31 | fe_0(z2);
32 | fe_copy(x3,x1);
33 | fe_1(z3);
34 |
35 | swap = 0;
36 | for (pos = 254;pos >= 0;--pos) {
37 | b = e[pos / 8] >> (pos & 7);
38 | b &= 1;
39 | swap ^= b;
40 | fe_cswap(x2,x3,swap);
41 | fe_cswap(z2,z3,swap);
42 | swap = b;
43 | #include "montgomery.h"
44 | }
45 | fe_cswap(x2,x3,swap);
46 | fe_cswap(z2,z3,swap);
47 |
48 | fe_invert(z2,z2);
49 | fe_mul(x2,x2,z2);
50 | fe_tobytes(q,x2);
51 | return 0;
52 | }
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_scalarmult_curve25519.h"
3 |
4 | size_t
5 | crypto_scalarmult_curve25519_bytes(void)
6 | {
7 | return crypto_scalarmult_curve25519_BYTES;
8 | }
9 |
10 | size_t
11 | crypto_scalarmult_curve25519_scalarbytes(void)
12 | {
13 | return crypto_scalarmult_curve25519_SCALARBYTES;
14 | }
15 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_secretbox.h"
3 |
4 | size_t
5 | crypto_secretbox_keybytes(void)
6 | {
7 | return crypto_secretbox_KEYBYTES;
8 | }
9 |
10 | size_t
11 | crypto_secretbox_noncebytes(void)
12 | {
13 | return crypto_secretbox_NONCEBYTES;
14 | }
15 |
16 | size_t
17 | crypto_secretbox_zerobytes(void)
18 | {
19 | return crypto_secretbox_ZEROBYTES;
20 | }
21 |
22 | size_t
23 | crypto_secretbox_boxzerobytes(void)
24 | {
25 | return crypto_secretbox_BOXZEROBYTES;
26 | }
27 |
28 | size_t
29 | crypto_secretbox_macbytes(void)
30 | {
31 | return crypto_secretbox_MACBYTES;
32 | }
33 |
34 | const char *
35 | crypto_secretbox_primitive(void)
36 | {
37 | return crypto_secretbox_PRIMITIVE;
38 | }
39 |
40 | int
41 | crypto_secretbox(unsigned char *c, const unsigned char *m,
42 | unsigned long long mlen, const unsigned char *n,
43 | const unsigned char *k)
44 | {
45 | return crypto_secretbox_xsalsa20poly1305(c, m, mlen, n, k);
46 | }
47 |
48 | int
49 | crypto_secretbox_open(unsigned char *m, const unsigned char *c,
50 | unsigned long long clen, const unsigned char *n,
51 | const unsigned char *k)
52 | {
53 | return crypto_secretbox_xsalsa20poly1305_open(m, c, clen, n, k);
54 | }
55 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/checksum:
--------------------------------------------------------------------------------
1 | df372f95dd87381b7c9ceb6f340ccaa03d19bed5d9e4ab004d99d847675a9658
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_secretbox_xsalsa20poly1305.h"
3 |
4 | #define crypto_secretbox crypto_secretbox_xsalsa20poly1305
5 | #define crypto_secretbox_open crypto_secretbox_xsalsa20poly1305_open
6 | #define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES
7 | #define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
8 | #define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
9 | #define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
10 | #define crypto_secretbox_IMPLEMENTATION crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION
11 | #define crypto_secretbox_VERSION crypto_secretbox_xsalsa20poly1305_VERSION
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 | #include "crypto_onetimeauth_poly1305.h"
3 | #include "crypto_stream_xsalsa20.h"
4 |
5 | int crypto_secretbox(
6 | unsigned char *c,
7 | const unsigned char *m,unsigned long long mlen,
8 | const unsigned char *n,
9 | const unsigned char *k
10 | )
11 | {
12 | int i;
13 | if (mlen < 32) return -1;
14 | crypto_stream_xsalsa20_xor(c,m,mlen,n,k);
15 | crypto_onetimeauth_poly1305(c + 16,c + 32,mlen - 32,c);
16 | for (i = 0;i < 16;++i) c[i] = 0;
17 | return 0;
18 | }
19 |
20 | int crypto_secretbox_open(
21 | unsigned char *m,
22 | const unsigned char *c,unsigned long long clen,
23 | const unsigned char *n,
24 | const unsigned char *k
25 | )
26 | {
27 | int i;
28 | unsigned char subkey[32];
29 | if (clen < 32) return -1;
30 | crypto_stream_xsalsa20(subkey,32,n,k);
31 | if (crypto_onetimeauth_poly1305_verify(c + 16,c + 32,clen - 32,subkey) != 0) return -1;
32 | crypto_stream_xsalsa20_xor(m,c,clen,n,k);
33 | for (i = 0;i < 32;++i) m[i] = 0;
34 | return 0;
35 | }
36 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_secretbox_xsalsa20poly1305.h"
2 |
3 | size_t
4 | crypto_secretbox_xsalsa20poly1305_keybytes(void) {
5 | return crypto_secretbox_xsalsa20poly1305_KEYBYTES;
6 | }
7 |
8 | size_t
9 | crypto_secretbox_xsalsa20poly1305_noncebytes(void) {
10 | return crypto_secretbox_xsalsa20poly1305_NONCEBYTES;
11 | }
12 |
13 | size_t
14 | crypto_secretbox_xsalsa20poly1305_zerobytes(void) {
15 | return crypto_secretbox_xsalsa20poly1305_ZEROBYTES;
16 | }
17 |
18 | size_t
19 | crypto_secretbox_xsalsa20poly1305_boxzerobytes(void) {
20 | return crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
21 | }
22 |
23 | size_t
24 | crypto_secretbox_xsalsa20poly1305_macbytes(void) {
25 | return crypto_secretbox_xsalsa20poly1305_MACBYTES;
26 | }
27 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_shorthash.h"
3 |
4 | size_t
5 | crypto_shorthash_bytes(void)
6 | {
7 | return crypto_shorthash_BYTES;
8 | }
9 |
10 | size_t
11 | crypto_shorthash_keybytes(void)
12 | {
13 | return crypto_shorthash_KEYBYTES;
14 | }
15 |
16 | const char *
17 | crypto_shorthash_primitive(void)
18 | {
19 | return crypto_shorthash_PRIMITIVE;
20 | }
21 |
22 | int
23 | crypto_shorthash(unsigned char *out, const unsigned char *in,
24 | unsigned long long inlen, const unsigned char *k)
25 | {
26 | return crypto_shorthash_siphash24(out, in, inlen, k);
27 | }
28 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_shorthash_siphash24.h"
3 |
4 | #define crypto_shorthash crypto_shorthash_siphash24
5 | #define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES
6 | #define crypto_shorthash_IMPLEMENTATION crypto_shorthash_siphash24_IMPLEMENTATION
7 | #define crypto_shorthash_VERSION crypto_shorthash_siphash24_VERSION
8 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.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 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/description:
--------------------------------------------------------------------------------
1 | EdDSA signatures using Curve25519
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_sign_ed25519.h"
3 |
4 | #define crypto_sign crypto_sign_ed25519
5 | #define crypto_sign_detached crypto_sign_ed25519_detached
6 | #define crypto_sign_open crypto_sign_ed25519_open
7 | #define crypto_sign_verify_detached crypto_sign_ed25519_verify_detached
8 | #define crypto_sign_keypair crypto_sign_ed25519_keypair
9 | #define crypto_sign_seed_keypair crypto_sign_ed25519_seed_keypair
10 | #define crypto_sign_BYTES crypto_sign_ed25519_BYTES
11 | #define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
12 | #define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
13 | #define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
14 | #define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION
15 | #define crypto_sign_VERSION crypto_sign_ed25519_VERSION
16 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h:
--------------------------------------------------------------------------------
1 | -10913610,13857413,-15372611,6949391,114729,-8787816,-6275908,-3247719,-18696448,-12055116
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h:
--------------------------------------------------------------------------------
1 | -21827239,-5839606,-30745221,13898782,229458,15978800,-12551817,-6495438,29715968,9444199
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | /*
4 | h = 0
5 | */
6 |
7 | void fe_0(fe h)
8 | {
9 | h[0] = 0;
10 | h[1] = 0;
11 | h[2] = 0;
12 | h[3] = 0;
13 | h[4] = 0;
14 | h[5] = 0;
15 | h[6] = 0;
16 | h[7] = 0;
17 | h[8] = 0;
18 | h[9] = 0;
19 | }
20 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | /*
4 | h = 1
5 | */
6 |
7 | void fe_1(fe h)
8 | {
9 | h[0] = 1;
10 | h[1] = 0;
11 | h[2] = 0;
12 | h[3] = 0;
13 | h[4] = 0;
14 | h[5] = 0;
15 | h[6] = 0;
16 | h[7] = 0;
17 | h[8] = 0;
18 | h[9] = 0;
19 | }
20 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | /*
4 | h = f
5 | */
6 |
7 | void fe_copy(fe h,const fe f)
8 | {
9 | crypto_int32 f0 = f[0];
10 | crypto_int32 f1 = f[1];
11 | crypto_int32 f2 = f[2];
12 | crypto_int32 f3 = f[3];
13 | crypto_int32 f4 = f[4];
14 | crypto_int32 f5 = f[5];
15 | crypto_int32 f6 = f[6];
16 | crypto_int32 f7 = f[7];
17 | crypto_int32 f8 = f[8];
18 | crypto_int32 f9 = f[9];
19 | h[0] = f0;
20 | h[1] = f1;
21 | h[2] = f2;
22 | h[3] = f3;
23 | h[4] = f4;
24 | h[5] = f5;
25 | h[6] = f6;
26 | h[7] = f7;
27 | h[8] = f8;
28 | h[9] = f9;
29 | }
30 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | void fe_invert(fe out,const fe z)
4 | {
5 | fe t0;
6 | fe t1;
7 | fe t2;
8 | fe t3;
9 | int i;
10 |
11 | #include "pow225521.h"
12 |
13 | return;
14 | }
15 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | /*
4 | return 1 if f is in {1,3,5,...,q-2}
5 | return 0 if f is in {0,2,4,...,q-1}
6 |
7 | Preconditions:
8 | |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
9 | */
10 |
11 | int fe_isnegative(const fe f)
12 | {
13 | unsigned char s[32];
14 | fe_tobytes(s,f);
15 | return s[0] & 1;
16 | }
17 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 | #include "crypto_verify_32.h"
3 |
4 | /*
5 | return 1 if f == 0
6 | return 0 if f != 0
7 |
8 | Preconditions:
9 | |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
10 | */
11 |
12 | static unsigned char zero[32];
13 |
14 | int fe_isnonzero(const fe f)
15 | {
16 | unsigned char s[32];
17 | fe_tobytes(s,f);
18 | return crypto_verify_32(s,zero);
19 | }
20 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | /*
4 | h = -f
5 |
6 | Preconditions:
7 | |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
8 |
9 | Postconditions:
10 | |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
11 | */
12 |
13 | void fe_neg(fe h,const fe f)
14 | {
15 | crypto_int32 f0 = f[0];
16 | crypto_int32 f1 = f[1];
17 | crypto_int32 f2 = f[2];
18 | crypto_int32 f3 = f[3];
19 | crypto_int32 f4 = f[4];
20 | crypto_int32 f5 = f[5];
21 | crypto_int32 f6 = f[6];
22 | crypto_int32 f7 = f[7];
23 | crypto_int32 f8 = f[8];
24 | crypto_int32 f9 = f[9];
25 | crypto_int32 h0 = -f0;
26 | crypto_int32 h1 = -f1;
27 | crypto_int32 h2 = -f2;
28 | crypto_int32 h3 = -f3;
29 | crypto_int32 h4 = -f4;
30 | crypto_int32 h5 = -f5;
31 | crypto_int32 h6 = -f6;
32 | crypto_int32 h7 = -f7;
33 | crypto_int32 h8 = -f8;
34 | crypto_int32 h9 = -f9;
35 | h[0] = h0;
36 | h[1] = h1;
37 | h[2] = h2;
38 | h[3] = h3;
39 | h[4] = h4;
40 | h[5] = h5;
41 | h[6] = h6;
42 | h[7] = h7;
43 | h[8] = h8;
44 | h[9] = h9;
45 | }
46 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c:
--------------------------------------------------------------------------------
1 | #include "fe.h"
2 |
3 | void fe_pow22523(fe out,const fe z)
4 | {
5 | fe t0;
6 | fe t1;
7 | fe t2;
8 | int i;
9 |
10 | #include "pow22523.h"
11 |
12 | return;
13 | }
14 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p + q
5 | */
6 |
7 | void ge_add(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
8 | {
9 | fe t0;
10 | #include "ge_add.h"
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | static const fe d = {
4 | #include "d.h"
5 | } ;
6 |
7 | static const fe sqrtm1 = {
8 | #include "sqrtm1.h"
9 | } ;
10 |
11 | int ge_frombytes_negate_vartime(ge_p3 *h,const unsigned char *s)
12 | {
13 | fe u;
14 | fe v;
15 | fe v3;
16 | fe vxx;
17 | fe check;
18 |
19 | fe_frombytes(h->Y,s);
20 | fe_1(h->Z);
21 | fe_sq(u,h->Y);
22 | fe_mul(v,u,d);
23 | fe_sub(u,u,h->Z); /* u = y^2-1 */
24 | fe_add(v,v,h->Z); /* v = dy^2+1 */
25 |
26 | fe_sq(v3,v);
27 | fe_mul(v3,v3,v); /* v3 = v^3 */
28 | fe_sq(h->X,v3);
29 | fe_mul(h->X,h->X,v);
30 | fe_mul(h->X,h->X,u); /* x = uv^7 */
31 |
32 | fe_pow22523(h->X,h->X); /* x = (uv^7)^((q-5)/8) */
33 | fe_mul(h->X,h->X,v3);
34 | fe_mul(h->X,h->X,u); /* x = uv^3(uv^7)^((q-5)/8) */
35 |
36 | fe_sq(vxx,h->X);
37 | fe_mul(vxx,vxx,v);
38 | fe_sub(check,vxx,u); /* vx^2-u */
39 | if (fe_isnonzero(check)) {
40 | fe_add(check,vxx,u); /* vx^2+u */
41 | if (fe_isnonzero(check)) return -1;
42 | fe_mul(h->X,h->X,sqrtm1);
43 | }
44 |
45 | if (fe_isnegative(h->X) == (s[31] >> 7))
46 | fe_neg(h->X,h->X);
47 |
48 | fe_mul(h->T,h->X,h->Y);
49 | return 0;
50 | }
51 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p + q
5 | */
6 |
7 | void ge_madd(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
8 | {
9 | fe t0;
10 | #include "ge_madd.h"
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p - q
5 | */
6 |
7 | void ge_msub(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
8 | {
9 | fe t0;
10 | #include "ge_msub.h"
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p
5 | */
6 |
7 | extern void ge_p1p1_to_p2(ge_p2 *r,const ge_p1p1 *p)
8 | {
9 | fe_mul(r->X,p->X,p->T);
10 | fe_mul(r->Y,p->Y,p->Z);
11 | fe_mul(r->Z,p->Z,p->T);
12 | }
13 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p
5 | */
6 |
7 | extern void ge_p1p1_to_p3(ge_p3 *r,const ge_p1p1 *p)
8 | {
9 | fe_mul(r->X,p->X,p->T);
10 | fe_mul(r->Y,p->Y,p->Z);
11 | fe_mul(r->Z,p->Z,p->T);
12 | fe_mul(r->T,p->X,p->Y);
13 | }
14 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | void ge_p2_0(ge_p2 *h)
4 | {
5 | fe_0(h->X);
6 | fe_1(h->Y);
7 | fe_1(h->Z);
8 | }
9 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = 2 * p
5 | */
6 |
7 | void ge_p2_dbl(ge_p1p1 *r,const ge_p2 *p)
8 | {
9 | fe t0;
10 | #include "ge_p2_dbl.h"
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | void ge_p3_0(ge_p3 *h)
4 | {
5 | fe_0(h->X);
6 | fe_1(h->Y);
7 | fe_1(h->Z);
8 | fe_0(h->T);
9 | }
10 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = 2 * p
5 | */
6 |
7 | void ge_p3_dbl(ge_p1p1 *r,const ge_p3 *p)
8 | {
9 | ge_p2 q;
10 | ge_p3_to_p2(&q,p);
11 | ge_p2_dbl(r,&q);
12 | }
13 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p
5 | */
6 |
7 | static const fe d2 = {
8 | #include "d2.h"
9 | } ;
10 |
11 | extern void ge_p3_to_cached(ge_cached *r,const ge_p3 *p)
12 | {
13 | fe_add(r->YplusX,p->Y,p->X);
14 | fe_sub(r->YminusX,p->Y,p->X);
15 | fe_copy(r->Z,p->Z);
16 | fe_mul(r->T2d,p->T,d2);
17 | }
18 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p
5 | */
6 |
7 | extern void ge_p3_to_p2(ge_p2 *r,const ge_p3 *p)
8 | {
9 | fe_copy(r->X,p->X);
10 | fe_copy(r->Y,p->Y);
11 | fe_copy(r->Z,p->Z);
12 | }
13 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | void ge_p3_tobytes(unsigned char *s,const ge_p3 *h)
4 | {
5 | fe recip;
6 | fe x;
7 | fe y;
8 |
9 | fe_invert(recip,h->Z);
10 | fe_mul(x,h->X,recip);
11 | fe_mul(y,h->Y,recip);
12 | fe_tobytes(s,y);
13 | s[31] ^= fe_isnegative(x) << 7;
14 | }
15 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | void ge_precomp_0(ge_precomp *h)
4 | {
5 | fe_1(h->yplusx);
6 | fe_1(h->yminusx);
7 | fe_0(h->xy2d);
8 | }
9 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | /*
4 | r = p - q
5 | */
6 |
7 | void ge_sub(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
8 | {
9 | fe t0;
10 | #include "ge_sub.h"
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c:
--------------------------------------------------------------------------------
1 | #include "ge.h"
2 |
3 | void ge_tobytes(unsigned char *s,const ge_p2 *h)
4 | {
5 | fe recip;
6 | fe x;
7 | fe y;
8 |
9 | fe_invert(recip,h->Z);
10 | fe_mul(x,h->X,recip);
11 | fe_mul(y,h->Y,recip);
12 | fe_tobytes(s,y);
13 | s[31] ^= fe_isnegative(x) << 7;
14 | }
15 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h:
--------------------------------------------------------------------------------
1 | #ifndef SC_H
2 | #define SC_H
3 |
4 | /*
5 | The set of scalars is \Z/l
6 | where l = 2^252 + 27742317777372353535851937790883648493.
7 | */
8 |
9 | #define sc_reduce crypto_sign_ed25519_ref10_sc_reduce
10 | #define sc_muladd crypto_sign_ed25519_ref10_sc_muladd
11 |
12 | extern void sc_reduce(unsigned char *);
13 | extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *);
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h:
--------------------------------------------------------------------------------
1 | -32595792,-7943725,9377950,3500415,12389472,-272473,-25146209,-2005654,326686,11406482
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | #include "crypto_sign_ed25519.h"
5 |
6 | size_t
7 | crypto_sign_ed25519_bytes(void) {
8 | return crypto_sign_ed25519_BYTES;
9 | }
10 |
11 | size_t
12 | crypto_sign_ed25519_seedbytes(void) {
13 | return crypto_sign_ed25519_SEEDBYTES;
14 | }
15 |
16 | size_t
17 | crypto_sign_ed25519_publickeybytes(void) {
18 | return crypto_sign_ed25519_PUBLICKEYBYTES;
19 | }
20 |
21 | size_t
22 | crypto_sign_ed25519_secretkeybytes(void) {
23 | return crypto_sign_ed25519_SECRETKEYBYTES;
24 | }
25 |
26 | int
27 | crypto_sign_ed25519_sk_to_seed(unsigned char *seed, const unsigned char *sk)
28 | {
29 | memmove(seed, sk, crypto_sign_ed25519_SEEDBYTES);
30 | return 0;
31 | }
32 |
33 | int
34 | crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
35 | {
36 | memmove(pk, sk + crypto_sign_ed25519_SEEDBYTES,
37 | crypto_sign_ed25519_PUBLICKEYBYTES);
38 | return 0;
39 | }
40 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_sign_edwards25519sha512batch.h"
3 |
4 | #define crypto_sign crypto_sign_edwards25519sha512batch
5 | #define crypto_sign_open crypto_sign_edwards25519sha512batch_open
6 | #define crypto_sign_keypair crypto_sign_edwards25519sha512batch_keypair
7 | #define crypto_sign_BYTES crypto_sign_edwards25519sha512batch_BYTES
8 | #define crypto_sign_PUBLICKEYBYTES crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES
9 | #define crypto_sign_SECRETKEYBYTES crypto_sign_edwards25519sha512batch_SECRETKEYBYTES
10 | #define crypto_sign_IMPLEMENTATION crypto_sign_edwards25519sha512batch_IMPLEMENTATION
11 | #define crypto_sign_VERSION crypto_sign_edwards25519sha512batch_VERSION
12 |
13 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h:
--------------------------------------------------------------------------------
1 | #ifndef GE25519_H
2 | #define GE25519_H
3 |
4 | #include "fe25519.h"
5 | #include "sc25519.h"
6 |
7 | #define ge25519 crypto_sign_edwards25519sha512batch_ge25519
8 | #define ge25519_unpack_vartime crypto_sign_edwards25519sha512batch_ge25519_unpack_vartime
9 | #define ge25519_pack crypto_sign_edwards25519sha512batch_ge25519_pack
10 | #define ge25519_add crypto_sign_edwards25519sha512batch_ge25519_add
11 | #define ge25519_double crypto_sign_edwards25519sha512batch_ge25519_double
12 | #define ge25519_scalarmult crypto_sign_edwards25519sha512batch_ge25519_scalarmult
13 | #define ge25519_scalarmult_base crypto_sign_edwards25519sha512batch_ge25519_scalarmult_base
14 |
15 | typedef struct {
16 | fe25519 x;
17 | fe25519 y;
18 | fe25519 z;
19 | fe25519 t;
20 | } ge25519;
21 |
22 | int ge25519_unpack_vartime(ge25519 *r, const unsigned char p[32]);
23 |
24 | void ge25519_pack(unsigned char r[32], const ge25519 *p);
25 |
26 | void ge25519_add(ge25519 *r, const ge25519 *p, const ge25519 *q);
27 |
28 | void ge25519_double(ge25519 *r, const ge25519 *p);
29 |
30 | void ge25519_scalarmult(ge25519 *r, const ge25519 *p, const sc25519 *s);
31 |
32 | void ge25519_scalarmult_base(ge25519 *r, const sc25519 *s);
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_sign_edwards25519sha512batch.h"
2 |
3 | size_t
4 | crypto_sign_edwards25519sha512batch_bytes(void) {
5 | return crypto_sign_edwards25519sha512batch_BYTES;
6 | }
7 |
8 | size_t
9 | crypto_sign_edwards25519sha512batch_publickeybytes(void) {
10 | return crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES;
11 | }
12 |
13 | size_t
14 | crypto_sign_edwards25519sha512batch_secretkeybytes(void) {
15 | return crypto_sign_edwards25519sha512batch_SECRETKEYBYTES;
16 | }
17 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/aes128ctr/checksum:
--------------------------------------------------------------------------------
1 | 6e9966897837aae181e93261ae88fdf0
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_stream_aes128ctr.h"
3 |
4 | #define crypto_stream crypto_stream_aes128ctr
5 | #define crypto_stream_xor crypto_stream_aes128ctr_xor
6 | #define crypto_stream_beforenm crypto_stream_aes128ctr_beforenm
7 | #define crypto_stream_afternm crypto_stream_aes128ctr_afternm
8 | #define crypto_stream_xor_afternm crypto_stream_aes128ctr_xor_afternm
9 | #define crypto_stream_KEYBYTES crypto_stream_aes128ctr_KEYBYTES
10 | #define crypto_stream_NONCEBYTES crypto_stream_aes128ctr_NONCEBYTES
11 | #define crypto_stream_BEFORENMBYTES crypto_stream_aes128ctr_BEFORENMBYTES
12 | #define crypto_stream_IMPLEMENTATION crypto_stream_aes128ctr_IMPLEMENTATION
13 | #define crypto_stream_VERSION crypto_stream_aes128ctr_VERSION
14 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h:
--------------------------------------------------------------------------------
1 | #ifndef CONSTS_H
2 | #define CONSTS_H
3 |
4 | #include "int128.h"
5 |
6 | #define ROTB crypto_stream_aes128ctr_portable_ROTB
7 | #define M0 crypto_stream_aes128ctr_portable_M0
8 | #define EXPB0 crypto_stream_aes128ctr_portable_EXPB0
9 | #define SWAP32 crypto_stream_aes128ctr_portable_SWAP32
10 | #define M0SWAP crypto_stream_aes128ctr_portable_M0SWAP
11 | #define SR crypto_stream_aes128ctr_portable_SR
12 | #define SRM0 crypto_stream_aes128ctr_portable_SRM0
13 | #define BS0 crypto_stream_aes128ctr_portable_BS0
14 | #define BS1 crypto_stream_aes128ctr_portable_BS1
15 | #define BS2 crypto_stream_aes128ctr_portable_BS2
16 |
17 | extern const unsigned char ROTB[16];
18 | extern const unsigned char M0[16];
19 | extern const unsigned char EXPB0[16];
20 | extern const unsigned char SWAP32[16];
21 | extern const unsigned char M0SWAP[16];
22 | extern const unsigned char SR[16];
23 | extern const unsigned char SRM0[16];
24 | extern const int128 BS0;
25 | extern const int128 BS1;
26 | extern const int128 BS2;
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c:
--------------------------------------------------------------------------------
1 | #include "consts.h"
2 |
3 | const unsigned char ROTB[16] = {0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08};
4 | const unsigned char M0[16] = {0x0f, 0x0b, 0x07, 0x03, 0x0e, 0x0a, 0x06, 0x02, 0x0d, 0x09, 0x05, 0x01, 0x0c, 0x08, 0x04, 0x00};
5 | const unsigned char EXPB0[16] = {0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0f, 0x0f, 0x0f, 0x0f};
6 |
7 | const unsigned char SWAP32[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c};
8 | const unsigned char M0SWAP[16] = {0x0c, 0x08, 0x04, 0x00, 0x0d, 0x09, 0x05, 0x01, 0x0e, 0x0a, 0x06, 0x02, 0x0f, 0x0b, 0x07, 0x03};
9 | const unsigned char SR[16] = {0x01, 0x02, 0x03, 0x00, 0x06, 0x07, 0x04, 0x05, 0x0b, 0x08, 0x09, 0x0a, 0x0c, 0x0d, 0x0e, 0x0f};
10 | const unsigned char SRM0[16] = {0x0f, 0x0a, 0x05, 0x00, 0x0e, 0x09, 0x04, 0x03, 0x0d, 0x08, 0x07, 0x02, 0x0c, 0x0b, 0x06, 0x01};
11 |
12 | const int128 BS0 = {{0x5555555555555555ULL, 0x5555555555555555ULL}};
13 | const int128 BS1 = {{0x3333333333333333ULL, 0x3333333333333333ULL}};
14 | const int128 BS2 = {{0x0f0f0f0f0f0f0f0fULL, 0x0f0f0f0f0f0f0f0fULL}};
15 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 |
3 | int crypto_stream(
4 | unsigned char *out,
5 | unsigned long long outlen,
6 | const unsigned char *n,
7 | const unsigned char *k
8 | )
9 | {
10 | unsigned char d[crypto_stream_BEFORENMBYTES];
11 | crypto_stream_beforenm(d, k);
12 | crypto_stream_afternm(out, outlen, n, d);
13 | return 0;
14 | }
15 |
16 | int crypto_stream_xor(
17 | unsigned char *out,
18 | const unsigned char *in,
19 | unsigned long long inlen,
20 | const unsigned char *n,
21 | const unsigned char *k
22 | )
23 | {
24 | unsigned char d[crypto_stream_BEFORENMBYTES];
25 | crypto_stream_beforenm(d, k);
26 | crypto_stream_xor_afternm(out, in, inlen, n, d);
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h:
--------------------------------------------------------------------------------
1 | #ifndef TYPES_H
2 | #define TYPES_H
3 |
4 | #include "crypto_uint32.h"
5 | typedef crypto_uint32 uint32;
6 |
7 | #include "crypto_uint64.h"
8 | typedef crypto_uint64 uint64;
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_stream_aes128ctr.h"
2 |
3 | size_t
4 | crypto_stream_aes128ctr_keybytes(void) {
5 | return crypto_stream_aes128ctr_KEYBYTES;
6 | }
7 |
8 | size_t
9 | crypto_stream_aes128ctr_noncebytes(void) {
10 | return crypto_stream_aes128ctr_NONCEBYTES;
11 | }
12 |
13 | size_t
14 | crypto_stream_aes128ctr_beforenmbytes(void) {
15 | return crypto_stream_aes128ctr_BEFORENMBYTES;
16 | }
17 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_stream_chacha20.h"
3 |
4 | int
5 | crypto_stream_chacha20_ref(unsigned char *c, unsigned long long clen,
6 | const unsigned char *n, const unsigned char *k);
7 |
8 | int
9 | crypto_stream_chacha20_ref_xor_ic(unsigned char *c, const unsigned char *m,
10 | unsigned long long mlen,
11 | const unsigned char *n, uint64_t ic,
12 | const unsigned char *k);
13 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_stream_chacha20.h"
2 | #include "ref/api.h"
3 |
4 | size_t
5 | crypto_stream_chacha20_keybytes(void) {
6 | return crypto_stream_chacha20_KEYBYTES;
7 | }
8 |
9 | size_t
10 | crypto_stream_chacha20_noncebytes(void) {
11 | return crypto_stream_chacha20_NONCEBYTES;
12 | }
13 |
14 | int
15 | crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
16 | const unsigned char *n, const unsigned char *k)
17 | {
18 | return crypto_stream_chacha20_ref(c, clen, n, k);
19 | }
20 |
21 | int
22 | crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
23 | unsigned long long mlen,
24 | const unsigned char *n, uint64_t ic,
25 | const unsigned char *k)
26 | {
27 | return crypto_stream_chacha20_ref_xor_ic(c, m, mlen, n, ic, k);
28 | }
29 |
30 | int
31 | crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
32 | unsigned long long mlen, const unsigned char *n,
33 | const unsigned char *k)
34 | {
35 | return crypto_stream_chacha20_ref_xor_ic(c, m, mlen, n, 0U, k);
36 | }
37 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/crypto_stream.c:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_stream.h"
3 |
4 | size_t
5 | crypto_stream_keybytes(void)
6 | {
7 | return crypto_stream_KEYBYTES;
8 | }
9 |
10 | size_t
11 | crypto_stream_noncebytes(void)
12 | {
13 | return crypto_stream_NONCEBYTES;
14 | }
15 |
16 | const char *
17 | crypto_stream_primitive(void)
18 | {
19 | return crypto_stream_PRIMITIVE;
20 | }
21 |
22 | int
23 | crypto_stream(unsigned char *c, unsigned long long clen,
24 | const unsigned char *n, const unsigned char *k)
25 | {
26 | return crypto_stream_xsalsa20(c, clen, n, k);
27 | }
28 |
29 |
30 | int
31 | crypto_stream_xor(unsigned char *c, const unsigned char *m,
32 | unsigned long long mlen, const unsigned char *n,
33 | const unsigned char *k)
34 | {
35 | return crypto_stream_xsalsa20_xor(c, m, mlen, n, k);
36 | }
37 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h:
--------------------------------------------------------------------------------
1 | #include "crypto_stream_salsa20.h"
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa20/checksum:
--------------------------------------------------------------------------------
1 | 44a3966eabcd3a2b13faca2150e38f2b7e6bac187d626618f50a9f875158ae78
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_stream_salsa20.h"
3 |
4 | #define crypto_stream crypto_stream_salsa20
5 | #define crypto_stream_xor crypto_stream_salsa20_xor
6 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_stream_salsa20.h"
2 |
3 | size_t
4 | crypto_stream_salsa20_keybytes(void) {
5 | return crypto_stream_salsa20_KEYBYTES;
6 | }
7 |
8 | size_t
9 | crypto_stream_salsa20_noncebytes(void) {
10 | return crypto_stream_salsa20_NONCEBYTES;
11 | }
12 |
13 | int
14 | crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
15 | unsigned long long mlen, const unsigned char *n,
16 | const unsigned char *k)
17 | {
18 | return crypto_stream_salsa20_xor_ic(c, m, mlen, n, 0U, k);
19 | }
20 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa2012/checksum:
--------------------------------------------------------------------------------
1 | ecc758f200061c3cc770b25797da73583548d4f90f69a967fbbe1a6d94d1705c
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_stream_salsa2012.h"
3 |
4 | #define crypto_stream crypto_stream_salsa2012
5 | #define crypto_stream_xor crypto_stream_salsa2012_xor
6 | #define crypto_stream_KEYBYTES crypto_stream_salsa2012_KEYBYTES
7 | #define crypto_stream_NONCEBYTES crypto_stream_salsa2012_NONCEBYTES
8 | #define crypto_stream_IMPLEMENTATION crypto_stream_salsa2012_IMPLEMENTATION
9 | #define crypto_stream_VERSION crypto_stream_salsa2012_VERSION
10 |
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c:
--------------------------------------------------------------------------------
1 | /*
2 | version 20080913
3 | D. J. Bernstein
4 | Public domain.
5 | */
6 |
7 | #include "api.h"
8 | #include "crypto_core_salsa2012.h"
9 |
10 | typedef unsigned int uint32;
11 |
12 | static const unsigned char sigma[16] = {
13 | 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
14 | };
15 |
16 | int crypto_stream(
17 | unsigned char *c,unsigned long long clen,
18 | const unsigned char *n,
19 | const unsigned char *k
20 | )
21 | {
22 | unsigned char in[16];
23 | unsigned char block[64];
24 | unsigned long long i;
25 | unsigned int u;
26 |
27 | if (!clen) return 0;
28 |
29 | for (i = 0;i < 8;++i) in[i] = n[i];
30 | for (i = 8;i < 16;++i) in[i] = 0;
31 |
32 | while (clen >= 64) {
33 | crypto_core_salsa2012(c,in,k,sigma);
34 |
35 | u = 1;
36 | for (i = 8;i < 16;++i) {
37 | u += (unsigned int) in[i];
38 | in[i] = u;
39 | u >>= 8;
40 | }
41 |
42 | clen -= 64;
43 | c += 64;
44 | }
45 |
46 | if (clen) {
47 | crypto_core_salsa2012(block,in,k,sigma);
48 | for (i = 0;i < clen;++i) c[i] = block[i];
49 | }
50 | return 0;
51 | }
52 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c:
--------------------------------------------------------------------------------
1 | /*
2 | version 20080913
3 | D. J. Bernstein
4 | Public domain.
5 | */
6 |
7 | #include "api.h"
8 | #include "crypto_core_salsa2012.h"
9 |
10 | typedef unsigned int uint32;
11 |
12 | static const unsigned char sigma[16] = {
13 | 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
14 | };
15 |
16 | int crypto_stream_xor(
17 | unsigned char *c,
18 | const unsigned char *m,unsigned long long mlen,
19 | const unsigned char *n,
20 | const unsigned char *k
21 | )
22 | {
23 | unsigned char in[16];
24 | unsigned char block[64];
25 | unsigned long long i;
26 | unsigned int u;
27 |
28 | if (!mlen) return 0;
29 |
30 | for (i = 0;i < 8;++i) in[i] = n[i];
31 | for (i = 8;i < 16;++i) in[i] = 0;
32 |
33 | while (mlen >= 64) {
34 | crypto_core_salsa2012(block,in,k,sigma);
35 | for (i = 0;i < 64;++i) c[i] = m[i] ^ block[i];
36 |
37 | u = 1;
38 | for (i = 8;i < 16;++i) {
39 | u += (unsigned int) in[i];
40 | in[i] = u;
41 | u >>= 8;
42 | }
43 |
44 | mlen -= 64;
45 | c += 64;
46 | m += 64;
47 | }
48 |
49 | if (mlen) {
50 | crypto_core_salsa2012(block,in,k,sigma);
51 | for (i = 0;i < mlen;++i) c[i] = m[i] ^ block[i];
52 | }
53 | return 0;
54 | }
55 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_stream_salsa2012.h"
2 |
3 | size_t
4 | crypto_stream_salsa2012_keybytes(void) {
5 | return crypto_stream_salsa2012_KEYBYTES;
6 | }
7 |
8 | size_t
9 | crypto_stream_salsa2012_noncebytes(void) {
10 | return crypto_stream_salsa2012_NONCEBYTES;
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa208/checksum:
--------------------------------------------------------------------------------
1 | 05f32b0647417aaa446b0b3127318133cf9af32b771869eab267000bf02710cd
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_stream_salsa208.h"
3 |
4 | #define crypto_stream crypto_stream_salsa208
5 | #define crypto_stream_xor crypto_stream_salsa208_xor
6 | #define crypto_stream_KEYBYTES crypto_stream_salsa208_KEYBYTES
7 | #define crypto_stream_NONCEBYTES crypto_stream_salsa208_NONCEBYTES
8 | #define crypto_stream_IMPLEMENTATION crypto_stream_salsa208_IMPLEMENTATION
9 | #define crypto_stream_VERSION crypto_stream_salsa208_VERSION
10 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c:
--------------------------------------------------------------------------------
1 | /*
2 | version 20080913
3 | D. J. Bernstein
4 | Public domain.
5 | */
6 |
7 | #include "api.h"
8 | #include "crypto_core_salsa208.h"
9 |
10 | typedef unsigned int uint32;
11 |
12 | static const unsigned char sigma[16] = {
13 | 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
14 | };
15 |
16 | int crypto_stream(
17 | unsigned char *c,unsigned long long clen,
18 | const unsigned char *n,
19 | const unsigned char *k
20 | )
21 | {
22 | unsigned char in[16];
23 | unsigned char block[64];
24 | unsigned long long i;
25 | unsigned int u;
26 |
27 | if (!clen) return 0;
28 |
29 | for (i = 0;i < 8;++i) in[i] = n[i];
30 | for (i = 8;i < 16;++i) in[i] = 0;
31 |
32 | while (clen >= 64) {
33 | crypto_core_salsa208(c,in,k,sigma);
34 |
35 | u = 1;
36 | for (i = 8;i < 16;++i) {
37 | u += (unsigned int) in[i];
38 | in[i] = u;
39 | u >>= 8;
40 | }
41 |
42 | clen -= 64;
43 | c += 64;
44 | }
45 |
46 | if (clen) {
47 | crypto_core_salsa208(block,in,k,sigma);
48 | for (i = 0;i < clen;++i) c[i] = block[i];
49 | }
50 | return 0;
51 | }
52 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c:
--------------------------------------------------------------------------------
1 | /*
2 | version 20080913
3 | D. J. Bernstein
4 | Public domain.
5 | */
6 |
7 | #include "api.h"
8 | #include "crypto_core_salsa208.h"
9 |
10 | typedef unsigned int uint32;
11 |
12 | static const unsigned char sigma[16] = {
13 | 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
14 | };
15 |
16 | int crypto_stream_xor(
17 | unsigned char *c,
18 | const unsigned char *m,unsigned long long mlen,
19 | const unsigned char *n,
20 | const unsigned char *k
21 | )
22 | {
23 | unsigned char in[16];
24 | unsigned char block[64];
25 | unsigned long long i;
26 | unsigned int u;
27 |
28 | if (!mlen) return 0;
29 |
30 | for (i = 0;i < 8;++i) in[i] = n[i];
31 | for (i = 8;i < 16;++i) in[i] = 0;
32 |
33 | while (mlen >= 64) {
34 | crypto_core_salsa208(block,in,k,sigma);
35 | for (i = 0;i < 64;++i) c[i] = m[i] ^ block[i];
36 |
37 | u = 1;
38 | for (i = 8;i < 16;++i) {
39 | u += (unsigned int) in[i];
40 | in[i] = u;
41 | u >>= 8;
42 | }
43 |
44 | mlen -= 64;
45 | c += 64;
46 | m += 64;
47 | }
48 |
49 | if (mlen) {
50 | crypto_core_salsa208(block,in,k,sigma);
51 | for (i = 0;i < mlen;++i) c[i] = m[i] ^ block[i];
52 | }
53 | return 0;
54 | }
55 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_stream_salsa208.h"
2 |
3 | size_t
4 | crypto_stream_salsa208_keybytes(void) {
5 | return crypto_stream_salsa208_KEYBYTES;
6 | }
7 |
8 | size_t
9 | crypto_stream_salsa208_noncebytes(void) {
10 | return crypto_stream_salsa208_NONCEBYTES;
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/xsalsa20/checksum:
--------------------------------------------------------------------------------
1 | 201bc58a96adcb6ed339ca33c188af8ca04a4ce68be1e0953309ee09a0cf8e7a
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_stream_xsalsa20.h"
3 |
4 | #define crypto_stream crypto_stream_xsalsa20
5 | #define crypto_stream_xor crypto_stream_xsalsa20_xor
6 | #define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
7 | #define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
8 | #define crypto_stream_IMPLEMENTATION crypto_stream_xsalsa20_IMPLEMENTATION
9 | #define crypto_stream_VERSION crypto_stream_xsalsa20_VERSION
10 |
11 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c:
--------------------------------------------------------------------------------
1 | /*
2 | version 20080914
3 | D. J. Bernstein
4 | Public domain.
5 | */
6 |
7 | #include "api.h"
8 | #include "crypto_core_hsalsa20.h"
9 | #include "crypto_stream_salsa20.h"
10 |
11 | static const unsigned char sigma[16] = {
12 | 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
13 | };
14 |
15 | int crypto_stream(
16 | unsigned char *c,unsigned long long clen,
17 | const unsigned char *n,
18 | const unsigned char *k
19 | )
20 | {
21 | unsigned char subkey[32];
22 | crypto_core_hsalsa20(subkey,n,k,sigma);
23 | return crypto_stream_salsa20(c,clen,n + 16,subkey);
24 | }
25 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c:
--------------------------------------------------------------------------------
1 | /*
2 | version 20080913
3 | D. J. Bernstein
4 | Public domain.
5 | */
6 |
7 | #include "api.h"
8 | #include "crypto_core_hsalsa20.h"
9 | #include "crypto_stream_salsa20.h"
10 |
11 | static const unsigned char sigma[16] = {
12 | 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
13 | };
14 |
15 | int crypto_stream_xor(
16 | unsigned char *c,
17 | const unsigned char *m,unsigned long long mlen,
18 | const unsigned char *n,
19 | const unsigned char *k
20 | )
21 | {
22 | unsigned char subkey[32];
23 | crypto_core_hsalsa20(subkey,n,k,sigma);
24 | return crypto_stream_salsa20_xor(c,m,mlen,n + 16,subkey);
25 | }
26 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_stream_xsalsa20.h"
2 |
3 | size_t
4 | crypto_stream_xsalsa20_keybytes(void) {
5 | return crypto_stream_xsalsa20_KEYBYTES;
6 | }
7 |
8 | size_t
9 | crypto_stream_xsalsa20_noncebytes(void) {
10 | return crypto_stream_xsalsa20_NONCEBYTES;
11 | }
12 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/16/checksum:
--------------------------------------------------------------------------------
1 | 0
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/16/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_verify_16.h"
3 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 |
3 | int crypto_verify_16(const unsigned char *x,const unsigned char *y)
4 | {
5 | unsigned int differentbits = 0;
6 | #define F(i) differentbits |= x[i] ^ y[i];
7 | F(0)
8 | F(1)
9 | F(2)
10 | F(3)
11 | F(4)
12 | F(5)
13 | F(6)
14 | F(7)
15 | F(8)
16 | F(9)
17 | F(10)
18 | F(11)
19 | F(12)
20 | F(13)
21 | F(14)
22 | F(15)
23 | return (1 & ((differentbits - 1) >> 8)) - 1;
24 | }
25 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_verify_16.h"
2 |
3 | size_t
4 | crypto_verify_16_bytes(void) {
5 | return crypto_verify_16_BYTES;
6 | }
7 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/32/checksum:
--------------------------------------------------------------------------------
1 | 0
2 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/32/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_verify_32.h"
3 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 |
3 | int crypto_verify_32(const unsigned char *x,const unsigned char *y)
4 | {
5 | unsigned int differentbits = 0;
6 | #define F(i) differentbits |= x[i] ^ y[i];
7 | F(0)
8 | F(1)
9 | F(2)
10 | F(3)
11 | F(4)
12 | F(5)
13 | F(6)
14 | F(7)
15 | F(8)
16 | F(9)
17 | F(10)
18 | F(11)
19 | F(12)
20 | F(13)
21 | F(14)
22 | F(15)
23 | F(16)
24 | F(17)
25 | F(18)
26 | F(19)
27 | F(20)
28 | F(21)
29 | F(22)
30 | F(23)
31 | F(24)
32 | F(25)
33 | F(26)
34 | F(27)
35 | F(28)
36 | F(29)
37 | F(30)
38 | F(31)
39 | return (1 & ((differentbits - 1) >> 8)) - 1;
40 | }
41 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_verify_32.h"
2 |
3 | size_t
4 | crypto_verify_32_bytes(void) {
5 | return crypto_verify_32_BYTES;
6 | }
7 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/64/ref/api.h:
--------------------------------------------------------------------------------
1 |
2 | #include "crypto_verify_64.h"
3 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c:
--------------------------------------------------------------------------------
1 | #include "api.h"
2 |
3 | int crypto_verify_64(const unsigned char *x,const unsigned char *y)
4 | {
5 | unsigned int differentbits = 0;
6 | #define F(i) differentbits |= x[i] ^ y[i];
7 | F(0)
8 | F(1)
9 | F(2)
10 | F(3)
11 | F(4)
12 | F(5)
13 | F(6)
14 | F(7)
15 | F(8)
16 | F(9)
17 | F(10)
18 | F(11)
19 | F(12)
20 | F(13)
21 | F(14)
22 | F(15)
23 | F(16)
24 | F(17)
25 | F(18)
26 | F(19)
27 | F(20)
28 | F(21)
29 | F(22)
30 | F(23)
31 | F(24)
32 | F(25)
33 | F(26)
34 | F(27)
35 | F(28)
36 | F(29)
37 | F(30)
38 | F(31)
39 | F(32)
40 | F(33)
41 | F(34)
42 | F(35)
43 | F(36)
44 | F(37)
45 | F(38)
46 | F(39)
47 | F(40)
48 | F(41)
49 | F(42)
50 | F(43)
51 | F(44)
52 | F(45)
53 | F(46)
54 | F(47)
55 | F(48)
56 | F(49)
57 | F(50)
58 | F(51)
59 | F(52)
60 | F(53)
61 | F(54)
62 | F(55)
63 | F(56)
64 | F(57)
65 | F(58)
66 | F(59)
67 | F(60)
68 | F(61)
69 | F(62)
70 | F(63)
71 | return (1 & ((differentbits - 1) >> 8)) - 1;
72 | }
73 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c:
--------------------------------------------------------------------------------
1 | #include "crypto_verify_64.h"
2 |
3 | size_t
4 | crypto_verify_64_bytes(void) {
5 | return crypto_verify_64_BYTES;
6 | }
7 |
--------------------------------------------------------------------------------
/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 |
14 | #ifdef __cplusplus
15 | }
16 | #endif
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/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 | # if __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 | #ifdef __cplusplus
36 | }
37 | #endif
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
15 | #define crypto_core_salsa208_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_salsa208_inputbytes(void);
18 |
19 | #define crypto_core_salsa208_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_salsa208_keybytes(void);
22 |
23 | #define crypto_core_salsa208_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_salsa208_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_salsa208(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 |
--------------------------------------------------------------------------------
/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 | # if __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 |
35 | #ifdef __cplusplus
36 | }
37 | #endif
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/crypto_int32.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_int32_H
2 | #define crypto_int32_H
3 |
4 | #include
5 |
6 | typedef int32_t crypto_int32;
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/crypto_int64.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_int64_H
2 | #define crypto_int64_H
3 |
4 | #include
5 |
6 | typedef int64_t crypto_int64;
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/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 | SODIUM_EXPORT
29 | int crypto_scalarmult(unsigned char *q, const unsigned char *n,
30 | const unsigned char *p);
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/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 | SODIUM_EXPORT
21 | int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
22 | const unsigned char *p);
23 |
24 | SODIUM_EXPORT
25 | int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/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 | # if __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 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/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 | # if __GNUC__
9 | # pragma GCC diagnostic ignored "-Wlong-long"
10 | # endif
11 | extern "C" {
12 | #endif
13 |
14 | #define crypto_shorthash_siphash24_BYTES 8U
15 | SODIUM_EXPORT
16 | size_t crypto_shorthash_siphash24_bytes(void);
17 |
18 | #define crypto_shorthash_siphash24_KEYBYTES 16U
19 | SODIUM_EXPORT
20 | size_t crypto_shorthash_siphash24_keybytes(void);
21 |
22 | SODIUM_EXPORT
23 | int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in,
24 | unsigned long long inlen, const unsigned char *k);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/crypto_uint16.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_uint16_H
2 | #define crypto_uint16_H
3 |
4 | #include
5 |
6 | typedef uint16_t crypto_uint16;
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/crypto_uint32.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_uint32_H
2 | #define crypto_uint32_H
3 |
4 | #include
5 |
6 | typedef uint32_t crypto_uint32;
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/crypto_uint64.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_uint64_H
2 | #define crypto_uint64_H
3 |
4 | #include
5 |
6 | typedef uint64_t crypto_uint64;
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/crypto_uint8.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_uint8_H
2 | #define crypto_uint8_H
3 |
4 | #include
5 |
6 | typedef uint8_t crypto_uint8;
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/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 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/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 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/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 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/export.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_export_H
3 | #define sodium_export_H
4 |
5 | #ifndef __GNUC__
6 | # ifdef __attribute__
7 | # undef __attribute__
8 | # endif
9 | # define __attribute__(a)
10 | #endif
11 |
12 | #ifdef SODIUM_STATIC
13 | # define SODIUM_EXPORT
14 | #else
15 | # if defined(_MSC_VER)
16 | # ifdef SODIUM_DLL_EXPORT
17 | # define SODIUM_EXPORT __declspec(dllexport)
18 | # else
19 | # define SODIUM_EXPORT __declspec(dllimport)
20 | # endif
21 | # else
22 | # if defined(__SUNPRO_C)
23 | # define SODIUM_EXPORT __attribute__ __global
24 | # elif defined(_MSG_VER)
25 | # define SODIUM_EXPORT extern __declspec(dllexport)
26 | # else
27 | # define SODIUM_EXPORT __attribute__ ((visibility ("default")))
28 | # endif
29 | # endif
30 | #endif
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef randombytes_salsa20_random_H
3 | #define randombytes_salsa20_random_H
4 |
5 | /*
6 | * THREAD SAFETY: randombytes_salsa20_random*() functions are
7 | * fork()-safe but not thread-safe.
8 | * Always wrap them in a mutex if you need thread safety.
9 | */
10 |
11 | #include
12 | #include
13 |
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 | SODIUM_EXPORT
21 | extern struct randombytes_implementation randombytes_salsa20_implementation;
22 |
23 | SODIUM_EXPORT
24 | const char *randombytes_salsa20_implementation_name(void);
25 |
26 | SODIUM_EXPORT
27 | uint32_t randombytes_salsa20_random(void);
28 |
29 | SODIUM_EXPORT
30 | void randombytes_salsa20_random_stir(void);
31 |
32 | SODIUM_EXPORT
33 | uint32_t randombytes_salsa20_random_uniform(const uint32_t upper_bound);
34 |
35 | SODIUM_EXPORT
36 | void randombytes_salsa20_random_buf(void * const buf, const size_t size);
37 |
38 | SODIUM_EXPORT
39 | int randombytes_salsa20_random_close(void);
40 |
41 | #ifdef __cplusplus
42 | }
43 | #endif
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef randombytes_sysrandom_H
3 | #define randombytes_sysrandom_H
4 |
5 | /*
6 | * THREAD SAFETY: randombytes_sysrandom() functions are thread-safe,
7 | * provided that you called sodium_init() once before using any
8 | * other libsodium function.
9 | */
10 |
11 | #include
12 | #include
13 |
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 | SODIUM_EXPORT
21 | extern struct randombytes_implementation randombytes_sysrandom_implementation;
22 |
23 | SODIUM_EXPORT
24 | const char *randombytes_sysrandom_implementation_name(void);
25 |
26 | SODIUM_EXPORT
27 | uint32_t randombytes_sysrandom(void);
28 |
29 | SODIUM_EXPORT
30 | void randombytes_sysrandom_stir(void);
31 |
32 | SODIUM_EXPORT
33 | uint32_t randombytes_sysrandom_uniform(const uint32_t upper_bound);
34 |
35 | SODIUM_EXPORT
36 | void randombytes_sysrandom_buf(void * const buf, const size_t size);
37 |
38 | SODIUM_EXPORT
39 | int randombytes_sysrandom_close(void);
40 |
41 | #ifdef __cplusplus
42 | }
43 | #endif
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/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
12 | int sodium_runtime_get_cpu_features(void);
13 |
14 | SODIUM_EXPORT
15 | int sodium_runtime_has_neon(void);
16 |
17 | SODIUM_EXPORT
18 | int sodium_runtime_has_sse2(void);
19 |
20 | SODIUM_EXPORT
21 | int sodium_runtime_has_sse3(void);
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/include/sodium/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.1"
8 |
9 | #define SODIUM_LIBRARY_VERSION_MAJOR 7
10 | #define SODIUM_LIBRARY_VERSION_MINOR 3
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 | #ifdef __cplusplus
26 | }
27 | #endif
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/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 |
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 | #ifdef __cplusplus
26 | }
27 | #endif
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/libsodium/src/libsodium/sodium/core.c:
--------------------------------------------------------------------------------
1 |
2 | #include "core.h"
3 | #include "crypto_onetimeauth.h"
4 | #include "randombytes.h"
5 | #include "runtime.h"
6 | #include "utils.h"
7 |
8 | static int initialized;
9 |
10 | int
11 | sodium_init(void)
12 | {
13 | if (initialized != 0) {
14 | return 1;
15 | }
16 | sodium_runtime_get_cpu_features();
17 | if (crypto_onetimeauth_pick_best_implementation() == NULL) {
18 | return -1; /* LCOV_EXCL_LINE */
19 | }
20 | randombytes_stir();
21 | _sodium_alloc_init();
22 | initialized = 1;
23 |
24 | return 0;
25 | }
26 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/libsodium/test/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS = \
2 | default
3 |
4 | EXTRA_DIST = \
5 | quirks/windows/windows-quirks.h
6 |
--------------------------------------------------------------------------------
/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 | 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 | unsigned char c[50]
12 | = { 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
13 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
14 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
15 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
16 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd };
17 |
18 | unsigned char a[32];
19 |
20 | int main(void)
21 | {
22 | int i;
23 |
24 | crypto_auth_hmacsha256(a, c, sizeof c, key);
25 | for (i = 0; i < 32; ++i) {
26 | printf(",0x%02x", (unsigned int)a[i]);
27 | if (i % 8 == 7)
28 | printf("\n");
29 | }
30 | return 0;
31 | }
32 |
--------------------------------------------------------------------------------
/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 | 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 | unsigned char c[50]
12 | = { 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
13 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
14 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
15 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
16 | 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd };
17 |
18 | unsigned char a[32]
19 | = { 0x37, 0x2e, 0xfc, 0xf9, 0xb4, 0x0b, 0x35, 0xc2, 0x11, 0x5b, 0x13,
20 | 0x46, 0x90, 0x3d, 0x2e, 0xf4, 0x2f, 0xce, 0xd4, 0x6f, 0x08, 0x46,
21 | 0xe7, 0x25, 0x7b, 0xb1, 0x56, 0xd3, 0xd7, 0xb3, 0x0d, 0x3f };
22 |
23 | int main(void)
24 | {
25 | printf("%d\n", crypto_auth_hmacsha256_verify(a, c, sizeof c, key));
26 |
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/libsodium/test/default/auth5.c:
--------------------------------------------------------------------------------
1 |
2 | #include "windows/windows-quirks.h"
3 |
4 | #define TEST_NAME "auth5"
5 | #include "cmptest.h"
6 |
7 | unsigned char key[32];
8 | unsigned char c[10000];
9 | unsigned char a[32];
10 |
11 | int main(void)
12 | {
13 | size_t clen;
14 |
15 | for (clen = 0; clen < 10000; ++clen) {
16 | randombytes_buf(key, sizeof key);
17 | randombytes_buf(c, clen);
18 | crypto_auth(a, c, clen, key);
19 | if (crypto_auth_verify(a, c, clen, key) != 0) {
20 | printf("fail %u\n", (unsigned int) clen);
21 | return 100;
22 | }
23 | if (clen > 0) {
24 | c[rand() % clen] += 1 + (rand() % 255);
25 | if (crypto_auth_verify(a, c, clen, key) == 0) {
26 | printf("forgery %u\n", (unsigned int) clen);
27 | return 100;
28 | }
29 | a[rand() % sizeof a] += 1 + (rand() % 255);
30 | if (crypto_auth_verify(a, c, clen, key) == 0) {
31 | printf("forgery %u\n", (unsigned int) clen);
32 | return 100;
33 | }
34 | }
35 | }
36 | return 0;
37 | }
38 |
--------------------------------------------------------------------------------
/libsodium/test/default/auth6.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "auth6"
3 | #include "cmptest.h"
4 |
5 | /* "Test Case 2" from RFC 4231 */
6 | unsigned char key[32] = "Jefe";
7 | unsigned char c[] = "what do ya want for nothing?";
8 |
9 | unsigned char a[64];
10 |
11 | int main(void)
12 | {
13 | int i;
14 |
15 | crypto_auth_hmacsha512(a, c, sizeof c - 1U, key);
16 | for (i = 0; i < 64; ++i) {
17 | printf(",0x%02x", (unsigned int)a[i]);
18 | if (i % 8 == 7)
19 | printf("\n");
20 | }
21 | return 0;
22 | }
23 |
--------------------------------------------------------------------------------
/libsodium/test/default/auth7.c:
--------------------------------------------------------------------------------
1 |
2 | #include "windows/windows-quirks.h"
3 |
4 | #define TEST_NAME "auth7"
5 | #include "cmptest.h"
6 |
7 | unsigned char key[32];
8 | unsigned char c[10000];
9 | unsigned char a[64];
10 |
11 | int main(void)
12 | {
13 | int clen;
14 |
15 | for (clen = 0; clen < 10000; ++clen) {
16 | randombytes_buf(key, sizeof key);
17 | randombytes_buf(c, clen);
18 | crypto_auth_hmacsha512(a, c, clen, key);
19 | if (crypto_auth_hmacsha512_verify(a, c, clen, key) != 0) {
20 | printf("fail %d\n", clen);
21 | return 100;
22 | }
23 | if (clen > 0) {
24 | c[rand() % clen] += 1 + (rand() % 255);
25 | if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) {
26 | printf("forgery %d\n", clen);
27 | return 100;
28 | }
29 | a[rand() % sizeof a] += 1 + (rand() % 255);
30 | if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) {
31 | printf("forgery %d\n", clen);
32 | return 100;
33 | }
34 | }
35 | }
36 | return 0;
37 | }
38 |
--------------------------------------------------------------------------------
/libsodium/test/default/box7.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "box7"
3 | #include "cmptest.h"
4 |
5 | unsigned char alicesk[crypto_box_SECRETKEYBYTES];
6 | unsigned char alicepk[crypto_box_PUBLICKEYBYTES];
7 | unsigned char bobsk[crypto_box_SECRETKEYBYTES];
8 | unsigned char bobpk[crypto_box_PUBLICKEYBYTES];
9 | unsigned char n[crypto_box_NONCEBYTES];
10 | unsigned char m[10000];
11 | unsigned char c[10000];
12 | unsigned char m2[10000];
13 |
14 | int main(void)
15 | {
16 | size_t mlen;
17 | size_t i;
18 |
19 | for (mlen = 0; mlen < 1000 && mlen + crypto_box_ZEROBYTES < sizeof m;
20 | ++mlen) {
21 | crypto_box_keypair(alicepk, alicesk);
22 | crypto_box_keypair(bobpk, bobsk);
23 | randombytes_buf(n, crypto_box_NONCEBYTES);
24 | randombytes_buf(m + crypto_box_ZEROBYTES, mlen);
25 | crypto_box(c, m, mlen + crypto_box_ZEROBYTES, n, bobpk, alicesk);
26 | if (crypto_box_open(m2, c, mlen + crypto_box_ZEROBYTES, n, alicepk,
27 | bobsk) == 0) {
28 | for (i = 0; i < mlen + crypto_box_ZEROBYTES; ++i) {
29 | if (m2[i] != m[i]) {
30 | printf("bad decryption\n");
31 | break;
32 | }
33 | }
34 | } else {
35 | printf("ciphertext fails verification\n");
36 | }
37 | }
38 | return 0;
39 | }
40 |
--------------------------------------------------------------------------------
/libsodium/test/default/box_seed.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "box_seed"
3 | #include "cmptest.h"
4 |
5 | unsigned char seed[32]
6 | = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1,
7 | 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0,
8 | 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a };
9 |
10 | int main(void)
11 | {
12 | int i;
13 | unsigned char sk[32];
14 | unsigned char pk[32];
15 |
16 | crypto_box_seed_keypair(pk, sk, seed);
17 | for (i = 0; i < 32; ++i) {
18 | printf(",0x%02x", (unsigned int)pk[i]);
19 | if (i % 8 == 7)
20 | printf("\n");
21 | }
22 | for (i = 0; i < 32; ++i) {
23 | printf(",0x%02x", (unsigned int)sk[i]);
24 | if (i % 8 == 7)
25 | printf("\n");
26 | }
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/libsodium/test/default/cmptest.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __CMPTEST_H__
3 | #define __CMPTEST_H__
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #include "sodium.h"
12 |
13 | #ifndef TEST_SRCDIR
14 | # define TEST_SRCDIR "."
15 | #endif
16 |
17 | #define TEST_NAME_RES TEST_NAME ".res"
18 | #define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"
19 |
20 | #ifdef HAVE_ARC4RANDOM
21 | # undef rand
22 | # define rand(X) arc4random(X)
23 | #endif
24 |
25 | FILE *fp_res;
26 | int xmain(void);
27 |
28 | int main(void)
29 | {
30 | FILE *fp_out;
31 | int c;
32 |
33 | if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
34 | perror("fopen(" TEST_NAME_RES ")");
35 | return 99;
36 | }
37 | if (sodium_init() != 0) {
38 | return 99;
39 | }
40 | if (xmain() != 0) {
41 | return 99;
42 | }
43 | rewind(fp_res);
44 | if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
45 | perror("fopen(" TEST_NAME_OUT ")");
46 | return 99;
47 | }
48 | do {
49 | if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
50 | return 99;
51 | }
52 | } while (c != EOF);
53 |
54 | return 0;
55 | }
56 |
57 | #undef printf
58 | #define printf(...) fprintf(fp_res, __VA_ARGS__)
59 | #define main xmain
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/libsodium/test/default/core1.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "core1"
3 | #include "cmptest.h"
4 |
5 | unsigned char shared[32]
6 | = { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1, 0x72, 0x8e, 0x3b,
7 | 0xf4, 0x80, 0x35, 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1,
8 | 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42 };
9 |
10 | unsigned char zero[32] = { 0 };
11 |
12 | unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
13 | 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
14 |
15 | unsigned char firstkey[32];
16 |
17 | int main(void)
18 | {
19 | int i;
20 |
21 | crypto_core_hsalsa20(firstkey, zero, shared, c);
22 | for (i = 0; i < 32; ++i) {
23 | if (i > 0) {
24 | printf(",");
25 | } else {
26 | printf(" ");
27 | }
28 | printf("0x%02x", (unsigned int)firstkey[i]);
29 | if (i % 8 == 7) {
30 | printf("\n");
31 | }
32 | }
33 | assert(crypto_core_hsalsa20_outputbytes() > 0U);
34 | assert(crypto_core_hsalsa20_inputbytes() > 0U);
35 | assert(crypto_core_hsalsa20_keybytes() > 0U);
36 | assert(crypto_core_hsalsa20_constbytes() > 0U);
37 |
38 | return 0;
39 | }
40 |
--------------------------------------------------------------------------------
/libsodium/test/default/core2.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "core2"
3 | #include "cmptest.h"
4 |
5 | unsigned char firstkey[32]
6 | = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 0xd4, 0x62, 0xcd, 0x51,
7 | 0x19, 0x7a, 0x9a, 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 0x64,
8 | 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 0x44, 0xf6, 0x83, 0x89 };
9 |
10 | unsigned char nonceprefix[16]
11 | = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73,
12 | 0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6 };
13 |
14 | unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
15 | 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
16 |
17 | unsigned char secondkey[32];
18 |
19 | int main(void)
20 | {
21 | int i;
22 |
23 | crypto_core_hsalsa20(secondkey, nonceprefix, firstkey, 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)secondkey[i]);
31 | if (i % 8 == 7) {
32 | printf("\n");
33 | }
34 | }
35 | return 0;
36 | }
37 |
--------------------------------------------------------------------------------
/libsodium/test/default/core4.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "core4"
3 | #include "cmptest.h"
4 |
5 | unsigned char k[32] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
6 | 12, 13, 14, 15, 16, 201, 202, 203, 204, 205, 206,
7 | 207, 208, 209, 210, 211, 212, 213, 214, 215, 216 };
8 |
9 | unsigned char in[16] = { 101, 102, 103, 104, 105, 106, 107, 108,
10 | 109, 110, 111, 112, 113, 114, 115, 116 };
11 |
12 | unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
13 | 50, 45, 98, 121, 116, 101, 32, 107 };
14 |
15 | unsigned char out[64];
16 |
17 | int main(void)
18 | {
19 | int i;
20 |
21 | crypto_core_salsa20(out, in, k, c);
22 | for (i = 0; i < 64; ++i) {
23 | if (i > 0) {
24 | printf(",");
25 | } else {
26 | printf(" ");
27 | }
28 | printf("%3d", (unsigned int)out[i]);
29 | if (i % 8 == 7) {
30 | printf("\n");
31 | }
32 | }
33 | return 0;
34 | }
35 |
--------------------------------------------------------------------------------
/libsodium/test/default/core5.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "core5"
3 | #include "cmptest.h"
4 |
5 | unsigned char k[32]
6 | = { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c, 0x12, 0x6f, 0x90,
7 | 0x02, 0x79, 0x01, 0xd8, 0x0f, 0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36,
8 | 0xcf, 0x3b, 0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
9 |
10 | unsigned char in[16] = { 0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
11 | 0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52 };
12 |
13 | unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
14 | 50, 45, 98, 121, 116, 101, 32, 107 };
15 |
16 | unsigned char out[32];
17 |
18 | int main(void)
19 | {
20 | int i;
21 |
22 | crypto_core_hsalsa20(out, in, k, c);
23 | for (i = 0; i < 32; ++i) {
24 | printf(",0x%02x", (unsigned int)out[i]);
25 | if (i % 8 == 7) {
26 | printf("\n");
27 | }
28 | }
29 | return 0;
30 | }
31 |
--------------------------------------------------------------------------------
/libsodium/test/default/hash3.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "hash3"
3 | #include "cmptest.h"
4 |
5 | unsigned char x[] = "testing\n";
6 | unsigned char h[crypto_hash_BYTES];
7 |
8 | int main(void)
9 | {
10 | size_t i;
11 |
12 | crypto_hash(h, x, sizeof x - 1U);
13 | for (i = 0; i < crypto_hash_BYTES; ++i) {
14 | printf("%02x", (unsigned int)h[i]);
15 | }
16 | printf("\n");
17 |
18 | return 0;
19 | }
20 |
--------------------------------------------------------------------------------
/libsodium/test/default/onetimeauth7.c:
--------------------------------------------------------------------------------
1 |
2 | #include "windows/windows-quirks.h"
3 |
4 | #define TEST_NAME "onetimeauth7"
5 | #include "cmptest.h"
6 |
7 | unsigned char key[32];
8 | unsigned char c[10000];
9 | unsigned char a[16];
10 |
11 | int main(void)
12 | {
13 | int clen;
14 |
15 | for (clen = 0; clen < 10000; ++clen) {
16 | randombytes_buf(key, sizeof key);
17 | randombytes_buf(c, clen);
18 | crypto_onetimeauth(a, c, clen, key);
19 | if (crypto_onetimeauth_verify(a, c, clen, key) != 0) {
20 | printf("fail %d\n", clen);
21 | return 100;
22 | }
23 | if (clen > 0) {
24 | c[rand() % clen] += 1 + (rand() % 255);
25 | if (crypto_onetimeauth_verify(a, c, clen, key) == 0) {
26 | printf("forgery %d\n", clen);
27 | return 100;
28 | }
29 | a[rand() % sizeof a] += 1 + (rand() % 255);
30 | if (crypto_onetimeauth_verify(a, c, clen, key) == 0) {
31 | printf("forgery %d\n", clen);
32 | return 100;
33 | }
34 | }
35 | }
36 | return 0;
37 | }
38 |
--------------------------------------------------------------------------------
/libsodium/test/default/pre.js:
--------------------------------------------------------------------------------
1 | try {
2 | this['Module'] = Module;
3 | Module.test;
4 | } catch(e) {
5 | this['Module'] = Module = {};
6 | }
7 | Module['preRun'] = Module['preRun'] || [];
8 | Module['preRun'].push(function(){
9 | var randombyte = null;
10 | try {
11 | function randombyte_standard() {
12 | var buf = new Int8Array(1);
13 | window.crypto.getRandomValues(buf);
14 | return buf[0];
15 | }
16 | randombyte_standard();
17 | randombyte = randombyte_standard;
18 | } catch (e) {
19 | try {
20 | var crypto = require('crypto');
21 | function randombyte_node() {
22 | return crypto.randomBytes(1)[0];
23 | }
24 | randombyte_node();
25 | randombyte = randombyte_node;
26 | } catch(e) { }
27 | }
28 | FS.init();
29 | var devFolder = FS.findObject('/dev') ||
30 | Module['FS_createFolder']('/', 'dev', true, true);
31 | Module['FS_createDevice'](devFolder, 'random', randombyte);
32 | Module['FS_createDevice'](devFolder, 'urandom', randombyte);
33 | });
34 |
--------------------------------------------------------------------------------
/libsodium/test/default/scalarmult.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "scalarmult"
3 | #include "cmptest.h"
4 |
5 | unsigned char alicesk[32]
6 | = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1,
7 | 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0,
8 | 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a };
9 |
10 | unsigned char alicepk[32];
11 |
12 | int main(void)
13 | {
14 | int i;
15 |
16 | crypto_scalarmult_base(alicepk, alicesk);
17 |
18 | for (i = 0; i < 32; ++i) {
19 | if (i > 0) {
20 | printf(",");
21 | } else {
22 | printf(" ");
23 | }
24 | printf("0x%02x", (unsigned int)alicepk[i]);
25 | if (i % 8 == 7) {
26 | printf("\n");
27 | }
28 | }
29 | assert(crypto_scalarmult_bytes() > 0U);
30 | assert(crypto_scalarmult_scalarbytes() > 0U);
31 | assert(strcmp(crypto_scalarmult_primitive(), "curve25519") == 0);
32 | assert(crypto_scalarmult_bytes() == crypto_scalarmult_curve25519_bytes());
33 | assert(crypto_scalarmult_scalarbytes()
34 | == crypto_scalarmult_curve25519_scalarbytes());
35 | assert(crypto_scalarmult_bytes() == crypto_scalarmult_scalarbytes());
36 |
37 | return 0;
38 | }
39 |
--------------------------------------------------------------------------------
/libsodium/test/default/scalarmult2.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "scalarmult2"
3 | #include "cmptest.h"
4 |
5 | unsigned char bobsk[32]
6 | = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f,
7 | 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18,
8 | 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb };
9 |
10 | unsigned char bobpk[32];
11 |
12 | int main(void)
13 | {
14 | int i;
15 |
16 | crypto_scalarmult_base(bobpk, bobsk);
17 |
18 | for (i = 0; i < 32; ++i) {
19 | if (i > 0) {
20 | printf(",");
21 | } else {
22 | printf(" ");
23 | }
24 | printf("0x%02x", (unsigned int)bobpk[i]);
25 | if (i % 8 == 7) {
26 | printf("\n");
27 | }
28 | }
29 | return 0;
30 | }
31 |
--------------------------------------------------------------------------------
/libsodium/test/default/scalarmult5.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "scalarmult5"
3 | #include "cmptest.h"
4 |
5 | unsigned char alicesk[32]
6 | = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1,
7 | 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0,
8 | 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a };
9 |
10 | unsigned char bobpk[32]
11 | = { 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b, 0x61,
12 | 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78,
13 | 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f };
14 |
15 | unsigned char k[32];
16 |
17 | int main(void)
18 | {
19 | int i;
20 |
21 | crypto_scalarmult(k, alicesk, bobpk);
22 |
23 | for (i = 0; i < 32; ++i) {
24 | if (i > 0) {
25 | printf(",");
26 | } else {
27 | printf(" ");
28 | }
29 | printf("0x%02x", (unsigned int)k[i]);
30 | if (i % 8 == 7) {
31 | printf("\n");
32 | }
33 | }
34 | return 0;
35 | }
36 |
--------------------------------------------------------------------------------
/libsodium/test/default/scalarmult7.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "scalarmult7"
3 | #include "cmptest.h"
4 |
5 | unsigned char p1[32] = {
6 | 0x72, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54,
7 | 0x74, 0x8b, 0x7d, 0xdc, 0xb4, 0x3e, 0xf7, 0x5a,
8 | 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a, 0xf4,
9 | 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0xea
10 | };
11 |
12 | unsigned char p2[32] = {
13 | 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54,
14 | 0x74, 0x8b, 0x7d, 0xdc, 0xb4, 0x3e, 0xf7, 0x5a,
15 | 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a, 0xf4,
16 | 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a
17 | };
18 |
19 | unsigned char scalar[32];
20 | unsigned char out1[32];
21 | unsigned char out2[32];
22 |
23 | int main(void)
24 | {
25 | scalar[0] = 1U;
26 | crypto_scalarmult_curve25519(out1, scalar, p1);
27 | crypto_scalarmult_curve25519(out2, scalar, p2);
28 | printf("%d\n", !!memcmp(out1, out2, 32));
29 |
30 | return 0;
31 | }
32 |
--------------------------------------------------------------------------------
/libsodium/test/default/secretbox7.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "secretbox7"
3 | #include "cmptest.h"
4 |
5 | unsigned char k[crypto_secretbox_KEYBYTES];
6 | unsigned char n[crypto_secretbox_NONCEBYTES];
7 | unsigned char m[10000];
8 | unsigned char c[10000];
9 | unsigned char m2[10000];
10 |
11 | int main(void)
12 | {
13 | size_t mlen;
14 | size_t i;
15 |
16 | for (mlen = 0; mlen < 1000 && mlen + crypto_secretbox_ZEROBYTES < sizeof m;
17 | ++mlen) {
18 | randombytes_buf(k, crypto_secretbox_KEYBYTES);
19 | randombytes_buf(n, crypto_secretbox_NONCEBYTES);
20 | randombytes_buf(m + crypto_secretbox_ZEROBYTES, mlen);
21 | crypto_secretbox(c, m, mlen + crypto_secretbox_ZEROBYTES, n, k);
22 | if (crypto_secretbox_open(m2, c, mlen + crypto_secretbox_ZEROBYTES, n,
23 | k) == 0) {
24 | for (i = 0; i < mlen + crypto_secretbox_ZEROBYTES; ++i) {
25 | if (m2[i] != m[i]) {
26 | printf("bad decryption\n");
27 | break;
28 | }
29 | }
30 | } else {
31 | printf("ciphertext fails verification\n");
32 | }
33 | }
34 | return 0;
35 | }
36 |
--------------------------------------------------------------------------------
/libsodium/test/default/shorthash.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "shorthash"
3 | #include "cmptest.h"
4 |
5 | #define MAXLEN 64
6 |
7 | int main(void)
8 | {
9 | unsigned char in[MAXLEN];
10 | unsigned char out[crypto_shorthash_BYTES];
11 | unsigned char k[crypto_shorthash_KEYBYTES];
12 | size_t i;
13 | size_t j;
14 |
15 | for (i = 0; i < crypto_shorthash_KEYBYTES; ++i) {
16 | k[i] = (unsigned char) i;
17 | }
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 |
--------------------------------------------------------------------------------
/libsodium/test/default/sodium_core.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "sodium_core"
3 | #include "cmptest.h"
4 |
5 | int main(void)
6 | {
7 | printf("%d\n", sodium_init());
8 |
9 | (void)sodium_runtime_has_neon();
10 | (void)sodium_runtime_has_sse2();
11 | (void)sodium_runtime_has_sse3();
12 |
13 | return 0;
14 | }
15 |
--------------------------------------------------------------------------------
/libsodium/test/default/sodium_utils3.c:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | #include
5 | #include
6 |
7 | #define TEST_NAME "sodium_utils3"
8 | #include "cmptest.h"
9 |
10 | #ifdef __SANITIZE_ADDRESS__
11 | # error This test requires address sanitizer to be off
12 | #endif
13 |
14 | static void segv_handler(int sig)
15 | {
16 | printf("Intentional segfault / bus error caught\n");
17 | printf("OK\n");
18 | #ifdef SIGSEGV
19 | signal(SIGSEGV, SIG_DFL);
20 | #endif
21 | #ifdef SIGBUS
22 | signal(SIGBUS, SIG_DFL);
23 | #endif
24 | #ifdef SIGABRT
25 | signal(SIGABRT, SIG_DFL);
26 | #endif
27 | exit(0);
28 | }
29 |
30 | int main(void)
31 | {
32 | void *buf;
33 | size_t size;
34 |
35 | #ifdef SIGSEGV
36 | signal(SIGSEGV, segv_handler);
37 | #endif
38 | #ifdef SIGBUS
39 | signal(SIGBUS, segv_handler);
40 | #endif
41 | #ifdef SIGABRT
42 | signal(SIGABRT, segv_handler);
43 | #endif
44 | size = randombytes_uniform(100000U);
45 | buf = sodium_malloc(size);
46 | sodium_mprotect_noaccess(buf);
47 | sodium_mprotect_readwrite(buf);
48 | sodium_memzero(((unsigned char *)buf) - 8, 8U);
49 | sodium_mprotect_readonly(buf);
50 | sodium_free(buf);
51 | printf("Underflow not caught\n");
52 |
53 | return 0;
54 | }
55 |
--------------------------------------------------------------------------------
/libsodium/test/default/sodium_version.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "sodium_version"
3 | #include "cmptest.h"
4 |
5 | int main(void)
6 | {
7 | printf("%d\n", sodium_version_string() != NULL);
8 | printf("%d\n", sodium_library_version_major() > 0);
9 | printf("%d\n", sodium_library_version_minor() >= 0);
10 |
11 | return 0;
12 | }
13 |
--------------------------------------------------------------------------------
/libsodium/test/default/stream.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "stream"
3 | #include "cmptest.h"
4 |
5 | unsigned char firstkey[32]
6 | = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 0xd4, 0x62, 0xcd, 0x51,
7 | 0x19, 0x7a, 0x9a, 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 0x64,
8 | 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 0x44, 0xf6, 0x83, 0x89 };
9 |
10 | unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73,
11 | 0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6,
12 | 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
13 |
14 | unsigned char output[4194304];
15 |
16 | unsigned char h[32];
17 |
18 | int main(void)
19 | {
20 | int i;
21 |
22 | crypto_stream(output, 4194304, nonce, firstkey);
23 | crypto_hash_sha256(h, output, sizeof output);
24 |
25 | for (i = 0; i < 32; ++i)
26 | printf("%02x", h[i]);
27 | printf("\n");
28 |
29 | assert(crypto_stream_keybytes() > 0U);
30 | assert(crypto_stream_noncebytes() > 0U);
31 | assert(strcmp(crypto_stream_primitive(), "xsalsa20") == 0);
32 | assert(crypto_stream_keybytes() == crypto_stream_xsalsa20_keybytes());
33 | assert(crypto_stream_noncebytes() == crypto_stream_xsalsa20_noncebytes());
34 |
35 | return 0;
36 | }
37 |
--------------------------------------------------------------------------------
/libsodium/test/default/stream2.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "stream2"
3 | #include "cmptest.h"
4 |
5 | unsigned char secondkey[32]
6 | = { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44, 0xa9, 0x53, 0x62, 0x9b,
7 | 0x73, 0x38, 0x20, 0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21, 0xbb,
8 | 0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e, 0x66, 0x25, 0x6c, 0xe4 };
9 |
10 | unsigned char noncesuffix[8]
11 | = { 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
12 |
13 | unsigned char output[4194304];
14 |
15 | unsigned char h[32];
16 |
17 | int main(void)
18 | {
19 | int i;
20 | crypto_stream_salsa20(output, 4194304, noncesuffix, secondkey);
21 | crypto_hash_sha256(h, output, sizeof output);
22 | for (i = 0; i < 32; ++i)
23 | printf("%02x", h[i]);
24 | printf("\n");
25 |
26 | assert(crypto_stream_salsa20_keybytes() > 0U);
27 | assert(crypto_stream_salsa20_noncebytes() > 0U);
28 |
29 | return 0;
30 | }
31 |
--------------------------------------------------------------------------------
/libsodium/test/default/stream3.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "stream3"
3 | #include "cmptest.h"
4 |
5 | unsigned char firstkey[32]
6 | = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 0xd4, 0x62, 0xcd, 0x51,
7 | 0x19, 0x7a, 0x9a, 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 0x64,
8 | 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 0x44, 0xf6, 0x83, 0x89 };
9 |
10 | unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73,
11 | 0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6,
12 | 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
13 |
14 | unsigned char rs[32];
15 |
16 | int main(void)
17 | {
18 | int i;
19 |
20 | crypto_stream(rs, 32, nonce, firstkey);
21 |
22 | for (i = 0; i < 32; ++i) {
23 | printf(",0x%02x", (unsigned int)rs[i]);
24 | if (i % 8 == 7)
25 | printf("\n");
26 | }
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/libsodium/test/default/verify1.c:
--------------------------------------------------------------------------------
1 |
2 | #define TEST_NAME "verify1"
3 | #include "cmptest.h"
4 |
5 | unsigned char v16[16], v16x[16];
6 | unsigned char v32[32], v32x[32];
7 | unsigned char v64[64], v64x[64];
8 |
9 | int main(void)
10 | {
11 | randombytes_buf(v16, sizeof v16);
12 | randombytes_buf(v32, sizeof v32);
13 | randombytes_buf(v64, sizeof v64);
14 |
15 | memcpy(v16x, v16, sizeof v16);
16 | memcpy(v32x, v32, sizeof v32);
17 | memcpy(v64x, v64, sizeof v64);
18 |
19 | printf("%d\n", crypto_verify_16(v16, v16x));
20 | printf("%d\n", crypto_verify_32(v32, v32x));
21 | printf("%d\n", crypto_verify_64(v64, v64x));
22 |
23 | v16x[randombytes_random() & 15U]++;
24 | v32x[randombytes_random() & 31U]++;
25 | v64x[randombytes_random() & 63U]++;
26 |
27 | printf("%d\n", crypto_verify_16(v16, v16x));
28 | printf("%d\n", crypto_verify_32(v32, v32x));
29 | printf("%d\n", crypto_verify_64(v64, v64x));
30 |
31 | assert(crypto_verify_16_bytes() == 16U);
32 | assert(crypto_verify_32_bytes() == 32U);
33 | assert(crypto_verify_64_bytes() == 64U);
34 |
35 | return 0;
36 | }
37 |
--------------------------------------------------------------------------------
/libsodium/test/quirks/windows/windows-quirks.h:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | #ifdef _WIN32
5 |
6 | static void
7 | srandom(unsigned seed)
8 | {
9 | srand(seed);
10 | }
11 |
12 | static long
13 | random(void)
14 | {
15 | return (long) rand();
16 | }
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/libudns/Makefile.am:
--------------------------------------------------------------------------------
1 | # This file is part of libasyncns.
2 | #
3 | # Copyright 2005-2008 Lennart Poettering
4 | #
5 | # libasyncns is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU Lesser General Public License as
7 | # published by the Free Software Foundation, either version 2.1 of the
8 | # License, or (at your option) any later version.
9 | #
10 | # libasyncns is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | # Lesser General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Lesser General Public
16 | # License along with libasyncns. If not, see
17 | # .
18 |
19 | SRCS = udns_dn.c udns_dntosp.c udns_parse.c udns_resolver.c udns_init.c \
20 | udns_misc.c udns_XtoX.c \
21 | udns_rr_a.c udns_rr_ptr.c udns_rr_mx.c udns_rr_txt.c udns_bl.c \
22 | udns_rr_srv.c udns_rr_naptr.c udns_codes.c udns_jran.c
23 | noinst_LTLIBRARIES=libudns.la
24 | libudns_la_SOURCES= ${SRCS}
25 | libudns_la_LDFLAGS= -static
26 |
--------------------------------------------------------------------------------
/libudns/udns_dntosp.c:
--------------------------------------------------------------------------------
1 | /* udns_dntosp.c
2 | dns_dntosp() = convert DN to asciiz string using static buffer
3 |
4 | Copyright (C) 2005 Michael Tokarev
5 | This file is part of UDNS library, an async DNS stub resolver.
6 |
7 | This library is free software; you can redistribute it and/or
8 | modify it under the terms of the GNU Lesser General Public
9 | License as published by the Free Software Foundation; either
10 | version 2.1 of the License, or (at your option) any later version.
11 |
12 | This library is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public
18 | License along with this library, in file named COPYING.LGPL; if not,
19 | write to the Free Software Foundation, Inc., 59 Temple Place,
20 | Suite 330, Boston, MA 02111-1307 USA
21 |
22 | */
23 |
24 | #include "udns.h"
25 |
26 | static char name[DNS_MAXNAME];
27 |
28 | const char *dns_dntosp(dnscc_t *dn) {
29 | return dns_dntop(dn, name, sizeof(name)) > 0 ? name : 0;
30 | }
31 |
--------------------------------------------------------------------------------
/m4/ltversion.m4:
--------------------------------------------------------------------------------
1 | # ltversion.m4 -- version numbers -*- Autoconf -*-
2 | #
3 | # Copyright (C) 2004 Free Software Foundation, Inc.
4 | # Written by Scott James Remnant, 2004
5 | #
6 | # This file is free software; the Free Software Foundation gives
7 | # unlimited permission to copy and/or distribute it, with or without
8 | # modifications, as long as this notice is preserved.
9 |
10 | # @configure_input@
11 |
12 | # serial 3337 ltversion.m4
13 | # This file is part of GNU Libtool
14 |
15 | m4_define([LT_PACKAGE_VERSION], [2.4.2])
16 | m4_define([LT_PACKAGE_REVISION], [1.3337])
17 |
18 | AC_DEFUN([LTVERSION_VERSION],
19 | [macro_version='2.4.2'
20 | macro_revision='1.3337'
21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
22 | _LT_DECL(, macro_revision, 0)
23 | ])
24 |
--------------------------------------------------------------------------------
/m4/polarssl.m4:
--------------------------------------------------------------------------------
1 | dnl Check to find the PolarSSL headers/libraries
2 |
3 | AC_DEFUN([ss_POLARSSL],
4 | [
5 |
6 | AC_ARG_WITH(polarssl,
7 | AS_HELP_STRING([--with-polarssl=DIR], [PolarSSL base directory, or:]),
8 | [polarssl="$withval"
9 | CFLAGS="$CFLAGS -I$withval/include"
10 | LDFLAGS="$LDFLAGS -L$withval/lib"]
11 | )
12 |
13 | AC_ARG_WITH(polarssl-include,
14 | AS_HELP_STRING([--with-polarssl-include=DIR], [PolarSSL headers directory (without trailing /polarssl)]),
15 | [polarssl_include="$withval"
16 | CFLAGS="$CFLAGS -I$withval"]
17 | )
18 |
19 | AC_ARG_WITH(polarssl-lib,
20 | AS_HELP_STRING([--with-polarssl-lib=DIR], [PolarSSL library directory]),
21 | [polarssl_lib="$withval"
22 | LDFLAGS="$LDFLAGS -L$withval"]
23 | )
24 |
25 | AC_CHECK_LIB(polarssl, cipher_init_ctx,
26 | [LIBS="-lpolarssl $LIBS"],
27 | [AC_MSG_ERROR([PolarSSL libraries not found.])]
28 | )
29 |
30 | AC_MSG_CHECKING([polarssl version])
31 | AC_COMPILE_IFELSE(
32 | [AC_LANG_PROGRAM(
33 | [[
34 | #include
35 | ]],
36 | [[
37 | #if POLARSSL_VERSION_NUMBER < 0x01020500
38 | #error invalid version
39 | #endif
40 | ]]
41 | )],
42 | [AC_MSG_RESULT([ok])],
43 | [AC_MSG_ERROR([PolarSSL 1.2.5 or newer required])]
44 | )
45 | ])
46 |
--------------------------------------------------------------------------------
/openwrt/files/shadowsocks.init:
--------------------------------------------------------------------------------
1 | #!/bin/sh /etc/rc.common
2 | # Copyright (C) 2006-2011 OpenWrt.org
3 |
4 | START=95
5 |
6 | SERVICE_USE_PID=1
7 | SERVICE_WRITE_PID=1
8 | SERVICE_DAEMONIZE=1
9 |
10 | start() {
11 | service_start /usr/bin/ss-local -b 0.0.0.0 -c /etc/shadowsocks.json
12 | }
13 |
14 | stop() {
15 | service_stop /usr/bin/ss-local
16 | }
17 |
--------------------------------------------------------------------------------
/openwrt/files/shadowsocks.json:
--------------------------------------------------------------------------------
1 | {
2 | "server":"127.0.0.1",
3 | "server_port":8388,
4 | "local_port":1080,
5 | "password":"barfoo!",
6 | "timeout":60,
7 | "method":null
8 | }
9 |
--------------------------------------------------------------------------------
/shadowsocks-libev.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | includedir=@includedir@
5 |
6 | Name: shadowsocks-libev
7 | Description: a lightweight secured scoks5
8 | URL: http://shadowsocks.org
9 | Version: @VERSION@
10 | Requires:
11 | Libs: -I${includedir}
12 | Cflags: -L${libdir} -lshadowsocks -lcrypto
13 |
--------------------------------------------------------------------------------
/src/acl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * acl.h - Define the ACL interface
3 | *
4 | * Copyright (C) 2013 - 2015, Max Lv
5 | *
6 | * This file is part of the shadowsocks-libev.
7 | *
8 | * shadowsocks-libev is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * shadowsocks-libev is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with shadowsocks-libev; see the file COPYING. If not, see
20 | * .
21 | */
22 |
23 | #ifndef _ACL_H
24 | #define _ACL_H
25 |
26 | int init_acl(const char *path);
27 | void free_acl(void);
28 |
29 | int acl_contains_ip(const char * ip);
30 |
31 | #endif // _ACL_H
32 |
--------------------------------------------------------------------------------
/src/netutils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * netutils.h - Network utilities
3 | *
4 | * Copyright (C) 2013 - 2015, Max Lv
5 | *
6 | * This file is part of the shadowsocks-libev.
7 | *
8 | * shadowsocks-libev is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * shadowsocks-libev is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with shadowsocks-libev; see the file COPYING. If not, see
20 | * .
21 | */
22 |
23 | int get_sockaddr_len(struct sockaddr *addr);
24 | int get_sockaddr(char *host, char *port, struct sockaddr_storage *storage, int block);
25 |
--------------------------------------------------------------------------------