]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl: dump the SSL string error when SSL_CTX_use_PrivateKey() failed.
authorWilliam Lallemand <wlallemand@haproxy.org>
Thu, 27 Oct 2022 12:41:07 +0000 (14:41 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 27 Oct 2022 12:50:22 +0000 (14:50 +0200)
Display the OpenSSL reason error string when SSL_CTX_use_PrivateKey()
failed.

src/ssl_sock.c

index 4a16f6f0ccb410b61c8484b1ff052ee49ee33737..6b38d4031b453d28240d10fb861bc673f1672cac 100644 (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;
        }