mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-31 00:03:08 +03:00
build: unify source lists
- introduce `src/crypto.c` as an umbrella source that does nothing else than include the selected crypto backend source. Moving this job from the built-tool to the C preprocessor. - this allows dropping the various techniques to pick the correct crypto backend sources in autotools, CMake and other build method. Including the per-backend `Makefile.<crypto-backend>.inc` makefiles. - copy a trick from curl and instead of maintaining duplicate source lists for CMake, convert the GNU Makefile kept for autotools automatically. Do this in `docs`, `examples` and `src`. Ref:dfabe8bca2/CMakeLists.txt (L1399-L1413)
Also fixes missing `libssh2_setup.h` from `src/CMakeFiles.txt` after59666e03f0
. - move `Makefile.inc` from root to `src`. - reformat `src/Makefile.inc` to list each source in separate lines, re-align the continuation character and sort the lists alphabetically. - update `docs/HACKING-CRYPTO` accordingly. - autotools: update the way we add crypto-backends to `LIBS`. - delete old CSV headers, indent, and merge two lines in `docs/Makefile.am` and `src/Makefile.am`. - add `libssh2.pc` to `.gitignore`, while there. Closes #941
This commit is contained in:
@ -212,7 +212,6 @@ if(CRYPTO_BACKEND STREQUAL "OpenSSL" OR NOT CRYPTO_BACKEND)
|
|||||||
|
|
||||||
if(OPENSSL_FOUND)
|
if(OPENSSL_FOUND)
|
||||||
set(CRYPTO_BACKEND "OpenSSL")
|
set(CRYPTO_BACKEND "OpenSSL")
|
||||||
set(CRYPTO_SOURCES openssl.c openssl.h)
|
|
||||||
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_OPENSSL")
|
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_OPENSSL")
|
||||||
set(CRYPTO_BACKEND_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
|
set(CRYPTO_BACKEND_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
|
||||||
list(APPEND LIBRARIES ${OPENSSL_LIBRARIES})
|
list(APPEND LIBRARIES ${OPENSSL_LIBRARIES})
|
||||||
@ -274,7 +273,6 @@ if(CRYPTO_BACKEND STREQUAL "wolfSSL" OR NOT CRYPTO_BACKEND)
|
|||||||
|
|
||||||
if(WOLFSSL_FOUND)
|
if(WOLFSSL_FOUND)
|
||||||
set(CRYPTO_BACKEND "wolfSSL")
|
set(CRYPTO_BACKEND "wolfSSL")
|
||||||
set(CRYPTO_SOURCES openssl.c openssl.h)
|
|
||||||
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WOLFSSL")
|
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WOLFSSL")
|
||||||
set(CRYPTO_BACKEND_INCLUDE_DIR ${WOLFSSL_INCLUDE_DIR} ${WOLFSSL_INCLUDE_DIR}/wolfssl)
|
set(CRYPTO_BACKEND_INCLUDE_DIR ${WOLFSSL_INCLUDE_DIR} ${WOLFSSL_INCLUDE_DIR}/wolfssl)
|
||||||
list(APPEND LIBRARIES ${WOLFSSL_LIBRARIES})
|
list(APPEND LIBRARIES ${WOLFSSL_LIBRARIES})
|
||||||
@ -302,7 +300,6 @@ if(CRYPTO_BACKEND STREQUAL "Libgcrypt" OR NOT CRYPTO_BACKEND)
|
|||||||
|
|
||||||
if(LIBGCRYPT_FOUND)
|
if(LIBGCRYPT_FOUND)
|
||||||
set(CRYPTO_BACKEND "Libgcrypt")
|
set(CRYPTO_BACKEND "Libgcrypt")
|
||||||
set(CRYPTO_SOURCES libgcrypt.c libgcrypt.h)
|
|
||||||
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_LIBGCRYPT")
|
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_LIBGCRYPT")
|
||||||
set(CRYPTO_BACKEND_INCLUDE_DIR ${LIBGCRYPT_INCLUDE_DIRS})
|
set(CRYPTO_BACKEND_INCLUDE_DIR ${LIBGCRYPT_INCLUDE_DIRS})
|
||||||
list(APPEND LIBRARIES ${LIBGCRYPT_LIBRARIES})
|
list(APPEND LIBRARIES ${LIBGCRYPT_LIBRARIES})
|
||||||
@ -316,7 +313,6 @@ if(CRYPTO_BACKEND STREQUAL "mbedTLS" OR NOT CRYPTO_BACKEND)
|
|||||||
|
|
||||||
if(MBEDTLS_FOUND)
|
if(MBEDTLS_FOUND)
|
||||||
set(CRYPTO_BACKEND "mbedTLS")
|
set(CRYPTO_BACKEND "mbedTLS")
|
||||||
set(CRYPTO_SOURCES mbedtls.c mbedtls.h)
|
|
||||||
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_MBEDTLS")
|
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_MBEDTLS")
|
||||||
set(CRYPTO_BACKEND_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR})
|
set(CRYPTO_BACKEND_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR})
|
||||||
list(APPEND LIBRARIES ${MBEDTLS_LIBRARIES})
|
list(APPEND LIBRARIES ${MBEDTLS_LIBRARIES})
|
||||||
@ -335,7 +331,6 @@ if(CRYPTO_BACKEND STREQUAL "WinCNG" OR NOT CRYPTO_BACKEND)
|
|||||||
|
|
||||||
if(HAVE_BCRYPT_H)
|
if(HAVE_BCRYPT_H)
|
||||||
set(CRYPTO_BACKEND "WinCNG")
|
set(CRYPTO_BACKEND "WinCNG")
|
||||||
set(CRYPTO_SOURCES wincng.c wincng.h)
|
|
||||||
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WINCNG")
|
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WINCNG")
|
||||||
set(CRYPTO_BACKEND_INCLUDE_DIR "")
|
set(CRYPTO_BACKEND_INCLUDE_DIR "")
|
||||||
|
|
||||||
@ -346,6 +341,19 @@ if(CRYPTO_BACKEND STREQUAL "WinCNG" OR NOT CRYPTO_BACKEND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Global functions
|
||||||
|
|
||||||
|
# Convert GNU Make assignments into CMake ones.
|
||||||
|
function(transform_makefile_inc INPUT_FILE OUTPUT_FILE)
|
||||||
|
file(READ ${INPUT_FILE} MAKEFILE_INC_CMAKE)
|
||||||
|
|
||||||
|
string(REGEX REPLACE "\\\\\n" "" MAKEFILE_INC_CMAKE ${MAKEFILE_INC_CMAKE})
|
||||||
|
string(REGEX REPLACE "([A-Za-z_]+) *= *([^\n]*)" "set(\\1 \\2)" MAKEFILE_INC_CMAKE ${MAKEFILE_INC_CMAKE})
|
||||||
|
|
||||||
|
file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_CMAKE})
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${INPUT_FILE}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
CRYPTO_CSOURCES = openssl.c
|
|
||||||
CRYPTO_HHEADERS = openssl.h
|
|
||||||
CRYPTO_LTLIBS = $(LTLIBSSL)
|
|
@ -1,3 +0,0 @@
|
|||||||
CRYPTO_CSOURCES = wincng.c
|
|
||||||
CRYPTO_HHEADERS = wincng.h
|
|
||||||
CRYPTO_LTLIBS = $(LTLIBBCRYPT)
|
|
@ -33,8 +33,7 @@ OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
|
|||||||
os400/libssh2rpg/libssh2.rpgle.in \
|
os400/libssh2rpg/libssh2.rpgle.in \
|
||||||
os400/libssh2rpg/libssh2_ccsid.rpgle.in \
|
os400/libssh2rpg/libssh2_ccsid.rpgle.in \
|
||||||
os400/libssh2rpg/libssh2_publickey.rpgle \
|
os400/libssh2rpg/libssh2_publickey.rpgle \
|
||||||
os400/libssh2rpg/libssh2_sftp.rpgle \
|
os400/libssh2rpg/libssh2_sftp.rpgle
|
||||||
Makefile.os400qc3.inc
|
|
||||||
|
|
||||||
EXTRA_DIST = $(WIN32FILES) get_ver.awk \
|
EXTRA_DIST = $(WIN32FILES) get_ver.awk \
|
||||||
maketgz RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \
|
maketgz RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \
|
|
||||||
packet.c publickey.c scp.c session.c sftp.c userauth.c transport.c \
|
|
||||||
userauth_kbd_packet.c \
|
|
||||||
version.c knownhost.c agent.c $(CRYPTO_CSOURCES) pem.c keepalive.c global.c \
|
|
||||||
bcrypt_pbkdf.c agent_win.c os400qc3.c
|
|
||||||
|
|
||||||
HHEADERS = libssh2_priv.h libssh2_setup.h $(CRYPTO_HHEADERS) transport.h \
|
|
||||||
channel.h comp.h mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h \
|
|
||||||
agent.h userauth_kbd_packet.h os400qc3.h
|
|
@ -1,3 +0,0 @@
|
|||||||
CRYPTO_CSOURCES = libgcrypt.c
|
|
||||||
CRYPTO_HHEADERS = libgcrypt.h
|
|
||||||
CRYPTO_LTLIBS = $(LTLIBGCRYPT)
|
|
@ -1,3 +0,0 @@
|
|||||||
CRYPTO_CSOURCES = mbedtls.c
|
|
||||||
CRYPTO_HHEADERS = mbedtls.h
|
|
||||||
CRYPTO_LTLIBS = $(LTLIBMBEDCRYPTO)
|
|
@ -105,29 +105,24 @@ ifdef OPENSSL_PATH
|
|||||||
_LDFLAGS += -L"$(OPENSSL_LIBPATH)"
|
_LDFLAGS += -L"$(OPENSSL_LIBPATH)"
|
||||||
OPENSSL_LIBS ?= -lssl -lcrypto
|
OPENSSL_LIBS ?= -lssl -lcrypto
|
||||||
_LIBS += $(OPENSSL_LIBS)
|
_LIBS += $(OPENSSL_LIBS)
|
||||||
include Makefile.OpenSSL.inc
|
|
||||||
else ifdef WOLFSSL_PATH
|
else ifdef WOLFSSL_PATH
|
||||||
CPPFLAGS += -DLIBSSH2_WOLFSSL
|
CPPFLAGS += -DLIBSSH2_WOLFSSL
|
||||||
CPPFLAGS += -I"$(WOLFSSL_PATH)/include"
|
CPPFLAGS += -I"$(WOLFSSL_PATH)/include"
|
||||||
CPPFLAGS += -I"$(WOLFSSL_PATH)/include/wolfssl"
|
CPPFLAGS += -I"$(WOLFSSL_PATH)/include/wolfssl"
|
||||||
_LDFLAGS += -L"$(WOLFSSL_PATH)/lib"
|
_LDFLAGS += -L"$(WOLFSSL_PATH)/lib"
|
||||||
_LIBS += -lwolfssl
|
_LIBS += -lwolfssl
|
||||||
include Makefile.wolfSSL.inc
|
|
||||||
else ifdef LIBGCRYPT_PATH
|
else ifdef LIBGCRYPT_PATH
|
||||||
CPPFLAGS += -DLIBSSH2_LIBGCRYPT
|
CPPFLAGS += -DLIBSSH2_LIBGCRYPT
|
||||||
CPPFLAGS += -I"$(LIBGCRYPT_PATH)/include"
|
CPPFLAGS += -I"$(LIBGCRYPT_PATH)/include"
|
||||||
_LDFLAGS += -L"$(LIBGCRYPT_PATH)/lib"
|
_LDFLAGS += -L"$(LIBGCRYPT_PATH)/lib"
|
||||||
_LIBS += -lgcrypt
|
_LIBS += -lgcrypt
|
||||||
include Makefile.libgcrypt.inc
|
|
||||||
else ifdef MBEDTLS_PATH
|
else ifdef MBEDTLS_PATH
|
||||||
CPPFLAGS += -DLIBSSH2_MBEDTLS
|
CPPFLAGS += -DLIBSSH2_MBEDTLS
|
||||||
CPPFLAGS += -I"$(MBEDTLS_PATH)/include"
|
CPPFLAGS += -I"$(MBEDTLS_PATH)/include"
|
||||||
_LDFLAGS += -L"$(MBEDTLS_PATH)/lib"
|
_LDFLAGS += -L"$(MBEDTLS_PATH)/lib"
|
||||||
_LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
|
_LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
|
||||||
include Makefile.mbedTLS.inc
|
|
||||||
else ifdef WIN32
|
else ifdef WIN32
|
||||||
CPPFLAGS += -DLIBSSH2_WINCNG
|
CPPFLAGS += -DLIBSSH2_WINCNG
|
||||||
include Makefile.WinCNG.inc
|
|
||||||
else
|
else
|
||||||
$(error No suitable cryptography backend found)
|
$(error No suitable cryptography backend found)
|
||||||
endif
|
endif
|
||||||
@ -177,8 +172,8 @@ ifdef WIN32
|
|||||||
vpath %.rc src
|
vpath %.rc src
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# include Makefile.inc to get CSOURCES define
|
# Get CSOURCES define
|
||||||
include Makefile.inc
|
include src/Makefile.inc
|
||||||
|
|
||||||
OBJS := $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(CSOURCES)))
|
OBJS := $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(CSOURCES)))
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
CRYPTO_CSOURCES = os400qc3.c
|
|
||||||
CRYPTO_HHEADERS = os400qc3.h
|
|
@ -1,3 +0,0 @@
|
|||||||
CRYPTO_CSOURCES = openssl.c
|
|
||||||
CRYPTO_HHEADERS = openssl.h
|
|
||||||
CRYPTO_LTLIBS = -lwolfssl
|
|
@ -16,11 +16,9 @@ CFLAGS=/nologo /GL /Zi /EHsc $(CFLAGS) /Iinclude
|
|||||||
!if "$(OPENSSL_PATH)" != ""
|
!if "$(OPENSSL_PATH)" != ""
|
||||||
CFLAGS=$(CFLAGS) /DLIBSSH2_OPENSSL /I$(OPENSSL_PATH)\include
|
CFLAGS=$(CFLAGS) /DLIBSSH2_OPENSSL /I$(OPENSSL_PATH)\include
|
||||||
LIBS=$(LIBS) $(OPENSSL_PATH)\lib\crypto.lib $(OPENSSL_PATH)\lib\ssl.lib
|
LIBS=$(LIBS) $(OPENSSL_PATH)\lib\crypto.lib $(OPENSSL_PATH)\lib\ssl.lib
|
||||||
!include "Makefile.OpenSSL.inc"
|
|
||||||
!else
|
!else
|
||||||
CFLAGS=$(CFLAGS) /DLIBSSH2_WINCNG
|
CFLAGS=$(CFLAGS) /DLIBSSH2_WINCNG
|
||||||
LIBS=crypt32.lib bcrypt.lib
|
LIBS=crypt32.lib bcrypt.lib
|
||||||
!include "Makefile.WinCNG.inc"
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!if "$(ZLIB_PATH)" != ""
|
!if "$(ZLIB_PATH)" != ""
|
||||||
@ -34,7 +32,7 @@ INTDIR=$(TARGET)
|
|||||||
|
|
||||||
SUBDIR=src
|
SUBDIR=src
|
||||||
|
|
||||||
!include "Makefile.inc"
|
!include "src/Makefile.inc"
|
||||||
|
|
||||||
OBJECTS=$(CSOURCES:.c=.obj)
|
OBJECTS=$(CSOURCES:.c=.obj)
|
||||||
|
|
||||||
|
14
configure.ac
14
configure.ac
@ -120,9 +120,17 @@ else
|
|||||||
test "$found_crypto_str" = "" && found_crypto_str="$found_crypto"
|
test "$found_crypto_str" = "" && found_crypto_str="$found_crypto"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
m4_set_foreach([crypto_backends], [backend],
|
if test "$found_crypto" = "openssl"; then
|
||||||
[AM_CONDITIONAL(m4_toupper(backend), test "$found_crypto" = "backend")]
|
LIBS="${LIBS} ${LTLIBSSL}"
|
||||||
)
|
elif test "$found_crypto" = "wolfssl"; then
|
||||||
|
LIBS="${LIBS} ${LTLIBWOLFSSL}"
|
||||||
|
elif test "$found_crypto" = "libgcrypt"; then
|
||||||
|
LIBS="${LIBS} ${LTLIBGCRYPT}"
|
||||||
|
elif test "$found_crypto" = "wincng"; then
|
||||||
|
LIBS="${LIBS} ${LTLIBBCRYPT}"
|
||||||
|
elif test "$found_crypto" = "mbedtls"; then
|
||||||
|
LIBS="${LIBS} ${LTLIBMBEDCRYPTO}"
|
||||||
|
fi
|
||||||
|
|
||||||
# libz
|
# libz
|
||||||
|
|
||||||
|
1
docs/.gitignore
vendored
1
docs/.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
Makefile.am.cmake
|
||||||
coverage
|
coverage
|
||||||
|
@ -33,185 +33,9 @@
|
|||||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
# OF SUCH DAMAGE.
|
# OF SUCH DAMAGE.
|
||||||
|
|
||||||
set(MAN_PAGES
|
transform_makefile_inc("Makefile.am" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake")
|
||||||
libssh2_agent_connect.3
|
# Get 'dist_man_MANS' variable
|
||||||
libssh2_agent_disconnect.3
|
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake)
|
||||||
libssh2_agent_free.3
|
|
||||||
libssh2_agent_get_identity.3
|
|
||||||
libssh2_agent_get_identity_path.3
|
|
||||||
libssh2_agent_init.3
|
|
||||||
libssh2_agent_list_identities.3
|
|
||||||
libssh2_agent_set_identity_path.3
|
|
||||||
libssh2_agent_userauth.3
|
|
||||||
libssh2_banner_set.3
|
|
||||||
libssh2_base64_decode.3
|
|
||||||
libssh2_channel_close.3
|
|
||||||
libssh2_channel_direct_tcpip.3
|
|
||||||
libssh2_channel_direct_tcpip_ex.3
|
|
||||||
libssh2_channel_eof.3
|
|
||||||
libssh2_channel_exec.3
|
|
||||||
libssh2_channel_flush.3
|
|
||||||
libssh2_channel_flush_ex.3
|
|
||||||
libssh2_channel_flush_stderr.3
|
|
||||||
libssh2_channel_forward_accept.3
|
|
||||||
libssh2_channel_forward_cancel.3
|
|
||||||
libssh2_channel_forward_listen.3
|
|
||||||
libssh2_channel_forward_listen_ex.3
|
|
||||||
libssh2_channel_free.3
|
|
||||||
libssh2_channel_get_exit_signal.3
|
|
||||||
libssh2_channel_get_exit_status.3
|
|
||||||
libssh2_channel_handle_extended_data.3
|
|
||||||
libssh2_channel_handle_extended_data2.3
|
|
||||||
libssh2_channel_ignore_extended_data.3
|
|
||||||
libssh2_channel_open_ex.3
|
|
||||||
libssh2_channel_open_session.3
|
|
||||||
libssh2_channel_process_startup.3
|
|
||||||
libssh2_channel_read.3
|
|
||||||
libssh2_channel_read_ex.3
|
|
||||||
libssh2_channel_read_stderr.3
|
|
||||||
libssh2_channel_receive_window_adjust.3
|
|
||||||
libssh2_channel_receive_window_adjust2.3
|
|
||||||
libssh2_channel_request_auth_agent.3
|
|
||||||
libssh2_channel_request_pty.3
|
|
||||||
libssh2_channel_request_pty_ex.3
|
|
||||||
libssh2_channel_request_pty_size.3
|
|
||||||
libssh2_channel_request_pty_size_ex.3
|
|
||||||
libssh2_channel_send_eof.3
|
|
||||||
libssh2_channel_set_blocking.3
|
|
||||||
libssh2_channel_setenv.3
|
|
||||||
libssh2_channel_setenv_ex.3
|
|
||||||
libssh2_channel_shell.3
|
|
||||||
libssh2_channel_subsystem.3
|
|
||||||
libssh2_channel_wait_closed.3
|
|
||||||
libssh2_channel_wait_eof.3
|
|
||||||
libssh2_channel_window_read.3
|
|
||||||
libssh2_channel_window_read_ex.3
|
|
||||||
libssh2_channel_window_write.3
|
|
||||||
libssh2_channel_window_write_ex.3
|
|
||||||
libssh2_channel_write.3
|
|
||||||
libssh2_channel_write_ex.3
|
|
||||||
libssh2_channel_write_stderr.3
|
|
||||||
libssh2_channel_x11_req.3
|
|
||||||
libssh2_channel_x11_req_ex.3
|
|
||||||
libssh2_crypto_engine.3
|
|
||||||
libssh2_exit.3
|
|
||||||
libssh2_free.3
|
|
||||||
libssh2_hostkey_hash.3
|
|
||||||
libssh2_init.3
|
|
||||||
libssh2_keepalive_config.3
|
|
||||||
libssh2_keepalive_send.3
|
|
||||||
libssh2_knownhost_add.3
|
|
||||||
libssh2_knownhost_addc.3
|
|
||||||
libssh2_knownhost_check.3
|
|
||||||
libssh2_knownhost_checkp.3
|
|
||||||
libssh2_knownhost_del.3
|
|
||||||
libssh2_knownhost_free.3
|
|
||||||
libssh2_knownhost_get.3
|
|
||||||
libssh2_knownhost_init.3
|
|
||||||
libssh2_knownhost_readfile.3
|
|
||||||
libssh2_knownhost_readline.3
|
|
||||||
libssh2_knownhost_writefile.3
|
|
||||||
libssh2_knownhost_writeline.3
|
|
||||||
libssh2_poll.3
|
|
||||||
libssh2_poll_channel_read.3
|
|
||||||
libssh2_publickey_add.3
|
|
||||||
libssh2_publickey_add_ex.3
|
|
||||||
libssh2_publickey_init.3
|
|
||||||
libssh2_publickey_list_fetch.3
|
|
||||||
libssh2_publickey_list_free.3
|
|
||||||
libssh2_publickey_remove.3
|
|
||||||
libssh2_publickey_remove_ex.3
|
|
||||||
libssh2_publickey_shutdown.3
|
|
||||||
libssh2_scp_recv.3
|
|
||||||
libssh2_scp_recv2.3
|
|
||||||
libssh2_scp_send.3
|
|
||||||
libssh2_scp_send64.3
|
|
||||||
libssh2_scp_send_ex.3
|
|
||||||
libssh2_session_abstract.3
|
|
||||||
libssh2_session_banner_get.3
|
|
||||||
libssh2_session_banner_set.3
|
|
||||||
libssh2_session_block_directions.3
|
|
||||||
libssh2_session_callback_set.3
|
|
||||||
libssh2_session_disconnect.3
|
|
||||||
libssh2_session_disconnect_ex.3
|
|
||||||
libssh2_session_flag.3
|
|
||||||
libssh2_session_free.3
|
|
||||||
libssh2_session_get_blocking.3
|
|
||||||
libssh2_session_get_read_timeout.3
|
|
||||||
libssh2_session_get_timeout.3
|
|
||||||
libssh2_session_handshake.3
|
|
||||||
libssh2_session_hostkey.3
|
|
||||||
libssh2_session_init.3
|
|
||||||
libssh2_session_init_ex.3
|
|
||||||
libssh2_session_last_errno.3
|
|
||||||
libssh2_session_last_error.3
|
|
||||||
libssh2_session_method_pref.3
|
|
||||||
libssh2_session_methods.3
|
|
||||||
libssh2_session_set_blocking.3
|
|
||||||
libssh2_session_set_last_error.3
|
|
||||||
libssh2_session_set_read_timeout.3
|
|
||||||
libssh2_session_set_timeout.3
|
|
||||||
libssh2_session_startup.3
|
|
||||||
libssh2_session_supported_algs.3
|
|
||||||
libssh2_sftp_close.3
|
|
||||||
libssh2_sftp_close_handle.3
|
|
||||||
libssh2_sftp_closedir.3
|
|
||||||
libssh2_sftp_fsetstat.3
|
|
||||||
libssh2_sftp_fstat.3
|
|
||||||
libssh2_sftp_fstat_ex.3
|
|
||||||
libssh2_sftp_fstatvfs.3
|
|
||||||
libssh2_sftp_fsync.3
|
|
||||||
libssh2_sftp_get_channel.3
|
|
||||||
libssh2_sftp_init.3
|
|
||||||
libssh2_sftp_last_error.3
|
|
||||||
libssh2_sftp_lstat.3
|
|
||||||
libssh2_sftp_mkdir.3
|
|
||||||
libssh2_sftp_mkdir_ex.3
|
|
||||||
libssh2_sftp_open.3
|
|
||||||
libssh2_sftp_open_ex.3
|
|
||||||
libssh2_sftp_opendir.3
|
|
||||||
libssh2_sftp_read.3
|
|
||||||
libssh2_sftp_readdir.3
|
|
||||||
libssh2_sftp_readdir_ex.3
|
|
||||||
libssh2_sftp_readlink.3
|
|
||||||
libssh2_sftp_realpath.3
|
|
||||||
libssh2_sftp_rename.3
|
|
||||||
libssh2_sftp_rename_ex.3
|
|
||||||
libssh2_sftp_rewind.3
|
|
||||||
libssh2_sftp_rmdir.3
|
|
||||||
libssh2_sftp_rmdir_ex.3
|
|
||||||
libssh2_sftp_seek.3
|
|
||||||
libssh2_sftp_seek64.3
|
|
||||||
libssh2_sftp_setstat.3
|
|
||||||
libssh2_sftp_shutdown.3
|
|
||||||
libssh2_sftp_stat.3
|
|
||||||
libssh2_sftp_stat_ex.3
|
|
||||||
libssh2_sftp_statvfs.3
|
|
||||||
libssh2_sftp_symlink.3
|
|
||||||
libssh2_sftp_symlink_ex.3
|
|
||||||
libssh2_sftp_tell.3
|
|
||||||
libssh2_sftp_tell64.3
|
|
||||||
libssh2_sftp_unlink.3
|
|
||||||
libssh2_sftp_unlink_ex.3
|
|
||||||
libssh2_sftp_write.3
|
|
||||||
libssh2_sign_sk.3
|
|
||||||
libssh2_trace.3
|
|
||||||
libssh2_trace_sethandler.3
|
|
||||||
libssh2_userauth_authenticated.3
|
|
||||||
libssh2_userauth_banner.3
|
|
||||||
libssh2_userauth_hostbased_fromfile.3
|
|
||||||
libssh2_userauth_hostbased_fromfile_ex.3
|
|
||||||
libssh2_userauth_keyboard_interactive.3
|
|
||||||
libssh2_userauth_keyboard_interactive_ex.3
|
|
||||||
libssh2_userauth_list.3
|
|
||||||
libssh2_userauth_password.3
|
|
||||||
libssh2_userauth_password_ex.3
|
|
||||||
libssh2_userauth_publickey.3
|
|
||||||
libssh2_userauth_publickey_fromfile.3
|
|
||||||
libssh2_userauth_publickey_fromfile_ex.3
|
|
||||||
libssh2_userauth_publickey_frommemory.3
|
|
||||||
libssh2_userauth_publickey_sk.3
|
|
||||||
libssh2_version.3)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(FILES ${MAN_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
|
install(FILES ${dist_man_MANS} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
|
||||||
|
@ -31,18 +31,20 @@ LIBSSH2_LIB_HAVE_LINKFLAGS from LIBSSH2_CRYPTO_CHECK, which automatically
|
|||||||
creates and handles a --with-$newname-prefix option and sets an
|
creates and handles a --with-$newname-prefix option and sets an
|
||||||
LTLIBNEWNAME variable on success.
|
LTLIBNEWNAME variable on success.
|
||||||
|
|
||||||
0.3) Create Makefile.newname.inc in the top-level directory
|
0.3) Add new header to src/Makefile.inc
|
||||||
|
|
||||||
This must set CRYPTO_CSOURCES, CRYPTO_HHEADERS and CRYPTO_LTLIBS.
|
0.4) Include new source in src/crypto.c
|
||||||
Set CRYPTO_CSOURCES and CRYPTO_HHEADERS to the new backend source files
|
|
||||||
and set CRYPTO_LTLIBS to the required library linking parameters, e.g.
|
|
||||||
$(LTLIBNEWNAME) as generated by by LIBSSH2_LIB_HAVE_LINKFLAGS.
|
|
||||||
|
|
||||||
0.4) Add a new block in src/Makefile.am
|
0.5) Add a new block in configure.ac
|
||||||
|
|
||||||
if NEWNAME
|
```
|
||||||
include ../Makefile.newname.inc
|
elif test "$found_crypto" = "newname"; then
|
||||||
endif
|
LIBS="${LIBS} ${LTLIBNEWNAME}"
|
||||||
|
```
|
||||||
|
|
||||||
|
0.6) Add CMake detection logic to CMakeLists.txt
|
||||||
|
|
||||||
|
0.7) Add manual config logic to Makefile.mk
|
||||||
|
|
||||||
|
|
||||||
1) Crypto library initialization/termination.
|
1) Crypto library initialization/termination.
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
|
|
||||||
|
|
||||||
EXTRA_DIST = template.3 BINDINGS INSTALL_AUTOTOOLS INSTALL_CMAKE.md HACKING TODO \
|
EXTRA_DIST = template.3 BINDINGS INSTALL_AUTOTOOLS INSTALL_CMAKE.md HACKING TODO \
|
||||||
AUTHORS CMakeLists.txt HACKING-CRYPTO SECURITY.md
|
AUTHORS CMakeLists.txt HACKING-CRYPTO SECURITY.md
|
||||||
|
|
||||||
dist_man_MANS = \
|
dist_man_MANS = \
|
||||||
libssh2_agent_connect.3 \
|
libssh2_agent_connect.3 \
|
||||||
|
1
example/.gitignore
vendored
1
example/.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
.libs
|
.libs
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
Makefile.am.cmake
|
||||||
*.gcno
|
*.gcno
|
||||||
*.gcda
|
*.gcda
|
||||||
stamp-h2
|
stamp-h2
|
||||||
|
@ -39,31 +39,10 @@ list(APPEND LIBRARIES ${SOCKET_LIBRARIES})
|
|||||||
|
|
||||||
add_definitions(-DHAVE_CONFIG_H)
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
set(EXAMPLES
|
transform_makefile_inc("Makefile.am" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake")
|
||||||
direct_tcpip
|
# Get 'noinst_PROGRAMS' variable
|
||||||
scp
|
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake)
|
||||||
scp_nonblock
|
set(EXAMPLES ${noinst_PROGRAMS})
|
||||||
scp_write
|
|
||||||
scp_write_nonblock
|
|
||||||
sftp
|
|
||||||
sftp_RW_nonblock
|
|
||||||
sftp_append
|
|
||||||
sftp_mkdir
|
|
||||||
sftp_mkdir_nonblock
|
|
||||||
sftp_nonblock
|
|
||||||
sftp_write
|
|
||||||
sftp_write_nonblock
|
|
||||||
sftp_write_sliding
|
|
||||||
sftpdir
|
|
||||||
sftpdir_nonblock
|
|
||||||
ssh2
|
|
||||||
ssh2_agent
|
|
||||||
ssh2_agent_forwarding
|
|
||||||
ssh2_echo
|
|
||||||
ssh2_exec
|
|
||||||
subsystem_netconf
|
|
||||||
tcpip-forward
|
|
||||||
x11)
|
|
||||||
|
|
||||||
foreach(example ${EXAMPLES})
|
foreach(example ${EXAMPLES})
|
||||||
add_executable(example-${example} ${example}.c)
|
add_executable(example-${example} ${example}.c)
|
||||||
|
@ -78,7 +78,7 @@ fi
|
|||||||
|
|
||||||
# Get source list.
|
# Get source list.
|
||||||
|
|
||||||
cat ../Makefile.inc ../Makefile.os400qc3.inc |
|
cat Makefile.inc |
|
||||||
sed -e ':begin' \
|
sed -e ':begin' \
|
||||||
-e '/\\$/{' \
|
-e '/\\$/{' \
|
||||||
-e 's/\\$/ /' \
|
-e 's/\\$/ /' \
|
||||||
@ -98,7 +98,7 @@ cat ../Makefile.inc ../Makefile.os400qc3.inc |
|
|||||||
INCLUDES="'`pwd`'"
|
INCLUDES="'`pwd`'"
|
||||||
|
|
||||||
for SRC in "${TOPDIR}/os400/os400sys.c" "${TOPDIR}/os400/ccsid.c" \
|
for SRC in "${TOPDIR}/os400/os400sys.c" "${TOPDIR}/os400/ccsid.c" \
|
||||||
${CSOURCES} ${CRYPTO_CSOURCES} macros.c
|
${CSOURCES} macros.c
|
||||||
do MODULE=`db2_name "${SRC}"`
|
do MODULE=`db2_name "${SRC}"`
|
||||||
make_module "${MODULE}" "${SRC}"
|
make_module "${MODULE}" "${SRC}"
|
||||||
done
|
done
|
||||||
|
2
src/.gitignore
vendored
2
src/.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
.deps
|
.deps
|
||||||
.libs
|
.libs
|
||||||
|
Makefile.inc.cmake
|
||||||
|
libssh2.pc
|
||||||
libssh2_config.h
|
libssh2_config.h
|
||||||
libssh2_config.h.in
|
libssh2_config.h.in
|
||||||
stamp-h1
|
stamp-h1
|
||||||
|
@ -96,47 +96,15 @@ if(MSVC)
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG")
|
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Library definition
|
## Sources
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
set(SOURCES
|
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||||
${CRYPTO_SOURCES}
|
# Get 'CSOURCES' and 'HHEADERS' variables
|
||||||
agent.c
|
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||||
agent_win.c
|
set(SOURCES ${CSOURCES} ${HHEADERS})
|
||||||
bcrypt_pbkdf.c
|
|
||||||
channel.c
|
## Library definition
|
||||||
channel.h
|
|
||||||
comp.c
|
|
||||||
comp.h
|
|
||||||
crypt.c
|
|
||||||
crypto.h
|
|
||||||
global.c
|
|
||||||
hostkey.c
|
|
||||||
keepalive.c
|
|
||||||
kex.c
|
|
||||||
knownhost.c
|
|
||||||
libssh2_priv.h
|
|
||||||
mac.c
|
|
||||||
mac.h
|
|
||||||
misc.c
|
|
||||||
misc.h
|
|
||||||
os400qc3.c
|
|
||||||
packet.c
|
|
||||||
packet.h
|
|
||||||
pem.c
|
|
||||||
publickey.c
|
|
||||||
scp.c
|
|
||||||
session.c
|
|
||||||
session.h
|
|
||||||
sftp.c
|
|
||||||
sftp.h
|
|
||||||
transport.c
|
|
||||||
transport.h
|
|
||||||
userauth_kbd_packet.c
|
|
||||||
userauth_kbd_packet.h
|
|
||||||
userauth.c
|
|
||||||
userauth.h
|
|
||||||
version.c)
|
|
||||||
|
|
||||||
# we want it to be called libssh2 on all platforms
|
# we want it to be called libssh2 on all platforms
|
||||||
if(BUILD_STATIC_LIBS)
|
if(BUILD_STATIC_LIBS)
|
||||||
|
@ -1,30 +1,11 @@
|
|||||||
# $Id: Makefile.am,v 1.21 2009/05/07 17:21:56 bagder Exp $
|
|
||||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||||
|
|
||||||
# Get the CRYPTO_CSOURCES, CRYPTO_HHEADERS and CRYPTO_LTLIBS defines
|
# Get the CSOURCES and HHEADERS defines
|
||||||
if OPENSSL
|
include Makefile.inc
|
||||||
include ../Makefile.OpenSSL.inc
|
|
||||||
endif
|
|
||||||
if WOLFSSL
|
|
||||||
include ../Makefile.wolfSSL.inc
|
|
||||||
endif
|
|
||||||
if LIBGCRYPT
|
|
||||||
include ../Makefile.libgcrypt.inc
|
|
||||||
endif
|
|
||||||
if WINCNG
|
|
||||||
include ../Makefile.WinCNG.inc
|
|
||||||
endif
|
|
||||||
if MBEDTLS
|
|
||||||
include ../Makefile.mbedTLS.inc
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
|
||||||
include ../Makefile.inc
|
|
||||||
|
|
||||||
libssh2_la_SOURCES = $(CSOURCES) $(HHEADERS)
|
libssh2_la_SOURCES = $(CSOURCES) $(HHEADERS)
|
||||||
|
|
||||||
EXTRA_DIST = libssh2_config.h.in libssh2_config_cmake.h.in
|
EXTRA_DIST = libssh2_config.h.in libssh2_config_cmake.h.in CMakeLists.txt
|
||||||
EXTRA_DIST += CMakeLists.txt
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libssh2.la
|
lib_LTLIBRARIES = libssh2.la
|
||||||
|
|
||||||
@ -65,4 +46,4 @@ VERSION=-version-info 1:1:0
|
|||||||
|
|
||||||
libssh2_la_LDFLAGS = $(VERSION) -no-undefined \
|
libssh2_la_LDFLAGS = $(VERSION) -no-undefined \
|
||||||
-export-symbols-regex '^libssh2_.*' \
|
-export-symbols-regex '^libssh2_.*' \
|
||||||
$(CRYPTO_LTLIBS) $(LTLIBZ)
|
$(LTLIBZ)
|
||||||
|
46
src/Makefile.inc
Normal file
46
src/Makefile.inc
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
CSOURCES = \
|
||||||
|
agent.c \
|
||||||
|
agent_win.c \
|
||||||
|
bcrypt_pbkdf.c \
|
||||||
|
channel.c \
|
||||||
|
comp.c \
|
||||||
|
crypt.c \
|
||||||
|
crypto.c \
|
||||||
|
global.c \
|
||||||
|
hostkey.c \
|
||||||
|
keepalive.c \
|
||||||
|
kex.c \
|
||||||
|
knownhost.c \
|
||||||
|
mac.c \
|
||||||
|
misc.c \
|
||||||
|
packet.c \
|
||||||
|
pem.c \
|
||||||
|
publickey.c \
|
||||||
|
scp.c \
|
||||||
|
session.c \
|
||||||
|
sftp.c \
|
||||||
|
transport.c \
|
||||||
|
userauth.c \
|
||||||
|
userauth_kbd_packet.c \
|
||||||
|
version.c
|
||||||
|
|
||||||
|
HHEADERS = \
|
||||||
|
agent.h \
|
||||||
|
channel.h \
|
||||||
|
comp.h \
|
||||||
|
crypto.h \
|
||||||
|
libgcrypt.h \
|
||||||
|
libssh2_priv.h \
|
||||||
|
libssh2_setup.h \
|
||||||
|
mac.h \
|
||||||
|
mbedtls.h \
|
||||||
|
misc.h \
|
||||||
|
openssl.h \
|
||||||
|
os400qc3.h \
|
||||||
|
packet.h \
|
||||||
|
session.h \
|
||||||
|
sftp.h \
|
||||||
|
transport.h \
|
||||||
|
userauth.h \
|
||||||
|
userauth_kbd_packet.h \
|
||||||
|
wincng.h
|
13
src/crypto.c
Normal file
13
src/crypto.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include "libssh2_priv.h"
|
||||||
|
|
||||||
|
#if defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL)
|
||||||
|
#include "openssl.c"
|
||||||
|
#elif defined(LIBSSH2_LIBGCRYPT)
|
||||||
|
#include "libgcrypt.c"
|
||||||
|
#elif defined(LIBSSH2_MBEDTLS)
|
||||||
|
#include "mbedtls.c"
|
||||||
|
#elif defined(LIBSSH2_OS400QC3)
|
||||||
|
#include "os400qc3.c"
|
||||||
|
#elif defined(LIBSSH2_WINCNG)
|
||||||
|
#include "wincng.c"
|
||||||
|
#endif
|
Reference in New Issue
Block a user