mirror of https://github.com/aria2/aria2
Replaced HAVE_LIBSSL with HAVE_OPENSSL
parent
7230fbd2f7
commit
395212f47f
|
@ -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],
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "common.h"
|
||||
#ifdef HAVE_LIBGCRYPT
|
||||
# include "LibgcryptARC4Decryptor.h"
|
||||
#elif HAVE_LIBSSL
|
||||
#elif HAVE_OPENSSL
|
||||
# include "LibsslARC4Decryptor.h"
|
||||
#else
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "common.h"
|
||||
#ifdef HAVE_LIBGCRYPT
|
||||
# include "LibgcryptARC4Encryptor.h"
|
||||
#elif HAVE_LIBSSL
|
||||
#elif HAVE_OPENSSL
|
||||
# include "LibsslARC4Encryptor.h"
|
||||
#else
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -54,10 +54,10 @@
|
|||
|
||||
#endif // HAVE_WINSOCK2_H
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
#ifdef HAVE_OPENSSL
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/ssl.h>
|
||||
#endif // HAVE_LIBSSL
|
||||
#endif // HAVE_OPENSSL
|
||||
#ifdef HAVE_LIBGNUTLS
|
||||
# include <gnutls/gnutls.h>
|
||||
#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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
|
||||
#include "a2netcompat.h"
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
#ifdef HAVE_OPENSSL
|
||||
// for SSL
|
||||
# include <openssl/ssl.h>
|
||||
# include <openssl/err.h>
|
||||
#endif // HAVE_LIBSSL
|
||||
#endif // HAVE_OPENSSL
|
||||
#ifdef HAVE_LIBGNUTLS
|
||||
# include <gnutls/gnutls.h>
|
||||
#endif // HAVE_LIBGNUTLS
|
||||
|
@ -88,12 +88,12 @@ private:
|
|||
static SharedHandle<TLSContext> 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_;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
#ifdef HAVE_OPENSSL
|
||||
# include "LibsslTLSContext.h"
|
||||
#elif HAVE_LIBGNUTLS
|
||||
# include "LibgnutlsTLSContext.h"
|
||||
|
|
|
@ -57,10 +57,10 @@
|
|||
|
||||
#ifdef HAVE_LIBGCRYPT
|
||||
# include <gcrypt.h>
|
||||
#elif HAVE_LIBSSL
|
||||
#elif HAVE_OPENSSL
|
||||
# include <openssl/rand.h>
|
||||
# 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<char*>(data), length);
|
||||
#endif // HAVE_LIBSSL
|
||||
#endif // HAVE_OPENSSL
|
||||
}
|
||||
|
||||
bool saveAs
|
||||
|
|
Loading…
Reference in New Issue