runner: Fix test DTLS 1.3 HelloRetryRequest messages on resume The test harness was accidentally echoing the legacy session ID in DTLS 1.3 HelloRetryRequest messages. This happened to never come up because we had no tests where the first connection negotiated DTLS 1.2 (needed for the shim to send a non-empty session ID) and then the second connection negotiated DTLS 1.3 with HelloRetryRequest. Still, fix this in case we ever write such a test. Write a test that our implementation indeed would have rejected this case. Fixed: 580998966 Change-Id: I5cf6a6f99a2a23dbcfdd2b740c789db47d48b6b9 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/105088 Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Lily Chen <chlily@google.com> Reviewed-by: Lily Chen <chlily@google.com> Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/ssl/test/runner/basic_tests.go b/ssl/test/runner/basic_tests.go index 884d623..cce52bb 100644 --- a/ssl/test/runner/basic_tests.go +++ b/ssl/test/runner/basic_tests.go
@@ -1951,7 +1951,7 @@ }) // Clients should reject DTLS 1.3 ServerHellos that echo the legacy - // session ID. + // session ID, in both ServerHello and HelloRetryRequest. testCases = append(testCases, testCase{ protocol: dtls, name: "DTLS13CompatibilityMode-EchoSessionID", @@ -1968,6 +1968,23 @@ shouldFail: true, expectedError: ":DECODE_ERROR:", }) + testCases = append(testCases, testCase{ + protocol: dtls, + name: "DTLS13CompatibilityMode-EchoSessionID-HelloRetryRequest", + resumeSession: true, + config: Config{ + MaxVersion: VersionTLS12, + }, + resumeConfig: &Config{ + MinVersion: VersionTLS13, + Bugs: ProtocolBugs{ + SendHelloRetryRequestCookie: []byte("cookie"), + DTLS13EchoSessionID: true, + }, + }, + shouldFail: true, + expectedError: ":DECODE_ERROR:", + }) // DTLS 1.3 should work with record headers that don't set the // length bit or that use the short sequence number format.
diff --git a/ssl/test/runner/handshake_server.go b/ssl/test/runner/handshake_server.go index 66209af..a995f3d 100644 --- a/ssl/test/runner/handshake_server.go +++ b/ssl/test/runner/handshake_server.go
@@ -714,7 +714,7 @@ helloRetryRequest := &helloRetryRequestMsg{ isDTLS: c.isDTLS, vers: c.vers.wire, - sessionID: hs.clientHello.sessionID, + sessionID: sessionID, cipherSuite: cipherSuite, compressionMethod: config.Bugs.SendCompressionMethod, duplicateExtensions: config.Bugs.DuplicateHelloRetryRequestExtensions,