Huw Davies : bcrypt: Ensure we have gnutls_hash() available.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 18 11:09:03 CST 2016


Module: wine
Branch: master
Commit: 625801ed7e765a89fe98e410d6272e9ce09adeb8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=625801ed7e765a89fe98e410d6272e9ce09adeb8

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Jan 18 12:52:40 2016 +0000

bcrypt: Ensure we have gnutls_hash() available.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 ab5434a..d82731e 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 0766edf..d2eac29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1270,6 +1270,8 @@ then
 #include <gnutls/crypto.h>]], [[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 227399f..fdd6911 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 514e5fe..805374e 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
 




More information about the wine-cvs mailing list