mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-11 01:01:25 +03:00
Minor clean up.
--HG-- branch : dev
This commit is contained in:
@@ -131,10 +131,10 @@ int OpenSSLSocket::certVerifyCb( X509_STORE_CTX * x509_ctx, void * arg ) {
|
||||
bool OpenSSLSocket::init() {
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use
|
||||
|
||||
SSL_library_init();
|
||||
#else
|
||||
OPENSSL_init_ssl(0, NULL);
|
||||
|
||||
SSL_library_init();
|
||||
#else
|
||||
OPENSSL_init_ssl(0, NULL);
|
||||
#endif
|
||||
|
||||
SSL_load_error_strings(); // Load SSL error strings
|
||||
@@ -258,12 +258,10 @@ Socket::Status OpenSSLSocket::connect( const IpAddress& remoteAddress, unsigned
|
||||
// Same as before, try to connect.
|
||||
int result = SSL_connect( mSSL );
|
||||
|
||||
eePRINTL( "CONNECTION RESULT: %d", result );
|
||||
|
||||
if ( result < 1 ) {
|
||||
ERR_print_errors_fp(stdout);
|
||||
|
||||
_print_error(result);
|
||||
printError(result);
|
||||
|
||||
mStatus = Socket::Error;
|
||||
|
||||
@@ -273,10 +271,7 @@ Socket::Status OpenSSLSocket::connect( const IpAddress& remoteAddress, unsigned
|
||||
X509 * peer = SSL_get_peer_certificate( mSSL );
|
||||
|
||||
if ( peer ) {
|
||||
bool cert_ok = SSL_get_verify_result(mSSL) == X509_V_OK;
|
||||
|
||||
eePRINTL( "cert_ok: %d", (int)cert_ok );
|
||||
|
||||
//eePRINTL( "cert_ok: %d", (int)( SSL_get_verify_result(mSSL) == X509_V_OK ) );
|
||||
mStatus = Socket::Done;
|
||||
} else if ( mSSLSocket->mValidateCertificate ) {
|
||||
mStatus = Socket::Error;
|
||||
@@ -303,7 +298,7 @@ void OpenSSLSocket::disconnect() {
|
||||
mStatus = Socket::Disconnected;
|
||||
}
|
||||
|
||||
void OpenSSLSocket::_print_error(int err) {
|
||||
void OpenSSLSocket::printError(int err) {
|
||||
err = SSL_get_error(mSSL,err);
|
||||
|
||||
switch(err) {
|
||||
@@ -331,7 +326,7 @@ Socket::Status OpenSSLSocket::send( const void * data, std::size_t size ) {
|
||||
int ret = SSL_write( mSSL, buf, size );
|
||||
|
||||
if ( ret <= 0 ) {
|
||||
_print_error(ret);
|
||||
printError(ret);
|
||||
|
||||
disconnect();
|
||||
|
||||
@@ -359,7 +354,7 @@ Socket::Status OpenSSLSocket::receive( void * data, std::size_t size, std::size_
|
||||
int ret = SSL_read( mSSL, buf, size );
|
||||
|
||||
if ( ret < 0 ) {
|
||||
_print_error(ret);
|
||||
printError(ret);
|
||||
|
||||
disconnect();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class OpenSSLSocket : public SSLSocketImpl {
|
||||
|
||||
static bool matchSubjectAlternativeName(const char *hostname, const X509 *server_cert);
|
||||
|
||||
void _print_error(int err);
|
||||
void printError(int err);
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
Reference in New Issue
Block a user