Skip to content

Commit d97cfcc

Browse files
committed
#158 readded CURVE25519_PRE_RFC_8731 to Preferred::DEFAULT and removed unsafe key exchanges from non-openssl defaults
1 parent eb6fee2 commit d97cfcc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

russh/src/negotiation.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ pub struct Preferred {
5252
pub compression: &'static [&'static str],
5353
}
5454

55-
const KEX_ORDER: &[kex::Name] = &[
55+
const SAFE_KEX_ORDER: &[kex::Name] = &[
5656
kex::CURVE25519,
57+
kex::CURVE25519_PRE_RFC_8731,
5758
kex::DH_G14_SHA256,
58-
kex::DH_G14_SHA1,
59-
kex::DH_G1_SHA1,
6059
kex::EXTENSION_SUPPORT_AS_CLIENT,
6160
kex::EXTENSION_SUPPORT_AS_SERVER,
6261
];
@@ -82,7 +81,7 @@ const HMAC_ORDER: &[mac::Name] = &[
8281
impl Preferred {
8382
#[cfg(feature = "openssl")]
8483
pub const DEFAULT: Preferred = Preferred {
85-
kex: &[kex::CURVE25519, kex::DH_G14_SHA256],
84+
kex: SAFE_KEX_ORDER,
8685
key: &[key::ED25519, key::RSA_SHA2_256, key::RSA_SHA2_512],
8786
cipher: CIPHER_ORDER,
8887
mac: HMAC_ORDER,
@@ -91,15 +90,15 @@ impl Preferred {
9190

9291
#[cfg(not(feature = "openssl"))]
9392
pub const DEFAULT: Preferred = Preferred {
94-
kex: KEX_ORDER,
93+
kex: SAFE_KEX_ORDER,
9594
key: &[key::ED25519],
9695
cipher: CIPHER_ORDER,
9796
mac: HMAC_ORDER,
9897
compression: &["none", "zlib", "zlib@openssh.com"],
9998
};
10099

101100
pub const COMPRESSED: Preferred = Preferred {
102-
kex: KEX_ORDER,
101+
kex: SAFE_KEX_ORDER,
103102
key: &[key::ED25519, key::RSA_SHA2_256, key::RSA_SHA2_512],
104103
cipher: CIPHER_ORDER,
105104
mac: HMAC_ORDER,

0 commit comments

Comments
 (0)