summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-06-10 05:03:14 +0200
committerGravatar Nikias Bassen2019-06-10 05:03:14 +0200
commit34444782e22ebfd2abc9e5e9c27e170a839ff66b (patch)
tree6e73890be7d38f4b0bdc73c8268f6dff235a94ad /src
parenteb61c7b660fb58f9edb0f7b5507ebaad28422361 (diff)
downloadlibimobiledevice-34444782e22ebfd2abc9e5e9c27e170a839ff66b.tar.gz
libimobiledevice-34444782e22ebfd2abc9e5e9c27e170a839ff66b.tar.bz2
Make sure OpenSSL version checks don't fail when using LibreSSL
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/idevice.c b/src/idevice.c
index cb9bb5c..be29884 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -2,8 +2,8 @@
2 * idevice.c 2 * idevice.c
3 * Device discovery and communication interface. 3 * Device discovery and communication interface.
4 * 4 *
5 * Copyright (c) 2009-2019 Nikias Bassen. All Rights Reserved.
5 * Copyright (c) 2014 Martin Szulecki All Rights Reserved. 6 * Copyright (c) 2014 Martin Szulecki All Rights Reserved.
6 * Copyright (c) 2009-2014 Nikias Bassen. All Rights Reserved.
7 * Copyright (c) 2008 Zach C. All Rights Reserved. 7 * Copyright (c) 2008 Zach C. All Rights Reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
@@ -37,7 +37,6 @@
37#ifdef HAVE_OPENSSL 37#ifdef HAVE_OPENSSL
38#include <openssl/err.h> 38#include <openssl/err.h>
39#include <openssl/ssl.h> 39#include <openssl/ssl.h>
40
41#else 40#else
42#include <gnutls/gnutls.h> 41#include <gnutls/gnutls.h>
43#endif 42#endif
@@ -49,7 +48,7 @@
49 48
50#ifdef HAVE_OPENSSL 49#ifdef HAVE_OPENSSL
51 50
52#if OPENSSL_VERSION_NUMBER < 0x10002000L 51#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER)
53static void SSL_COMP_free_compression_methods(void) 52static void SSL_COMP_free_compression_methods(void)
54{ 53{
55 sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); 54 sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
@@ -60,7 +59,7 @@ static void openssl_remove_thread_state(void)
60{ 59{
61/* ERR_remove_thread_state() is available since OpenSSL 1.0.0-beta1, but 60/* ERR_remove_thread_state() is available since OpenSSL 1.0.0-beta1, but
62 * deprecated in OpenSSL 1.1.0 */ 61 * deprecated in OpenSSL 1.1.0 */
63#if OPENSSL_VERSION_NUMBER < 0x10100000L 62#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
64#if OPENSSL_VERSION_NUMBER >= 0x10000001L 63#if OPENSSL_VERSION_NUMBER >= 0x10000001L
65 ERR_remove_thread_state(NULL); 64 ERR_remove_thread_state(NULL);
66#else 65#else
@@ -69,7 +68,7 @@ static void openssl_remove_thread_state(void)
69#endif 68#endif
70} 69}
71 70
72#if OPENSSL_VERSION_NUMBER < 0x10100000L 71#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
73static mutex_t *mutex_buf = NULL; 72static mutex_t *mutex_buf = NULL;
74static void locking_function(int mode, int n, const char* file, int line) 73static void locking_function(int mode, int n, const char* file, int line)
75{ 74{
@@ -89,7 +88,7 @@ static unsigned long id_function(void)
89static void internal_idevice_init(void) 88static void internal_idevice_init(void)
90{ 89{
91#ifdef HAVE_OPENSSL 90#ifdef HAVE_OPENSSL
92#if OPENSSL_VERSION_NUMBER < 0x10100000L 91#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
93 int i; 92 int i;
94 SSL_library_init(); 93 SSL_library_init();
95 94
@@ -110,7 +109,7 @@ static void internal_idevice_init(void)
110static void internal_idevice_deinit(void) 109static void internal_idevice_deinit(void)
111{ 110{
112#ifdef HAVE_OPENSSL 111#ifdef HAVE_OPENSSL
113#if OPENSSL_VERSION_NUMBER < 0x10100000L 112#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
114 int i; 113 int i;
115 if (mutex_buf) { 114 if (mutex_buf) {
116 CRYPTO_set_id_callback(NULL); 115 CRYPTO_set_id_callback(NULL);