]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix nettle library probe
authorTim Kientzle <kientzle@acm.org>
Tue, 19 Jan 2016 13:32:56 +0000 (05:32 -0800)
committerTim Kientzle <kientzle@acm.org>
Tue, 19 Jan 2016 13:32:56 +0000 (05:32 -0800)
 = Only use it if we can find the library *and* the headers
 = When probing the library, try to link a function that's
   actually in the library (not 'main')

configure.ac
libarchive/archive_cryptor.c
libarchive/archive_cryptor_private.h
libarchive/archive_hmac.c
libarchive/archive_hmac_private.h

index 7a9cb9fec833041fa9957419abe4c78103d33458..cce432cf21b1f866b8b416ceb2871b96285b17e3 100644 (file)
@@ -780,8 +780,9 @@ esac
 
 if test "x$with_nettle" != "xno"; then
     AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h])
+    AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h])
     saved_LIBS=$LIBS
-    AC_CHECK_LIB(nettle,main)
+    AC_CHECK_LIB(nettle,nettle_sha1_init)
     CRYPTO_CHECK(MD5, NETTLE, md5)
     CRYPTO_CHECK(RMD160, NETTLE, rmd160)
     CRYPTO_CHECK(SHA1, NETTLE, sha1)
@@ -790,10 +791,9 @@ if test "x$with_nettle" != "xno"; then
     CRYPTO_CHECK(SHA512, NETTLE, sha512)
     if test "x$found_NETTLE" != "xyes"; then
       LIBS=$saved_LIBS
-    else
-      AC_CHECK_HEADERS([nettle/pbkdf2.h])
     fi
 fi
+
 if test "x$with_openssl" != "xno"; then
     AC_CHECK_HEADERS([openssl/evp.h])
     saved_LIBS=$LIBS
@@ -801,18 +801,18 @@ if test "x$with_openssl" != "xno"; then
       *mingw* | *cygwin*)
         case "$host_cpu" in
           x86_64)
-            AC_CHECK_LIB(eay64,main)
+            AC_CHECK_LIB(eay64,OPENSSL_config)
             if test "x$ac_cv_lib_eay64_main" != "xyes"; then
-              AC_CHECK_LIB(eay32,main)
+              AC_CHECK_LIB(eay32,OPENSSL_config)
             fi
             ;;
           *)
-            AC_CHECK_LIB(eay32,main)
+            AC_CHECK_LIB(eay32,OPENSSL_config)
             ;;
         esac
         ;;
       *)
-        AC_CHECK_LIB(crypto,main)
+        AC_CHECK_LIB(crypto,OPENSSL_config)
         ;;
     esac
     CRYPTO_CHECK(MD5, OPENSSL, md5)
@@ -832,7 +832,7 @@ fi
 # The two are incompatible and OpenSSL is more complete.
 AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h])
 saved_LIBS=$LIBS
-AC_CHECK_LIB(md,main)
+AC_CHECK_LIB(md,MD5Init)
 CRYPTO_CHECK(MD5, LIBMD, md5)
 CRYPTO_CHECK(RMD160, LIBMD, rmd160)
 CRYPTO_CHECK(SHA1, LIBMD, sha1)
index efd350d29ee4f78a3359444cb8b36aec7ff00020..f9615a64ac98d77d195489ca802eb0e1fdbe9cdd 100644 (file)
@@ -256,7 +256,7 @@ aes_ctr_release(archive_crypto_ctx *ctx)
        return 0;
 }
 
-#elif defined(HAVE_LIBNETTLE)
+#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_AES_H)
 
 static int
 aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
index 9a96aeea6cc394090d87c48c93f4fbc01f1f27fc..f629bc13b70d12c2039ccf53e533fac7ff3c610f 100644 (file)
@@ -72,7 +72,7 @@ typedef struct {
        unsigned        encr_pos;
 } archive_crypto_ctx;
 
-#elif defined(HAVE_LIBNETTLE)
+#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_AES_H)
 #if defined(HAVE_NETTLE_PBKDF2_H)
 #include <nettle/pbkdf2.h>
 #endif
index 36e3e1c6fdf8faeb57c75eb0c2538752cb8a9d02..12fca4561a95a2fbe8b10025da9085e94b466432 100644 (file)
@@ -129,7 +129,7 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
        }
 }
 
-#elif defined(HAVE_LIBNETTLE)
+#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H)
 
 static int
 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
index a9fb8eca5d0ffe7115c850e9e62724c6fa95c836..1f182d92b954009973665ec37ee4288014f2ee1d 100644 (file)
@@ -53,7 +53,7 @@ typedef struct {
 
 } archive_hmac_sha1_ctx;
 
-#elif defined(HAVE_LIBNETTLE)
+#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H)
 #include <nettle/hmac.h>
 
 typedef        struct hmac_sha1_ctx archive_hmac_sha1_ctx;