config BR2_PACKAGE_LIBRESSL_ARCH_SUPPORTS
	bool
	# see include/CMakeLists.txt
	default y if BR2_aarch64 || BR2_aarch64_be
	default y if BR2_arm || BR2_armeb
	default y if BR2_i386 || BR2_x86_64
	default y if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
	default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
	default y if BR2_RISCV_64
	default y if BR2_sparc64

config BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
	bool

config BR2_PACKAGE_OPENSSL
	bool "openssl support"
	select BR2_PACKAGE_HAS_OPENSSL
	help
	  Select the desired ssl library provider.

if BR2_PACKAGE_OPENSSL

choice
	prompt "ssl library"
	help
	  Select OpenSSL or LibreSSL.

config BR2_PACKAGE_LIBOPENSSL
	bool "openssl"
	select BR2_PACKAGE_ZLIB
	help
	  A collaborative effort to develop a robust, commercial-grade,
	  fully featured, and Open Source toolkit implementing the
	  Secure Sockets Layer (SSL v2/v3) and Transport Security
	  (TLS v1) as well as a full-strength general-purpose
	  cryptography library.

	  https://openssl-library.org/

	  Note: Some helper scripts need perl.

source "package/libopenssl/Config.in"

config BR2_PACKAGE_LIBRESSL
	bool "libressl"
	depends on BR2_PACKAGE_LIBRESSL_ARCH_SUPPORTS
	depends on !BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
	depends on BR2_TOOLCHAIN_HAS_THREADS
	# uClibc doesn't provide __register_atfork() without NPTL
	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HAS_THREADS_NPTL
	help
	  LibreSSL is a version of the TLS/crypto stack forked from
	  OpenSSL in 2014, with goals of modernizing the codebase,
	  improving security, and applying best practice development
	  processes.

	  http://www.libressl.org/

source "package/libressl/Config.in"

# openssl from br2-external trees, if any
source "$BR2_BASE_DIR/.br2-external.in.openssl"

endchoice

config BR2_PACKAGE_HAS_OPENSSL
	bool

config BR2_PACKAGE_PROVIDES_OPENSSL
	string
	default "libopenssl" if BR2_PACKAGE_LIBOPENSSL
	default "libressl" if BR2_PACKAGE_LIBRESSL

endif

# ensure libopenssl is used for the host variant
config BR2_PACKAGE_PROVIDES_HOST_OPENSSL
	string
	default "host-libopenssl"
