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 golang#52955
  • Loading branch information
dchaofei committed May 18, 2022
1 parent 5f2fdbe commit 7213227
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/crypto/x509/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,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 7213227

Please sign in to comment.