Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-07-24 17:56:51 +0300
committerDavid Benjamin <davidben@google.com>2016-07-25 18:03:38 +0300
commit12d2c480864d6e60e78d77a6bb7a8c9585900456 (patch)
tree3eaa393ee20e20c67206c6edd32a11182dee6d77
parent0e04498934916da26dcdb219240732ffc903ed60 (diff)
Add a packed renegotiation test.
Ridiculous as it is, the protocol does not forbid packing HelloRequest and Finished into the same record. Add a test for this case. Change-Id: I8e1455b261f56169309070bf44d14d40a63eae50 Reviewed-on: https://boringssl-review.googlesource.com/8901 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com>
-rw-r--r--ssl/test/runner/common.go4
-rw-r--r--ssl/test/runner/conn.go4
-rw-r--r--ssl/test/runner/handshake_server.go5
-rw-r--r--ssl/test/runner/runner.go18
4 files changed, 30 insertions, 1 deletions
diff --git a/ssl/test/runner/common.go b/ssl/test/runner/common.go
index b2d31dc2..240a7ecd 100644
--- a/ssl/test/runner/common.go
+++ b/ssl/test/runner/common.go
@@ -997,6 +997,10 @@ type ProtocolBugs struct {
// SkipHelloRetryRequest, if true, causes the TLS 1.3 server to not send
// HelloRetryRequest.
SkipHelloRetryRequest bool
+
+ // PackHelloRequestWithFinished, if true, causes the TLS server to send
+ // HelloRequest in the same record as Finished.
+ PackHelloRequestWithFinished bool
}
func (c *Config) serverInit() {
diff --git a/ssl/test/runner/conn.go b/ssl/test/runner/conn.go
index fbd501a0..1b6c5573 100644
--- a/ssl/test/runner/conn.go
+++ b/ssl/test/runner/conn.go
@@ -1268,6 +1268,10 @@ func (c *Conn) Write(b []byte) (int, error) {
c.out.Lock()
defer c.out.Unlock()
+ // Flush any pending handshake data. PackHelloRequestWithFinished may
+ // have been set and the handshake not followed by Renegotiate.
+ c.flushHandshake()
+
if err := c.out.err; err != nil {
return 0, err
}
diff --git a/ssl/test/runner/handshake_server.go b/ssl/test/runner/handshake_server.go
index f8b5deed..aeda2f15 100644
--- a/ssl/test/runner/handshake_server.go
+++ b/ssl/test/runner/handshake_server.go
@@ -1391,7 +1391,10 @@ func (hs *serverHandshakeState) sendFinished(out []byte) error {
if !c.config.Bugs.SkipFinished && len(postCCSBytes) > 0 {
c.writeRecord(recordTypeHandshake, postCCSBytes)
- c.flushHandshake()
+ if !c.config.Bugs.PackHelloRequestWithFinished {
+ // Defer flushing until renegotiation.
+ c.flushHandshake()
+ }
}
c.cipherSuite = hs.suite
diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go
index fd263e63..f8cb4d94 100644
--- a/ssl/test/runner/runner.go
+++ b/ssl/test/runner/runner.go
@@ -5021,6 +5021,24 @@ func addRenegotiationTests() {
},
})
+ // Test renegotiation works if HelloRequest and server Finished come in
+ // the same record.
+ testCases = append(testCases, testCase{
+ name: "Renegotiate-Client-Packed",
+ config: Config{
+ MaxVersion: VersionTLS12,
+ Bugs: ProtocolBugs{
+ PackHandshakeFlight: true,
+ PackHelloRequestWithFinished: true,
+ },
+ },
+ renegotiate: 1,
+ flags: []string{
+ "-renegotiate-freely",
+ "-expect-total-renegotiations", "1",
+ },
+ })
+
// Renegotiation is forbidden in TLS 1.3.
//
// TODO(davidben): This test current asserts that we ignore