summaryrefslogtreecommitdiffstats
path: root/libarchive/archive_hmac_private.h
diff options
context:
space:
mode:
authorLibArchive Upstream <libarchive-discuss@googlegroups.com>2016-04-30 17:26:35 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-02 14:25:52 (GMT)
commit501345e470bb9c5b0cb61aff84bd50ffdd95b92d (patch)
tree7c85737479c18f250aa481dae8eccaa16102af7b /libarchive/archive_hmac_private.h
parentfc8fc40f0a00830ab17faf8f86ef06d622eb1b77 (diff)
downloadCMake-501345e470bb9c5b0cb61aff84bd50ffdd95b92d.zip
CMake-501345e470bb9c5b0cb61aff84bd50ffdd95b92d.tar.gz
CMake-501345e470bb9c5b0cb61aff84bd50ffdd95b92d.tar.bz2
LibArchive 2016-04-30 (167e97be)
Code extracted from: https://github.com/libarchive/libarchive.git at commit 167e97be1d35c1e0947d768adbf94712244aad6b (master).
Diffstat (limited to 'libarchive/archive_hmac_private.h')
-rw-r--r--libarchive/archive_hmac_private.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/libarchive/archive_hmac_private.h b/libarchive/archive_hmac_private.h
index 3e48bc3..64de743 100644
--- a/libarchive/archive_hmac_private.h
+++ b/libarchive/archive_hmac_private.h
@@ -30,12 +30,30 @@
#ifndef ARCHIVE_HMAC_PRIVATE_H_INCLUDED
#define ARCHIVE_HMAC_PRIVATE_H_INCLUDED
+/*
+ * On systems that do not support any recognized crypto libraries,
+ * the archive_hmac.c file is expected to define no usable symbols.
+ *
+ * But some compilers and linkers choke on empty object files, so
+ * define a public symbol that will always exist. This could
+ * be removed someday if this file gains another always-present
+ * symbol definition.
+ */
+int __libarchive_hmac_build_hack(void);
+
#ifdef __APPLE__
+# include <AvailabilityMacros.h>
+# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+# define ARCHIVE_HMAC_USE_Apple_CommonCrypto
+# endif
+#endif
+
+#ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto
#include <CommonCrypto/CommonHMAC.h>
typedef CCHmacContext archive_hmac_sha1_ctx;
-#elif defined(_WIN32) && !defined(__CYGWIN__)
+#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
#include <bcrypt.h>
typedef struct {
@@ -46,7 +64,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;