Enable with CMake option `-DCURL_USE_WOLFSSH=ON`. Customize with
`-DWOLFSSH_INCLUDE_DIR=<path-to-wolfssh>/include`,
`-DWOLFSSH_LIBRARY=<path-to-wolfssh>/lib/libwolfssh.a`.

It requires the wolfSSL TLS backend.

Closes #14568
This commit is contained in:
Viktor Szakats 2024-08-15 23:38:10 +02:00
Родитель 3ff147f8ba
Коммит 0d8fdd1c74
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5ABD165E2AEF201
4 изменённых файлов: 80 добавлений и 2 удалений

56
CMake/FindWolfSSH.cmake Normal file
Просмотреть файл

@ -0,0 +1,56 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
# Find the wolfssh library
#
# Result Variables:
#
# WOLFSSH_FOUND System has wolfssh
# WOLFSSH_INCLUDE_DIRS The wolfssh include directories
# WOLFSSH_LIBRARIES The wolfssh library names
# WOLFSSH_VERSION Version of wolfssh
find_path(WOLFSSH_INCLUDE_DIR "wolfssh/ssh.h")
find_library(WOLFSSH_LIBRARY NAMES "wolfssh" "libwolfssh")
if(WOLFSSH_INCLUDE_DIR)
file(STRINGS "${WOLFSSH_INCLUDE_DIR}/wolfssh/version.h" _wolfssh_version_str REGEX "#[\t ]*define[\t ]+LIBWOLFSSH_VERSION_STRING[\t ]+\"(.*)\"")
string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" WOLFSSH_VERSION "${_wolfssh_version_str}")
unset(_wolfssh_version_str)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WolfSSH
REQUIRED_VARS
WOLFSSH_INCLUDE_DIR
WOLFSSH_LIBRARY
VERSION_VAR
WOLFSSH_VERSION
)
if(WOLFSSH_FOUND)
set(WOLFSSH_INCLUDE_DIRS ${WOLFSSH_INCLUDE_DIR})
set(WOLFSSH_LIBRARIES ${WOLFSSH_LIBRARY})
endif()
mark_as_advanced(WOLFSSH_INCLUDE_DIR WOLFSSH_LIBRARY)

Просмотреть файл

@ -1097,6 +1097,24 @@ if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
endif()
endif()
# wolfSSH
option(CURL_USE_WOLFSSH "Use wolfssh" OFF)
mark_as_advanced(CURL_USE_WOLFSSH)
set(USE_WOLFSSH OFF)
if(NOT USE_LIBSSH2 AND NOT USE_LIBSSH AND CURL_USE_WOLFSSH)
if(USE_WOLFSSL)
find_package(WolfSSH)
if(WOLFSSH_FOUND)
list(APPEND CURL_LIBS ${WOLFSSH_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES "${WOLFSSH_INCLUDE_DIRS}")
include_directories(${WOLFSSH_INCLUDE_DIRS})
set(USE_WOLFSSH ON)
endif()
else()
message(WARNING "wolfSSH requires wolfSSL. Skipping.")
endif()
endif()
option(CURL_USE_GSASL "Use GSASL implementation" OFF)
mark_as_advanced(CURL_USE_GSASL)
if(CURL_USE_GSASL)
@ -1822,8 +1840,8 @@ if(NOT CURL_DISABLE_INSTALL)
_use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4))
_add_if("SMTP" NOT CURL_DISABLE_SMTP)
_add_if("SMTPS" NOT CURL_DISABLE_SMTP AND _ssl_enabled)
_add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH)
_add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH)
_add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH OR USE_WOLFSSH)
_add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH OR USE_WOLFSSH)
_add_if("RTSP" NOT CURL_DISABLE_RTSP)
_add_if("RTMP" USE_LIBRTMP)
_add_if("MQTT" NOT CURL_DISABLE_MQTT)

Просмотреть файл

@ -45,6 +45,7 @@ CMAKE_DIST = \
CMake/FindNGTCP2.cmake \
CMake/FindNettle.cmake \
CMake/FindQUICHE.cmake \
CMake/FindWolfSSH.cmake \
CMake/FindWolfSSL.cmake \
CMake/FindZstd.cmake \
CMake/Findrustls.cmake \

Просмотреть файл

@ -707,6 +707,9 @@ ${SIZEOF_TIME_T_CODE}
/* if libssh2 is in use */
#cmakedefine USE_LIBSSH2 1
/* if wolfssh is in use */
#cmakedefine USE_WOLFSSH 1
/* if libpsl is in use */
#cmakedefine USE_LIBPSL 1