Add a test that DTLS does not support RC4.

Make sure we don't break that on accident.

Change-Id: I22d58d35170d43375622fe61e4a588d1d626a054
Reviewed-on: https://boringssl-review.googlesource.com/4960
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-05-30 17:13:12 -04:00 committed by Adam Langley
parent 9a980abaee
commit 0fa4012331
3 changed files with 17 additions and 1 deletions

View File

@ -723,6 +723,9 @@ type ProtocolBugs struct {
// PackHandshakeRecords, if true, causes handshake records to be packed // PackHandshakeRecords, if true, causes handshake records to be packed
// into individual packets, up to the specified packet size. // into individual packets, up to the specified packet size.
PackHandshakeRecords int PackHandshakeRecords int
// EnableAllCiphersInDTLS, if true, causes RC4 to be enabled in DTLS.
EnableAllCiphersInDTLS bool
} }
func (c *Config) serverInit() { func (c *Config) serverInit() {

View File

@ -115,7 +115,7 @@ NextCipherSuite:
continue continue
} }
// Don't advertise non-DTLS cipher suites on DTLS. // Don't advertise non-DTLS cipher suites on DTLS.
if c.isDTLS && suite.flags&suiteNoDTLS != 0 { if c.isDTLS && suite.flags&suiteNoDTLS != 0 && !c.config.Bugs.EnableAllCiphersInDTLS {
continue continue
} }
hello.cipherSuites = append(hello.cipherSuites, suiteId) hello.cipherSuites = append(hello.cipherSuites, suiteId)

View File

@ -1116,6 +1116,19 @@ var testCases = []testCase{
}, },
}, },
}, },
{
testType: serverTest,
protocol: dtls,
name: "NoRC4-DTLS",
config: Config{
CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_RC4_128_SHA},
Bugs: ProtocolBugs{
EnableAllCiphersInDTLS: true,
},
},
shouldFail: true,
expectedError: ":NO_SHARED_CIPHER:",
},
} }
func doExchange(test *testCase, config *Config, conn net.Conn, messageLen int, isResume bool) error { func doExchange(test *testCase, config *Config, conn net.Conn, messageLen int, isResume bool) error {