Module: kamailio
Branch: master
Commit: 6df13e614cf6898b6d67f36c9b185a7530102ef1
URL:
https://github.com/kamailio/kamailio/commit/6df13e614cf6898b6d67f36c9b185a7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-10-05T15:28:23+02:00
tls: reintroduced use of OPENSSL_cleanup() on mod destroy
- by that avoid executing it on atexit() callback, when shm is gone
---
Modified: src/modules/tls/tls_init.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6df13e614cf6898b6d67f36c9b185a7…
Patch:
https://github.com/kamailio/kamailio/commit/6df13e614cf6898b6d67f36c9b185a7…
---
diff --git a/src/modules/tls/tls_init.c b/src/modules/tls/tls_init.c
index f10d0c0344..8bdd14f2cc 100644
--- a/src/modules/tls/tls_init.c
+++ b/src/modules/tls/tls_init.c
@@ -627,13 +627,14 @@ int tls_h_mod_pre_init_f(void)
return 0;
}
LM_DBG("preparing tls env for modules initialization\n");
-#if OPENSSL_VERSION_NUMBER < 0x010100000L || defined(LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER >= 0x010100000L &&
!defined(LIBRESSL_VERSION_NUMBER)
+ LM_DBG("preparing tls env for modules initialization (libssl >=1.1)\n");
+ OPENSSL_init_ssl(0, NULL);
+#else
LM_DBG("preparing tls env for modules initialization (libssl <=1.0)\n");
SSL_library_init();
- SSL_load_error_strings();
-#else
- LM_DBG("preparing tls env for modules initialization (libssl >=1.1)\n");
#endif
+ SSL_load_error_strings();
tls_mod_preinitialized=1;
return 0;
}
@@ -865,7 +866,6 @@ int tls_check_sockets(tls_domains_cfg_t* cfg)
void tls_h_mod_destroy_f(void)
{
LM_DBG("tls module final tls destroy\n");
-#if OPENSSL_VERSION_NUMBER < 0x010100000L || defined(LIBRESSL_VERSION_NUMBER)
if(tls_mod_preinitialized > 0)
ERR_free_strings();
/* TODO: free all the ctx'es */
@@ -878,5 +878,4 @@ void tls_h_mod_destroy_f(void)
LM_DBG("executing openssl v1.1+ cleanup\n");
OPENSSL_cleanup();
#endif
-#endif
}