diff -ruNp linuxdcpp-1.1.0-orig/dcpp/CID.h linuxdcpp-1.1.0/dcpp/CID.h
--- linuxdcpp-1.1.0-orig/dcpp/CID.h	2011-04-17 12:57:09.000000000 -0500
+++ linuxdcpp-1.1.0/dcpp/CID.h	2014-08-12 21:04:11.000000000 -0500
@@ -57,14 +57,19 @@ private:
 
 } // namespace dcpp
 
-namespace std { namespace tr1 {
+namespace std {
+#ifndef _LIBCPP_VERSION
+namespace tr1 {
+#endif
 template<>
 struct hash<dcpp::CID> {
 	size_t operator()(const dcpp::CID& rhs) const {
 		return *reinterpret_cast<const size_t*>(rhs.data());
 	}
 };
+#ifndef _LIBCPP_VERSION
 }
+#endif
 }
 
 #endif // !defined(CID_H)
diff -ruNp linuxdcpp-1.1.0-orig/dcpp/HashValue.h linuxdcpp-1.1.0/dcpp/HashValue.h
--- linuxdcpp-1.1.0-orig/dcpp/HashValue.h	2011-04-17 12:57:09.000000000 -0500
+++ linuxdcpp-1.1.0/dcpp/HashValue.h	2014-08-12 21:04:11.000000000 -0500
@@ -46,12 +46,17 @@ struct HashValue : FastAlloc<HashValue<H
 
 } // namespace dcpp
 
-namespace std { namespace tr1 {
+namespace std {
+#ifndef _LIBCPP_VERSION
+namespace tr1 {
+#endif
 template<typename T>
 struct hash<dcpp::HashValue<T> > {
 	size_t operator()(const dcpp::HashValue<T>& rhs) const { return *(size_t*)rhs.data; }
 };
+#ifndef _LIBCPP_VERSION
 }
+#endif
 }
 
 #endif // !defined(HASH_VALUE_H)
diff -ruNp linuxdcpp-1.1.0-orig/dcpp/stdinc.h linuxdcpp-1.1.0/dcpp/stdinc.h
--- linuxdcpp-1.1.0-orig/dcpp/stdinc.h	2011-04-17 12:57:09.000000000 -0500
+++ linuxdcpp-1.1.0/dcpp/stdinc.h	2014-08-12 21:05:07.000000000 -0500
@@ -123,7 +123,7 @@ typedef unsigned __int64 uint64_t;
 #include <boost/scoped_array.hpp>
 #include <boost/noncopyable.hpp>
 
-#if defined(_MSC_VER) || defined(_STLPORT_VERSION)
+#if defined(_MSC_VER) || defined(_STLPORT_VERSION) || defined(_LIBCPP_VERSION)
 
 #include <unordered_map>
 #include <unordered_set>
@@ -137,6 +137,9 @@ typedef unsigned __int64 uint64_t;
 #error "Unknown STL, please configure accordingly"
 #endif
 
+#ifdef _LIBCPP_VERSION
+namespace std { namespace tr1 { using namespace std; }}
+#endif
 namespace dcpp {
 using namespace std;
 using namespace std::tr1;
--- a/dcpp/CryptoManager.cpp.orig	2011-04-17 17:57:09 UTC
+++ b/dcpp/CryptoManager.cpp
@@ -107,12 +107,20 @@ CryptoManager::CryptoManager()
                 };
 
 		if(dh) {
-			dh->p = BN_bin2bn(dh4096_p, sizeof(dh4096_p), 0);
-			dh->g = BN_bin2bn(dh4096_g, sizeof(dh4096_g), 0);
+			BIGNUM *p, *g;
 
-			if (!dh->p || !dh->g) {
+			p = BN_bin2bn(dh4096_p, sizeof(dh4096_p), 0);
+			g = BN_bin2bn(dh4096_g, sizeof(dh4096_g), 0);
+
+			if (!p || !g) {
 				dh.reset();
 			} else {
+#if OPENSSL_VERSION_NUMBER < 0x10100005L
+				dh->p = p;
+				dh->g = g;
+#else
+				DH_set0_pqg(dh, p, NULL, g);
+#endif
 				SSL_CTX_set_options(serverContext, SSL_OP_SINGLE_DH_USE);
 				SSL_CTX_set_options(serverVerContext, SSL_OP_SINGLE_DH_USE);
 				SSL_CTX_set_tmp_dh(serverContext, (DH*)dh);