Skip to content

Commit d67839f

Browse files
Clide Stefanigopherbot
Clide Stefani
authored andcommitted
crypto/tls: add support for -expect-version to bogo_shim_test
The existing implementation of bogo_shim_test does not support tests that use the expect-version flag. This change adds support for this flag. Updates #51434. Change-Id: Ie23fdb06d15ec0593ca58f28144e83f93ef7f200 Reviewed-on: https://go-review.googlesource.com/c/go/+/592635 Auto-Submit: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: David Chase <drchase@google.com>
1 parent 2011294 commit d67839f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/crypto/tls/bogo_shim_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ var (
3333

3434
trustCert = flag.String("trust-cert", "", "")
3535

36-
minVersion = flag.Int("min-version", VersionSSL30, "")
37-
maxVersion = flag.Int("max-version", VersionTLS13, "")
36+
minVersion = flag.Int("min-version", VersionSSL30, "")
37+
maxVersion = flag.Int("max-version", VersionTLS13, "")
38+
expectVersion = flag.Int("expect-version", 0, "")
3839

3940
noTLS13 = flag.Bool("no-tls13", false, "")
4041

@@ -252,7 +253,9 @@ func bogoShim() {
252253
if *expectALPN != "" && cs.NegotiatedProtocol != *expectALPN {
253254
log.Fatalf("unexpected protocol negotiated: want %q, got %q", *expectALPN, cs.NegotiatedProtocol)
254255
}
255-
256+
if *expectVersion != 0 && cs.Version != uint16(*expectVersion) {
257+
log.Fatalf("expected ssl version %q, got %q", uint16(*expectVersion), cs.Version)
258+
}
256259
if *expectECHAccepted && !cs.ECHAccepted {
257260
log.Fatal("expected ECH to be accepted, but connection state shows it was not")
258261
} else if i == 0 && *onInitialExpectECHAccepted && !cs.ECHAccepted {

0 commit comments

Comments
 (0)