From 562ba769750ba11052d668a531b84ff7696a7df5 Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Wed, 2 Dec 2015 09:42:02 +0000
Subject: [PATCH] qca2: add patch to build with libressl 2.3

---
 pkgs/development/libraries/qca2/default.nix   |  2 ++
 .../development/libraries/qca2/libressl.patch | 28 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 pkgs/development/libraries/qca2/libressl.patch

diff --git a/pkgs/development/libraries/qca2/default.nix b/pkgs/development/libraries/qca2/default.nix
index 43ef6f78b576..4e6b50502d62 100644
--- a/pkgs/development/libraries/qca2/default.nix
+++ b/pkgs/development/libraries/qca2/default.nix
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  patches = [ ./libressl.patch ];
+
   meta = with stdenv.lib; {
     description = "Qt Cryptographic Architecture";
     license = "LGPL";
diff --git a/pkgs/development/libraries/qca2/libressl.patch b/pkgs/development/libraries/qca2/libressl.patch
new file mode 100644
index 000000000000..c9b0267f85d8
--- /dev/null
+++ b/pkgs/development/libraries/qca2/libressl.patch
@@ -0,0 +1,28 @@
+--- a/plugins/qca-ossl/qca-ossl.cpp	2015-12-02 09:34:25.810682094 +0000
++++ b/plugins/qca-ossl/qca-ossl.cpp	2015-12-02 09:29:51.720392423 +0000
+@@ -5403,11 +5403,13 @@
+ 			ctx = SSL_CTX_new(SSLv2_client_method());
+ 			break;
+ #endif
++#ifndef OPENSSL_NO_SSL3
+ 		case TLS::SSL_v3:
+ 			ctx = SSL_CTX_new(SSLv3_client_method());
+ 			break;
++#endif
+ 		case TLS::TLS_v1:
++			ctx = SSL_CTX_new(SSLv23_client_method());
+-			ctx = SSL_CTX_new(TLSv1_client_method());
+ 			break;
+ 		case TLS::DTLS_v1:
+ 		default:
+@@ -7133,8 +7135,10 @@
+ 			return new opensslInfoContext(this);
+ 		else if ( type == "sha1" )
+ 			return new opensslHashContext( EVP_sha1(), this, type);
++#ifndef OPENSSL_NO_SHA0
+ 		else if ( type == "sha0" )
+ 			return new opensslHashContext( EVP_sha(), this, type);
++#endif
+ 		else if ( type == "ripemd160" )
+ 			return new opensslHashContext( EVP_ripemd160(), this, type);
+ #ifdef HAVE_OPENSSL_MD2