Skip to content

Commit 643be05

Browse files
authored
Fix block ciphers + HMAC_SHA1_ETM (#298)
Due to an incorrect specified array length, any combinaison of a cipher using `block.rs`and `HMAC_SHA1_ETM` such as: ``` let mut config = client::Config::default(); config.preferred.cipher = &[cipher::AES_128_CTR]; config.preferred.mac = &[mac::HMAC_SHA1_ETM]; ``` Would fail during packet auth. ``` [...] [2024-06-07T12:49:14Z DEBUG russh::cipher] reading, clear len = 276 [2024-06-07T12:49:14Z DEBUG russh::cipher] read_exact 280 [2024-06-07T12:49:14Z DEBUG russh::cipher] read_exact done [2024-06-07T12:49:14Z TRACE russh::client] disconnected [2024-06-07T12:49:14Z DEBUG russh::client] disconnected: Error(PacketAuth) [2024-06-07T12:49:14Z TRACE mio::poll] deregistering event source from poller [2024-06-07T12:49:14Z DEBUG russh::client] drop session [2024-06-07T12:49:14Z DEBUG russh::client] drop handle ``` This PR fixes that.
1 parent 2577754 commit 643be05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

russh/src/mac/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static _HMAC_SHA256: CryptoMacAlgorithm<Hmac<Sha256>, U32> =
7474
CryptoMacAlgorithm(PhantomData, PhantomData);
7575
static _HMAC_SHA512: CryptoMacAlgorithm<Hmac<Sha512>, U64> =
7676
CryptoMacAlgorithm(PhantomData, PhantomData);
77-
static _HMAC_SHA1_ETM: CryptoEtmMacAlgorithm<Hmac<Sha1>, U64> =
77+
static _HMAC_SHA1_ETM: CryptoEtmMacAlgorithm<Hmac<Sha1>, U20> =
7878
CryptoEtmMacAlgorithm(PhantomData, PhantomData);
7979
static _HMAC_SHA256_ETM: CryptoEtmMacAlgorithm<Hmac<Sha256>, U32> =
8080
CryptoEtmMacAlgorithm(PhantomData, PhantomData);

0 commit comments

Comments
 (0)