Browse Source
Merge pull request #70 from MyHush/tls-patch
Add ERR_clear_error() before all SSL_* calls
pull/72/head
Kent Sommer
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
2 deletions
-
src/net.cpp
-
src/net.h
|
|
@ -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; |
|
|
|
|
|
@ -30,7 +30,7 @@ |
|
|
|
#include <boost/foreach.hpp> |
|
|
|
#include <boost/signals2/signal.hpp> |
|
|
|
|
|
|
|
// Enable OpenSSL Support for Zen
|
|
|
|
// Enable OpenSSL Support for Hush
|
|
|
|
#include <openssl/bio.h> |
|
|
|
#include <openssl/ssl.h> |
|
|
|
|
|
|
|