]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Remove direct includes of windows.h where possible
authorTomas Mraz <tomas@openssl.foundation>
Thu, 18 Jun 2026 13:51:58 +0000 (15:51 +0200)
committerNeil Horman <nhorman@openssl.org>
Sat, 20 Jun 2026 11:00:32 +0000 (07:00 -0400)
It should be included via e_os.h instead.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Jun 20 11:00:42 2026
(Merged from https://github.com/openssl/openssl/pull/31587)

16 files changed:
crypto/LPdir_win.c
crypto/armcap.c
crypto/async/arch/async_win.c
crypto/async/async_local.h
crypto/comp/c_brotli.c
crypto/comp/c_zlib.c
crypto/comp/c_zstd.c
crypto/mem_sec.c
crypto/rand/rand_deprecated.c
crypto/rand/randfile.c
crypto/sleep.c
crypto/thread/arch/thread_win.c
crypto/threads_win.c
crypto/ui/ui_openssl.c
include/internal/thread_arch.h
providers/implementations/rands/seeding/rand_win.c

index bc5cec35d9875d5073bd673185e83b534d813951..e8141cab8687fc435ac6b62dc92f386e3adf29b0 100644 (file)
@@ -36,8 +36,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <windows.h>
 #include <tchar.h>
+#include "internal/e_os.h"
 #include "internal/numbers.h"
 #ifndef LPDIR_H
 #include "LPdir.h"
index cdb8336b13ab32b514d2e2d0d5ab83a34cf3b45b..bd978dc86db0648651375c40f64a068191994748 100644 (file)
@@ -19,7 +19,7 @@
 #endif
 #include "internal/cryptlib.h"
 #ifdef _WIN32
-#include <windows.h>
+#include "internal/e_os.h"
 #else
 #include <unistd.h>
 #endif
index 849da5c3c41b351e2d0e6f3707fe41f4d650b35b..2ca4ed6a931904cc97f27129444c30069c0c7f04 100644 (file)
@@ -12,7 +12,7 @@
 
 #ifdef ASYNC_WIN
 
-#include <windows.h>
+#include "internal/e_os.h"
 #include "internal/cryptlib.h"
 
 int ASYNC_is_capable(void)
index e1d1113464640b1114f71b22ef8afb696c399e37..f10a6745f8824c312e02630c9e76f804bae2a083 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/e_os2.h>
+#include <internal/e_os.h>
 
 typedef struct async_ctx_st async_ctx;
 typedef struct async_pool_st async_pool;
@@ -29,7 +30,6 @@ typedef struct async_pool_st async_pool;
 #define ASYNC_WIN
 #define ASYNC_ARCH
 
-#include <windows.h>
 #include "internal/cryptlib.h"
 
 typedef struct async_fibre_st {
index d262ec6a4ef4cbc1d75bdd70aa869658c78cc663..9c99e066b78d6278a817fcfe971fe1c478c2e98d 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <openssl/objects.h>
+#include "internal/e_os.h"
 #include "internal/comp.h"
 #include <openssl/err.h>
 #include "crypto/cryptlib.h"
@@ -46,10 +47,6 @@ static void brotli_free(void *opaque, void *address)
  * work.  Therefore, all BROTLI routines are loaded at run time
  * and we do not link to a .LIB file when BROTLI_SHARED is set.
  */
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-#include <windows.h>
-#endif
-
 #ifdef BROTLI_SHARED
 #include "internal/dso.h"
 
index c90c7b090db5939140c0eef17163ef24bca251d0..4af4e30b64b13b929b1de974c9e930e3b3b58926 100644 (file)
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <openssl/objects.h>
+#include "internal/e_os.h"
 #include "internal/comp.h"
 #include <openssl/err.h>
 #include "crypto/cryptlib.h"
@@ -64,10 +65,6 @@ static COMP_METHOD zlib_stateful_method = {
  * work.  Therefore, all ZLIB routines are loaded at run time
  * and we do not link to a .LIB file when ZLIB_SHARED is set.
  */
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-#include <windows.h>
-#endif /* !(OPENSSL_SYS_WINDOWS || \
-        * OPENSSL_SYS_WIN32) */
 
 #ifdef ZLIB_SHARED
 #include "internal/dso.h"
index a9c881f8f9ca9900fde0a54fdcd6fcca43fafbd1..c5c6cd6eef9dd31bc7919513f0545b9f6429a646 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <openssl/objects.h>
+#include "internal/e_os.h"
 #include "internal/comp.h"
 #include <openssl/err.h>
 #include "crypto/cryptlib.h"
@@ -62,16 +63,6 @@ static ZSTD_customMem zstd_mem_funcs = {
 };
 #endif
 
-/*
- * When OpenSSL is built on Windows, we do not want to require that
- * the LIBZSTD.DLL be available in order for the OpenSSL DLLs to
- * work.  Therefore, all ZSTD routines are loaded at run time
- * and we do not link to a .LIB file when ZSTD_SHARED is set.
- */
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-#include <windows.h>
-#endif
-
 #ifdef ZSTD_SHARED
 #include "internal/dso.h"
 
index 3c5de4de8f27515c6d60f62d9b7d3abc7b3794fe..a727d2008dd89e7b38284e97da0513ccc635c5a9 100644 (file)
@@ -23,7 +23,6 @@
 
 #ifndef OPENSSL_NO_SECURE_MEMORY
 #if defined(_WIN32)
-#include <windows.h>
 #if defined(WINAPI_FAMILY_PARTITION)
 #if !defined(WINAPI_PARTITION_SYSTEM)
 #define WINAPI_PARTITION_SYSTEM 0
index d838f3cd708d8205405995212a6c4212241979b0..07b6ff04e8da708e425e9fa38421a5323f8f9431 100644 (file)
@@ -12,7 +12,6 @@
 #include <openssl/rand.h>
 
 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-#include <windows.h>
 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
 
 #define DEPRECATED_RAND_FUNCTIONS_DEFINED
index ab059bb5e86f252881f4a41210af6cd321d2eb83..b1881dac9771ed9e473cfb66f44a7cfc77213cfd 100644 (file)
@@ -36,7 +36,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #if defined(_WIN32) && !defined(_WIN32_WCE)
-#include <windows.h>
 #include <io.h>
 #define stat _stat
 #define chmod _chmod
index 9273995be682b783f5084e92c6bd7e16cb4a0e91..3d8be852c9106d4abc24039b4527e04debca0f14 100644 (file)
@@ -67,7 +67,6 @@ static void ossl_sleep_millis(uint64_t millis)
 
 #endif
 #elif defined(_WIN32) && !defined(OPENSSL_SYS_UEFI)
-#include <windows.h>
 
 static void ossl_sleep_millis(uint64_t millis)
 {
index b26a1d917a66bab80d86189ab165d6b018e584be..1026ed3de369aacf11d3856c0c518beaedc0bac3 100644 (file)
@@ -7,11 +7,11 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <internal/thread_arch.h>
+#include "internal/thread_arch.h"
+#include "internal/e_os.h"
 
 #if defined(OPENSSL_THREADS_WINNT)
 #include <process.h>
-#include <windows.h>
 
 static unsigned __stdcall thread_start_thunk(LPVOID vthread)
 {
index 4fedf24e90c0b8598567710d7b6185dd68e6ae25..448c9096308174890cb942dedd247af216a9a516 100644 (file)
@@ -7,14 +7,13 @@
  * https://www.openssl.org/source/license.html
  */
 
-#if defined(_WIN32)
-#include <windows.h>
+#include "internal/e_os.h"
+
 #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
 #define USE_RWLOCK
 #endif
-#endif
-#include <assert.h>
 
+#include <assert.h>
 #include <openssl/crypto.h>
 #include <crypto/cryptlib.h>
 #include "internal/common.h"
index 1da5369287e750de37f836f819c221b21437396c..8715ff068eeafb94100a54387a9bf34c26b6f4dd 100644 (file)
@@ -60,7 +60,6 @@
 #endif
 
 #ifdef WIN_CONSOLE_BUG
-#include <windows.h>
 #ifndef OPENSSL_SYS_WINCE
 #include <wincon.h>
 #endif
index d7fc08a8afaaa35b203a4686c82879baaea6bfe0..73e6e0d1e7fd0a404265b8dab5eec2d898646a74 100644 (file)
 #define OSSL_INTERNAL_THREAD_ARCH_H
 #include <openssl/configuration.h>
 #include <openssl/e_os2.h>
+#include "internal/e_os.h"
 #include "internal/time.h"
 
-#if defined(_WIN32)
-#include <windows.h>
-#endif
-
 #if defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_UNIX)
 #define OPENSSL_THREADS_POSIX
 #elif defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_VMS)
index 63b523b729f37f0f6d17ba3f18a88ec2051b7e7e..9b889e38bced6d7b53f012e2bee4ffa91535f6a1 100644 (file)
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include "internal/e_os.h" /* For windows.h */
 #include "internal/cryptlib.h"
 #include <openssl/rand.h>
 #include "crypto/rand_pool.h"
@@ -19,7 +20,6 @@
 #error "Unsupported seeding method configured; must be os"
 #endif
 
-#include <windows.h>
 /* On Windows Vista or higher use BCrypt instead of the legacy CryptoAPI */
 #if defined(_MSC_VER) && _MSC_VER > 1500 /* 1500 = Visual Studio 2008 */ \
     && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600