runner: Make echIsInner a boolean. Having the nil vs. non-nil []byte for the sake of a couple tests with invalid payloads is tedious. Use separate fields instead. Bug: 275 Change-Id: I557d914d60ce94d68796c05162ff3dd2ab7684db Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/47965 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/ssl/test/runner/handshake_client.go b/ssl/test/runner/handshake_client.go index 792ef9f..fba7355 100644 --- a/ssl/test/runner/handshake_client.go +++ b/ssl/test/runner/handshake_client.go
@@ -817,10 +817,8 @@ } if (isInner && !c.config.Bugs.OmitECHIsInner) || c.config.Bugs.AlwaysSendECHIsInner { - hello.echIsInner = []byte{} - if len(c.config.Bugs.SendInvalidECHIsInner) != 0 { - hello.echIsInner = c.config.Bugs.SendInvalidECHIsInner - } + hello.echIsInner = true + hello.invalidECHIsInner = c.config.Bugs.SendInvalidECHIsInner } if innerHello != nil { @@ -1090,7 +1088,7 @@ } else { // When not offering ECH, we may still expect a confirmation signal to // test the backend server behavior. - if hs.hello.echIsInner != nil { + if hs.hello.echIsInner { if !echConfirmed { return errors.New("tls: server did not send ECH confirmation when requested") } @@ -1514,7 +1512,7 @@ } if isInner && c.config.Bugs.OmitSecondECHIsInner { - hello.echIsInner = nil + hello.echIsInner = false } hello.hasEarlyData = c.config.Bugs.SendEarlyDataOnSecondClientHello
diff --git a/ssl/test/runner/handshake_messages.go b/ssl/test/runner/handshake_messages.go index a4e8136..9f283ea 100644 --- a/ssl/test/runner/handshake_messages.go +++ b/ssl/test/runner/handshake_messages.go
@@ -324,7 +324,8 @@ nextProtoNeg bool serverName string clientECH *clientECH - echIsInner []byte + echIsInner bool + invalidECHIsInner []byte ocspStapling bool supportedCurves []CurveID supportedPoints []uint8 @@ -459,10 +460,12 @@ body: body.finish(), }) } - if m.echIsInner != nil { + if m.echIsInner { extensions = append(extensions, extension{ - id: extensionECHIsInner, - body: m.echIsInner, + id: extensionECHIsInner, + // If unset, invalidECHIsInner is empty, which is the correct + // serialization. + body: m.invalidECHIsInner, }) } if m.outerExtensions != nil && typ == clientHelloEncodedInner {