From d057c45e8f48aa90d8b340cac4c8ae4cc8b5d0ac Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 28 Jan 2017 16:42:13 +0000 Subject: [PATCH] Unbreak build with LibreSSL after openssl 1.1 support added Fixes: 3e9e0a0d46e4 ("Make it build using OpenSSL 1.1.0") Fixes: #445 --- openssl-compat.h | 4 ++-- sample/https-client.c | 6 +++--- sample/le-proxy.c | 2 +- sample/openssl_hostname_validation.c | 2 +- test/regress_ssl.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openssl-compat.h b/openssl-compat.h index 69afc716..0f2dcb75 100644 --- a/openssl-compat.h +++ b/openssl-compat.h @@ -1,7 +1,7 @@ #ifndef OPENSSL_COMPAT_H #define OPENSSL_COMPAT_H -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) static inline BIO_METHOD *BIO_meth_new(int type, const char *name) { @@ -30,6 +30,6 @@ static inline BIO_METHOD *BIO_meth_new(int type, const char *name) #define TLS_method SSLv23_method -#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ +#endif /* (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) */ #endif /* OPENSSL_COMPAT_H */ diff --git a/sample/https-client.c b/sample/https-client.c index 74839565..75666836 100644 --- a/sample/https-client.c +++ b/sample/https-client.c @@ -312,7 +312,7 @@ main(int argc, char **argv) } uri[sizeof(uri) - 1] = '\0'; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) // Initialize OpenSSL SSL_library_init(); ERR_load_crypto_strings(); @@ -480,7 +480,7 @@ cleanup: SSL_CTX_free(ssl_ctx); if (type == HTTP && ssl) SSL_free(ssl); -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) EVP_cleanup(); ERR_free_strings(); @@ -492,7 +492,7 @@ cleanup: CRYPTO_cleanup_all_ex_data(); sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); -#endif /*OPENSSL_VERSION_NUMBER < 0x10100000L */ +#endif /* (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) */ #ifdef _WIN32 WSACleanup(); diff --git a/sample/le-proxy.c b/sample/le-proxy.c index 8d9b529e..e2fbf452 100644 --- a/sample/le-proxy.c +++ b/sample/le-proxy.c @@ -259,7 +259,7 @@ main(int argc, char **argv) if (use_ssl) { int r; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) SSL_library_init(); ERR_load_crypto_strings(); SSL_load_error_strings(); diff --git a/sample/openssl_hostname_validation.c b/sample/openssl_hostname_validation.c index 40312f2e..a60e38c4 100644 --- a/sample/openssl_hostname_validation.c +++ b/sample/openssl_hostname_validation.c @@ -48,7 +48,7 @@ SOFTWARE. #define HOSTNAME_MAX_SIZE 255 -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) #define ASN1_STRING_get0_data ASN1_STRING_data #endif diff --git a/test/regress_ssl.c b/test/regress_ssl.c index 681705fc..490853fc 100644 --- a/test/regress_ssl.c +++ b/test/regress_ssl.c @@ -186,7 +186,7 @@ get_ssl_ctx(void) void init_ssl(void) { -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) SSL_library_init(); ERR_load_crypto_strings(); SSL_load_error_strings(); -- 2.40.0