windows: Enable building Privoxy with OpenSSL
authorLee <ler762@users.sourceforge.net>
Wed, 9 Aug 2023 07:47:37 +0000 (03:47 -0400)
committerLee <ler762@users.sourceforge.net>
Wed, 9 Aug 2023 07:47:37 +0000 (03:47 -0400)
- openssl.c

I got random crashes when using openssl on windows; fixed with
  #include <openssl/applink.c>
I don't understand
  https://www.openssl.org/docs/faq.html
it seems to be applicable only to calling DLLs but even with
no DLLs involved that include also fixes the crashes that happen
when statically linking openssl

- project.h

pull in the required gunk for windows

openssl.c
project.h

index 2841c12..4b1fceb 100644 (file)
--- a/openssl.c
+++ b/openssl.c
 #include <openssl/pem.h>
 #include <openssl/md5.h>
 #include <openssl/x509v3.h>
+#ifdef _WIN32
+/* https://www.openssl.org/docs/faq.html
+   I’ve compiled a program under Windows and it crashes: Why?
+   tl,dr: because it needs this include:
+*/
+#include <openssl/applink.c>
+#endif /* _WIN32 */
 
 #include "config.h"
 #include "project.h"
index b203ad3..04fbe8e 100644 (file)
--- a/project.h
+++ b/project.h
 
 #ifdef FEATURE_HTTPS_INSPECTION_OPENSSL
 #ifdef _WIN32
+#include <windef.h>
+#include <minwindef.h>
+#include <basetsd.h>
+#include <minwinbase.h>
 #include <wincrypt.h>
 #undef X509_NAME
 #undef X509_EXTENSIONS