session BUILD proper threading support for libssh < 0.8.0
@@ -1377,25 +1377,28 @@ nc_handshake_io(struct nc_session *session)
#ifdef NC_ENABLED_SSH
-#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
-
static void
nc_ssh_init(void)
{
+#if (LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 8, 0))
ssh_threads_set_callbacks(ssh_threads_get_pthread());
ssh_init();
+#endif
}
static void
nc_ssh_destroy(void)
{
+#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
FIPS_mode_set(0);
CONF_modules_unload(1);
nc_thread_destroy();
- ssh_finalize();
-}
+#endif
+#if (LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 8, 0))
+ ssh_finalize();
#endif
+}
#endif /* NC_ENABLED_SSH */
@@ -1535,9 +1538,11 @@ nc_ssh_tls_init(void)
SSL_load_error_strings();
ERR_load_BIO_strings();
SSL_library_init();
+#endif
nc_ssh_init();
+#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
CRYPTO_set_dynlock_create_callback(tls_dyn_create_func);
CRYPTO_set_dynlock_lock_callback(tls_dyn_lock_func);
CRYPTO_set_dynlock_destroy_callback(tls_dyn_destroy_func);
@@ -1553,10 +1558,12 @@ nc_ssh_tls_destroy(void)
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
# elif OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
SSL_COMP_free_compression_methods();
+# endif
#endif
nc_ssh_destroy();
+#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
CRYPTO_set_dynlock_create_callback(NULL);
CRYPTO_set_dynlock_lock_callback(NULL);
CRYPTO_set_dynlock_destroy_callback(NULL);
@@ -1588,7 +1595,7 @@ nc_init(void)
{
#if defined(NC_ENABLED_SSH) && defined(NC_ENABLED_TLS)
nc_ssh_tls_init();
-#elif defined(NC_ENABLED_SSH) && OPENSSL_VERSION_NUMBER < 0x10100000L
+#elif defined(NC_ENABLED_SSH)
nc_ssh_init();
#elif defined(NC_ENABLED_TLS)
nc_tls_init();
@@ -1600,7 +1607,7 @@ nc_destroy(void)
{
#if defined(NC_ENABLED_SSH) && defined(NC_ENABLED_TLS)
nc_ssh_tls_destroy();
-#elif defined(NC_ENABLED_SSH) && OPENSSL_VERSION_NUMBER < 0x10100000L
+#elif defined(NC_ENABLED_SSH)
nc_ssh_destroy();
#elif defined(NC_ENABLED_TLS)
nc_tls_destroy();
