Add test coverage for normal alert parsing.
We have test coverage for invalid alerts, but not for normal ones on the DTLS side. Change-Id: I359dce8d4dc80dfa99b5d8bacd73f48a8e4ac310 Reviewed-on: https://boringssl-review.googlesource.com/3291 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
ddb9f15e18
commit
3fd1fbd1c8
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user