crypto/x509: optimize the performance of checkSignature

The loop should be terminated immediately when `algo` has been found

Fixes #52955
This commit is contained in:
dchaofei 2022-05-18 15:31:12 +08:00
parent 5f2fdbe7ed
commit 721322725f
1 changed files with 1 additions and 0 deletions

View File

@ -823,6 +823,7 @@ func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey
if details.algo == algo {
hashType = details.hash
pubKeyAlgo = details.pubKeyAlgo
break
}
}