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)
/* 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
/* 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
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
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
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,
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,
} archive_crypto_ctx;
#elif defined(HAVE_LIBNETTLE)
+#if defined(HAVE_NETTLE_PBKDF2_H)
#include <nettle/pbkdf2.h>
+#endif
#include <nettle/aes.h>
typedef struct {
* 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 */ \