]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Don't use Windows bcrypt when building for Windows XP or older (#2374)
authorSteve Lhomme <robux4@ycbcr.xyz>
Wed, 9 Oct 2024 04:06:57 +0000 (21:06 -0700)
committerGitHub <noreply@github.com>
Wed, 9 Oct 2024 04:06:57 +0000 (21:06 -0700)
The header may be detected but we can't use the calls.

The same check is already done in many places but not all of them.

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

index 437dba06be62ba66718a268249b2c8caa6ac2597..1825af4dc5100c13b1341c6103dbb31cbd43c9aa 100644 (file)
@@ -57,7 +57,7 @@ pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
        return 0;
 }
 
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
+#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
 #ifdef _MSC_VER
 #pragma comment(lib, "Bcrypt.lib")
 #endif
@@ -197,7 +197,7 @@ aes_ctr_release(archive_crypto_ctx *ctx)
        return 0;
 }
 
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
+#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
 
 static int
 aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
index 16b6d16ff23cca5e42838fdc28139c3b845f1151..c13f29260a07bc0d0763fe110461d9196f00c06c 100644 (file)
@@ -62,7 +62,7 @@ typedef struct {
        unsigned        encr_pos;
 } archive_crypto_ctx;
 
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
+#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
 #include <bcrypt.h>
 
 /* Common in other bcrypt implementations, but missing from VS2008. */
index edb3bf5abd42102f4de40a79451e43a2654196ae..210cca70744dd9e9db9d53b7ce07908a2adeeb08 100644 (file)
@@ -74,7 +74,7 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
        memset(ctx, 0, sizeof(*ctx));
 }
 
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
+#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
 
 #ifndef BCRYPT_HASH_REUSABLE_FLAG
 # define BCRYPT_HASH_REUSABLE_FLAG 0x00000020
index d0fda7f9667a01d999b9da0e408167f194b779cd..1b24ddd1bc94adb5e3418852449f8a2c956f9c2f 100644 (file)
@@ -52,7 +52,7 @@ int __libarchive_hmac_build_hack(void);
 
 typedef        CCHmacContext archive_hmac_sha1_ctx;
 
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
+#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
 #include <bcrypt.h>
 
 typedef struct {