Browse code

Revert "Revert "tls: added define condition on version functions""

This reverts commit bffd78f14921f67735a64caea2fb130393daa2bc.

Daniel-Constantin Mierla authored on 18/09/2020 12:12:17
Showing 2 changed files
... ...
@@ -63,9 +63,11 @@ static void setup_ecdh(SSL_CTX *ctx)
63 63
 {
64 64
    EC_KEY *ecdh;
65 65
 
66
-   if (OpenSSL_version_num() < 0x1000005fL) {
66
+#if OPENSSL_VERSION_NUMBER < 0x010100000L
67
+   if (SSLeay() < 0x1000005fL) {
67 68
       return;
68 69
    }
70
+#endif
69 71
 
70 72
    ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
71 73
    SSL_CTX_set_options(ctx, SSL_OP_SINGLE_ECDH_USE);
... ...
@@ -645,6 +645,7 @@ int tls_h_mod_init_f(void)
645 645
 {
646 646
 	/*struct socket_info* si;*/
647 647
 	long ssl_version;
648
+	const char *ssl_version_txt;
648 649
 #if OPENSSL_VERSION_NUMBER < 0x010100000L && !defined(LIBRESSL_VERSION_NUMBER)
649 650
 	int lib_kerberos;
650 651
 	int lib_zlib;
... ...
@@ -667,7 +668,15 @@ int tls_h_mod_init_f(void)
667 668
 #if OPENSSL_VERSION_NUMBER < 0x00907000L
668 669
 	LM_WARN("You are using an old version of OpenSSL (< 0.9.7). Upgrade!\n");
669 670
 #endif
671
+
672
+#if OPENSSL_VERSION_NUMBER < 0x010100000L
673
+	ssl_version=SSLeay();
674
+	ssl_version_txt=SSLeay_version(SSLEAY_VERSION);
675
+#else
670 676
 	ssl_version=OpenSSL_version_num();
677
+	ssl_version_txt=OpenSSL_version(OPENSSL_VERSION);
678
+#endif
679
+
671 680
 	/* check if version have the same major minor and fix level
672 681
 	 * (e.g. 0.9.8a & 0.9.8c are ok, but 0.9.8 and 0.9.9x are not)
673 682
 	 * - values is represented as 0xMMNNFFPPS: major minor fix patch status
... ...
@@ -679,7 +688,7 @@ int tls_h_mod_init_f(void)
679 688
 				" compiled \"%s\" (0x%08lx).\n"
680 689
 				" Please make sure a compatible version is used"
681 690
 				" (tls_force_run in kamailio.cfg will override this check)\n",
682
-				OpenSSL_version(OPENSSL_VERSION), ssl_version,
691
+				ssl_version_txt, ssl_version,
683 692
 				OPENSSL_VERSION_TEXT, (long)OPENSSL_VERSION_NUMBER);
684 693
 		if (cfg_get(tls, tls_cfg, force_run))
685 694
 			LM_WARN("tls_force_run turned on, ignoring "