1################################################################################
2#
3# libssh2
4#
5################################################################################
6
7LIBSSH2_VERSION = 1.11.0
8LIBSSH2_SOURCE= libssh2-$(LIBSSH2_VERSION).tar.xz
9LIBSSH2_SITE = https://www.libssh2.org/download
10LIBSSH2_LICENSE = BSD
11LIBSSH2_LICENSE_FILES = COPYING
12LIBSSH2_CPE_ID_VENDOR = libssh2
13LIBSSH2_INSTALL_STAGING = YES
14LIBSSH2_CONF_OPTS = --disable-examples-build --disable-rpath
15
16# 0002-src-add-strict-KEX-to-fix-CVE-2023-48795-Terrapin-Attack.patch
17LIBSSH2_IGNORE_CVES += CVE-2023-48795
18
19ifeq ($(BR2_PACKAGE_LIBSSH2_MBEDTLS),y)
20LIBSSH2_DEPENDENCIES += mbedtls
21LIBSSH2_CONF_OPTS += --with-libmbedcrypto-prefix=$(STAGING_DIR)/usr \
22	--with-crypto=mbedtls
23else ifeq ($(BR2_PACKAGE_LIBSSH2_LIBGCRYPT),y)
24LIBSSH2_DEPENDENCIES += libgcrypt
25LIBSSH2_CONF_OPTS += --with-libgcrypt-prefix=$(STAGING_DIR)/usr \
26	--with-crypto=libgcrypt
27# configure.ac forgets to link to dependent libraries of gcrypt breaking static
28# linking
29LIBSSH2_CONF_ENV += LIBS="`$(STAGING_DIR)/usr/bin/libgcrypt-config --libs`"
30else ifeq ($(BR2_PACKAGE_LIBSSH2_OPENSSL),y)
31LIBSSH2_DEPENDENCIES += host-pkgconf openssl
32LIBSSH2_CONF_OPTS += --with-libssl-prefix=$(STAGING_DIR)/usr \
33	--with-crypto=openssl
34# configure.ac forgets to link to dependent libraries of openssl breaking static
35# linking
36LIBSSH2_CONF_ENV += LIBS=`$(PKG_CONFIG_HOST_BINARY) --libs openssl`
37endif
38
39# Add zlib support if enabled
40ifeq ($(BR2_PACKAGE_ZLIB),y)
41LIBSSH2_DEPENDENCIES += zlib
42LIBSSH2_CONF_OPTS += --with-libz \
43	--with-libz-prefix=$(STAGING_DIR)/usr
44else
45LIBSSH2_CONF_OPTS += --without-libz
46endif
47
48HOST_LIBSSH2_DEPENDENCIES += host-openssl
49HOST_LIBSSH2_CONF_OPTS += --with-openssl \
50	--with-libssl-prefix=$(HOST_DIR) \
51	--without-libgcrypt
52
53$(eval $(autotools-package))
54$(eval $(host-autotools-package))
55