summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-12-18 19:37:40 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-12-22 22:55:39 +0100
commit90270f0959d490d56db891809d83c91b3d4b9bf0 (patch)
tree80589894ae2a0eda080b6c6cf416882b52eaef7d /CMakeLists.txt
parent470f5cf449ac20c7d7bf50ad805c72a5f52d256f (diff)
hashes, methods: Add OpenSSL backends
Introduce an OpenSSL::Crypto backend for the hashes library and an OpenSSL::SSL backend for the TLS support in our https method. Many thanks to curl for showing the way with how to handle a CRL file. There are some memory leaks here with the TlsFd itself as well as the proxy support; and we should reorganize the code to generate the ssl object as late as possible. A peculiar aspect of OpenSSL is that SSL_has_pending() returns 1 even if SSL_read() will fail to read anything and return the equivalent of EAGAIN. We work around this here by also peeking ahead 1 byte. I was running a very high RTT connection from Germany to Australia for testing, and with the peeking it's using negligible amounts of CPU; before that, it was busy looping at 100%. Bad OpenSSL!
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 9 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d2a5414d..f2433c6c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ enable_testing()
option(REQUIRE_MERGED_USR "Require merged-usr." ON)
option(WITH_DOC "Build all documentation." ON)
+option(WITH_OPENSSL "Build all documentation." ON)
include(CMakeDependentOption)
cmake_dependent_option(WITH_DOC_MANPAGES "Force building manpages." OFF "NOT WITH_DOC" OFF)
cmake_dependent_option(WITH_DOC_GUIDES "Force building guides." OFF "NOT WITH_DOC" OFF)
@@ -92,9 +93,13 @@ if (BERKELEY_FOUND)
set(HAVE_BDB 1)
endif()
-find_package(GnuTLS)
-if (GNUTLS_FOUND)
- set(HAVE_GNUTLS 1)
+if (WITH_OPENSSL)
+ find_package(OpenSSL REQUIRED)
+else()
+ find_package(GnuTLS)
+ if (GNUTLS_FOUND)
+ set(HAVE_GNUTLS 1)
+ endif()
endif()
# (De)Compressor libraries
@@ -141,7 +146,7 @@ if (SECCOMP_FOUND)
set(HAVE_SECCOMP 1)
endif()
-if (NOT HAVE_GNUTLS)
+if (NOT HAVE_GNUTLS AND NOT WITH_OPENSSL)
find_package(GCRYPT REQUIRED)
endif()
find_package(XXHASH REQUIRED)