Skip to content

Commit 6fabb3a

Browse files
committed
curve25519 encoding fix
1 parent cb45295 commit 6fabb3a

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

russh/src/client/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,7 @@ impl Session {
11351135
// The kex signal has not been consumed yet,
11361136
// so we can send return the concrete error to be propagated
11371137
// into the JoinHandle and returned from `connect_stream`
1138+
debug!("disconnected during handshake {e:?}");
11381139
Err(e)
11391140
} else {
11401141
// The kex signal has been consumed, so no one is

russh/src/kex/curve25519.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use sha2::Digest;
77
use ssh_encoding::{Encode, Writer};
88

99
use super::{
10-
compute_keys, encode_mpint, KexAlgorithm, KexAlgorithmImplementor, KexType, SharedSecret,
10+
KexAlgorithm, KexAlgorithmImplementor, KexType, SharedSecret, compute_keys, encode_mpint,
1111
};
1212
use crate::mac::{self};
1313
use crate::session::Exchange;
14-
use crate::{cipher, msg, CryptoVec};
14+
use crate::{CryptoVec, cipher, msg};
1515

1616
pub struct Curve25519KexType {}
1717

@@ -79,7 +79,9 @@ impl KexAlgorithmImplementor for Curve25519Kex {
7979

8080
// fill exchange.
8181
exchange.server_ephemeral.clear();
82-
exchange.server_ephemeral.extend_from_slice(&server_pubkey.0);
82+
exchange
83+
.server_ephemeral
84+
.extend_from_slice(&server_pubkey.0);
8385
let shared = server_secret * client_pubkey;
8486
self.shared_secret = Some(shared);
8587
Ok(())
@@ -99,7 +101,7 @@ impl KexAlgorithmImplementor for Curve25519Kex {
99101
client_ephemeral.extend_from_slice(&client_pubkey.0);
100102

101103
msg::KEX_ECDH_INIT.encode(writer)?;
102-
client_pubkey.0.encode(writer)?;
104+
(&client_pubkey.0[..]).encode(writer)?;
103105

104106
self.local_secret = Some(client_secret);
105107
Ok(())

0 commit comments

Comments
 (0)