]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/tls: use illegal param alert for bad compression
authorDaniel McCarney <daniel@binaryparadox.net>
Tue, 29 Apr 2025 18:33:15 +0000 (14:33 -0400)
committerDaniel McCarney <daniel@binaryparadox.net>
Fri, 9 May 2025 20:38:22 +0000 (13:38 -0700)
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 <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/crypto/tls/bogo_config.json
src/crypto/tls/handshake_client.go

index 5261a35ca95bad2a7ff38805334f86a34ae34cfb..7184f56b05884aed5e44bd2211bb33c54cb975d7 100644 (file)
@@ -65,7 +65,6 @@
         "NoNullCompression-TLS12": "TODO: first pass, this should be fixed",
         "KeyUpdate-RequestACK": "TODO: first pass, this should be fixed",
         "TLS13-HRR-InvalidCompressionMethod": "TODO: first pass, this should be fixed",
-        "InvalidCompressionMethod": "TODO: first pass, this should be fixed",
         "TLS-TLS12-RSA_WITH_AES_128_GCM_SHA256-LargeRecord": "TODO: first pass, this should be fixed",
         "TLS-TLS1-RSA_WITH_AES_128_CBC_SHA-LargeRecord": "TODO: first pass, this should be fixed",
         "TLS-TLS11-RSA_WITH_AES_128_CBC_SHA-LargeRecord": "TODO: first pass, this should be fixed",
index 30f2e2a2a2c43d23094f3cd0d52f2dfadd5356b8..0971afabaca8871c0b4aac07c0ae73e1205cb775 100644 (file)
@@ -889,7 +889,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")
        }