diff --git a/.travis.yml b/.travis.yml index cb373aa2..b7e12830 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ jdk: env: global: - - NDK_VERSION=r15b + - NDK_VERSION=r16 - NDK_CCACHE=ccache - GOROOT_BOOTSTRAP=$GOROOT - ANDROID_NDK_HOME=$HOME/.android/android-ndk-${NDK_VERSION} diff --git a/README.md b/README.md index 7a317945..9486b767 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A [shadowsocks](http://shadowsocks.org) client for Android, written in Scala. * Android SDK - Build Tools 26+ - Android Support Repository and Google Repository (see `build.sbt` for version) - - Android NDK r15+ + - Android NDK r16+ ### BUILD diff --git a/mobile/src/main/jni/Android.mk b/mobile/src/main/jni/Android.mk index ee7c03c3..4957b3a6 100755 --- a/mobile/src/main/jni/Android.mk +++ b/mobile/src/main/jni/Android.mk @@ -27,52 +27,133 @@ include $(CLEAR_VARS) SODIUM_SOURCE := \ crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \ crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \ + crypto_auth/crypto_auth.c \ + crypto_auth/hmacsha256/auth_hmacsha256.c \ + crypto_auth/hmacsha512/auth_hmacsha512.c \ + crypto_auth/hmacsha512256/auth_hmacsha512256.c \ + crypto_box/crypto_box.c \ + crypto_box/crypto_box_easy.c \ + crypto_box/crypto_box_seal.c \ + crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c \ + crypto_core/curve25519/ref10/curve25519_ref10.c \ crypto_core/hchacha20/core_hchacha20.c \ + crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c \ + crypto_core/hsalsa20/core_hsalsa20.c \ crypto_core/salsa/ref/core_salsa_ref.c \ + crypto_generichash/crypto_generichash.c \ + crypto_generichash/blake2b/generichash_blake2.c \ crypto_generichash/blake2b/ref/blake2b-compress-ref.c \ crypto_generichash/blake2b/ref/blake2b-ref.c \ crypto_generichash/blake2b/ref/generichash_blake2b.c \ + crypto_hash/crypto_hash.c \ + crypto_hash/sha256/hash_sha256.c \ + crypto_hash/sha256/cp/hash_sha256_cp.c \ + crypto_hash/sha512/hash_sha512.c \ + crypto_hash/sha512/cp/hash_sha512_cp.c \ + crypto_kdf/blake2b/kdf_blake2b.c \ + crypto_kdf/crypto_kdf.c \ + crypto_kx/crypto_kx.c \ + crypto_onetimeauth/crypto_onetimeauth.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ crypto_onetimeauth/poly1305/donna/poly1305_donna.c \ - crypto_pwhash/crypto_pwhash.c \ crypto_pwhash/argon2/argon2-core.c \ - crypto_pwhash/argon2/argon2.c \ crypto_pwhash/argon2/argon2-encoding.c \ crypto_pwhash/argon2/argon2-fill-block-ref.c \ + crypto_pwhash/argon2/argon2.c \ crypto_pwhash/argon2/blake2b-long.c \ crypto_pwhash/argon2/pwhash_argon2i.c \ + crypto_pwhash/argon2/pwhash_argon2id.c \ + crypto_pwhash/crypto_pwhash.c \ + crypto_scalarmult/crypto_scalarmult.c \ crypto_scalarmult/curve25519/scalarmult_curve25519.c \ + crypto_secretbox/crypto_secretbox.c \ + crypto_secretbox/crypto_secretbox_easy.c \ + crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c \ + crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c \ + crypto_shorthash/crypto_shorthash.c \ + crypto_shorthash/siphash24/shorthash_siphash24.c \ + crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c \ + crypto_sign/crypto_sign.c \ + crypto_sign/ed25519/sign_ed25519.c \ + crypto_sign/ed25519/ref10/keypair.c \ + crypto_sign/ed25519/ref10/open.c \ + crypto_sign/ed25519/ref10/sign.c \ crypto_stream/chacha20/stream_chacha20.c \ crypto_stream/chacha20/ref/chacha20_ref.c \ + crypto_stream/crypto_stream.c \ crypto_stream/salsa20/stream_salsa20.c \ - crypto_stream/salsa20/ref/salsa20_ref.c \ + crypto_stream/xsalsa20/stream_xsalsa20.c \ crypto_verify/sodium/verify.c \ randombytes/randombytes.c \ - randombytes/sysrandom/randombytes_sysrandom.c \ + sodium/codecs.c \ sodium/core.c \ sodium/runtime.c \ sodium/utils.c \ - sodium/version.c + sodium/version.c \ + randombytes/salsa20/randombytes_salsa20_random.c \ + randombytes/sysrandom/randombytes_sysrandom.c \ + crypto_scalarmult/curve25519/ref10/x25519_ref10.c \ + crypto_stream/salsa20/ref/salsa20_ref.c \ + crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c \ + crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c \ + crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c \ + crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \ + crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c \ + crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c \ + crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c \ + crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c \ + crypto_shorthash/siphash24/shorthash_siphashx24.c \ + crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c \ + crypto_sign/ed25519/ref10/obsolete.c \ + crypto_stream/salsa2012/ref/stream_salsa2012_ref.c \ + crypto_stream/salsa2012/stream_salsa2012.c \ + crypto_stream/salsa208/ref/stream_salsa208_ref.c \ + crypto_stream/salsa208/stream_salsa208.c \ + crypto_stream/xchacha20/stream_xchacha20.c LOCAL_MODULE := sodium -LOCAL_CFLAGS += -O2 -I$(LOCAL_PATH)/libsodium/src/libsodium/include \ +LOCAL_CFLAGS += -I$(LOCAL_PATH)/libsodium/src/libsodium/include \ -I$(LOCAL_PATH)/include \ -I$(LOCAL_PATH)/include/sodium \ -I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \ -DPACKAGE_NAME=\"libsodium\" -DPACKAGE_TARNAME=\"libsodium\" \ - -DPACKAGE_VERSION=\"1.0.7\" -DPACKAGE_STRING=\"libsodium\ 1.0.7\" \ + -DPACKAGE_VERSION=\"1.0.15\" -DPACKAGE_STRING=\"libsodium\ 1.0.15\" \ -DPACKAGE_BUGREPORT=\"https://github.com/jedisct1/libsodium/issues\" \ -DPACKAGE_URL=\"https://github.com/jedisct1/libsodium\" \ - -DPACKAGE=\"libsodium\" -DVERSION=\"1.0.7\" -DSTDC_HEADERS=1 \ - -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 \ - -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 \ - -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 \ - -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 \ - -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 \ - -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" \ - -DHAVE_SYS_MMAN_H=1 -DNATIVE_LITTLE_ENDIAN=1 \ - -DHAVE_WEAK_SYMBOLS=1 -DHAVE_ARC4RANDOM=1 -DHAVE_ARC4RANDOM_BUF=1 \ - -DHAVE_MLOCK=1 -DHAVE_MPROTECT=1 -DHAVE_POSIX_MEMALIGN=1 + -DPACKAGE=\"libsodium\" -DVERSION=\"1.0.15\" \ + -DHAVE_PTHREAD=1 \ + -DSTDC_HEADERS=1 \ + -DHAVE_SYS_TYPES_H=1 \ + -DHAVE_SYS_STAT_H=1 \ + -DHAVE_STDLIB_H=1 \ + -DHAVE_STRING_H=1 \ + -DHAVE_MEMORY_H=1 \ + -DHAVE_STRINGS_H=1 \ + -DHAVE_INTTYPES_H=1 \ + -DHAVE_STDINT_H=1 \ + -DHAVE_UNISTD_H=1 \ + -D__EXTENSIONS__=1 \ + -D_ALL_SOURCE=1 \ + -D_GNU_SOURCE=1 \ + -D_POSIX_PTHREAD_SEMANTICS=1 \ + -D_TANDEM_SOURCE=1 \ + -DHAVE_DLFCN_H=1 \ + -DLT_OBJDIR=\".libs/\" \ + -DHAVE_SYS_MMAN_H=1 \ + -DNATIVE_LITTLE_ENDIAN=1 \ + -DASM_HIDE_SYMBOL=.hidden \ + -DHAVE_WEAK_SYMBOLS=1 \ + -DHAVE_ATOMIC_OPS=1 \ + -DHAVE_ARC4RANDOM=1 \ + -DHAVE_ARC4RANDOM_BUF=1 \ + -DHAVE_MMAP=1 \ + -DHAVE_MLOCK=1 \ + -DHAVE_MADVISE=1 \ + -DHAVE_MPROTECT=1 \ + -DHAVE_NANOSLEEP=1 \ + -DHAVE_POSIX_MEMALIGN=1 \ + -DHAVE_GETPID=1 \ + -DCONFIGURED=1 LOCAL_SRC_FILES := $(addprefix libsodium/src/libsodium/,$(SODIUM_SOURCE)) @@ -91,7 +172,7 @@ LIBEVENT_SOURCES := \ LOCAL_MODULE := event LOCAL_SRC_FILES := $(addprefix libevent/, $(LIBEVENT_SOURCES)) -LOCAL_CFLAGS := -O2 -I$(LOCAL_PATH)/libevent \ +LOCAL_CFLAGS := -I$(LOCAL_PATH)/libevent \ -I$(LOCAL_PATH)/libevent/include \ include $(BUILD_STATIC_LIBRARY) @@ -105,7 +186,7 @@ include $(CLEAR_VARS) ANCILLARY_SOURCE := fd_recv.c fd_send.c LOCAL_MODULE := libancillary -LOCAL_CFLAGS += -O2 -I$(LOCAL_PATH)/libancillary +LOCAL_CFLAGS += -I$(LOCAL_PATH)/libancillary LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE)) @@ -120,7 +201,7 @@ include $(CLEAR_VARS) BLOOM_SOURCE := bloom.c murmur2/MurmurHash2.c LOCAL_MODULE := libbloom -LOCAL_CFLAGS += -O2 -I$(LOCAL_PATH)/shadowsocks-libev/libbloom \ +LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libbloom \ -I$(LOCAL_PATH)/shadowsocks-libev/libbloom/murmur2 LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libbloom/, $(BLOOM_SOURCE)) @@ -143,7 +224,7 @@ set_src = set/allocation.c set/inspection.c set/ipv4_set.c set/ipv6_set.c \ IPSET_SOURCE := general.c $(bdd_src) $(map_src) $(set_src) LOCAL_MODULE := libipset -LOCAL_CFLAGS += -O2 -I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \ +LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \ -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libipset/src/libipset/,$(IPSET_SOURCE)) @@ -170,7 +251,7 @@ pthreads_src := pthreads/thread.c CORK_SOURCE := $(cli_src) $(core_src) $(ds_src) $(posix_src) $(pthreads_src) LOCAL_MODULE := libcork -LOCAL_CFLAGS += -O2 -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \ +LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \ -DCORK_API=CORK_LOCAL LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libcork/src/libcork/,$(CORK_SOURCE)) @@ -184,7 +265,7 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libev -LOCAL_CFLAGS += -O2 -DNDEBUG -DHAVE_CONFIG_H \ +LOCAL_CFLAGS += -DNDEBUG -DHAVE_CONFIG_H \ -I$(LOCAL_PATH)/include/libev LOCAL_SRC_FILES := \ libev/ev.c \ @@ -207,7 +288,7 @@ LOCAL_STATIC_LIBRARIES := libevent LOCAL_MODULE := redsocks LOCAL_SRC_FILES := $(addprefix redsocks/, $(REDSOCKS_SOURCES)) -LOCAL_CFLAGS := -O2 -std=gnu99 -DUSE_IPTABLES \ +LOCAL_CFLAGS := -std=gnu99 -DUSE_IPTABLES \ -I$(LOCAL_PATH)/redsocks \ -I$(LOCAL_PATH)/libevent/include \ -I$(LOCAL_PATH)/libevent @@ -229,7 +310,7 @@ SHADOWSOCKS_SOURCES := local.c \ LOCAL_MODULE := ss-local LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES)) -LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DMODULE_LOCAL \ +LOCAL_CFLAGS := -Wall -fno-strict-aliasing -DMODULE_LOCAL \ -DUSE_CRYPTO_MBEDTLS -DHAVE_CONFIG_H \ -DCONNECT_IN_PROGRESS=EINPROGRESS \ -I$(LOCAL_PATH)/include/shadowsocks-libev \ @@ -265,7 +346,7 @@ SHADOWSOCKS_SOURCES := tunnel.c \ LOCAL_MODULE := ss-tunnel LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES)) -LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DMODULE_TUNNEL \ +LOCAL_CFLAGS := -Wall -fno-strict-aliasing -DMODULE_TUNNEL \ -DUSE_CRYPTO_MBEDTLS -DHAVE_CONFIG_H -DSSTUNNEL_JNI \ -DCONNECT_IN_PROGRESS=EINPROGRESS \ -I$(LOCAL_PATH)/libancillary \ diff --git a/mobile/src/main/jni/Application.mk b/mobile/src/main/jni/Application.mk index e38747eb..f80bef09 100644 --- a/mobile/src/main/jni/Application.mk +++ b/mobile/src/main/jni/Application.mk @@ -1,4 +1,4 @@ APP_ABI := armeabi-v7a arm64-v8a x86 APP_PLATFORM := android-19 -APP_STL := stlport_static +APP_STL := c++_static NDK_TOOLCHAIN_VERSION := clang