MINOR: ssl: dump the SSL string error when SSL_CTX_use_PrivateKey() failed.

Display the OpenSSL reason error string when SSL_CTX_use_PrivateKey()
failed.
This commit is contained in:
William Lallemand 2022-10-27 14:41:07 +02:00
parent 7faffdc6ab
commit 5de4951252

View File

@ -3720,9 +3720,14 @@ static int ssl_sock_put_ckch_into_ctx(const char *path, const struct cert_key_an
int errcode = 0;
STACK_OF(X509) *find_chain = NULL;
ERR_clear_error();
if (SSL_CTX_use_PrivateKey(ctx, ckch->key) <= 0) {
memprintf(err, "%sunable to load SSL private key into SSL Context '%s'.\n",
err && *err ? *err : "", path);
int ret;
ret = ERR_get_error();
memprintf(err, "%sunable to load SSL private key into SSL Context '%s': %s.\n",
err && *err ? *err : "", path, ERR_reason_error_string(ret));
errcode |= ERR_ALERT | ERR_FATAL;
return errcode;
}