summaryrefslogtreecommitdiff
path: root/community/pokerth/gcrypt16.patch
blob: 818feda09dee78ab1c3b06d63aacb0688c248e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From aa22d39d7753acc56813171e654fa9fa1f0ca759 Mon Sep 17 00:00:00 2001
From: lotodore <pokerth@lotharmay.de>
Date: Thu, 19 Dec 2013 12:28:35 +0100
Subject: [PATCH] Fix for libgcrypt 1.6.0 compile error #247 (supported only on
 Linux because libgcrypt does not yet support native Windows threads).

---
 src/net/common/socket_startup.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/net/common/socket_startup.cpp b/src/net/common/socket_startup.cpp
index 12e8604..59ffc4f 100644
--- a/src/net/common/socket_startup.cpp
+++ b/src/net/common/socket_startup.cpp
@@ -37,6 +37,10 @@
 
 #ifndef HAVE_OPENSSL
 
+// With libgcrypt 1.6.0, it is no longer supported to provide thread callbacks.
+// Use the default thread implementation instead, and cross fingers that it works with boost thread...
+#if GCRYPT_VERSION_NUMBER < 0x010600
+
 extern "C" {
 
 	int gcry_bthread_init()
@@ -64,12 +68,15 @@
 		return 0;
 	}
 
-	struct gcry_thread_cbs gcry_threads_boost = {
+	static struct gcry_thread_cbs gcry_threads_boost = {
 		GCRY_THREAD_OPTION_USER, gcry_bthread_init, gcry_bmutex_init,
 		gcry_bmutex_destroy, gcry_bmutex_lock, gcry_bmutex_unlock,
 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 	};
 }
+
+#endif // GCRYPT_VERSION_NUMBER < 0x010600
+
 #endif // not HAVE_OPENSSL
 
 bool
@@ -78,8 +85,10 @@
 #ifdef HAVE_OPENSSL
 	return SSL_library_init() == 1;
 #else
-	gcry_check_version(NULL);
+#if GCRYPT_VERSION_NUMBER < 0x010600
 	gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_boost);
+#endif
+	gcry_check_version(NULL);
 	gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0);
 	gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
 	return true;
-- 
1.8.5.1