diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e4f9b3ec..7403f7ad5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ unset(DESKFLOW_VERSION_TWEAK) message(STATUS "Building ${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}") # Set lib versions -set(REQUIRED_OPENSSL_VERSION 3.0) +set(REQUIRED_OPENSSL_VERSION 2.0) # OpenBSD's built-in LibreSSL returns 2.0 set(REQUIRED_LIBEI_VERSION 1.3) set(REQUIRED_LIBPORTAL_VERSION 0.9.1) set(REQUIRED_QT_VERSION 6.7.0) diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index ab437e4eb..cf4636eea 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -168,7 +168,8 @@ endmacro() macro(configure_xorg_libs) # Set include dir for BSD-derived systems - set(CMAKE_REQUIRED_INCLUDES "/usr/local/include") + set(CMAKE_REQUIRED_INCLUDES "/usr/local/include;/usr/X11R6/include") + include_directories(/usr/local/include /usr/X11R6/include) set(XKBlib "X11/Xlib.h;X11/XKBlib.h") set(CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h") @@ -191,9 +192,9 @@ macro(configure_xorg_libs) # Set library path and -L flag for BSD-derived systems. # On our FreeBSD CI, `link_directories` is also needed for some reason. - set(CMAKE_LIBRARY_PATH "/usr/local/lib") - set(CMAKE_REQUIRED_FLAGS "-L${CMAKE_LIBRARY_PATH}") - link_directories(${CMAKE_LIBRARY_PATH}) + set(CMAKE_LIBRARY_PATH "/usr/local/lib;/usr/X11R6/lib") + set(CMAKE_REQUIRED_FLAGS "-L/usr/local/lib -L/usr/X11R6/lib") + link_directories(/usr/local/lib /usr/X11R6/lib) check_library_exists("SM;ICE" IceConnectionNumber "" HAVE_ICE) check_library_exists("Xext;X11" DPMSQueryExtension "" HAVE_Xext) diff --git a/src/apps/deskflow-core/CMakeLists.txt b/src/apps/deskflow-core/CMakeLists.txt index 2b4d990be..fd952d3df 100644 --- a/src/apps/deskflow-core/CMakeLists.txt +++ b/src/apps/deskflow-core/CMakeLists.txt @@ -41,7 +41,7 @@ target_link_libraries( install( TARGETS ${target} - RUNTIME_DEPENDENCY_SET coreDeps +# RUNTIME_DEPENDENCY_SET coreDeps RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) diff --git a/src/apps/deskflow-daemon/CMakeLists.txt b/src/apps/deskflow-daemon/CMakeLists.txt index 070c9248b..7780beab4 100644 --- a/src/apps/deskflow-daemon/CMakeLists.txt +++ b/src/apps/deskflow-daemon/CMakeLists.txt @@ -34,7 +34,7 @@ if(WIN32) install( TARGETS ${target} - RUNTIME_DEPENDENCY_SET daemonDeps +# RUNTIME_DEPENDENCY_SET daemonDeps RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) install(RUNTIME_DEPENDENCY_SET daemonDeps diff --git a/src/apps/deskflow-gui/CMakeLists.txt b/src/apps/deskflow-gui/CMakeLists.txt index c485f84a3..433637bb2 100644 --- a/src/apps/deskflow-gui/CMakeLists.txt +++ b/src/apps/deskflow-gui/CMakeLists.txt @@ -51,7 +51,7 @@ target_link_libraries( install( TARGETS ${target} - RUNTIME_DEPENDENCY_SET guiDeps +# RUNTIME_DEPENDENCY_SET guiDeps RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} BUNDLE DESTINATION . ) diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 365f46b67..3125c48de 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -26,6 +26,11 @@ #include #include +// LibreSSL has no SSL_OP_IGNORE_UNEXPECTED_EOF +#if !defined(SSL_OP_IGNORE_UNEXPECTED_EOF) +#define SSL_OP_IGNORE_UNEXPECTED_EOF 0 +#endif + // // SecureSocket // diff --git a/src/lib/net/SecureUtils.cpp b/src/lib/net/SecureUtils.cpp index d6e0d24b7..c775bd03f 100644 --- a/src/lib/net/SecureUtils.cpp +++ b/src/lib/net/SecureUtils.cpp @@ -35,6 +35,23 @@ const EVP_MD *digestForType(QCryptographicHash::Algorithm type) throw std::runtime_error("Unknown fingerprint type " + std::to_string(static_cast(type))); } +// LibreSSL has no EVP_RSA_gen() +EVP_PKEY *evp_rsa_gen(unsigned int bits) +{ + EVP_PKEY *pkey = NULL; + + auto *ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL); + if (ctx == NULL) + return NULL; + auto ctxFree = finally([ctx]() { EVP_PKEY_CTX_free(ctx); }); + + if (EVP_PKEY_keygen_init(ctx) <= 0 || EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) <= 0 || + EVP_PKEY_keygen(ctx, &pkey) <= 0) + pkey = NULL; + + return pkey; +} + } // namespace QString formatSSLFingerprint(const QByteArray &fingerprint, bool enableSeparators) @@ -66,7 +83,7 @@ void generatePemSelfSignedCert(const QString &path, int keyLength) { auto expirationDays = 365; - auto *privateKey = EVP_RSA_gen(keyLength); + auto *privateKey = evp_rsa_gen(keyLength); if (!privateKey) { throw std::runtime_error("failed to generate a " + std::to_string(keyLength) + "bit key for certificate"); }