-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minor improvements starting from NDK r16 (#1458) #1466
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. As long as everything still works.
Working well on Nexus 6P Android 8.0 with self-built android-21 apk |
I wonder if you would like to insert another sbt command when building the apk:
|
We already have go-clean. Does that answer your question? |
This is the example output when using it, I think it's different from go-clean
|
Oh do you mean add that command to the Travis build script or README? I don't think those folders are cached in the Travis environment and I don't know if the clean-file command really does anything useful. By the way, it seems the build is failing. Care to fix? :) |
Add to README obviously, since you're not using it to generate apk, cache got dropped when finished.
It seems you forgot to update libsodium files list after upgrading its version. |
Base branch is building though. |
So is there a case where using clean-file actually fixes a problem? |
Part of my libsodium changes and configured via aarch64 standalone toolchain, you might want to do so to android-19 diff --git a/mobile/src/main/jni/Android.mk b/mobile/src/main/jni/Android.mk
index ee7c03c32..5c5d21c39 100755
--- a/mobile/src/main/jni/Android.mk
+++ b/mobile/src/main/jni/Android.mk
@@ -27,52 +27,140 @@ 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 |
Just suggestion, depends on your thoughts. |
The missing ref locates at crypto_scalarmult/curve25519/ref10/x25519_ref10.c. So, don't forget to update files list after upgrading components. |
Could you fix the build error here? |
I will just paste the diff above then since I'm using git-for-windows to send this patch. Also, I'm not sure configured android-21 setting also applies to android-19. |
If you think ready to go, I will copy & paste & update this branch & do force push. |
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
force pushed, let's see whether it compiles. |
OK. Fixed. Please configure libsodium via correct standalone toolchain to make sure all works as expected. |
Thanks, merged. |
It looks not an issue of missing source files. I can get the original commit passed locally. The original file list contains the minimal functions used by shadowsocks-libev, which should work. Maybe there is something wrong with the |
It's static library, so doesn't matter to include all features |
But it still takes more time to build. |
I'm using You can revert sodium changes and try this on travis again. |
You'd better check submodule status and see where the detached HEAD locates and clear untracked files in submodule. |
Well it seems like force push is a bad idea. We had the option to squash the commits while merging. :)
Yes. It took me quite a while to tune the minimal file set. C/C++ sucks. :/ |
Just took from https://github.com/jedisct1/libsodium/blob/master/src/libsodium/Makefile.am If you really want official minimal build: check |
@wongsyrone The minimal refers to the minimal files required to make all the cryptos in shadowsocks work instead of the official minimal build. Fixed via ae83321. |
Just placebo, It doesn't fix anything and improves anything IMHO. It makes no sense at all.
Any benchmark on this? any noticeable improvements? |
@wongsyrone Probably not. Just think of it as an OCD. |
minor improvements starting from NDK r16 (shadowsocks#1458)
minor improvements starting from NDK r16 (shadowsocks#1458)
Signed-off-by: Syrone Wong wong.syrone@gmail.com
Type of changes
Put an
x
inside the [ ] that applies.Details
Please provide more details about changes if necessary.