mirror of https://github.com/aria2/aria2
				
				
				
			Replaced HAVE_LIBSSL with HAVE_OPENSSL
							parent
							
								
									7230fbd2f7
								
							
						
					
					
						commit
						395212f47f
					
				| 
						 | 
					@ -161,7 +161,7 @@ else
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ])
 | 
					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
 | 
					if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
 | 
				
			||||||
  AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1],
 | 
					  AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1],
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,13 +38,13 @@ if test "x$have_openssl" != "xyes"; then
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if test "x$have_openssl" = "xyes"; then
 | 
					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"
 | 
					  LIBS="$OPENSSL_LIBS $LIBS"
 | 
				
			||||||
  CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
 | 
					  CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
 | 
				
			||||||
  # check whether EVP_DigestInit_ex exists. Old openssl doesn't have it.
 | 
					  # check whether EVP_DigestInit_ex exists. Old openssl doesn't have it.
 | 
				
			||||||
  AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
 | 
					  AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
 | 
				
			||||||
  if test "x$have_digestinit_ex" = "x"; then
 | 
					  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
 | 
					  fi
 | 
				
			||||||
  # search for sha224 support
 | 
					  # search for sha224 support
 | 
				
			||||||
  AC_CHECK_FUNCS([EVP_sha224])
 | 
					  AC_CHECK_FUNCS([EVP_sha224])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@
 | 
				
			||||||
#include "common.h"
 | 
					#include "common.h"
 | 
				
			||||||
#ifdef HAVE_LIBGCRYPT
 | 
					#ifdef HAVE_LIBGCRYPT
 | 
				
			||||||
# include "LibgcryptARC4Decryptor.h"
 | 
					# include "LibgcryptARC4Decryptor.h"
 | 
				
			||||||
#elif HAVE_LIBSSL
 | 
					#elif HAVE_OPENSSL
 | 
				
			||||||
# include "LibsslARC4Decryptor.h"
 | 
					# include "LibsslARC4Decryptor.h"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@
 | 
				
			||||||
#include "common.h"
 | 
					#include "common.h"
 | 
				
			||||||
#ifdef HAVE_LIBGCRYPT
 | 
					#ifdef HAVE_LIBGCRYPT
 | 
				
			||||||
# include "LibgcryptARC4Encryptor.h"
 | 
					# include "LibgcryptARC4Encryptor.h"
 | 
				
			||||||
#elif HAVE_LIBSSL
 | 
					#elif HAVE_OPENSSL
 | 
				
			||||||
# include "LibsslARC4Encryptor.h"
 | 
					# include "LibsslARC4Encryptor.h"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,8 +38,8 @@
 | 
				
			||||||
#include "common.h"
 | 
					#include "common.h"
 | 
				
			||||||
#ifdef HAVE_LIBGCRYPT
 | 
					#ifdef HAVE_LIBGCRYPT
 | 
				
			||||||
# include "LibgcryptDHKeyExchange.h"
 | 
					# include "LibgcryptDHKeyExchange.h"
 | 
				
			||||||
#elif HAVE_LIBSSL
 | 
					#elif HAVE_OPENSSL
 | 
				
			||||||
# include "LibsslDHKeyExchange.h"
 | 
					# include "LibsslDHKeyExchange.h"
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // D_DH_KEY_EXCHANGE_H
 | 
					#endif // D_DH_KEY_EXCHANGE_H
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -261,14 +261,14 @@ SRCS += LibgnutlsTLSContext.cc LibgnutlsTLSContext.h\
 | 
				
			||||||
	LibgcryptDHKeyExchange.cc LibgcryptDHKeyExchange.h
 | 
						LibgcryptDHKeyExchange.cc LibgcryptDHKeyExchange.h
 | 
				
			||||||
endif # HAVE_LIBGNUTLS
 | 
					endif # HAVE_LIBGNUTLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if HAVE_LIBSSL
 | 
					if HAVE_OPENSSL
 | 
				
			||||||
