Only use Libgcrypt for GnuTLS < 2.12

Only initialize Libgcrypt threading functions on GnuTLS < 2.12 which
does not do this automatically. Also drop explicit linking against
Libgcrypt on newer GnuTLS version.

This should allow GKrellM to work with a GnuTLS that uses Nettle instead
of Libgcrypt as its cryptographic backend.
This commit is contained in:
Stefan Gehn 2011-08-27 16:32:31 +02:00
parent 50b126e085
commit 752e5965b1
3 changed files with 17 additions and 1 deletions

View File

@ -16,6 +16,9 @@ GKrellM Changelog
* Bugfixes * Bugfixes
o Store lockfiles under /var/lock/gkrellm-UID directories to make o Store lockfiles under /var/lock/gkrellm-UID directories to make
lockfiles work for multiple users. lockfiles work for multiple users.
* Only link against and initialize Libgcrypt when building with
GnuTLS < 2.12. This allows using GKrellM with GnuTLS versions built
against Nettle instead of Libgcrypt.
2.3.5 - Thu Oct 7, 2010 2.3.5 - Thu Oct 7, 2010
------------------------ ------------------------

7
src/configure vendored
View File

@ -96,7 +96,12 @@ echo -n "Checking for gnutls... "
echo "Checking for gnutls... " 1>& 5 echo "Checking for gnutls... " 1>& 5
GNUTLS_INCLUDE="$(pkg-config gnutls --cflags 2>& 5 || true)" GNUTLS_INCLUDE="$(pkg-config gnutls --cflags 2>& 5 || true)"
GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl -lgcrypt" GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl"
# GnuTLS >= 2.12 does not need explicit gcrypt linking anymore
if $(pkg-config --max-version=2.11.99 gnutls 2>& 5 || false); then
GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
fi
cat << EOF > test.c cat << EOF > test.c
#include <gnutls/openssl.h> #include <gnutls/openssl.h>

View File

@ -51,6 +51,9 @@
#define MD5Update MD5_Update #define MD5Update MD5_Update
#define MD5Final MD5_Final #define MD5Final MD5_Final
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* gcrypt mutex setup is only needed for GnuTLS < 2.12 */
static int gk_gcry_glib_mutex_init (void **priv) { static int gk_gcry_glib_mutex_init (void **priv) {
GMutex *lock = g_mutex_new(); GMutex *lock = g_mutex_new();
if (!lock) if (!lock)
@ -90,6 +93,8 @@ static struct gcry_thread_cbs gk_gcry_threads_glib = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
}; };
#endif
#else #else
#if defined(HAVE_SSL) #if defined(HAVE_SSL)
@ -4340,7 +4345,10 @@ gkrellm_init_mail_monitor(void)
_GK.decal_mail_delay = 1; _GK.decal_mail_delay = 1;
#ifdef HAVE_GNUTLS #ifdef HAVE_GNUTLS
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* gcrypt mutex setup, only needed for GnuTLS < 2.12 */
gcry_control (GCRYCTL_SET_THREAD_CBS, &gk_gcry_threads_glib); gcry_control (GCRYCTL_SET_THREAD_CBS, &gk_gcry_threads_glib);
#endif
gnutls_global_init(); gnutls_global_init();
SSL_load_error_strings(); SSL_load_error_strings();
SSL_library_init(); SSL_library_init();