net-libs/libssh2: Sync with gentoo

It's from gentoo commit 071f81847bccf95001e3f3fd23f92c105c9532fe.
This commit is contained in:
Krzesimir Nowak 2022-03-03 15:59:32 +01:00
parent 5907650a82
commit cbf3dfbafd
9 changed files with 19 additions and 261 deletions

View File

@ -1,2 +1 @@
DIST libssh2-1.8.0.tar.gz 854916 BLAKE2B 618c4a19789f2e5eda85852760dffff5672d420d2fa50393b05b7398a1913f74e5f6695f078628050ac9851965d6e45cf410b7c4590a8f18d67c718c829ab352 SHA512 289aa45c4f99653bebf5f99565fe9c519abc204feb2084b47b7cc3badc8bf4ecdedd49ea6acdce8eb902b3c00995d5f92a3ca77b2508b92f04ae0e7de7287558 DIST libssh2-1.10.0.tar.gz 965044 BLAKE2B 0e6f571cc723e0050bf7ba7492f361ef222547dcbc311019cb6762f01405b4906e0418207a7d484c5170bee5e6f666827a7ea0d0cf233f684f999f896ce0b415 SHA512 e064ee1089eb8e6cd5fa2617f4fd8ff56c2721c5476775a98bdb68c6c4ee4d05c706c3bb0eb479a27a8ec0b17a8a5ef43e1d028ad3f134519aa582d3981a3a30
DIST libssh2-1.8.2.tar.gz 859587 BLAKE2B 58e0854e83001c424a767ceb4ddfb535373320d8319aa632244dc14434276db7c8b7a77d4a5f22fe8e397f1050b33516d2fca1162658a9f414166f560bc1f358 SHA512 390ab4ad93bb738415ec11a6eb92806c9b9e9e5d8ee7c442d841a58b4292c1c447a9bc99e153ba464e2e11f9c0d1913469303598c3046722d1ae821991e8cb93

View File

