diff --git a/ssl/test/runner/common.go b/ssl/test/runner/common.go index f5ceefce..a253cb9d 100644 --- a/ssl/test/runner/common.go +++ b/ssl/test/runner/common.go @@ -475,8 +475,9 @@ type ProtocolBugs struct { // two records. FragmentAlert bool - // SendSpuriousAlert will cause an spurious, unwanted alert to be sent. - SendSpuriousAlert bool + // SendSpuriousAlert, if non-zero, will cause an spurious, unwanted + // alert to be sent. + SendSpuriousAlert alert // RsaClientKeyExchangeVersion, if non-zero, causes the client to send a // ClientKeyExchange with the specified version rather than the diff --git a/ssl/test/runner/conn.go b/ssl/test/runner/conn.go index 90ce9bb0..6207b02a 100644 --- a/ssl/test/runner/conn.go +++ b/ssl/test/runner/conn.go @@ -1093,8 +1093,8 @@ func (c *Conn) Write(b []byte) (int, error) { return 0, alertInternalError } - if c.config.Bugs.SendSpuriousAlert { - c.sendAlertLocked(alertRecordOverflow) + if c.config.Bugs.SendSpuriousAlert != 0 { + c.sendAlertLocked(c.config.Bugs.SendSpuriousAlert) } // SSL 3.0 and TLS 1.0 are susceptible to a chosen-plaintext diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go index 6ee34adc..70ed3146 100644 --- a/ssl/test/runner/runner.go +++ b/ssl/test/runner/runner.go @@ -375,13 +375,36 @@ var testCases = []testCase{ shouldFail: true, expectedError: ":HANDSHAKE_RECORD_BEFORE_CCS:", }, + { + testType: serverTest, + name: "Alert", + config: Config{ + Bugs: ProtocolBugs{ + SendSpuriousAlert: alertRecordOverflow, + }, + }, + shouldFail: true, + expectedError: ":TLSV1_ALERT_RECORD_OVERFLOW:", + }, + { + protocol: dtls, + testType: serverTest, + name: "Alert-DTLS", + config: Config{ + Bugs: ProtocolBugs{ + SendSpuriousAlert: alertRecordOverflow, + }, + }, + shouldFail: true, + expectedError: ":TLSV1_ALERT_RECORD_OVERFLOW:", + }, { testType: serverTest, name: "FragmentAlert", config: Config{ Bugs: ProtocolBugs{ FragmentAlert: true, - SendSpuriousAlert: true, + SendSpuriousAlert: alertRecordOverflow, }, }, shouldFail: true, @@ -394,7 +417,7 @@ var testCases = []testCase{ config: Config{ Bugs: ProtocolBugs{ FragmentAlert: true, - SendSpuriousAlert: true, + SendSpuriousAlert: alertRecordOverflow, }, }, shouldFail: true,