From 6eaeb7eb6b61d8a297f21db89fac26396bf2c037 Mon Sep 17 00:00:00 2001 From: Kent Sommer Date: Mon, 4 Dec 2017 09:22:45 +0900 Subject: [PATCH] add ERR_clear_error() before all SSL_* calls --- src/net.cpp | 5 ++++- src/net.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index d2d0ad20c..f1df70ea4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -389,7 +389,7 @@ CNode* FindNode(const CService& addr) static int WaitFor(SSLConnectionRoutine eRoutine, SOCKET hSocket, SSL *ssl, int timeoutSec) { int nErr = 0; - + ERR_clear_error(); while (true) { switch (eRoutine) @@ -923,6 +923,7 @@ void SocketSendData(CNode *pnode) if (bIsSSL) { + ERR_clear_error(); nBytes = SSL_write(pnode->ssl, &data[pnode->nSendOffset], data.size() - pnode->nSendOffset); nRet = SSL_get_error(pnode->ssl, nBytes); } @@ -1589,6 +1590,7 @@ void ThreadSocketHandler() if (bIsSSL) { + ERR_clear_error(); nBytes = SSL_read(pnode->ssl, pchBuf, sizeof(pchBuf)); nRet = SSL_get_error(pnode->ssl, nBytes); } @@ -2306,6 +2308,7 @@ static bool TLSInitialize() // Initialization routines for the OpenSSL library // SSL_load_error_strings(); + ERR_load_crypto_strings(); OpenSSL_add_ssl_algorithms(); // OpenSSL_add_ssl_algorithms() always returns "1", so it is safe to discard the return value. namespace fs = boost::filesystem; diff --git a/src/net.h b/src/net.h index 5c3875b1d..970f3a222 100644 --- a/src/net.h +++ b/src/net.h @@ -30,7 +30,7 @@ #include #include -// Enable OpenSSL Support for Zen +// Enable OpenSSL Support for Hush #include #include