Add server-side FallbackSCSV tests.

Assert that inappropriate fallbacks are detected, but if the client_version
matches the server's highest version, do not abort the handshake.

Change-Id: I9d72570bce45e1eb23fc2b74a3c5fca10562e573
Reviewed-on: https://boringssl-review.googlesource.com/1373
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2014-08-02 04:22:02 -04:00 committed by Adam Langley
parent d86c7671a8
commit bef270a9cf
3 changed files with 29 additions and 0 deletions

View File

@ -387,6 +387,10 @@ type ProtocolBugs struct {
// SendV2ClientHello causes the client to send a V2ClientHello // SendV2ClientHello causes the client to send a V2ClientHello
// instead of a normal ClientHello. // instead of a normal ClientHello.
SendV2ClientHello bool SendV2ClientHello bool
// SendFallbackSCSV causes the client to include
// TLS_FALLBACK_SCSV in the ClientHello.
SendFallbackSCSV bool
} }
func (c *Config) serverInit() { func (c *Config) serverInit() {

View File

@ -71,6 +71,10 @@ NextCipherSuite:
} }
} }
if c.config.Bugs.SendFallbackSCSV {
hello.cipherSuites = append(hello.cipherSuites, fallbackSCSV)
}
_, err := io.ReadFull(c.config.rand(), hello.random) _, err := io.ReadFull(c.config.rand(), hello.random)
if err != nil { if err != nil {
c.sendAlert(alertInternalError) c.sendAlert(alertInternalError)

View File

@ -380,6 +380,27 @@ var testCases = []testCase{
}, },
}, },
}, },
{
testType: serverTest,
name: "FallbackSCSV",
config: Config{
MaxVersion: VersionTLS11,
Bugs: ProtocolBugs{
SendFallbackSCSV: true,
},
},
shouldFail: true,
expectedError: ":INAPPROPRIATE_FALLBACK:",
},
{
testType: serverTest,
name: "FallbackSCSV-VersionMatch",
config: Config{
Bugs: ProtocolBugs{
SendFallbackSCSV: true,
},
},
},
} }
func doExchange(testType testType, config *Config, conn net.Conn, messageLen int) error { func doExchange(testType testType, config *Config, conn net.Conn, messageLen int) error {