]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
main: Fix OpenSSL 1.1 compilation without deprecated APIs
authorRosen Penev <rosenp@gmail.com>
Mon, 19 Nov 2018 22:57:05 +0000 (14:57 -0800)
committerJaroslav Kysela <perex@perex.cz>
Wed, 21 Nov 2018 09:02:46 +0000 (10:02 +0100)
Also fixed compilation for OpenSSL without ENGINE support.

src/httpc.c
src/main.c

index c86dcfdedec17fb62cf66f590b732ed2040d67a0..04d1a90902fd0937bb98a5ee3a4fc7a3c1cf7e1a 100644 (file)
@@ -1496,7 +1496,11 @@ http_client_reconnect
   if (strcasecmp(scheme, "https") == 0 || strcasecmp(scheme, "rtsps") == 0) {
     ssl = calloc(1, sizeof(*ssl));
     hc->hc_ssl = ssl;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
     ssl->ctx   = SSL_CTX_new(SSLv23_client_method());
+#else
+    ssl->ctx   = SSL_CTX_new(TLS_client_method());
+#endif
     if (ssl->ctx == NULL) {
       tvherror(LS_HTTPC, "%04X: Unable to get SSL_CTX", shortid(hc));
       goto err1;
index 21abc93bbea3ad63d250d44ac4ee9e275ebbba7b..8b5c51a1c99bab9ba57343b07f9f82fd9cc15e72 100644 (file)
@@ -89,7 +89,9 @@
 #include <openssl/conf.h>
 #include <openssl/err.h>
 #include <openssl/rand.h>
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 
 pthread_t main_tid;
 
@@ -1162,10 +1164,13 @@ main(int argc, char **argv)
   sigprocmask(SIG_BLOCK, &set, NULL);
   trap_init(argv[0]);
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
   /* SSL library init */
   OPENSSL_config(NULL);
   SSL_load_error_strings();
   SSL_library_init();
+#endif
+
   /* Rand seed */
   randseed.thread_id = (void *)main_tid;
   gettimeofday(&randseed.tv, NULL);
@@ -1368,8 +1373,11 @@ main(int argc, char **argv)
   if(opt_fork)
     unlink(opt_pidpath);
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
   /* OpenSSL - welcome to the "cleanup" hell */
+#ifndef OPENSSL_NO_ENGINE
   ENGINE_cleanup();
+#endif
   RAND_cleanup();
   CRYPTO_cleanup_all_ex_data();
   EVP_cleanup();
@@ -1383,6 +1391,7 @@ main(int argc, char **argv)
   sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
 #endif
   /* end of OpenSSL cleanup code */
+#endif
 
 #if ENABLE_DBUS_1
   extern void dbus_shutdown(void);