diff --git a/README.md b/README.md index 921c67d5..68f2f792 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ This is a fork of [Thrussh](https://nest.pijul.com/pijul/thrussh) by Pierre-Éti * `aes256-cbc` ✨ * `aes192-cbc` ✨ * `aes128-cbc` ✨ + * `3des-cbc` ✨ * Key exchanges: * `curve25519-sha256@libssh.org` * `diffie-hellman-group1-sha1` ✨ diff --git a/russh/Cargo.toml b/russh/Cargo.toml index 70a18c75..4974d15e 100644 --- a/russh/Cargo.toml +++ b/russh/Cargo.toml @@ -62,6 +62,7 @@ tokio = { workspace = true, features = [ "macros", "process", ] } +des = "0.8.1" [dev-dependencies] anyhow = "1.0" diff --git a/russh/src/cipher/mod.rs b/russh/src/cipher/mod.rs index fbb627f7..1b5b2bff 100644 --- a/russh/src/cipher/mod.rs +++ b/russh/src/cipher/mod.rs @@ -25,6 +25,7 @@ use aes::{Aes128, Aes192, Aes256}; use byteorder::{BigEndian, ByteOrder}; use cbc::CbcWrapper; use ctr::Ctr128BE; +use des::TdesEde3; use log::debug; use once_cell::sync::Lazy; use tokio::io::{AsyncRead, AsyncReadExt}; @@ -70,6 +71,8 @@ pub(crate) trait Cipher { /// `clear` pub const CLEAR: Name = Name("clear"); +/// `3des-cbc` +pub const TRIPLE_DES_CBC: Name = Name("3des-cbc"); /// `aes128-ctr` pub const AES_128_CTR: Name = Name("aes128-ctr"); /// `aes192-ctr` @@ -90,6 +93,7 @@ pub const CHACHA20_POLY1305: Name = Name("chacha20-poly1305@openssh.com"); pub const NONE: Name = Name("none"); static _CLEAR: Clear = Clear {}; +static _3DES_CBC: SshBlockCipher> = SshBlockCipher(PhantomData); static _AES_128_CTR: SshBlockCipher> = SshBlockCipher(PhantomData); static _AES_192_CTR: SshBlockCipher> = SshBlockCipher(PhantomData); static _AES_256_CTR: SshBlockCipher> = SshBlockCipher(PhantomData); @@ -102,6 +106,7 @@ static _CHACHA20_POLY1305: SshChacha20Poly1305Cipher = SshChacha20Poly1305Cipher pub static ALL_CIPHERS: &[&Name] = &[ &CLEAR, &NONE, + &TRIPLE_DES_CBC, &AES_128_CTR, &AES_192_CTR, &AES_256_CTR, @@ -117,6 +122,7 @@ pub(crate) static CIPHERS: Lazy = HashMap::new(); h.insert(&CLEAR, &_CLEAR); h.insert(&NONE, &_CLEAR); + h.insert(&TRIPLE_DES_CBC, &_3DES_CBC); h.insert(&AES_128_CTR, &_AES_128_CTR); h.insert(&AES_192_CTR, &_AES_192_CTR); h.insert(&AES_256_CTR, &_AES_256_CTR);