diff --git a/configure.ac b/configure.ac index 3cb4a9c7..7111959b 100644 --- a/configure.ac +++ b/configure.ac @@ -161,7 +161,7 @@ else fi AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ]) -AM_CONDITIONAL([HAVE_LIBSSL], [ test "x$have_openssl" = "xyes" ]) +AM_CONDITIONAL([HAVE_OPENSSL], [ test "x$have_openssl" = "xyes" ]) if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1], diff --git a/m4/openssl.m4 b/m4/openssl.m4 index 1df8d53e..f63983a3 100644 --- a/m4/openssl.m4 +++ b/m4/openssl.m4 @@ -38,13 +38,13 @@ if test "x$have_openssl" != "xyes"; then fi if test "x$have_openssl" = "xyes"; then - AC_DEFINE([HAVE_LIBSSL], [1], [Define to 1 if you have openssl.]) + AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have openssl.]) LIBS="$OPENSSL_LIBS $LIBS" CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS" # check whether EVP_DigestInit_ex exists. Old openssl doesn't have it. AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes]) if test "x$have_digestinit_ex" = "x"; then - AC_DEFINE([HAVE_OLD_LIBSSL], [1], [Define to 1 if you have old openssl.]) + AC_DEFINE([HAVE_OLD_OPENSSL], [1], [Define to 1 if you have old openssl.]) fi # search for sha224 support AC_CHECK_FUNCS([EVP_sha224]) diff --git a/src/ARC4Decryptor.h b/src/ARC4Decryptor.h index 32714f3f..20254c31 100644 --- a/src/ARC4Decryptor.h +++ b/src/ARC4Decryptor.h @@ -38,7 +38,7 @@ #include "common.h" #ifdef HAVE_LIBGCRYPT # include "LibgcryptARC4Decryptor.h" -#elif HAVE_LIBSSL +#elif HAVE_OPENSSL # include "LibsslARC4Decryptor.h" #else diff --git a/src/ARC4Encryptor.h b/src/ARC4Encryptor.h index f3437d97..84a0f049 100644 --- a/src/ARC4Encryptor.h +++ b/src/ARC4Encryptor.h @@ -38,7 +38,7 @@ #include "common.h" #ifdef HAVE_LIBGCRYPT # include "LibgcryptARC4Encryptor.h" -#elif HAVE_LIBSSL +#elif HAVE_OPENSSL # include "LibsslARC4Encryptor.h" #else diff --git a/src/DHKeyExchange.h b/src/DHKeyExchange.h index fbabc7af..91e12ff0 100644 --- a/src/DHKeyExchange.h +++ b/src/DHKeyExchange.h @@ -38,8 +38,8 @@ #include "common.h" #ifdef HAVE_LIBGCRYPT # include "LibgcryptDHKeyExchange.h" -#elif HAVE_LIBSSL +#elif HAVE_OPENSSL # include "LibsslDHKeyExchange.h" -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #endif // D_DH_KEY_EXCHANGE_H diff --git a/src/Makefile.am b/src/Makefile.am index 83a57781..05cb27c4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -261,14 +261,14 @@ SRCS += LibgnutlsTLSContext.cc LibgnutlsTLSContext.h\ LibgcryptDHKeyExchange.cc LibgcryptDHKeyExchange.h endif # HAVE_LIBGNUTLS -if HAVE_LIBSSL +if HAVE_OPENSSL SRCS += LibsslTLSContext.cc LibsslTLSContext.h\ LibsslMessageDigestImpl.cc LibsslMessageDigestImpl.h\ LibsslARC4Context.cc LibsslARC4Context.h\ LibsslARC4Decryptor.cc LibsslARC4Decryptor.h\ LibsslARC4Encryptor.cc LibsslARC4Encryptor.h\ LibsslDHKeyExchange.cc LibsslDHKeyExchange.h -endif # HAVE_LIBSSL +endif # HAVE_OPENSSL if HAVE_ZLIB SRCS += GZipDecoder.cc GZipDecoder.h\ diff --git a/src/MessageDigestImpl.h b/src/MessageDigestImpl.h index a7892daa..91a901d6 100644 --- a/src/MessageDigestImpl.h +++ b/src/MessageDigestImpl.h @@ -37,8 +37,8 @@ #ifdef HAVE_LIBGCRYPT # include "LibgcryptMessageDigestImpl.h" -#elif HAVE_LIBSSL +#elif HAVE_OPENSSL # include "LibsslMessageDigestImpl.h" -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #endif // D_MESSAGE_DIGEST_IMPL_H diff --git a/src/Platform.cc b/src/Platform.cc index 57638f92..151b40ef 100644 --- a/src/Platform.cc +++ b/src/Platform.cc @@ -54,10 +54,10 @@ #endif // HAVE_WINSOCK2_H -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL # include # include -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS # include #endif // HAVE_LIBGNUTLS @@ -97,11 +97,11 @@ bool Platform::setUp() textdomain (PACKAGE); #endif // ENABLE_NLS -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL initialization SSL_load_error_strings(); SSL_library_init(); -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS gnutls_global_init(); #endif // HAVE_LIBGNUTLS diff --git a/src/SocketCore.cc b/src/SocketCore.cc index dcd5d676..cf4693bf 100644 --- a/src/SocketCore.cc +++ b/src/SocketCore.cc @@ -152,10 +152,10 @@ void SocketCore::init() wantRead_ = false; wantWrite_ = false; -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL ssl = NULL; -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS sslSession_ = 0; #endif //HAVE_LIBGNUTLS @@ -554,12 +554,12 @@ void SocketCore::setBlockingMode() void SocketCore::closeConnection() { -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL if(secure_) { SSL_shutdown(ssl); } -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS if(secure_) { gnutls_bye(sslSession_, GNUTLS_SHUT_RDWR); @@ -569,12 +569,12 @@ void SocketCore::closeConnection() CLOSE(sockfd_); sockfd_ = -1; } -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL if(secure_) { SSL_free(ssl); } -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS if(secure_) { gnutls_deinit(sslSession_); @@ -685,7 +685,7 @@ bool SocketCore::isReadable(time_t timeout) #endif // !HAVE_POLL } -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL int SocketCore::sslHandleEAGAIN(int ret) { int error = SSL_get_error(ssl, ret); @@ -699,7 +699,7 @@ int SocketCore::sslHandleEAGAIN(int ret) } return ret; } -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS void SocketCore::gnutlsRecordCheckDirection() @@ -731,7 +731,7 @@ ssize_t SocketCore::writeData(const char* data, size_t len) } } } else { -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL ret = SSL_write(ssl, data, len); if(ret < 0) { ret = sslHandleEAGAIN(ret); @@ -741,7 +741,7 @@ ssize_t SocketCore::writeData(const char* data, size_t len) (fmt(EX_SOCKET_SEND, ERR_error_string(SSL_get_error(ssl, ret), 0))); } -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS while((ret = gnutls_record_send(sslSession_, data, len)) == GNUTLS_E_INTERRUPTED); @@ -776,7 +776,7 @@ void SocketCore::readData(char* data, size_t& len) } } } else { -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL // TODO handling len == 0 case required ret = SSL_read(ssl, data, len); @@ -788,7 +788,7 @@ void SocketCore::readData(char* data, size_t& len) (fmt(EX_SOCKET_RECV, ERR_error_string(SSL_get_error(ssl, ret), 0))); } -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS while((ret = gnutls_record_recv(sslSession_, data, len)) == GNUTLS_E_INTERRUPTED); @@ -807,7 +807,7 @@ void SocketCore::readData(char* data, size_t& len) void SocketCore::prepareSecureConnection() { if(!secure_) { -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL ssl = SSL_new(tlsContext_->getSSLCtx()); if(!ssl) { @@ -820,7 +820,7 @@ void SocketCore::prepareSecureConnection() (fmt(EX_SSL_INIT_FAILURE, ERR_error_string(ERR_get_error(), 0))); } -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS int r; gnutls_init(&sslSession_, GNUTLS_CLIENT); @@ -847,7 +847,7 @@ bool SocketCore::initiateSecureConnection(const std::string& hostname) if(secure_ == 1) { wantRead_ = false; wantWrite_ = false; -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL int e = SSL_connect(ssl); if (e <= 0) { @@ -922,7 +922,7 @@ bool SocketCore::initiateSecureConnection(const std::string& hostname) throw DL_ABORT_EX(MSG_HOSTNAME_NOT_MATCH); } } -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS int ret = gnutls_handshake(sslSession_); if(ret == GNUTLS_E_AGAIN) { diff --git a/src/SocketCore.h b/src/SocketCore.h index bbf01ea7..2df3efe6 100644 --- a/src/SocketCore.h +++ b/src/SocketCore.h @@ -44,11 +44,11 @@ #include "a2netcompat.h" -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL # include # include -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS # include #endif // HAVE_LIBGNUTLS @@ -88,12 +88,12 @@ private: static SharedHandle tlsContext_; #endif // ENABLE_SSL -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL // for SSL SSL* ssl; int sslHandleEAGAIN(int ret); -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #ifdef HAVE_LIBGNUTLS gnutls_session_t sslSession_; diff --git a/src/TLSContext.h b/src/TLSContext.h index 9a3f509b..f3832b4f 100644 --- a/src/TLSContext.h +++ b/src/TLSContext.h @@ -37,7 +37,7 @@ #include "common.h" -#ifdef HAVE_LIBSSL +#ifdef HAVE_OPENSSL # include "LibsslTLSContext.h" #elif HAVE_LIBGNUTLS # include "LibgnutlsTLSContext.h" diff --git a/src/util.cc b/src/util.cc index 382f2cff..e4656e29 100644 --- a/src/util.cc +++ b/src/util.cc @@ -57,10 +57,10 @@ #ifdef HAVE_LIBGCRYPT # include -#elif HAVE_LIBSSL +#elif HAVE_OPENSSL # include # include "SimpleRandomizer.h" -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL #include "File.h" #include "message.h" @@ -1285,7 +1285,7 @@ void generateRandomData(unsigned char* data, size_t length) { #ifdef HAVE_LIBGCRYPT gcry_randomize(data, length, GCRY_STRONG_RANDOM); -#elif HAVE_LIBSSL +#elif HAVE_OPENSSL if(RAND_bytes(data, length) != 1) { for(size_t i = 0; i < length; ++i) { data[i] = SimpleRandomizer::getInstance()->getRandomNumber(UINT8_MAX+1); @@ -1294,7 +1294,7 @@ void generateRandomData(unsigned char* data, size_t length) #else std::ifstream i("/dev/urandom", std::ios::binary); i.read(reinterpret_cast(data), length); -#endif // HAVE_LIBSSL +#endif // HAVE_OPENSSL } bool saveAs