Add version tolerance tests for DTLS.
Also move them with the other version negotiation tests. Change-Id: I8ea5777c131f8ab618de3c6d02038e802bd34dd0 Reviewed-on: https://boringssl-review.googlesource.com/8550 Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
parent
ce9a2166d6
commit
95c69563dc
@ -1378,37 +1378,6 @@ func addBasicTests() {
|
||||
},
|
||||
expectedVersion: VersionTLS13,
|
||||
},
|
||||
{
|
||||
testType: serverTest,
|
||||
name: "MinorVersionTolerance",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x03ff,
|
||||
},
|
||||
},
|
||||
expectedVersion: VersionTLS13,
|
||||
},
|
||||
{
|
||||
testType: serverTest,
|
||||
name: "MajorVersionTolerance",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x0400,
|
||||
},
|
||||
},
|
||||
expectedVersion: VersionTLS13,
|
||||
},
|
||||
{
|
||||
testType: serverTest,
|
||||
name: "VersionTooLow",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x0200,
|
||||
},
|
||||
},
|
||||
shouldFail: true,
|
||||
expectedError: ":UNSUPPORTED_PROTOCOL:",
|
||||
},
|
||||
{
|
||||
testType: serverTest,
|
||||
name: "HttpGET",
|
||||
@ -3668,6 +3637,77 @@ func addVersionNegotiationTests() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test for version tolerance.
|
||||
testCases = append(testCases, testCase{
|
||||
testType: serverTest,
|
||||
name: "MinorVersionTolerance",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x03ff,
|
||||
},
|
||||
},
|
||||
expectedVersion: VersionTLS13,
|
||||
})
|
||||
testCases = append(testCases, testCase{
|
||||
testType: serverTest,
|
||||
name: "MajorVersionTolerance",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x0400,
|
||||
},
|
||||
},
|
||||
expectedVersion: VersionTLS13,
|
||||
})
|
||||
testCases = append(testCases, testCase{
|
||||
protocol: dtls,
|
||||
testType: serverTest,
|
||||
name: "MinorVersionTolerance-DTLS",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x03ff,
|
||||
},
|
||||
},
|
||||
expectedVersion: VersionTLS12,
|
||||
})
|
||||
testCases = append(testCases, testCase{
|
||||
protocol: dtls,
|
||||
testType: serverTest,
|
||||
name: "MajorVersionTolerance-DTLS",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x0400,
|
||||
},
|
||||
},
|
||||
expectedVersion: VersionTLS12,
|
||||
})
|
||||
|
||||
// Test that versions below 3.0 are rejected.
|
||||
testCases = append(testCases, testCase{
|
||||
testType: serverTest,
|
||||
name: "VersionTooLow",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
SendClientVersion: 0x0200,
|
||||
},
|
||||
},
|
||||
shouldFail: true,
|
||||
expectedError: ":UNSUPPORTED_PROTOCOL:",
|
||||
})
|
||||
testCases = append(testCases, testCase{
|
||||
protocol: dtls,
|
||||
testType: serverTest,
|
||||
name: "VersionTooLow-DTLS",
|
||||
config: Config{
|
||||
Bugs: ProtocolBugs{
|
||||
// 0x0201 is the lowest version expressable in
|
||||
// DTLS.
|
||||
SendClientVersion: 0x0201,
|
||||
},
|
||||
},
|
||||
shouldFail: true,
|
||||
expectedError: ":UNSUPPORTED_PROTOCOL:",
|
||||
})
|
||||
}
|
||||
|
||||
func addMinimumVersionTests() {
|
||||
|
Loading…
Reference in New Issue
Block a user