]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure on FreeBSD 9.2.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 14 Sep 2014 13:27:45 +0000 (22:27 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 14 Sep 2014 13:27:45 +0000 (22:27 +0900)
CMakeLists.txt
build/cmake/config.h.in
configure.ac
libarchive/archive_cryptor.c
libarchive/archive_cryptor_private.h
libarchive/archive_read_support_format_lha.c

index 24ff970fcf97b771d3a97309d919dc7373fe7970..e49c1aeb9bb47c8572fd929d3097d7697d59e047 100644 (file)
@@ -601,6 +601,7 @@ IF(ENABLE_NETTLE)
     SET(HAVE_NETTLE_SHA_H 1)
     INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR})
     LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES})
+    LA_CHECK_INCLUDE_FILE("nettle/pbkdf2.h" HAVE_NETTLE_PBKDF2_H)
   ENDIF(NETTLE_FOUND)
   MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR)
   MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES)
index b66bb5433bcc33824acda8209a200ed4f4cfec43..baca049dd06ee003924b9253f311e024ece7b2af 100644 (file)
@@ -727,6 +727,9 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the <nettle/md5.h> header file. */
 #cmakedefine HAVE_NETTLE_MD5_H 1
 
+/* Define to 1 if you have the <nettle/pbkdf2.h> header file. */
+#cmakedefine HAVE_NETTLE_PBKDF2_H 1
+
 /* Define to 1 if you have the <nettle/ripemd160.h> header file. */
 #cmakedefine HAVE_NETTLE_RIPEMD160_H 1
 
@@ -748,6 +751,9 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the `pipe' function. */
 #cmakedefine HAVE_PIPE 1
 
+/* Define to 1 if you have the `PKCS5_PBKDF2_HMAC_SHA1' function. */
+#cmakedefine HAVE_PKCS5_PBKDF2_HMAC_SHA1 1
+
 /* Define to 1 if you have the `poll' function. */
 #cmakedefine HAVE_POLL 1
 
index 46311b5d3e2a5f02496aa72d6a4a49a2de163c96..6682efb00e2f5480e161eacdc9dd3b2860a72ab5 100644 (file)
@@ -784,6 +784,8 @@ 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
@@ -815,6 +817,8 @@ if test "x$with_openssl" != "xno"; then
     CRYPTO_CHECK(SHA512, OPENSSL, sha512)
     if test "x$found_OPENSSL" != "xyes"; then
       LIBS=$saved_LIBS
+    else
+      AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1])
     fi
 fi
 
index 03b598fa856213bc3dabf5adb933d32f567d2ee3..0a332bafed391206de8937fce950a8355fd5f80d 100644 (file)
@@ -44,7 +44,7 @@ pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
        return 0;
 }
 
-#elif defined(HAVE_LIBNETTLE)
+#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_PBKDF2_H)
 
 static int
 pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
@@ -55,7 +55,7 @@ pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
        return 0;
 }
 
-#elif defined(HAVE_LIBCRYPTO)
+#elif defined(HAVE_LIBCRYPTO) && defined(HAVE_PKCS5_PBKDF2_HMAC_SHA1)
 
 static int
 pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
index 5bd550782bde77e63d7d85f80816ebde37bc8d8f..7e2033b19051263932ed7aaf34f8a8a25fb5d9e9 100644 (file)
@@ -46,7 +46,9 @@ typedef struct {
 } archive_crypto_ctx;
 
 #elif defined(HAVE_LIBNETTLE)
+#if defined(HAVE_NETTLE_PBKDF2_H)
 #include <nettle/pbkdf2.h>
+#endif
 #include <nettle/aes.h>
 
 typedef struct {
index 4daba9474a8770a5d4dde537b7597aafdf644b01..223ef02f6fbe7f064427222010418dc61eef98a1 100644 (file)
@@ -1712,10 +1712,11 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
                 * remove the stament which will not be executed. */
 #ifdef _MSC_VER  /* Visual Studio */
 #  define bswap16(x) _byteswap_ushort(x)
-#elif defined(__GNUC__) || defined(__clang__)
+#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \
+      || defined(__clang__)
 #  define bswap16(x) __builtin_bswap16(x)
 #else
-#  define bswap16(x) ((((b) >> 8) & 0xff) | ((b) << 8))
+#  define bswap16(x) ((((x) >> 8) & 0xff) | ((x) << 8))
 #endif
 #define CRC16W do {    \
                if(u.c[0] == 1) { /* Big endian */              \