From 5352fae61345062b832498fde1371db48b4b4c51 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Tue, 5 Jan 2021 10:05:49 +0800 Subject: [PATCH] Check deprecated ciphers (#2651) --- core/build.gradle.kts | 1 + .../main/java/com/github/shadowsocks/bg/ProxyInstance.kt | 7 +++++++ core/src/main/res/values/arrays.xml | 6 ++++++ core/src/main/rust/shadowsocks-rust | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 178448c896..f43a9fdc07 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -38,6 +38,7 @@ cargo { profile = findProperty("CARGO_PROFILE")?.toString() ?: currentFlavor extraCargoBuildArguments = listOf("--bin", libname!!) featureSpec.noDefaultBut(arrayOf( + "stream-cipher", "logging", "local-flow-stat", "local-dns")) diff --git a/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt b/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt index 3b936f2914..3f56241d72 100644 --- a/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt +++ b/core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt @@ -53,6 +53,13 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro throw UnknownHostException().initCause(e) }?.hostAddress ?: throw UnknownHostException() } + // check the crypto + if (profile.method == "xchacha20-ietf-poly1305") { + throw IllegalArgumentException("cipher xchacha20-ietf-poly1305 is deprecated.") + } + if (profile.method == "aes-192-gcm") { + throw IllegalArgumentException("cipher aes-192-gcm is deprecated.") + } } /** diff --git a/core/src/main/res/values/arrays.xml b/core/src/main/res/values/arrays.xml index f50e97843c..eab8518f8c 100644 --- a/core/src/main/res/values/arrays.xml +++ b/core/src/main/res/values/arrays.xml @@ -4,11 +4,14 @@ NONE RC4-MD5 AES-128-CFB + AES-192-CFB AES-256-CFB AES-128-CTR + AES-192-CTR AES-256-CTR BF-CFB CAMELLIA-128-CFB + CAMELLIA-192-CFB CAMELLIA-256-CFB SALSA20 CHACHA20 @@ -22,11 +25,14 @@ none rc4-md5 aes-128-cfb + aes-192-cfb aes-256-cfb aes-128-ctr + aes-192-ctr aes-256-ctr bf-cfb camellia-128-cfb + camellia-192-cfb camellia-256-cfb salsa20 chacha20 diff --git a/core/src/main/rust/shadowsocks-rust b/core/src/main/rust/shadowsocks-rust index 7bf6d320a7..9000b31ffb 160000 --- a/core/src/main/rust/shadowsocks-rust +++ b/core/src/main/rust/shadowsocks-rust @@ -1 +1 @@ -Subproject commit 7bf6d320a743147d165c3ff1a8d5d1992db3e970 +Subproject commit 9000b31ffb9805324719ff5ba57c9338e357d1f0