From 7731a3e575762a34156d65408e58bfd793ce4962 Mon Sep 17 00:00:00 2001
From: Enno Boland <g@s01.de>
Date: Thu, 5 May 2016 22:08:41 +0200
Subject: [PATCH] lib/ssl.c: fix libre- and boringssl

---
 changelog | 6 ++++++
 lib/ssl.c | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/changelog b/changelog
index a0065cff..f36d20ff 100644
--- a/changelog
+++ b/changelog
@@ -1,6 +1,12 @@
 Changelog
 ---------
 
+Fixes
+-----
+
+1) OpenSSL version tests not needed on LibreSSL and BoringSSL
+
+
 v2.0.0
 ======
 
diff --git a/lib/ssl.c b/lib/ssl.c
index 0a028bb1..685584e0 100644
--- a/lib/ssl.c
+++ b/lib/ssl.c
@@ -197,7 +197,9 @@ lws_ssl_destroy(struct lws_vhost *vhost)
 #if (OPENSSL_VERSION_NUMBER < 0x01000000) || defined(USE_WOLFSSL)
 	ERR_remove_state(0);
 #else
-#if (OPENSSL_VERSION_NUMBER >= 0x10100005L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100005L) && \
+	!defined(LIBRESSL_VERSION_NUMBER) && \
+	!defined(OPENSSL_IS_BORINGSSL)
 	ERR_remove_thread_state();
 #else
 	ERR_remove_thread_state(NULL);
@@ -689,7 +691,9 @@ lws_ssl_context_destroy(struct lws_context *context)
 #if (OPENSSL_VERSION_NUMBER < 0x01000000) || defined(USE_WOLFSSL)
 	ERR_remove_state(0);
 #else
-#if (OPENSSL_VERSION_NUMBER >= 0x10100005L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100005L) && \
+	!defined(LIBRESSL_VERSION_NUMBER) && \
+	!defined(OPENSSL_IS_BORINGSSL)
 	ERR_remove_thread_state();
 #else
 	ERR_remove_thread_state(NULL);
-- 
GitLab