diff options
author | David Benjamin <davidben@google.com> | 2024-02-23 14:43:33 -0500 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-03-05 17:08:54 +0000 |
commit | 8037383527cd5105f38ef328db5171815b9c3ea4 (patch) | |
tree | 9080c6924fa5f3ff08c7a4e345a2b9c4b4655b93 /ssl | |
parent | 88a537fe4e99d45804a832fbab27a938f995336d (diff) | |
download | boringssl-8037383527cd5105f38ef328db5171815b9c3ea4.zip boringssl-8037383527cd5105f38ef328db5171815b9c3ea4.tar.gz boringssl-8037383527cd5105f38ef328db5171815b9c3ea4.tar.bz2 |
Use slices.Contains in ssl/test/runner
Minor cleanup afforded by Go 1.21
Change-Id: I49a0f257f2585e54159014f1f442497a816e6589
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66548
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/test/runner/common.go | 9 | ||||
-rw-r--r-- | ssl/test/runner/sign.go | 5 |
2 files changed, 3 insertions, 11 deletions
diff --git a/ssl/test/runner/common.go b/ssl/test/runner/common.go index 64f7741..666b4b6 100644 --- a/ssl/test/runner/common.go +++ b/ssl/test/runner/common.go @@ -2339,15 +2339,6 @@ func unexpectedMessageError(wanted, got any) error { return fmt.Errorf("tls: received unexpected handshake message of type %T when waiting for %T", got, wanted) } -func isSupportedSignatureAlgorithm(sigAlg signatureAlgorithm, sigAlgs []signatureAlgorithm) bool { - for _, s := range sigAlgs { - if s == sigAlg { - return true - } - } - return false -} - var ( // See RFC 8446, section 4.1.3. downgradeTLS13 = []byte{0x44, 0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x01} diff --git a/ssl/test/runner/sign.go b/ssl/test/runner/sign.go index 70541a1..e0c6a92 100644 --- a/ssl/test/runner/sign.go +++ b/ssl/test/runner/sign.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" "math/big" + "slices" ) type signer interface { @@ -35,7 +36,7 @@ func selectSignatureAlgorithm(version uint16, key crypto.PrivateKey, config *Con } for _, sigAlg := range config.signSignatureAlgorithms() { - if !isSupportedSignatureAlgorithm(sigAlg, peerSigAlgs) { + if !slices.Contains(peerSigAlgs, sigAlg) { continue } @@ -68,7 +69,7 @@ func signMessage(version uint16, key crypto.PrivateKey, config *Config, sigAlg s } func verifyMessage(version uint16, key crypto.PublicKey, config *Config, sigAlg signatureAlgorithm, msg, sig []byte) error { - if version >= VersionTLS12 && !isSupportedSignatureAlgorithm(sigAlg, config.verifySignatureAlgorithms()) { + if version >= VersionTLS12 && !slices.Contains(config.verifySignatureAlgorithms(), sigAlg) { return errors.New("tls: unsupported signature algorithm") } |