Merge pull request #5786 from philljj/zd15125

Fix incorrect self signed error return.
This commit is contained in:
David Garske
2022-11-10 14:13:38 -08:00
committed by GitHub

View File

@ -13609,6 +13609,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
(defined(WOLFSSL_CERT_REQ) || defined(WOLFSSL_CERT_EXT)) && \
!defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR)
if (ret == ASN_NO_SIGNER_E || ret == ASN_SELF_SIGNED_E) {
int lastErr = ret; /* save error from last time */
WOLFSSL_MSG("try to load certificate if hash dir is set");
ret = LoadCertByIssuer(SSL_STORE(ssl),
(WOLFSSL_X509_NAME*)args->dCert->issuerName,
@ -13622,7 +13623,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
&subjectHash, &alreadySigner);
}
else {
ret = ASN_NO_SIGNER_E;
ret = lastErr; /* restore error */
WOLFSSL_ERROR_VERBOSE(ret);
}
}