Commit 24e5886c authored by David Benjamin's avatar David Benjamin Committed by CQ bot account: [email protected]
Browse files

Add a test for invalid alert types.

This doesn't hugely matter, but I noticed it was some missing coverage.

Change-Id: I3e425d47fbbeaacd9da2ae883f34e89b4562ec11
Reviewed-on: https://boringssl-review.googlesource.com/17184


Commit-Queue: Steven Valdez <[email protected]>
Reviewed-by: default avatarSteven Valdez <[email protected]>
CQ-Verified: CQ bot account: [email protected] <[email protected]>
parent 5e578c9d
......@@ -412,11 +412,14 @@ type testCase struct {
// which will be compared against the expected value.
testTLSUnique bool
// sendEmptyRecords is the number of consecutive empty records to send
// before and after the test message.
// before each test message.
sendEmptyRecords int
// sendWarningAlerts is the number of consecutive warning alerts to send
// before and after the test message.
// before each test message.
sendWarningAlerts int
// sendBogusAlertType, if true, causes a bogus alert of invalid type to
// be sent before each test message.
sendBogusAlertType bool
// sendKeyUpdates is the number of consecutive key updates to send
// before and after the test message.
sendKeyUpdates int
......@@ -750,6 +753,10 @@ func doExchange(test *testCase, config *Config, conn net.Conn, isResume bool, nu
tlsConn.SendAlert(alertLevelWarning, alertUnexpectedMessage)
}
if test.sendBogusAlertType {
tlsConn.SendAlert(0x42, alertUnexpectedMessage)
}
testMessage := make([]byte, messageLen)
for i := range testMessage {
testMessage[i] = 0x42 ^ byte(j)
......@@ -2096,6 +2103,21 @@ func addBasicTests() {
shouldFail: true,
expectedError: ":TOO_MANY_WARNING_ALERTS:",
},
{
name: "SendBogusAlertType",
sendBogusAlertType: true,
shouldFail: true,
expectedError: ":UNKNOWN_ALERT_TYPE:",
expectedLocalError: "remote error: illegal parameter",
},
{
protocol: dtls,
name: "SendBogusAlertType-DTLS",
sendBogusAlertType: true,
shouldFail: true,
expectedError: ":UNKNOWN_ALERT_TYPE:",
expectedLocalError: "remote error: illegal parameter",
},
{
name: "TooManyKeyUpdates",
config: Config{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment