Skip to content

Commit 4eaa080

Browse files
committed
added 3des-cbc cipher support
1 parent 9b9e145 commit 4eaa080

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This is a fork of [Thrussh](https://nest.pijul.com/pijul/thrussh) by Pierre-Éti
2626
* `aes256-cbc`
2727
* `aes192-cbc`
2828
* `aes128-cbc`
29+
* `3des-cbc`
2930
* Key exchanges:
3031
* `curve25519-sha256@libssh.org`
3132
* `diffie-hellman-group1-sha1`

russh/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ tokio = { workspace = true, features = [
6262
"macros",
6363
"process",
6464
] }
65+
des = "0.8.1"
6566

6667
[dev-dependencies]
6768
anyhow = "1.0"

russh/src/cipher/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use aes::{Aes128, Aes192, Aes256};
2525
use byteorder::{BigEndian, ByteOrder};
2626
use cbc::CbcWrapper;
2727
use ctr::Ctr128BE;
28+
use des::TdesEde3;
2829
use log::debug;
2930
use once_cell::sync::Lazy;
3031
use tokio::io::{AsyncRead, AsyncReadExt};
@@ -70,6 +71,8 @@ pub(crate) trait Cipher {
7071

7172
/// `clear`
7273
pub const CLEAR: Name = Name("clear");
74+
/// `3des-cbc`
75+
pub const TRIPLE_DES_CBC: Name = Name("3des-cbc");
7376
/// `aes128-ctr`
7477
pub const AES_128_CTR: Name = Name("aes128-ctr");
7578
/// `aes192-ctr`
@@ -90,6 +93,7 @@ pub const CHACHA20_POLY1305: Name = Name("chacha20-poly1305@openssh.com");
9093
pub const NONE: Name = Name("none");
9194

9295
static _CLEAR: Clear = Clear {};
96+
static _3DES_CBC: SshBlockCipher<CbcWrapper<TdesEde3>> = SshBlockCipher(PhantomData);
9397
static _AES_128_CTR: SshBlockCipher<Ctr128BE<Aes128>> = SshBlockCipher(PhantomData);
9498
static _AES_192_CTR: SshBlockCipher<Ctr128BE<Aes192>> = SshBlockCipher(PhantomData);
9599
static _AES_256_CTR: SshBlockCipher<Ctr128BE<Aes256>> = SshBlockCipher(PhantomData);
@@ -102,6 +106,7 @@ static _CHACHA20_POLY1305: SshChacha20Poly1305Cipher = SshChacha20Poly1305Cipher
102106
pub static ALL_CIPHERS: &[&Name] = &[
103107
&CLEAR,
104108
&NONE,
109+
&TRIPLE_DES_CBC,
105110
&AES_128_CTR,
106111
&AES_192_CTR,
107112
&AES_256_CTR,
@@ -117,6 +122,7 @@ pub(crate) static CIPHERS: Lazy<HashMap<&'static Name, &(dyn Cipher + Send + Syn
117122
let mut h: HashMap<&'static Name, &(dyn Cipher + Send + Sync)> = HashMap::new();
118123
h.insert(&CLEAR, &_CLEAR);
119124
h.insert(&NONE, &_CLEAR);
125+
h.insert(&TRIPLE_DES_CBC, &_3DES_CBC);
120126
h.insert(&AES_128_CTR, &_AES_128_CTR);
121127
h.insert(&AES_192_CTR, &_AES_192_CTR);
122128
h.insert(&AES_256_CTR, &_AES_256_CTR);

0 commit comments

Comments
 (0)