From: Alexander Lobakin Date: Tue, 21 Apr 2026 20:50:18 +0000 (+0200) Subject: libarchive: fix Windows compilation with ENABLE_CNG=OFF X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15b133b372c8e78ccdecd7db0d4fc458590f2330;p=thirdparty%2Flibarchive.git libarchive: fix Windows compilation with ENABLE_CNG=OFF Currently, libarchive_{random,util}.c use a couple bcrypt functions regardless of whether HAVE_BCRYPT_H is defined as there are no other implementations for Windows, but the actual header is included only under this macro. To be able to build libarchive with ENABLE_CNG=OFF (for example, to prefer a different crypto/digest engine) on Windows, don't guard the include in these two files. In that case, bcrypt will still be used, but only as an RNG. This won't break anything because, as mentioned above, bcrypt is used unconditionally here and if it's not present in the system, the library won't build either way, with or without the change. At least until we implement an RNG for Windows based on something else. Signed-off-by: Alexander Lobakin --- diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c index cf7adc829..28cba00bd 100644 --- a/libarchive/archive_random.c +++ b/libarchive/archive_random.c @@ -57,7 +57,7 @@ static void la_arc4random_buf(void *, size_t); #include "archive.h" #include "archive_random_private.h" -#if defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#if defined(_WIN32) && !defined(__CYGWIN__) #include /* Common in other bcrypt implementations, but missing from VS2008. */ diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c index 38371ea2a..e725a6d76 100644 --- a/libarchive/archive_util.c +++ b/libarchive/archive_util.c @@ -42,7 +42,6 @@ #include #endif #if defined(_WIN32) && !defined(__CYGWIN__) -#if defined(HAVE_BCRYPT_H) #include /* Common in other bcrypt implementations, but missing from VS2008. */ @@ -50,7 +49,6 @@ #define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS) #endif #endif -#endif #ifdef HAVE_ZLIB_H #include #endif