From 625801ed7e765a89fe98e410d6272e9ce09adeb8 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 18 Jan 2016 12:52:40 +0000 Subject: [PATCH] bcrypt: Ensure we have gnutls_hash() available. Signed-off-by: Huw Davies Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- configure | 16 ++++++++++++++++ configure.ac | 2 ++ dlls/bcrypt/bcrypt_main.c | 10 +++++----- include/config.h.in | 3 +++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/configure b/configure index ab5434a9c56..d82731ecee3 100755 --- a/configure +++ b/configure @@ -11595,6 +11595,22 @@ CPPFLAGS=$ac_save_CPPFLAGS test -z "$GNUTLS_CFLAGS" || GNUTLS_CFLAGS=`echo " $GNUTLS_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` test -z "$GNUTLS_LIBS" || GNUTLS_LIBS=`echo " $GNUTLS_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` + ac_wine_check_funcs_save_LIBS="$LIBS" +LIBS="$LIBS $GNUTLS_LIBS" +for ac_func in gnutls_hash +do : + ac_fn_c_check_func "$LINENO" "gnutls_hash" "ac_cv_func_gnutls_hash" +if test "x$ac_cv_func_gnutls_hash" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GNUTLS_HASH 1 +_ACEOF + +else + as_fn_append wine_notices "|libgnutls ${notice_platform}development files too old, no bcrypt hash support." +fi +done + +LIBS="$ac_wine_check_funcs_save_LIBS" fi if test "x$ac_cv_lib_soname_gnutls" = "x"; then : case "x$with_gnutls" in diff --git a/configure.ac b/configure.ac index 0766edf7ab6..d2eac296f8e 100644 --- a/configure.ac +++ b/configure.ac @@ -1270,6 +1270,8 @@ then #include ]], [[static typeof(gnutls_mac_get_key_size) *func; if (func) return 0;]])], [WINE_CHECK_SONAME(gnutls,gnutls_global_init,,[GNUTLS_CFLAGS=""],[$GNUTLS_LIBS],[[libgnutls\\(-deb0\\)\\{0,1\\}]])])], [GNUTLS_CFLAGS=""])]) + WINE_CHECK_LIB_FUNCS(gnutls_hash,[$GNUTLS_LIBS],, + [WINE_NOTICE([libgnutls ${notice_platform}development files too old, no bcrypt hash support.])]) fi WINE_WARNING_WITH(gnutls,[test "x$ac_cv_lib_soname_gnutls" = "x"], [libgnutls ${notice_platform}development files not found, no schannel support.]) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 227399f56b6..fdd69116790 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -43,7 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(bcrypt); static HINSTANCE instance; -#if defined(SONAME_LIBGNUTLS) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) +#if defined(HAVE_GNUTLS_HASH) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) WINE_DECLARE_DEBUG_CHANNEL(winediag); static void *libgnutls_handle; @@ -116,7 +116,7 @@ static void gnutls_uninitialize(void) wine_dlclose( libgnutls_handle, NULL, 0 ); libgnutls_handle = NULL; } -#endif /* SONAME_LIBGNUTLS && !HAVE_COMMONCRYPTO_COMMONDIGEST_H */ +#endif /* HAVE_GNUTLS_HASH && !HAVE_COMMONCRYPTO_COMMONDIGEST_H */ NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount, BCRYPT_ALGORITHM_IDENTIFIER **ppAlgList, ULONG dwFlags) @@ -338,7 +338,7 @@ static NTSTATUS hash_finish( struct hash *hash, UCHAR *output, ULONG size ) } return STATUS_SUCCESS; } -#elif defined(SONAME_LIBGNUTLS) +#elif defined(HAVE_GNUTLS_HASH) struct hash { struct object hdr; @@ -642,14 +642,14 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) case DLL_PROCESS_ATTACH: instance = hinst; DisableThreadLibraryCalls( hinst ); -#if defined(SONAME_LIBGNUTLS) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) +#if defined(HAVE_GNUTLS_HASH) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) gnutls_initialize(); #endif break; case DLL_PROCESS_DETACH: if (reserved) break; -#if defined(SONAME_LIBGNUTLS) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) +#if defined(HAVE_GNUTLS_HASH) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) gnutls_uninitialize(); #endif break; diff --git a/include/config.h.in b/include/config.h.in index 514e5fe82f6..805374ecee7 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -228,6 +228,9 @@ /* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID +/* Define to 1 if you have the `gnutls_hash' function. */ +#undef HAVE_GNUTLS_HASH + /* Define if we have the libgphoto2 development environment */ #undef HAVE_GPHOTO2