]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
libarchive: fix Windows compilation with ENABLE_CNG=OFF 2966/head
authorAlexander Lobakin <alobakin@mailbox.org>
Tue, 21 Apr 2026 20:50:18 +0000 (22:50 +0200)
committerAlexander Lobakin <alobakin@mailbox.org>
Tue, 21 Apr 2026 20:50:18 +0000 (22:50 +0200)
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 <bcrypt.h> 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 <alobakin@mailbox.org>
libarchive/archive_random.c
libarchive/archive_util.c

index cf7adc8297d1ad939676fbb2fd982c27135c839c..28cba00bd3cd0fc6723b65a8e676b45bfc9754e8 100644 (file)
@@ -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 <bcrypt.h>
 
 /* Common in other bcrypt implementations, but missing from VS2008. */
index 38371ea2a416a82c074555f294149142a9530a28..e725a6d7680add912b3e70727ead151792ca40db 100644 (file)
@@ -42,7 +42,6 @@
 #include <string.h>
 #endif
 #if defined(_WIN32) && !defined(__CYGWIN__)
-#if defined(HAVE_BCRYPT_H)
 #include <bcrypt.h>
 
 /* 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 <zlib.h>
 #endif