aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Picard <rob.picard@goteleport.com>2026-03-12 11:17:52 -0600
committerNicola Murino <nicola.murino@gmail.com>2026-03-20 08:28:06 -0700
commit81c6cb34a8fc386ed53293cd79e3c0c232ee7366 (patch)
treeb68cf9aed3339baaede7e9a3cd98e7f97bcf943c
parent982eaa62dfb7273603b97fc1835561450096f3bd (diff)
downloadgo-x-crypto-81c6cb34a8fc386ed53293cd79e3c0c232ee7366.tar.xz
ssh: swap cbcMinPaddingSize to cbcMinPacketSize to get encLength
The existing code uses cbcMinPaddingSize incorrectly. That value is also used in the first parameter of the max call, meaning it will never be used. Fixes golang/go#78062 Change-Id: I4243ab668168313919df33d78c6965e9eff0e934 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/754780 Reviewed-by: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Nicola Murino <nicola.murino@gmail.com>
-rw-r--r--ssh/cipher.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/ssh/cipher.go b/ssh/cipher.go
index 7554ed5..ad2b370 100644
--- a/ssh/cipher.go
+++ b/ssh/cipher.go
@@ -586,7 +586,7 @@ func (c *cbcCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader
// Length of encrypted portion of the packet (header, payload, padding).
// Enforce minimum padding and packet size.
- encLength := maxUInt32(prefixLen+len(packet)+cbcMinPaddingSize, cbcMinPaddingSize)
+ encLength := maxUInt32(prefixLen+len(packet)+cbcMinPaddingSize, cbcMinPacketSize)
// Enforce block size.
encLength = (encLength + effectiveBlockSize - 1) / effectiveBlockSize * effectiveBlockSize