From ce70d0748ea8c08b51aa1240978f2844af107c0e Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sat, 10 May 2025 23:39:22 -0400 Subject: [PATCH] crypto/tls: use illegal param alert for bad compression Previously if the clientHandshakeState for the TLS 1.2 client code encountered a server helo message that contained a compression method other than compressionNone, we would emit an unexpected message alert. Instead, it seems more appropriate to return an illegal parameter alert. The server hello message _was_ expected, it just contained a bad parameter option. Making this change also allows enabling the InvalidCompressionMethod bogo test. Updates #72006 Change-Id: I27a2cd231e4b8762b0d9e2dbd3d8ddd5b87fd5c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/669155 Reviewed-by: Roland Shoemaker LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- handshake_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handshake_client.go b/handshake_client.go index b3c7cd2..4ad6aa2 100644 --- a/handshake_client.go +++ b/handshake_client.go @@ -882,7 +882,7 @@ func (hs *clientHandshakeState) processServerHello() (bool, error) { } if hs.serverHello.compressionMethod != compressionNone { - c.sendAlert(alertUnexpectedMessage) + c.sendAlert(alertIllegalParameter) return false, errors.New("tls: server selected unsupported compression format") }