mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
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>
This commit is contained in:
committed by
Andreas Schneider
parent
6a077fe750
commit
83b43443e5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user