commit:     c76da85a21aa8f1546e5977dff8dae8843220805
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 17:35:56 2018 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 17:39:37 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c76da85a

net-libs/libssh2: Fix openssl-1.1 compat (#614784)

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 .../libssh2/files/libssh2-1.8.0-openssl11.patch    | 70 ++++++++++++++++++++++
 net-libs/libssh2/libssh2-1.8.0-r1.ebuild           | 21 +++----
 2 files changed, 78 insertions(+), 13 deletions(-)

diff --git a/net-libs/libssh2/files/libssh2-1.8.0-openssl11.patch 
b/net-libs/libssh2/files/libssh2-1.8.0-openssl11.patch
new file mode 100644
index 00000000000..0824dd06176
--- /dev/null
+++ b/net-libs/libssh2/files/libssh2-1.8.0-openssl11.patch
@@ -0,0 +1,70 @@
+From c423b543ca45d6caca7b94763bf65ff79d07e811 Mon Sep 17 00:00:00 2001
+From: Marcel Raad <[email protected]>
+Date: Wed, 24 May 2017 19:21:22 +0200
+Subject: [PATCH] openssl: fix build with OpenSSL 1.1 API (#176)
+
+When building with OPENSSL_API_COMPAT=0x10100000L, OpenSSL_add_all_algorithms
+and OpenSSL_add_all_ciphers don't exist. The corresponding functionality is
+handled automatically with OpenSSL 1.1.
+---
+ src/openssl.c | 4 ++++
+ src/openssl.h | 6 ++++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/src/openssl.c b/src/openssl.c
+index f10f2921..25cef082 100644
+--- a/src/openssl.c
++++ b/src/openssl.c
+@@ -1056,6 +1056,7 @@ _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
+                               "Unable to extract public key from private key "
+                               "file: Unable to open private key file");
+     }
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+     if (!EVP_get_cipherbyname("des")) {
+         /* If this cipher isn't loaded it's a pretty good indication that none
+          * are.  I have *NO DOUBT* that there's a better way to deal with this
+@@ -1064,6 +1065,7 @@ _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
+          */
+         OpenSSL_add_all_ciphers();
+     }
++#endif
+     BIO_reset(bp);
+     pk = PEM_read_bio_PrivateKey(bp, NULL, NULL, (void*)passphrase);
+     BIO_free(bp);
+@@ -1132,6 +1134,7 @@ _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session,
+     if (!bp) {
+         return -1;
+     }
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+     if (!EVP_get_cipherbyname("des")) {
+         /* If this cipher isn't loaded it's a pretty good indication that none
+          * are.  I have *NO DOUBT* that there's a better way to deal with this
+@@ -1140,6 +1143,7 @@ _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session,
+          */
+         OpenSSL_add_all_ciphers();
+     }
++#endif
+     BIO_reset(bp);
+     pk = PEM_read_bio_PrivateKey(bp, NULL, NULL, (void*)passphrase);
+     BIO_free(bp);
+diff --git a/src/openssl.h b/src/openssl.h
+index 2bd80b96..d8874286 100644
+--- a/src/openssl.h
++++ b/src/openssl.h
+@@ -226,10 +226,16 @@ int _libssh2_md5_init(libssh2_md5_ctx *ctx);
+ #define libssh2_hmac_cleanup(ctx) HMAC_cleanup(ctx)
+ #endif
+ 
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L
++#define libssh2_crypto_init() \
++  ENGINE_load_builtin_engines(); \
++  ENGINE_register_all_complete()
++#else
+ #define libssh2_crypto_init() \
+   OpenSSL_add_all_algorithms(); \
+   ENGINE_load_builtin_engines(); \
+   ENGINE_register_all_complete()
++#endif
+ 
+ #define libssh2_crypto_exit()
+ 

diff --git a/net-libs/libssh2/libssh2-1.8.0-r1.ebuild 
b/net-libs/libssh2/libssh2-1.8.0-r1.ebuild
index 8abb95e667b..1105b230b82 100644
--- a/net-libs/libssh2/libssh2-1.8.0-r1.ebuild
+++ b/net-libs/libssh2/libssh2-1.8.0-r1.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
-inherit ltprune multilib-minimal
+inherit multilib-minimal
 
 DESCRIPTION="Library implementing the SSH2 protocol"
 HOMEPAGE="https://www.libssh2.org";
@@ -10,27 +10,23 @@ SRC_URI="https://www.${PN}.org/download/${P}.tar.gz";
 
 LICENSE="BSD"
 SLOT="0"
-KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~mips ~ppc ~ppc64 ~s390 ~sh sparc 
x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~x86-solaris"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ~mips ~ppc ~ppc64 ~s390 ~sh sparc 
x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~x86-solaris"
 IUSE="gcrypt libressl static-libs test zlib"
 
-DEPEND="
+RDEPEND="
        !gcrypt? (
-               !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0[${MULTILIB_USEDEP}] 
)
-               libressl? ( dev-libs/libressl[${MULTILIB_USEDEP}] )
+               !libressl? ( 
>=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+               libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
        )
        gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] )
        zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
 "
-RDEPEND="
-       ${DEPEND}
-"
+DEPEND="${RDEPEND}"
 
-DOCS=(
-       NEWS README
-)
 PATCHES=(
        "${FILESDIR}"/${PN}-1.8.0-libgcrypt-prefix.patch
        "${FILESDIR}"/${PN}-1.8.0-mansyntax_sh.patch
+       "${FILESDIR}"/${PN}-1.8.0-openssl11.patch
 )
 
 multilib_src_configure() {
@@ -45,6 +41,5 @@ multilib_src_configure() {
 
 multilib_src_install_all() {
        einstalldocs
-
-       prune_libtool_files
+       find "${D}" -name '*.la' -delete || die
 }

Reply via email to