ssh: add aes192-cbc and aes256-cbc cipher modes

Some legacy devices only offer AES-256 in CBC mode, which the package
did not implement. Register both the 192-bit and 256-bit variants of
the existing AES-CBC packet cipher so they can be enabled through a
custom Config. aes.NewCipher already handles 24- and 32-byte keys, so
both registrations reuse the existing implementation.
This commit is contained in:
ys-ll
2026-09-22 10:35:51 +08:00
parent 7a4a4d6bea
commit 18e0be4596
2 changed files with 9 additions and 1 deletions
+4
View File
@@ -129,6 +129,10 @@ func init() {
// You should expect that an active attacker can recover plaintext if
// you do.
cipherModes[InsecureCipherAES128CBC] = &cipherMode{16, aes.BlockSize, newAESCBCCipher}
// AES-192 and AES-256 reuse the same CBC packet cipher; aes.NewCipher
// selects the key schedule from the key length.
cipherModes[InsecureCipherAES192CBC] = &cipherMode{24, aes.BlockSize, newAESCBCCipher}
cipherModes[InsecureCipherAES256CBC] = &cipherMode{32, aes.BlockSize, newAESCBCCipher}
cipherModes[InsecureCipherTripleDESCBC] = &cipherMode{24, des.BlockSize, newTripleDESCBCCipher}
}