Make WrongCertificateMessageType work in both 1.3 and 1.2.

In preparation for getting the tests going.

Change-Id: Ifd2ab09e6ce91f99abde759d5db8dc6554521572
Reviewed-on: https://boringssl-review.googlesource.com/8764
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2016-07-13 16:58:23 -04:00
parent 6f8f4de300
commit 1edae6beea
2 changed files with 18 additions and 2 deletions

View File

@ -433,8 +433,12 @@ Curves:
if !config.Bugs.EmptyCertificateList { if !config.Bugs.EmptyCertificateList {
certMsg.certificates = hs.cert.Certificate certMsg.certificates = hs.cert.Certificate
} }
hs.writeServerHash(certMsg.marshal()) certMsgBytes := certMsg.marshal()
c.writeRecord(recordTypeHandshake, certMsg.marshal()) if config.Bugs.WrongCertificateMessageType {
certMsgBytes[0] += 42
}
hs.writeServerHash(certMsgBytes)
c.writeRecord(recordTypeHandshake, certMsgBytes)
certVerify := &certificateVerifyMsg{ certVerify := &certificateVerifyMsg{
hasSignatureAlgorithm: true, hasSignatureAlgorithm: true,

View File

@ -1679,6 +1679,18 @@ func addBasicTests() {
}, },
{ {
name: "WrongMessageType", name: "WrongMessageType",
config: Config{
MaxVersion: VersionTLS12,
Bugs: ProtocolBugs{
WrongCertificateMessageType: true,
},
},
shouldFail: true,
expectedError: ":UNEXPECTED_MESSAGE:",
expectedLocalError: "remote error: unexpected message",
},
{
name: "WrongMessageType-TLS13",
config: Config{ config: Config{
Bugs: ProtocolBugs{ Bugs: ProtocolBugs{
WrongCertificateMessageType: true, WrongCertificateMessageType: true,