summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoraksr2018-03-29 20:57:13 +0200
committeraksr2018-03-29 20:57:13 +0200
commit7a391f5e2c302b9753478c6bcdd54054f23e60f0 (patch)
tree6efc172bb820ad75d0d47f90a4dc7205fdd85318
parent6015326552f129161ba11019dd9740560803438c (diff)
downloadaur-7a391f5e2c302b9753478c6bcdd54054f23e60f0.tar.gz
Add patch for openssl [community].
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD14
-rw-r--r--libtorrent-openssl-1.1.patch105
3 files changed, 121 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e424d0986305..d052c04682cd 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,8 @@
+# Generated by mksrcinfo v8
+# Thu Mar 29 18:54:39 UTC 2018
pkgbase = libtorrent-git
pkgdesc = A BitTorrent library written in C++.
- pkgver = 0.13.4.r104.g4791513
+ pkgver = 0.13.4.r176.gc167c5a9
pkgrel = 1
url = https://github.com/rakshasa/libtorrent/
arch = i686
@@ -14,7 +16,9 @@ pkgbase = libtorrent-git
conflicts = libtorrent
options = !libtool
source = libtorrent-git::git+https://github.com/rakshasa/libtorrent.git
+ source = libtorrent-openssl-1.1.patch::https://github.com/rakshasa/libtorrent/commit/4607bbf7.patch
md5sums = SKIP
+ md5sums = f041643ba1c308e915fba0b4c9a9e685
pkgname = libtorrent-git
diff --git a/PKGBUILD b/PKGBUILD
index e527a8ea8bdc..e6650567b942 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
## Based on libtorrent [community]
# Maintainer: aksr <aksr at t-com dot me>
pkgname=libtorrent-git
-pkgver=0.13.4.r104.g4791513
+pkgver=0.13.4.r176.gc167c5a9
pkgrel=1
pkgdesc="A BitTorrent library written in C++."
url="https://github.com/rakshasa/libtorrent/"
@@ -13,14 +13,22 @@ makedepends=("cppunit" "git")
conflicts=('libtorrent')
provides=('libtorrent')
options=("!libtool")
-source=("$pkgname::git+https://github.com/rakshasa/libtorrent.git")
-md5sums=("SKIP")
+source=("$pkgname::git+https://github.com/rakshasa/libtorrent.git"
+ libtorrent-openssl-1.1.patch::"https://github.com/rakshasa/libtorrent/commit/4607bbf7.patch")
+md5sums=('SKIP'
+ 'f041643ba1c308e915fba0b4c9a9e685')
pkgver() {
cd "$srcdir/$pkgname"
git describe --long | sed -r "s/([^-]*-g)/r\1/;s/-/./g"
}
+prepare() {
+ cd "$srcdir/$pkgname"
+ sed '/AM_PATH_CPPUNIT/d' -i configure.ac
+ patch -p1 -i ../libtorrent-openssl-1.1.patch
+}
+
build() {
cd "$srcdir/$pkgname"
./autogen.sh
diff --git a/libtorrent-openssl-1.1.patch b/libtorrent-openssl-1.1.patch
new file mode 100644
index 000000000000..55d0cb901b71
--- /dev/null
+++ b/libtorrent-openssl-1.1.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
+ }
+