@@ -412,11 +412,14 @@ type testCase struct {
412
412
// which will be compared against the expected value.
413
413
testTLSUnique bool
414
414
// sendEmptyRecords is the number of consecutive empty records to send
415
- // before and after the test message.
415
+ // before each test message.
416
416
sendEmptyRecords int
417
417
// sendWarningAlerts is the number of consecutive warning alerts to send
418
- // before and after the test message.
418
+ // before each test message.
419
419
sendWarningAlerts int
420
+ // sendBogusAlertType, if true, causes a bogus alert of invalid type to
421
+ // be sent before each test message.
422
+ sendBogusAlertType bool
420
423
// sendKeyUpdates is the number of consecutive key updates to send
421
424
// before and after the test message.
422
425
sendKeyUpdates int
@@ -750,6 +753,10 @@ func doExchange(test *testCase, config *Config, conn net.Conn, isResume bool, nu
750
753
tlsConn .SendAlert (alertLevelWarning , alertUnexpectedMessage )
751
754
}
752
755
756
+ if test .sendBogusAlertType {
757
+ tlsConn .SendAlert (0x42 , alertUnexpectedMessage )
758
+ }
759
+
753
760
testMessage := make ([]byte , messageLen )
754
761
for i := range testMessage {
755
762
testMessage [i ] = 0x42 ^ byte (j )
@@ -2096,6 +2103,21 @@ func addBasicTests() {
2096
2103
shouldFail : true ,
2097
2104
expectedError : ":TOO_MANY_WARNING_ALERTS:" ,
2098
2105
},
2106
+ {
2107
+ name : "SendBogusAlertType" ,
2108
+ sendBogusAlertType : true ,
2109
+ shouldFail : true ,
2110
+ expectedError : ":UNKNOWN_ALERT_TYPE:" ,
2111
+ expectedLocalError : "remote error: illegal parameter" ,
2112
+ },
2113
+ {
2114
+ protocol : dtls ,
2115
+ name : "SendBogusAlertType-DTLS" ,
2116
+ sendBogusAlertType : true ,
2117
+ shouldFail : true ,
2118
+ expectedError : ":UNKNOWN_ALERT_TYPE:" ,
2119
+ expectedLocalError : "remote error: illegal parameter" ,
2120
+ },
2099
2121
{
2100
2122
name : "TooManyKeyUpdates" ,
2101
2123
config : Config {
0 commit comments