From: Rosen Penev Date: Mon, 19 Nov 2018 22:57:05 +0000 (-0800) Subject: main: Fix OpenSSL 1.1 compilation without deprecated APIs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3de759873b5e81b9ae0a89d33e0756a6ae10c102;p=thirdparty%2Ftvheadend.git main: Fix OpenSSL 1.1 compilation without deprecated APIs Also fixed compilation for OpenSSL without ENGINE support. --- diff --git a/src/httpc.c b/src/httpc.c index c86dcfded..04d1a9090 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -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; diff --git a/src/main.c b/src/main.c index 21abc93bb..8b5c51a1c 100644 --- a/src/main.c +++ b/src/main.c @@ -89,7 +89,9 @@ #include #include #include +#ifndef OPENSSL_NO_ENGINE #include +#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);