diff options
-rw-r--r-- | libraries/libtorrent/4607bbf7.patch | 105 | ||||
-rw-r--r-- | libraries/libtorrent/libtorrent.SlackBuild | 10 | ||||
-rw-r--r-- | libraries/libtorrent/libtorrent.info | 6 |
3 files changed, 115 insertions, 6 deletions
diff --git a/libraries/libtorrent/4607bbf7.patch b/libraries/libtorrent/4607bbf7.patch new file mode 100644 index 0000000000..55d0cb901b --- /dev/null +++ b/libraries/libtorrent/4607bbf7.patch @@ -0,0 +1,105 @@ +From 4607bbf78040789dee29266878ce109136b984ef Mon Sep 17 00:00:00 2001 +From: rakshasa <sundell.software@gmail.com> +Date: Tue, 20 Dec 2016 19:51:02 +0900 +Subject: [PATCH] Added support for openssl 1.1. + +--- + configure.ac | 4 ++++ + src/utils/diffie_hellman.cc | 36 ++++++++++++++++++++++++++++++++++-- + 2 files changed, 38 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 65e34872..27e33570 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -69,12 +69,15 @@ AC_ARG_ENABLE(openssl, + [ --disable-openssl Don't use OpenSSL's SHA1 implementation.], + [ + if test "$enableval" = "yes"; then ++dnl move to scripts. + PKG_CHECK_MODULES(OPENSSL, libcrypto, + CXXFLAGS="$CXXFLAGS $OPENSSL_CFLAGS"; + LIBS="$LIBS $OPENSSL_LIBS") + + AC_DEFINE(USE_OPENSSL, 1, Using OpenSSL.) + AC_DEFINE(USE_OPENSSL_SHA, 1, Using OpenSSL's SHA1 implementation.) ++ AC_CHECK_LIB([crypto], [DH_set0_pqg], [AC_DEFINE(USE_OPENSSL_1_1, 1, Using OpenSSL 1.1.)]) ++ + else + AC_DEFINE(USE_NSS_SHA, 1, Using Mozilla's SHA1 implementation.) + fi +@@ -85,6 +88,7 @@ AC_ARG_ENABLE(openssl, + + AC_DEFINE(USE_OPENSSL, 1, Using OpenSSL.) + AC_DEFINE(USE_OPENSSL_SHA, 1, Using OpenSSL's SHA1 implementation.) ++ AC_CHECK_LIB([crypto], [DH_set0_pqg], [AC_DEFINE(USE_OPENSSL_1_1, 1, Using OpenSSL 1.1.)]) + ] + ) + +diff --git a/src/utils/diffie_hellman.cc b/src/utils/diffie_hellman.cc +index aa653d45..7ec13165 100644 +--- a/src/utils/diffie_hellman.cc ++++ b/src/utils/diffie_hellman.cc +@@ -54,11 +54,23 @@ DiffieHellman::DiffieHellman(const unsigned char *prime, int primeLength, + m_secret(NULL), m_size(0) { + + #ifdef USE_OPENSSL ++ + m_dh = DH_new(); ++ ++#ifdef USE_OPENSSL_1_1 ++ BIGNUM * const dh_p = BN_bin2bn(prime, primeLength, NULL); ++ BIGNUM * const dh_g = BN_bin2bn(generator, generatorLength, NULL); ++ ++ if (dh_p == NULL || dh_g == NULL || ++ !DH_set0_pqg(m_dh, dh_p, NULL, dh_g)) ++ throw internal_error("Could not generate Diffie-Hellman parameters"); ++#else + m_dh->p = BN_bin2bn(prime, primeLength, NULL); + m_dh->g = BN_bin2bn(generator, generatorLength, NULL); ++#endif + + DH_generate_key(m_dh); ++ + #else + throw internal_error("Compiled without encryption support."); + #endif +@@ -74,7 +86,19 @@ DiffieHellman::~DiffieHellman() { + bool + DiffieHellman::is_valid() const { + #ifdef USE_OPENSSL ++ if (m_dh == NULL) ++ return false; ++ ++#ifdef USE_OPENSSL_1_1 ++ const BIGNUM *pub_key; ++ ++ DH_get0_key(m_dh, &pub_key, NULL); ++ ++ return pub_key != NULL; ++#else + return m_dh != NULL && m_dh->pub_key != NULL; ++#endif ++ + #else + return false; + #endif +@@ -103,8 +127,16 @@ DiffieHellman::store_pub_key(unsigned char* dest, unsigned int length) { + #ifdef USE_OPENSSL + std::memset(dest, 0, length); + +- if ((int)length >= BN_num_bytes(m_dh->pub_key)) +- BN_bn2bin(m_dh->pub_key, dest + length - BN_num_bytes(m_dh->pub_key)); ++ const BIGNUM *pub_key; ++ ++#ifdef USE_OPENSSL_1_1 ++ DH_get0_key(m_dh, &pub_key, NULL); ++#else ++ pub_key = m_dh->pub_key; ++#endif ++ ++ if ((int)length >= BN_num_bytes(pub_key)) ++ BN_bn2bin(pub_key, dest + length - BN_num_bytes(pub_key)); + #endif + } + diff --git a/libraries/libtorrent/libtorrent.SlackBuild b/libraries/libtorrent/libtorrent.SlackBuild index feb2231046..48f7d5e85e 100644 --- a/libraries/libtorrent/libtorrent.SlackBuild +++ b/libraries/libtorrent/libtorrent.SlackBuild @@ -5,13 +5,13 @@ # Updated by Andrew Brouwers, abrouwers@gmail.com PRGNAM=libtorrent -VERSION=${VERSION:-0.13.6} +VERSION=${VERSION:-0.13.7} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac @@ -22,7 +22,7 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i486" ]; then +if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then @@ -51,6 +51,10 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# Added OpenSSL 1.1 support. +patch -p1 < $CWD/4607bbf7.patch + +./autogen.sh CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ diff --git a/libraries/libtorrent/libtorrent.info b/libraries/libtorrent/libtorrent.info index cf8c19258c..b94f0f0ece 100644 --- a/libraries/libtorrent/libtorrent.info +++ b/libraries/libtorrent/libtorrent.info @@ -1,8 +1,8 @@ PRGNAM="libtorrent" -VERSION="0.13.6" +VERSION="0.13.7" HOMEPAGE="https://github.com/rakshasa/libtorrent" -DOWNLOAD="http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz" -MD5SUM="66f18044432a62c006c75f6d0bb4d7dc" +DOWNLOAD="http://rtorrent.net/downloads/libtorrent-0.13.7.tar.gz" +MD5SUM="fe34521cd440910b7ad4e1720a1ff5e0" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" |