@ -1,30 +0,0 @@
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -412,9 +412,9 @@ AC_DEFUN([LIBSSH2_CHECKFOR_GCRYPT], [
old_LDFLAGS=$LDFLAGS
old_CFLAGS=$CFLAGS
- if test -n "$use_libgcrypt" && test "$use_libgcrypt" != "no"; then
- LDFLAGS="$LDFLAGS -L$use_libgcrypt/lib"
- CFLAGS="$CFLAGS -I$use_libgcrypt/include"
+ if test -n "$with_libgcrypt_prefix" && test "$use_libgcrypt" != "no"; then
+ LDFLAGS="$LDFLAGS -L$with_libgcrypt_prefix/lib"
+ CFLAGS="$CFLAGS -I$with_libgcrypt_prefix/include"
fi
AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [
#include <gcrypt.h>
--- a/configure
+++ b/configure
@@ -14250,9 +14235,9 @@
old_LDFLAGS=$LDFLAGS
old_CFLAGS=$CFLAGS
- if test -n "$use_libgcrypt" && test "$use_libgcrypt" != "no"; then
- LDFLAGS="$LDFLAGS -L$use_libgcrypt/lib"
- CFLAGS="$CFLAGS -I$use_libgcrypt/include"
+ if test -n "$with_libgcrypt_prefix" && test "$use_libgcrypt" != "no"; then
+ LDFLAGS="$LDFLAGS -L$with_libgcrypt_prefix/lib"
+ CFLAGS="$CFLAGS -I$with_libgcrypt_prefix/include"
fi

View File

@ -1,23 +0,0 @@
From 97518ca8bda91ce12c503197a98fa71690cb67f9 Mon Sep 17 00:00:00 2001
From: Will Cosgrove <will@panic.com>
Date: Fri, 12 May 2017 16:34:26 -0700
Subject: [PATCH] Fix memory leak of crypt_ctx->h using openSSL 1.1+ (#177)
Need to use EVP_CIPHER_CTX_free instead of EVP_CIPHER_CTX_reset.
---
src/openssl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/openssl.h b/src/openssl.h
index 6aa12192..2bd80b96 100644
--- a/src/openssl.h
+++ b/src/openssl.h
@@ -267,7 +267,7 @@ int _libssh2_md5_init(libssh2_md5_ctx *ctx);
#define _libssh2_cipher_3des EVP_des_ede3_cbc
#ifdef HAVE_OPAQUE_STRUCTS
-#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_reset(*(ctx))
+#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_free(*(ctx))
#else
#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_cleanup(ctx)
#endif

View File

@ -1,70 +0,0 @@
From c423b543ca45d6caca7b94763bf65ff79d07e811 Mon Sep 17 00:00:00 2001
From: Marcel Raad <MarcelRaad@users.noreply.github.com>
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()

View File

@ -1,27 +1,28 @@
# Copyright 1999-2019 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=7
CMAKE_ECLASS=cmake
inherit cmake-multilib inherit cmake-multilib
DESCRIPTION="Library implementing the SSH2 protocol" DESCRIPTION="Library implementing the SSH2 protocol"
HOMEPAGE="https://www.libssh2.org" HOMEPAGE="https://www.libssh2.org"
SRC_URI="https://www.${PN}.org/download/${P}.tar.gz" SRC_URI="https://www.libssh2.org/download/${P}.tar.gz"
LICENSE="BSD" LICENSE="BSD"
SLOT="0" 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 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-solaris"
IUSE="gcrypt libressl mbedtls zlib" IUSE="gcrypt mbedtls zlib"
REQUIRED_USE="?? ( gcrypt mbedtls )" REQUIRED_USE="?? ( gcrypt mbedtls )"
# Tests try to set containers up using docker (and fail for some reason).
RESTRICT="test" RESTRICT="test"
RDEPEND=" RDEPEND="
gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] )
!gcrypt? ( !gcrypt? (
mbedtls? ( net-libs/mbedtls[${MULTILIB_USEDEP}] ) mbedtls? ( net-libs/mbedtls:0=[${MULTILIB_USEDEP}] )
!mbedtls? ( !mbedtls? (
!libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] ) >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}]
libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
) )
) )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] ) zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
@ -30,13 +31,6 @@ DEPEND="
${RDEPEND} ${RDEPEND}
" "
PATCHES=(
"${FILESDIR}"/${PN}-1.8.0-libgcrypt-prefix.patch
"${FILESDIR}"/${PN}-1.8.0-mansyntax_sh.patch
"${FILESDIR}"/${PN}-1.8.0-openssl11-memleak.patch
"${FILESDIR}"/${PN}-1.8.0-openssl11.patch
)
multilib_src_configure() { multilib_src_configure() {
local crypto_backend=OpenSSL local crypto_backend=OpenSSL
if use gcrypt; then if use gcrypt; then
@ -50,12 +44,10 @@ multilib_src_configure() {
-DCRYPTO_BACKEND=${crypto_backend} -DCRYPTO_BACKEND=${crypto_backend}
-DENABLE_ZLIB_COMPRESSION=$(usex zlib) -DENABLE_ZLIB_COMPRESSION=$(usex zlib)
) )
cmake-utils_src_configure cmake_src_configure
} }
multilib_src_install_all() { multilib_src_install_all() {
einstalldocs einstalldocs
find "${ED}" -name '*.la' -delete || die find "${ED}" -name '*.la' -delete || die
mv "${ED}"/usr/share/doc/${PN}/* "${ED}"/usr/share/doc/${PF}/ || die
rm -r "${ED}"/usr/share/doc/${PN}/ || die
} }

View File

@ -1,46 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit multilib-minimal
DESCRIPTION="Library implementing the SSH2 protocol"
HOMEPAGE="https://www.libssh2.org"
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"
IUSE="gcrypt libressl static-libs test zlib"
RDEPEND="
!gcrypt? (
!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}] )
"
DEPEND="${RDEPEND}"
PATCHES=(
"${FILESDIR}"/${PN}-1.8.0-libgcrypt-prefix.patch
"${FILESDIR}"/${PN}-1.8.0-mansyntax_sh.patch
"${FILESDIR}"/${PN}-1.8.0-openssl11.patch
"${FILESDIR}"/${PN}-1.8.0-openssl11-memleak.patch
)
multilib_src_configure() {
# Disable tests that require extra permissions (bug #333319)
use test && local -x ac_cv_path_SSHD=
ECONF_SOURCE=${S} econf \
$(use_with zlib libz) \
$(usex gcrypt --with-libgcrypt --with-openssl) \
$(use_enable static-libs static)
}
multilib_src_install_all() {
einstalldocs
find "${D}" -name '*.la' -delete || die
}

View File

@ -1,61 +0,0 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-multilib
DESCRIPTION="Library implementing the SSH2 protocol"
HOMEPAGE="https://www.libssh2.org"
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"
IUSE="gcrypt libressl mbedtls zlib"
REQUIRED_USE="?? ( gcrypt mbedtls )"
RESTRICT="test"
RDEPEND="
gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] )
!gcrypt? (
mbedtls? ( net-libs/mbedtls[${MULTILIB_USEDEP}] )
!mbedtls? (
!libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
)
)
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
"
DEPEND="
${RDEPEND}
"
PATCHES=(
"${FILESDIR}"/${PN}-1.8.0-libgcrypt-prefix.patch
"${FILESDIR}"/${PN}-1.8.0-mansyntax_sh.patch
"${FILESDIR}"/${PN}-1.8.0-openssl11-memleak.patch
"${FILESDIR}"/${PN}-1.8.0-openssl11.patch
)
multilib_src_configure() {
local crypto_backend=OpenSSL
if use gcrypt; then
crypto_backend=Libgcrypt
elif use mbedtls; then
crypto_backend=mbedTLS
fi
local mycmakeargs=(
-DBUILD_SHARED_LIBS=ON
-DCRYPTO_BACKEND=${crypto_backend}
-DENABLE_ZLIB_COMPRESSION=$(usex zlib)
)
cmake-utils_src_configure
}
multilib_src_install_all() {
einstalldocs
find "${ED}" -name '*.la' -delete || die
mv "${ED}"/usr/share/doc/${PN}/* "${ED}"/usr/share/doc/${PF}/ || die
rm -r "${ED}"/usr/share/doc/${PN}/ || die
}

View File

@ -1,7 +1,8 @@
# Copyright 1999-2019 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=7
CMAKE_ECLASS=cmake
inherit git-r3 cmake-multilib inherit git-r3 cmake-multilib
DESCRIPTION="Library implementing the SSH2 protocol" DESCRIPTION="Library implementing the SSH2 protocol"
@ -11,17 +12,16 @@ EGIT_REPO_URI="https://github.com/libssh2/libssh2"
LICENSE="BSD" LICENSE="BSD"
SLOT="0" SLOT="0"
KEYWORDS="" KEYWORDS=""
IUSE="gcrypt libressl mbedtls zlib" IUSE="gcrypt mbedtls zlib"
REQUIRED_USE="?? ( gcrypt mbedtls )" REQUIRED_USE="?? ( gcrypt mbedtls )"
RESTRICT="test" RESTRICT="test"
RDEPEND=" RDEPEND="
gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] )
!gcrypt? ( !gcrypt? (
mbedtls? ( net-libs/mbedtls[${MULTILIB_USEDEP}] ) mbedtls? ( net-libs/mbedtls:0=[${MULTILIB_USEDEP}] )
!mbedtls? ( !mbedtls? (
!libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] ) >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}]
libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
) )
) )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] ) zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
@ -47,12 +47,10 @@ multilib_src_configure() {
-DCRYPTO_BACKEND=${crypto_backend} -DCRYPTO_BACKEND=${crypto_backend}
-DENABLE_ZLIB_COMPRESSION=$(usex zlib) -DENABLE_ZLIB_COMPRESSION=$(usex zlib)
) )
cmake-utils_src_configure cmake_src_configure
} }
multilib_src_install_all() { multilib_src_install_all() {
einstalldocs einstalldocs
find "${ED}" -name '*.la' -delete || die find "${ED}" -name '*.la' -delete || die
mv "${ED}"/usr/share/doc/${PN}/* "${ED}"/usr/share/doc/${PF}/ || die
rm -r "${ED}"/usr/share/doc/${PN}/ || die
} }

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<maintainer type="project"> <maintainer type="project">
<email>netmon@gentoo.org</email> <email>netmon@gentoo.org</email>
@ -10,7 +10,6 @@
</maintainer> </maintainer>
<use> <use>
<flag name="gcrypt">Use <pkg>dev-libs/libgcrypt</pkg> instead of <pkg>dev-libs/openssl</pkg></flag> <flag name="gcrypt">Use <pkg>dev-libs/libgcrypt</pkg> instead of <pkg>dev-libs/openssl</pkg></flag>
<flag name="libressl">Use <pkg>dev-libs/libressl</pkg> instead of <pkg>dev-libs/openssl</pkg></flag>
<flag name="mbedtls">Use <pkg>net-libs/mbedtls</pkg> instead of <pkg>dev-libs/openssl</pkg></flag> <flag name="mbedtls">Use <pkg>net-libs/mbedtls</pkg> instead of <pkg>dev-libs/openssl</pkg></flag>
</use> </use>
</pkgmetadata> </pkgmetadata>