SRCS += LibsslTLSContext.cc LibsslTLSContext.h\
 | 
					SRCS += LibsslTLSContext.cc LibsslTLSContext.h\
 | 
				
			||||||
	LibsslMessageDigestImpl.cc LibsslMessageDigestImpl.h\
 | 
						LibsslMessageDigestImpl.cc LibsslMessageDigestImpl.h\
 | 
				
			||||||
	LibsslARC4Context.cc LibsslARC4Context.h\
 | 
						LibsslARC4Context.cc LibsslARC4Context.h\
 | 
				
			||||||
	LibsslARC4Decryptor.cc LibsslARC4Decryptor.h\
 | 
						LibsslARC4Decryptor.cc LibsslARC4Decryptor.h\
 | 
				
			||||||
	LibsslARC4Encryptor.cc LibsslARC4Encryptor.h\
 | 
						LibsslARC4Encryptor.cc LibsslARC4Encryptor.h\
 | 
				
			||||||
	LibsslDHKeyExchange.cc LibsslDHKeyExchange.h
 | 
						LibsslDHKeyExchange.cc LibsslDHKeyExchange.h
 | 
				
			||||||
endif # HAVE_LIBSSL
 | 
					endif # HAVE_OPENSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if HAVE_ZLIB
 | 
					if HAVE_ZLIB
 | 
				
			||||||
SRCS += GZipDecoder.cc GZipDecoder.h\
 | 
					SRCS += GZipDecoder.cc GZipDecoder.h\
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,8 +37,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBGCRYPT
 | 
					#ifdef HAVE_LIBGCRYPT
 | 
				
			||||||
# include "LibgcryptMessageDigestImpl.h"
 | 
					# include "LibgcryptMessageDigestImpl.h"
 | 
				
			||||||
#elif HAVE_LIBSSL
 | 
					#elif HAVE_OPENSSL
 | 
				
			||||||
# include "LibsslMessageDigestImpl.h"
 | 
					# include "LibsslMessageDigestImpl.h"
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // D_MESSAGE_DIGEST_IMPL_H
 | 
					#endif // D_MESSAGE_DIGEST_IMPL_H
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,10 +54,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // HAVE_WINSOCK2_H
 | 
					#endif // HAVE_WINSOCK2_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
# include <openssl/err.h>
 | 
					# include <openssl/err.h>
 | 
				
			||||||
# include <openssl/ssl.h>
 | 
					# include <openssl/ssl.h>
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
# include <gnutls/gnutls.h>
 | 
					# include <gnutls/gnutls.h>
 | 
				
			||||||
#endif // HAVE_LIBGNUTLS
 | 
					#endif // HAVE_LIBGNUTLS
 | 
				
			||||||
| 
						 | 
					@ -97,11 +97,11 @@ bool Platform::setUp()
 | 
				
			||||||
  textdomain (PACKAGE);
 | 
					  textdomain (PACKAGE);
 | 
				
			||||||
#endif // ENABLE_NLS
 | 
					#endif // ENABLE_NLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
  // for SSL initialization
 | 
					  // for SSL initialization
 | 
				
			||||||
  SSL_load_error_strings();
 | 
					  SSL_load_error_strings();
 | 
				
			||||||
  SSL_library_init();
 | 
					  SSL_library_init();
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
  gnutls_global_init();
 | 
					  gnutls_global_init();
 | 
				
			||||||
#endif // HAVE_LIBGNUTLS
 | 
					#endif // HAVE_LIBGNUTLS
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,10 +152,10 @@ void SocketCore::init()
 | 
				
			||||||
  wantRead_ = false;
 | 
					  wantRead_ = false;
 | 
				
			||||||
  wantWrite_ = false;
 | 
					  wantWrite_ = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
  // for SSL
 | 
					  // for SSL
 | 
				
			||||||
  ssl = NULL;
 | 
					  ssl = NULL;
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
  sslSession_ = 0;
 | 
					  sslSession_ = 0;
 | 
				
			||||||
