diff --git a/mobile/src/main/jni/Android.mk b/mobile/src/main/jni/Android.mk index 45d3b96d..ed6698e3 100755 --- a/mobile/src/main/jni/Android.mk +++ b/mobile/src/main/jni/Android.mk @@ -26,6 +26,7 @@ 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_api.c \ crypto_auth/hmacsha256/cp/hmac_hmacsha256.c \ @@ -48,6 +49,7 @@ SODIUM_SOURCE := \ crypto_core/hsalsa20/core_hsalsa20_api.c \ crypto_core/salsa20/ref/core_salsa20.c \ crypto_core/salsa20/core_salsa20_api.c \ + crypto_core/hchacha20/core_hchacha20.c \ crypto_generichash/crypto_generichash.c \ crypto_generichash/blake2/generichash_blake2_api.c \ crypto_generichash/blake2/ref/blake2-impl.h \ @@ -120,6 +122,7 @@ SODIUM_SOURCE += \ crypto_scalarmult/curve25519/ref10/x25519_ref10.c SODIUM_SOURCE += \ + crypto_pwhash/crypto_pwhash.c \ crypto_pwhash/argon2/argon2-core.c \ crypto_pwhash/argon2/argon2.c \ crypto_pwhash/argon2/argon2-encoding.c \ @@ -329,8 +332,10 @@ include $(BUILD_SHARED_EXECUTABLE) include $(CLEAR_VARS) -SHADOWSOCKS_SOURCES := local.c cache.c udprelay.c encrypt.c \ - utils.c netutils.c json.c jconf.c acl.c http.c tls.c rule.c \ +SHADOWSOCKS_SOURCES := local.c \ + cache.c udprelay.c utils.c netutils.c json.c jconf.c \ + acl.c http.c tls.c rule.c \ + crypto.c aead.c stream.c \ plugin.c \ android.c @@ -364,7 +369,11 @@ include $(BUILD_SHARED_EXECUTABLE) include $(CLEAR_VARS) -SHADOWSOCKS_SOURCES := tunnel.c cache.c udprelay.c encrypt.c utils.c netutils.c json.c jconf.c android.c plugin.c +SHADOWSOCKS_SOURCES := tunnel.c \ + cache.c udprelay.c utils.c netutils.c json.c jconf.c \ + crypto.c aead.c stream.c \ + plugin.c \ + android.c LOCAL_MODULE := ss-tunnel LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES)) diff --git a/mobile/src/main/jni/shadowsocks-libev b/mobile/src/main/jni/shadowsocks-libev index 1c2b6170..c0030f0d 160000 --- a/mobile/src/main/jni/shadowsocks-libev +++ b/mobile/src/main/jni/shadowsocks-libev @@ -1 +1 @@ -Subproject commit 1c2b6170b9ec5443d4a3e211425bc0d5f8e18119 +Subproject commit c0030f0d7d74d1197877e093366bbd2713296aaa diff --git a/mobile/src/main/res/values/arrays.xml b/mobile/src/main/res/values/arrays.xml index 58e8ae88..1961833f 100644 --- a/mobile/src/main/res/values/arrays.xml +++ b/mobile/src/main/res/values/arrays.xml @@ -17,6 +17,9 @@ SALSA20 CHACHA20 CHACHA20-IETF + AES-128-GCM + AES-192-GCM + AES-256-GCM @@ -36,6 +39,9 @@ salsa20 chacha20 chacha20-ietf + aes-128-gcm + aes-192-gcm + aes-256-gcm diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml index a8e902f9..38a689a9 100644 --- a/mobile/src/main/res/values/strings.xml +++ b/mobile/src/main/res/values/strings.xml @@ -36,8 +36,6 @@ IPv6 Route Redirect IPv6 traffic to remote - One-time Authentication - Enable one-time authentication Route All Bypass LAN diff --git a/mobile/src/main/res/xml/pref_profile.xml b/mobile/src/main/res/xml/pref_profile.xml index 80b104e7..2ad83064 100644 --- a/mobile/src/main/res/xml/pref_profile.xml +++ b/mobile/src/main/res/xml/pref_profile.xml @@ -36,10 +36,6 @@ android:entryValues="@array/enc_method_value" android:summary="%s" android:title="@string/enc_method"/> - diff --git a/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala b/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala index 3b3d2ccb..2d418e0d 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala @@ -325,7 +325,6 @@ trait BaseService extends Service { .put("server_port", profile.remotePort) .put("password", profile.password) .put("method", profile.method) - if (profile.auth) config.put("auth", true) if (pluginPath != null) config .put("plugin", Commandline.toString(buildPluginCommandLine())) .put("plugin_opts", plugin.toString) diff --git a/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala b/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala index 90e6d4e0..155ddf28 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala @@ -77,9 +77,6 @@ class DBHelper(val context: Context) } else if (oldVersion < 19) { profileDao.executeRawNoArgs("UPDATE `profile` SET route = 'all' WHERE route IS NULL;") } - if (oldVersion < 10) { - profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN auth SMALLINT;") - } if (oldVersion < 11) { profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN ipv6 SMALLINT;") } @@ -89,9 +86,9 @@ class DBHelper(val context: Context) TableUtils.createTable(connectionSource, classOf[Profile]) profileDao.executeRawNoArgs( "INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, proxyApps, bypass," + - " udpdns, auth, ipv6, individual) " + - "SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, auth," + - " ipv6, individual FROM `tmp`;") + " udpdns, ipv6, individual) " + + "SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, ipv6," + + " individual FROM `tmp`;") profileDao.executeRawNoArgs("DROP TABLE `tmp`;") profileDao.executeRawNoArgs("COMMIT;") } else if (oldVersion < 13) { @@ -127,10 +124,10 @@ class DBHelper(val context: Context) profileDao.executeRawNoArgs("ALTER TABLE `profile` RENAME TO `tmp`;") TableUtils.createTable(connectionSource, classOf[Profile]) profileDao.executeRawNoArgs( - "INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, remoteDns, proxyApps," + - " bypass, udpdns, auth, ipv6, individual, tx, rx, date, userOrder, plugin) " + + "INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, remoteDns, " + + "proxyApps, bypass, udpdns, ipv6, individual, tx, rx, date, userOrder, plugin) " + "SELECT id, name, host, localPort, CASE WHEN kcp = 1 THEN kcpPort ELSE remotePort END, password, method, " + - "route, remoteDns, proxyApps, bypass, udpdns, auth, ipv6, individual, tx, rx, date, userOrder, " + + "route, remoteDns, proxyApps, bypass, udpdns, ipv6, individual, tx, rx, date, userOrder, " + "CASE WHEN kcp = 1 THEN 'kcptun ' || kcpcli ELSE NULL END FROM `tmp`;") profileDao.executeRawNoArgs("DROP TABLE `tmp`;") profileDao.executeRawNoArgs("COMMIT;") diff --git a/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala b/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala index 19ffe4d5..b7ad44d7 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala @@ -68,9 +68,6 @@ class Profile { @DatabaseField var udpdns: Boolean = _ - @DatabaseField - var auth: Boolean = _ - @DatabaseField var ipv6: Boolean = _ @@ -96,8 +93,8 @@ class Profile { def nameIsEmpty: Boolean = name == null || name.isEmpty def getName: String = if (nameIsEmpty) formattedAddress else name - override def toString: String = "ss://" + Base64.encodeToString("%s%s:%s@%s:%d".formatLocal(Locale.ENGLISH, - method, if (auth) "-auth" else "", password, host, remotePort).getBytes, Base64.NO_PADDING | Base64.NO_WRAP) + + override def toString: String = "ss://" + Base64.encodeToString("%s:%s@%s:%d".formatLocal(Locale.ENGLISH, + method, password, host, remotePort).getBytes, Base64.NO_PADDING | Base64.NO_WRAP) + (if (TextUtils.isEmpty(name)) "" else '#' + URLEncoder.encode(name, "utf-8")) def isMethodUnsafe: Boolean = "table".equalsIgnoreCase(method) || "rc4".equalsIgnoreCase(method) @@ -114,7 +111,6 @@ class Profile { .putBoolean(Key.proxyApps, proxyApps) .putBoolean(Key.bypass, bypass) .putBoolean(Key.udpdns, udpdns) - .putBoolean(Key.auth, auth) .putBoolean(Key.ipv6, ipv6) .putString(Key.individual, individual) .putString(Key.plugin, plugin) @@ -132,7 +128,6 @@ class Profile { proxyApps = pref.getBoolean(Key.proxyApps, false) bypass = pref.getBoolean(Key.bypass, false) udpdns = pref.getBoolean(Key.udpdns, false) - auth = pref.getBoolean(Key.auth, false) ipv6 = pref.getBoolean(Key.ipv6, false) individual = pref.getString(Key.individual, null) plugin = pref.getString(Key.plugin, null) diff --git a/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala b/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala index 69034aba..d1d9fe21 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala @@ -141,7 +141,6 @@ object Key { val proxyApps = "isProxyApps" val bypass = "isBypassApps" val udpdns = "isUdpDns" - val auth = "isAuth" val ipv6 = "isIpv6" val host = "proxy" diff --git a/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala b/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala index e9666fda..8597da9a 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala @@ -36,7 +36,6 @@ object Parser { case Some(ss) => val profile = new Profile profile.method = ss.group(2).toLowerCase - if (ss.group(3) != null) profile.auth = true profile.password = ss.group(4) profile.host = ss.group(5) profile.remotePort = ss.group(6).toInt