[vlc-commits] gcrypt: require libgcrypt >= 1.6.0
Thomas Guillem
git at videolan.org
Tue Jun 16 10:51:06 CEST 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jun 15 19:21:31 2015 +0200| [07c9677da146b8993299da8d8474907d2f703279] | committer: Thomas Guillem
gcrypt: require libgcrypt >= 1.6.0
And remove setup thread callbacks init since it's not supported anymore.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=07c9677da146b8993299da8d8474907d2f703279
---
configure.ac | 29 ++++++++++++-----------
include/vlc_gcrypt.h | 64 ++++----------------------------------------------
2 files changed, 19 insertions(+), 74 deletions(-)
diff --git a/configure.ac b/configure.ac
index 49f4793..5332221 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3966,22 +3966,23 @@ dnl libgcrypt
dnl
AC_ARG_ENABLE(libgcrypt,
[ --disable-libgcrypt gcrypt support (default enabled)])
+# require libgcrypt >= 1.6.0
AS_IF([test "${enable_libgcrypt}" != "no"], [
- AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
- libgcrypt-config --version >/dev/null || \
- AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
- AC_CHECK_LIB(gcrypt, gcry_control, [
- have_libgcrypt="yes"
- AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
- GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
- GCRYPT_LIBS="`libgcrypt-config --libs`"
- ], [
- AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or pass --disable-libgcrypt.])
- ], [`libgcrypt-config --libs`])
+ AC_TRY_COMPILE([
+#include <gcrypt.h>
+#if GCRYPT_VERSION_NUMBER < 0x010600
+#error
+#endif],
+ [], [
+ have_libgcrypt="yes"
+ AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
+ GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
+ GCRYPT_LIBS="`libgcrypt-config --libs`"
], [
- AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
- ], [#include <gcrypt.h>]
- )
+ AS_IF([test "${enable_libgcrypt}" == "yes"], [
+ AC_MSG_ERROR([libgcrypt version 1.6.0 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
+ ])
+ ])
])
AC_SUBST(GCRYPT_CFLAGS)
diff --git a/include/vlc_gcrypt.h b/include/vlc_gcrypt.h
index 89bdab8..a04e1b1 100644
--- a/include/vlc_gcrypt.h
+++ b/include/vlc_gcrypt.h
@@ -25,65 +25,6 @@
#include <errno.h>
-#ifdef LIBVLC_USE_PTHREAD
-/**
- * If possible, use gcrypt-provided thread implementation. This is so that
- * other non-VLC components (inside the process) can also use gcrypt safely.
- */
-GCRY_THREAD_OPTION_PTHREAD_IMPL;
-# define gcry_threads_vlc gcry_threads_pthread
-#else
-
-/**
- * gcrypt thread option VLC implementation
- */
-
-static int gcry_vlc_mutex_init( void **p_sys )
-{
- vlc_mutex_t *p_lock = (vlc_mutex_t *)malloc( sizeof( vlc_mutex_t ) );
- if( p_lock == NULL)
- return ENOMEM;
-
- vlc_mutex_init( p_lock );
- *p_sys = p_lock;
- return VLC_SUCCESS;
-}
-
-static int gcry_vlc_mutex_destroy( void **p_sys )
-{
- vlc_mutex_t *p_lock = (vlc_mutex_t *)*p_sys;
- vlc_mutex_destroy( p_lock );
- free( p_lock );
- return VLC_SUCCESS;
-}
-
-static int gcry_vlc_mutex_lock( void **p_sys )
-{
- vlc_mutex_lock( (vlc_mutex_t *)*p_sys );
- return VLC_SUCCESS;
-}
-
-static int gcry_vlc_mutex_unlock( void **lock )
-{
- vlc_mutex_unlock( (vlc_mutex_t *)*lock );
- return VLC_SUCCESS;
-}
-
-static const struct gcry_thread_cbs gcry_threads_vlc =
-{
- GCRY_THREAD_OPTION_USER,
- NULL,
- gcry_vlc_mutex_init,
- gcry_vlc_mutex_destroy,
- gcry_vlc_mutex_lock,
- gcry_vlc_mutex_unlock,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
-};
-#endif
-
-/**
- * Initializes gcrypt with proper locking.
- */
static inline void vlc_gcrypt_init (void)
{
/* This would need a process-wide static mutex with all libraries linking
@@ -96,7 +37,10 @@ static inline void vlc_gcrypt_init (void)
vlc_global_lock (VLC_GCRYPT_MUTEX);
if (!done)
{
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_vlc);
+ /* The suggested way for an application to make sure that global_init
+ * has been called is by using gcry_check_version. (see global_init
+ * comments in gcrypt sources) */
+ gcry_check_version(NULL);
done = true;
}
vlc_global_unlock (VLC_GCRYPT_MUTEX);
More information about the vlc-commits
mailing list