Include wincrypt.h when compiling with OpenSSL on Windows
authorFabian Keil <fk@fabiankeil.de>
Mon, 21 Sep 2020 13:42:04 +0000 (15:42 +0200)
committerFabian Keil <fk@fabiankeil.de>
Tue, 22 Sep 2020 14:22:04 +0000 (16:22 +0200)
... but undefine X509_NAME and X509_EXTENSIONS.

Fixes:

    x86_64-w64-mingw32-gcc -c -pipe -O2 -Wshadow -DWINVER=0x501   -mwindows
    -Wall -Ipcre  openssl.c -o openssl.o
    In file included from
    P:/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:95,
                     from project.h:62,
                     from openssl.c:42:
    P:/msys64/mingw64/include/openssl/ssl.h:1611:5: error: expected
    specifier-qualifier-list before '(' token
     1611 |     X509_EXTENSIONS *tlsext_ocsp_exts;
          |     ^~~~~~~~~~~~~~~

when using OpenSSL 1.0.2.

Reported and partially submitted by: Hớ Hờ Hợ

project.h

index a9fe894..7918780 100644 (file)
--- a/project.h
+++ b/project.h
 #endif /* FEATURE_HTTPS_INSPECTION_MBEDTLS */
 
 #ifdef FEATURE_HTTPS_INSPECTION_OPENSSL
+#ifdef _WIN32
+#include <wincrypt.h>
+#undef X509_NAME
+#undef X509_EXTENSIONS
+#endif
 #include <openssl/ssl.h>
 #include <openssl/bio.h>
 #include <openssl/err.h>