From 721322725fb2d3a3ea410d09fd8320dfef865d8d Mon Sep 17 00:00:00 2001 From: dchaofei Date: Wed, 18 May 2022 15:31:12 +0800 Subject: [PATCH] crypto/x509: optimize the performance of checkSignature The loop should be terminated immediately when `algo` has been found Fixes #52955 --- src/crypto/x509/x509.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go index e17df0dd94328..1d4520540e6d4 100644 --- a/src/crypto/x509/x509.go +++ b/src/crypto/x509/x509.go @@ -823,6 +823,7 @@ func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey if details.algo == algo { hashType = details.hash pubKeyAlgo = details.pubKeyAlgo + break } }