Module: kamailio
Branch: master
Commit: 99c6a68dea60ca745dfdfa33085bb6acbcee846a
URL:
https://github.com/kamailio/kamailio/commit/99c6a68dea60ca745dfdfa33085bb6a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-08-13T07:19:28+02:00
tls: added define condition on version functions
- libssl 1.1 variants are not in 1.0
- following the changes by 234b02236b3ad13cdaf5624d11c727ad7d804747
---
Modified: src/modules/tls/tls_domain.c
Modified: src/modules/tls/tls_init.c
---
Diff:
https://github.com/kamailio/kamailio/commit/99c6a68dea60ca745dfdfa33085bb6a…
Patch:
https://github.com/kamailio/kamailio/commit/99c6a68dea60ca745dfdfa33085bb6a…
---
diff --git a/src/modules/tls/tls_domain.c b/src/modules/tls/tls_domain.c
index fc84033e68..2930bde2be 100644
--- a/src/modules/tls/tls_domain.c
+++ b/src/modules/tls/tls_domain.c
@@ -63,9 +63,11 @@ static void setup_ecdh(SSL_CTX *ctx)
{
EC_KEY *ecdh;
- if (OpenSSL_version_num() < 0x1000005fL) {
+#if OPENSSL_VERSION_NUMBER < 0x010100000L
+ if (SSLeay() < 0x1000005fL) {
return;
}
+#endif
ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
SSL_CTX_set_options(ctx, SSL_OP_SINGLE_ECDH_USE);
diff --git a/src/modules/tls/tls_init.c b/src/modules/tls/tls_init.c
index 351ed4187e..f10d0c0344 100644
--- a/src/modules/tls/tls_init.c
+++ b/src/modules/tls/tls_init.c
@@ -645,6 +645,7 @@ int tls_h_mod_init_f(void)
{
/*struct socket_info* si;*/
long ssl_version;
+ const char *ssl_version_txt;
#if OPENSSL_VERSION_NUMBER < 0x010100000L &&
!defined(LIBRESSL_VERSION_NUMBER)
int lib_kerberos;
int lib_zlib;
@@ -667,7 +668,15 @@ int tls_h_mod_init_f(void)
#if OPENSSL_VERSION_NUMBER < 0x00907000L
LM_WARN("You are using an old version of OpenSSL (< 0.9.7). Upgrade!\n");
#endif
+
+#if OPENSSL_VERSION_NUMBER < 0x010100000L
+ ssl_version=SSLeay();
+ ssl_version_txt=SSLeay_version(SSLEAY_VERSION);
+#else
ssl_version=OpenSSL_version_num();
+ ssl_version_txt=OpenSSL_version(OPENSSL_VERSION);
+#endif
+
/* check if version have the same major minor and fix level
* (e.g. 0.9.8a & 0.9.8c are ok, but 0.9.8 and 0.9.9x are not)
* - values is represented as 0xMMNNFFPPS: major minor fix patch status
@@ -679,7 +688,7 @@ int tls_h_mod_init_f(void)
" compiled \"%s\" (0x%08lx).\n"
" Please make sure a compatible version is used"
" (tls_force_run in kamailio.cfg will override this check)\n",
- OpenSSL_version(OPENSSL_VERSION), ssl_version,
+ ssl_version_txt, ssl_version,
OPENSSL_VERSION_TEXT, (long)OPENSSL_VERSION_NUMBER);
if (cfg_get(tls, tls_cfg, force_run))
LM_WARN("tls_force_run turned on, ignoring "