Test the client rejects invalid compression methods from the server.

Change-Id: I90286da596d5822d4cfedf40995d80cf76adaf97
Reviewed-on: https://boringssl-review.googlesource.com/17536
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2017-07-01 10:11:53 -04:00
parent 7d7ed9f51b
commit 413e79e947
3 changed files with 20 additions and 1 deletions

View File

@ -1279,6 +1279,10 @@ type ProtocolBugs struct {
// send in the ClientHello.
SendCompressionMethods []byte
// SendCompressionMethod is the compression method to send in the
// ServerHello.
SendCompressionMethod byte
// AlwaysSendPreSharedKeyIdentityHint, if true, causes the server to
// always send a ServerKeyExchange for PSK ciphers, even if the identity
// hint is empty.

View File

@ -1044,7 +1044,7 @@ func (hs *serverHandshakeState) processClientHello() (isResume bool, err error)
isDTLS: c.isDTLS,
vers: c.wireVersion,
versOverride: config.Bugs.SendServerHelloVersion,
compressionMethod: compressionNone,
compressionMethod: config.Bugs.SendCompressionMethod,
}
hs.hello.random = make([]byte, 32)

View File

@ -2508,6 +2508,21 @@ func addBasicTests() {
expectedError: ":INVALID_COMPRESSION_LIST:",
expectedLocalError: "remote error: illegal parameter",
},
// Test that the client rejects invalid compression methods
// from the server.
{
testType: clientTest,
name: "InvalidCompressionMethod",
config: Config{
MaxVersion: VersionTLS12,
Bugs: ProtocolBugs{
SendCompressionMethod: 1,
},
},
shouldFail: true,
expectedError: ":UNSUPPORTED_COMPRESSION_ALGORITHM:",
expectedLocalError: "remote error: illegal parameter",
},
{
name: "GREASE-Client-TLS12",
config: Config{