aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/tls/TLSSession.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2011-08-21 08:55:46 +0000
committerVincent Richard <[email protected]>2011-08-21 08:55:46 +0000
commitf68a466dc0d99283eb610635c27bd0facb693f11 (patch)
treeae7960bb6a0bb429620e5aee23cdca15e3ff303f /src/net/tls/TLSSession.cpp
parentUse gnutls_strerror() for reporting errors. (diff)
downloadvmime-f68a466dc0d99283eb610635c27bd0facb693f11.tar.gz
vmime-f68a466dc0d99283eb610635c27bd0facb693f11.zip
Removed dependency on gcrypt for gnutls version >= 2.12.
Diffstat (limited to 'src/net/tls/TLSSession.cpp')
-rw-r--r--src/net/tls/TLSSession.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
index 7426a73c..d3f6d495 100644
--- a/src/net/tls/TLSSession.cpp
+++ b/src/net/tls/TLSSession.cpp
@@ -26,9 +26,17 @@
#include "vmime/config.hpp"
+// Dependency on gcrypt is not needed since GNU TLS version 2.12.
+// See here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638651
+#if GNUTLS_VERSION_NUMBER <= 0x020b00
+# define VMIME_GNUTLS_NEEDS_GCRYPT 1
+#endif
+
#if VMIME_HAVE_PTHREAD
# include <pthread.h>
-# include <gcrypt.h>
+# if VMIME_GNUTLS_NEEDS_GCRYPT
+# include <gcrypt.h>
+# endif
# include <errno.h>
#endif // VMIME_HAVE_PTHREAD
@@ -49,7 +57,7 @@
#endif // VMIME_DEBUG && GNUTLS_DEBUG
-#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
+#if VMIME_HAVE_PTHREAD && VMIME_GNUTLS_NEEDS_GCRYPT && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
extern "C"
{
GCRY_THREAD_OPTION_PTHREAD_IMPL;
@@ -70,7 +78,9 @@ struct TLSGlobal
TLSGlobal()
{
#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
+ #if VMIME_GNUTLS_NEEDS_GCRYPT
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ #endif // VMIME_GNUTLS_NEEDS_GCRYPT
#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
gnutls_global_init();