summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-06-15 16:59:57 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-06-15 16:59:57 +0300
commit5895100845ee7b16f8c6dc2c04c62c6e923c096c (patch)
tree9e16a7c1276b5530669d953196e79cfd82968822 /src
parent675042de86f7fa98659a7e0aac67fbdb84bc0daa (diff)
make openssl errors a bit more informative
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/netlib_ssl.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mir_app/src/netlib_ssl.cpp b/src/mir_app/src/netlib_ssl.cpp
index e300e3ca9a..861e801095 100644
--- a/src/mir_app/src/netlib_ssl.cpp
+++ b/src/mir_app/src/netlib_ssl.cpp
@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "netlib.h"
#include <openssl/ssl.h>
+#include <openssl/err.h>
#include <openssl/rand.h>
static bool bSslInitDone;
@@ -79,6 +80,15 @@ static bool SSL_library_load(void)
return bSslInitDone;
}
+static void dump_error(SSL *session, int err)
+{
+ err = SSL_get_error(session, err);
+
+ char buf[100];
+ ERR_error_string_n(err, buf, sizeof(buf));
+ Netlib_Logf(nullptr, "SSL negotiation failure: %s (%d)", buf, err);
+}
+
const char* SSL_GetCipherName(SslHandle *ssl)
{
if (!ssl || !ssl->session)
@@ -145,10 +155,8 @@ static bool ClientConnect(SslHandle *ssl, const char*)
SSL_set_fd(ssl->session, ssl->s);
int err = SSL_connect(ssl->session);
-
if (err != 1) {
- err = SSL_get_error(ssl->session, err);
- Netlib_Logf(nullptr, "SSL negotiation failure (%d)", err);
+ dump_error(ssl->session, err);
return false;
}