libraries/libtorrent: Updated for version 0.13.8, new maintainer.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2024-09-16 23:33:35 -04:00 committed by Willy Sudiarto Raharjo
parent 984c47af33
commit e515c7f964
No known key found for this signature in database
GPG key ID: 3F617144D7238786
4 changed files with 26 additions and 126 deletions

View file

@ -1,105 +0,0 @@
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
}

View file

@ -1,3 +1,5 @@
libtorrent (C++ torrent library)
LibTorrent is a BitTorrent library written in C++ for *nix, with a focus
on high performance and good code. The library differentiates itself
from other implementations by transfering directly from file pages to

View file

@ -1,8 +1,17 @@
#!/bin/bash
# Slackware build script for libtorrent
# Written by Tom Fitzhenry <tom@fitzhenry.name> 2007/08/22
# Updated by Andrew Brouwers, abrouwers@gmail.com
# Written by Tom Fitzhenry, 2007/08/22
# Updated by Andrew Brouwers
# At some point, updated by bkysela
# Updated and now maintained by B. Watson <urchlay@slackware.uk>
# Original version had no license. Modified version is
# licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20240916 bkw:
# - new maintainer.
# - update for v0.13.8.
# 20220420 bkw: Modified by SlackBuilds.org, BUILD=2:
# - name SlackBuild *correctly* in the doc dir.
@ -11,8 +20,8 @@
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=libtorrent
VERSION=${VERSION:-0.13.7}
BUILD=${BUILD:-3}
VERSION=${VERSION:-0.13.8}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -56,14 +65,8 @@ cd $TMP
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \+ -o \
\( -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
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
./autogen.sh
CFLAGS="$SLKCFLAGS" \
@ -79,10 +82,10 @@ CXXFLAGS="$SLKCFLAGS" \
make
make install-strip DESTDIR=$PKG
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
install -m 0644 AUTHORS COPYING NEWS README $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
rm -f $PKG/usr/lib*/*.la

View file

@ -1,10 +1,10 @@
PRGNAM="libtorrent"
VERSION="0.13.7"
VERSION="0.13.8"
HOMEPAGE="https://github.com/rakshasa/libtorrent"
DOWNLOAD="https://github.com/rakshasa/libtorrent/archive/v0.13.7/libtorrent-0.13.7.tar.gz"
MD5SUM="bead5cfa0f640fef13abc1dd1eac94ea"
DOWNLOAD="https://github.com/rakshasa/libtorrent/archive/v0.13.8/libtorrent-0.13.8.tar.gz"
MD5SUM="dd184eadb8b449ddc6c3498a93ddd568"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="bkysela"
EMAIL="bkysela@gmail.com"
MAINTAINER="B. Watson"
EMAIL="urchlay@slackware.uk"