aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-07-02 13:03:12 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-08-03 16:43:03 +0200
commit83b43443e51b5db06184750fb874e1e8d7ece95a (patch)
tree9c81acc146ee9d0d129ab953a38e2363574fa888 /src/CMakeLists.txt
parent6a077fe7509fb3141c0c63365a32208e42aa90f1 (diff)
downloadlibssh-83b43443e51b5db06184750fb874e1e8d7ece95a.tar.gz
libssh-83b43443e51b5db06184750fb874e1e8d7ece95a.tar.xz
libssh-83b43443e51b5db06184750fb874e1e8d7ece95a.zip
threads: Automatically call ssh_init on load
This makes unnecessary to call ssh_init() when the library is dynamically loaded. Also removes the threads shared library. The used threads implementation is chosen in configuration time, changing the ssh_threads_get_default() depending on the available threads library. Internally, it is expected a threads implementation providing: - void ssh_mutex_lock(void **mutex); - void ssh_mutex_unlock(void **mutex); - struct ssh_threads_callbacks_struct *ssh_threads_get_default(void); and a crypto implementation providing: - int crypto_thread_init(struct ssh_threads_callbacks_struct *user_callbacks); - void crypto_thread_finalize(void); This adds internal threads implementation for pthreads and noop. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 819d05c2..c37ce4d3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -167,9 +167,23 @@ set(libssh_SRCS
chachapoly.c
)
+if (CMAKE_USE_PTHREADS_INIT)
+ set(libssh_SRCS
+ ${libssh_SRCS}
+ threads/noop.c
+ threads/pthread.c
+ )
+else()
+ set(libssh_SRCS
+ ${libssh_SRCS}
+ threads/noop.c
+ )
+endif()
+
if (WITH_GCRYPT)
set(libssh_SRCS
${libssh_SRCS}
+ threads/libgcrypt.c
libgcrypt.c
gcrypt_missing.c
pki_gcrypt.c
@@ -178,6 +192,7 @@ if (WITH_GCRYPT)
elseif (WITH_MBEDTLS)
set(libssh_SRCS
${libssh_SRCS}
+ threads/mbedtls.c
libmbedcrypto.c
mbedcrypto_missing.c
pki_mbedcrypto.c
@@ -186,6 +201,7 @@ elseif (WITH_MBEDTLS)
else (WITH_GCRYPT)
set(libssh_SRCS
${libssh_SRCS}
+ threads/libcrypto.c
pki_crypto.c
ecdh_crypto.c
libcrypto.c
@@ -319,6 +335,3 @@ if (WITH_STATIC_LIB)
endif (WITH_STATIC_LIB)
message(STATUS "Threads_FOUND=${Threads_FOUND}")
-if (Threads_FOUND)
- add_subdirectory(threads)
-endif (Threads_FOUND)