From e8dac8e231b72bfec56e32873d8572b673c1adbc Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 22 Jun 2019 02:19:18 +0200 Subject: Make sure to not use deprecated API when compiling with OpenSSL >= 1.1 There are several missing headers as well as deprecated functions for which compatibility was added as needed. --- src/idevice.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/idevice.c b/src/idevice.c index 8c81576..02d34cc 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -36,6 +36,7 @@ #include #ifdef HAVE_OPENSSL #include +#include #include #else #include @@ -49,6 +50,11 @@ #ifdef HAVE_OPENSSL +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ + (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x20020000L)) +#define TLS_method TLSv1_method +#endif + #if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER) static void SSL_COMP_free_compression_methods(void) { @@ -771,7 +777,7 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne } BIO_set_fd(ssl_bio, (int)(long)connection->data, BIO_NOCLOSE); - SSL_CTX *ssl_ctx = SSL_CTX_new(TLSv1_method()); + SSL_CTX *ssl_ctx = SSL_CTX_new(TLS_method()); if (ssl_ctx == NULL) { debug_info("ERROR: Could not create SSL context."); BIO_free(ssl_bio); -- cgit v1.1-32-gdbae