smx509: include more hints for verification failure

This commit is contained in:
Sun Yimin 2022-12-02 08:47:39 +08:00 committed by GitHub
parent 13f777bb2f
commit acf6edec18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -578,7 +578,7 @@ func encodeSignature(r, s []byte) ([]byte, error) {
// addASN1IntBytes encodes in ASN.1 a positive integer represented as
// a big-endian byte slice with zero or more leading zeroes.
func addASN1IntBytes(b *cryptobyte.Builder, bytes []byte) {
for len(bytes) > 1 && bytes[0] == 0 {
for len(bytes) > 0 && bytes[0] == 0 {
bytes = bytes[1:]
}
if len(bytes) == 0 {

View File

@ -802,6 +802,10 @@ func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, o
err = candidate.isValid(certType, currentChain, opts)
if err != nil {
if hintErr == nil {
hintErr = err
hintCert = candidate
}
return
}