Skip to content

Commit

Permalink
Check deprecated ciphers (#2651)
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Jan 5, 2021
1 parent e51f177 commit 5352fae
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
7 changes: 7 additions & 0 deletions core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
}

/**
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
<item>NONE</item>
<item>RC4-MD5</item>
<item>AES-128-CFB</item>
<item>AES-192-CFB</item>
<item>AES-256-CFB</item>
<item>AES-128-CTR</item>
<item>AES-192-CTR</item>
<item>AES-256-CTR</item>
<item>BF-CFB</item>
<item>CAMELLIA-128-CFB</item>
<item>CAMELLIA-192-CFB</item>
<item>CAMELLIA-256-CFB</item>
<item>SALSA20</item>
<item>CHACHA20</item>
Expand All @@ -22,11 +25,14 @@
<item>none</item>
<item>rc4-md5</item>
<item>aes-128-cfb</item>
<item>aes-192-cfb</item>
<item>aes-256-cfb</item>
<item>aes-128-ctr</item>
<item>aes-192-ctr</item>
<item>aes-256-ctr</item>
<item>bf-cfb</item>
<item>camellia-128-cfb</item>
<item>camellia-192-cfb</item>
<item>camellia-256-cfb</item>
<item>salsa20</item>
<item>chacha20</item>
Expand Down

0 comments on commit 5352fae

Please sign in to comment.