Skip to content

Commit

Permalink
crypto/x509: optimize the performance of checkSignature
Browse files Browse the repository at this point in the history
The loop should be terminated immediately when `algo` has been found

Fixes #52955

Change-Id: Ib3865c4616a0c1af9b72daea45f5a1750f84562f
GitHub-Last-Rev: 721322725fb2d3a3ea410d09fd8320dfef865d8d
GitHub-Pull-Request: golang/go#52987
Reviewed-on: https://go-review.googlesource.com/c/go/+/407215
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: David Chase <[email protected]>
Reviewed-by: Roland Shoemaker <[email protected]>
Auto-Submit: Roland Shoemaker <[email protected]>
  • Loading branch information
dchaofei authored and gopherbot committed Nov 1, 2023
1 parent aab9865 commit 615f899
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions x509/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey
if details.algo == algo {
hashType = details.hash
pubKeyAlgo = details.pubKeyAlgo
break
}
}

Expand Down

0 comments on commit 615f899

Please sign in to comment.