Module: kamailio
Branch: master
Commit: c4b04696a6bfe31fdd65fa56529b0d46f2774067
URL: 
https://github.com/kamailio/kamailio/commit/c4b04696a6bfe31fdd65fa56529b0d46f2774067

Author: Victor Seva <linuxman...@torreviejawireless.org>
Committer: Victor Seva <linuxman...@torreviejawireless.org>
Date: 2023-06-20T12:51:16+02:00

tls: disable tls_rand for openssl >= 3.0

>From https://www.openssl.org/docs/man3.0/man3/RAND_set_rand_method.html

> All of the functions described on this page are deprecated.
> Applications should instead use RAND_set_DRBG_type(3), EVP_RAND(3) and
> EVP_RAND(7).

---

Modified: src/modules/tls/tls_mod.c
Modified: src/modules/tls/tls_rand.c
Modified: src/modules/tls/tls_rand.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/c4b04696a6bfe31fdd65fa56529b0d46f2774067.diff
Patch: 
https://github.com/kamailio/kamailio/commit/c4b04696a6bfe31fdd65fa56529b0d46f2774067.patch

---

diff --git a/src/modules/tls/tls_mod.c b/src/modules/tls/tls_mod.c
index 9878c0f5178..c966e34b6f8 100644
--- a/src/modules/tls/tls_mod.c
+++ b/src/modules/tls/tls_mod.c
@@ -510,7 +510,8 @@ static void mod_destroy(void)
 
 int ksr_rand_engine_param(modparam_t type, void *val)
 {
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L \
+               && OPENSSL_VERSION_NUMBER < 0x030000000L
        str *reng;
 
        if(val == NULL) {
@@ -678,7 +679,8 @@ int mod_register(char *path, int *dlflags, void *p1, void 
*p2)
 
        register_tls_hooks(&tls_h);
 
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L \
+               && OPENSSL_VERSION_NUMBER < 0x030000000L
        LM_DBG("setting cryptorand random engine\n");
        RAND_set_rand_method(RAND_ksr_cryptorand_method());
 #endif
diff --git a/src/modules/tls/tls_rand.c b/src/modules/tls/tls_rand.c
index 297855e5b4a..288642e4ce7 100644
--- a/src/modules/tls/tls_rand.c
+++ b/src/modules/tls/tls_rand.c
@@ -29,7 +29,8 @@
 
 #include "tls_rand.h"
 
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L \
+               && OPENSSL_VERSION_NUMBER < 0x030000000L
 
 #include "../../core/dprint.h"
 #include "../../core/locking.h"
diff --git a/src/modules/tls/tls_rand.h b/src/modules/tls/tls_rand.h
index 34d6b2d1ff2..58ddc853acd 100644
--- a/src/modules/tls/tls_rand.h
+++ b/src/modules/tls/tls_rand.h
@@ -21,7 +21,8 @@
 #define _TLS_RAND_H_
 
 #include <openssl/ssl.h>
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L \
+               && OPENSSL_VERSION_NUMBER < 0x030000000L
 
 #include <openssl/rand.h>
 

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to