Improve TLS error reporting

This commit is contained in:
Duke Leto
2021-03-29 09:57:03 -04:00
parent 84ac805f11
commit fe0d371165
2 changed files with 10 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ WOLFSSL_EVP_PKEY* GenerateEcKey(int nid)
WOLFSSL_X509* GenerateCertificate(WOLFSSL_EVP_PKEY *keypair)
{
if (!keypair) {
LogPrintf("%s: Null keypair!\n", __func__);
return NULL;
}
@@ -60,12 +61,17 @@ WOLFSSL_X509* GenerateCertificate(WOLFSSL_EVP_PKEY *keypair)
// private key from keypair is used; signature will be set inside of the cert
bCertSigned = wolfSSL_X509_sign(cert, keypair, wolfSSL_EVP_sha512());
}
} else {
LogPrintf("%s: Unable to alloc rand bytes!\n", __func__);
}
if (!bCertSigned) {
LogPrintf("%s: TLS cert not signed correctly!\n", __func__);
wolfSSL_X509_free(cert);
cert = NULL;
}
} else {
LogPrintf("%s: Unable to create x509 cert!\n", __func__);
}
return cert;