#endif //HAVE_LIBGNUTLS
 | 
					#endif //HAVE_LIBGNUTLS
 | 
				
			||||||
| 
						 | 
					@ -554,12 +554,12 @@ void SocketCore::setBlockingMode()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SocketCore::closeConnection()
 | 
					void SocketCore::closeConnection()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
  // for SSL
 | 
					  // for SSL
 | 
				
			||||||
  if(secure_) {
 | 
					  if(secure_) {
 | 
				
			||||||
    SSL_shutdown(ssl);
 | 
					    SSL_shutdown(ssl);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
  if(secure_) {
 | 
					  if(secure_) {
 | 
				
			||||||
    gnutls_bye(sslSession_, GNUTLS_SHUT_RDWR);
 | 
					    gnutls_bye(sslSession_, GNUTLS_SHUT_RDWR);
 | 
				
			||||||
| 
						 | 
					@ -569,12 +569,12 @@ void SocketCore::closeConnection()
 | 
				
			||||||
    CLOSE(sockfd_);
 | 
					    CLOSE(sockfd_);
 | 
				
			||||||
    sockfd_ = -1;
 | 
					    sockfd_ = -1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
  // for SSL
 | 
					  // for SSL
 | 
				
			||||||
  if(secure_) {
 | 
					  if(secure_) {
 | 
				
			||||||
    SSL_free(ssl);
 | 
					    SSL_free(ssl);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
  if(secure_) {
 | 
					  if(secure_) {
 | 
				
			||||||
    gnutls_deinit(sslSession_);
 | 
					    gnutls_deinit(sslSession_);
 | 
				
			||||||
| 
						 | 
					@ -685,7 +685,7 @@ bool SocketCore::isReadable(time_t timeout)
 | 
				
			||||||
#endif // !HAVE_POLL
 | 
					#endif // !HAVE_POLL
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
int SocketCore::sslHandleEAGAIN(int ret)
 | 
					int SocketCore::sslHandleEAGAIN(int ret)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int error = SSL_get_error(ssl, ret);
 | 
					  int error = SSL_get_error(ssl, ret);
 | 
				
			||||||
| 
						 | 
					@ -699,7 +699,7 @@ int SocketCore::sslHandleEAGAIN(int ret)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
void SocketCore::gnutlsRecordCheckDirection()
 | 
					void SocketCore::gnutlsRecordCheckDirection()
 | 
				
			||||||
| 
						 | 
					@ -731,7 +731,7 @@ ssize_t SocketCore::writeData(const char* data, size_t len)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
    ret = SSL_write(ssl, data, len);
 | 
					    ret = SSL_write(ssl, data, len);
 | 
				
			||||||
    if(ret < 0) {
 | 
					    if(ret < 0) {
 | 
				
			||||||
      ret = sslHandleEAGAIN(ret);
 | 
					      ret = sslHandleEAGAIN(ret);
 | 
				
			||||||
| 
						 | 
					@ -741,7 +741,7 @@ ssize_t SocketCore::writeData(const char* data, size_t len)
 | 
				
			||||||
        (fmt(EX_SOCKET_SEND,
 | 
					        (fmt(EX_SOCKET_SEND,
 | 
				
			||||||
             ERR_error_string(SSL_get_error(ssl, ret), 0)));
 | 
					             ERR_error_string(SSL_get_error(ssl, ret), 0)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
    while((ret = gnutls_record_send(sslSession_, data, len)) ==
 | 
					    while((ret = gnutls_record_send(sslSession_, data, len)) ==
 | 
				
			||||||
          GNUTLS_E_INTERRUPTED);
 | 
					          GNUTLS_E_INTERRUPTED);
 | 
				
			||||||
| 
						 | 
					@ -776,7 +776,7 @@ void SocketCore::readData(char* data, size_t& len)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
    // for SSL
 | 
					    // for SSL
 | 
				
			||||||
    // TODO handling len == 0 case required
 | 
					    // TODO handling len == 0 case required
 | 
				
			||||||
    ret = SSL_read(ssl, data, len);
 | 
					    ret = SSL_read(ssl, data, len);
 | 
				
			||||||
| 
						 | 
					@ -788,7 +788,7 @@ void SocketCore::readData(char* data, size_t& len)
 | 
				
			||||||
        (fmt(EX_SOCKET_RECV,
 | 
					        (fmt(EX_SOCKET_RECV,
 | 
				
			||||||
             ERR_error_string(SSL_get_error(ssl, ret), 0)));
 | 
					             ERR_error_string(SSL_get_error(ssl, ret), 0)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
    while((ret = gnutls_record_recv(sslSession_, data, len)) ==
 | 
					    while((ret = gnutls_record_recv(sslSession_, data, len)) ==
 | 
				
			||||||
          GNUTLS_E_INTERRUPTED);
 | 
					          GNUTLS_E_INTERRUPTED);
 | 
				
			||||||
| 
						 | 
					@ -807,7 +807,7 @@ void SocketCore::readData(char* data, size_t& len)
 | 
				
			||||||
void SocketCore::prepareSecureConnection()
 | 
					void SocketCore::prepareSecureConnection()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if(!secure_) {
 | 
					  if(!secure_) {
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
    // for SSL
 | 
					    // for SSL
 | 
				
			||||||
    ssl = SSL_new(tlsContext_->getSSLCtx());
 | 
					    ssl = SSL_new(tlsContext_->getSSLCtx());
 | 
				
			||||||
    if(!ssl) {
 | 
					    if(!ssl) {
 | 
				
			||||||
| 
						 | 
					@ -820,7 +820,7 @@ void SocketCore::prepareSecureConnection()
 | 
				
			||||||
        (fmt(EX_SSL_INIT_FAILURE,
 | 
					        (fmt(EX_SSL_INIT_FAILURE,
 | 
				
			||||||
             ERR_error_string(ERR_get_error(), 0)));
 | 
					             ERR_error_string(ERR_get_error(), 0)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
    int r;
 | 
					    int r;
 | 
				
			||||||
    gnutls_init(&sslSession_, GNUTLS_CLIENT);
 | 
					    gnutls_init(&sslSession_, GNUTLS_CLIENT);
 | 
				
			||||||
| 
						 | 
					@ -847,7 +847,7 @@ bool SocketCore::initiateSecureConnection(const std::string& hostname)
 | 
				
			||||||
  if(secure_ == 1) {
 | 
					  if(secure_ == 1) {
 | 
				
			||||||
    wantRead_ = false;
 | 
					    wantRead_ = false;
 | 
				
			||||||
    wantWrite_ = false;
 | 
					    wantWrite_ = false;
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
    int e = SSL_connect(ssl);
 | 
					    int e = SSL_connect(ssl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (e <= 0) {
 | 
					    if (e <= 0) {
 | 
				
			||||||
| 
						 | 
					@ -922,7 +922,7 @@ bool SocketCore::initiateSecureConnection(const std::string& hostname)
 | 
				
			||||||
        throw DL_ABORT_EX(MSG_HOSTNAME_NOT_MATCH);
 | 
					        throw DL_ABORT_EX(MSG_HOSTNAME_NOT_MATCH);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
    int ret = gnutls_handshake(sslSession_);
 | 
					    int ret = gnutls_handshake(sslSession_);
 | 
				
			||||||
    if(ret == GNUTLS_E_AGAIN) {
 | 
					    if(ret == GNUTLS_E_AGAIN) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,11 +44,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "a2netcompat.h"
 | 
					#include "a2netcompat.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
// for SSL
 | 
					// for SSL
 | 
				
			||||||
# include <openssl/ssl.h>
 | 
					# include <openssl/ssl.h>
 | 
				
			||||||
# include <openssl/err.h>
 | 
					# include <openssl/err.h>
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
# include <gnutls/gnutls.h>
 | 
					# include <gnutls/gnutls.h>
 | 
				
			||||||
#endif // HAVE_LIBGNUTLS
 | 
					#endif // HAVE_LIBGNUTLS
 | 
				
			||||||
| 
						 | 
					@ -88,12 +88,12 @@ private:
 | 
				
			||||||
  static SharedHandle<TLSContext> tlsContext_;
 | 
					  static SharedHandle<TLSContext> tlsContext_;
 | 
				
			||||||
#endif // ENABLE_SSL
 | 
					#endif // ENABLE_SSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
  // for SSL
 | 
					  // for SSL
 | 
				
			||||||
  SSL* ssl;
 | 
					  SSL* ssl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int sslHandleEAGAIN(int ret);
 | 
					  int sslHandleEAGAIN(int ret);
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
#ifdef HAVE_LIBGNUTLS
 | 
					#ifdef HAVE_LIBGNUTLS
 | 
				
			||||||
  gnutls_session_t sslSession_;
 | 
					  gnutls_session_t sslSession_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "common.h"
 | 
					#include "common.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBSSL
 | 
					#ifdef HAVE_OPENSSL
 | 
				
			||||||
# include "LibsslTLSContext.h"
 | 
					# include "LibsslTLSContext.h"
 | 
				
			||||||
#elif HAVE_LIBGNUTLS
 | 
					#elif HAVE_LIBGNUTLS
 | 
				
			||||||
# include "LibgnutlsTLSContext.h"
 | 
					# include "LibgnutlsTLSContext.h"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,10 +57,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBGCRYPT
 | 
					#ifdef HAVE_LIBGCRYPT
 | 
				
			||||||
# include <gcrypt.h>
 | 
					# include <gcrypt.h>
 | 
				
			||||||
#elif HAVE_LIBSSL
 | 
					#elif HAVE_OPENSSL
 | 
				
			||||||
# include <openssl/rand.h>
 | 
					# include <openssl/rand.h>
 | 
				
			||||||
# include "SimpleRandomizer.h"
 | 
					# include "SimpleRandomizer.h"
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "File.h"
 | 
					#include "File.h"
 | 
				
			||||||
#include "message.h"
 | 
					#include "message.h"
 | 
				
			||||||
| 
						 | 
					@ -1285,7 +1285,7 @@ void generateRandomData(unsigned char* data, size_t length)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef HAVE_LIBGCRYPT
 | 
					#ifdef HAVE_LIBGCRYPT
 | 
				
			||||||
  gcry_randomize(data, length, GCRY_STRONG_RANDOM);
 | 
					  gcry_randomize(data, length, GCRY_STRONG_RANDOM);
 | 
				
			||||||
#elif HAVE_LIBSSL
 | 
					#elif HAVE_OPENSSL
 | 
				
			||||||
  if(RAND_bytes(data, length) != 1) {
 | 
					  if(RAND_bytes(data, length) != 1) {
 | 
				
			||||||
    for(size_t i = 0; i < length; ++i) {
 | 
					    for(size_t i = 0; i < length; ++i) {
 | 
				
			||||||
      data[i] = SimpleRandomizer::getInstance()->getRandomNumber(UINT8_MAX+1);
 | 
					      data[i] = SimpleRandomizer::getInstance()->getRandomNumber(UINT8_MAX+1);
 | 
				
			||||||
| 
						 | 
					@ -1294,7 +1294,7 @@ void generateRandomData(unsigned char* data, size_t length)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  std::ifstream i("/dev/urandom", std::ios::binary);
 | 
					  std::ifstream i("/dev/urandom", std::ios::binary);
 | 
				
			||||||
  i.read(reinterpret_cast<char*>(data), length);
 | 
					  i.read(reinterpret_cast<char*>(data), length);
 | 
				
			||||||
#endif // HAVE_LIBSSL
 | 
					#endif // HAVE_OPENSSL
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool saveAs
 | 
					bool saveAs
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue