aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <buster@gmail.com>2023-03-15 17:33:08 -0600
committerBrent Cook <buster@gmail.com>2023-03-15 18:49:29 -0600
commit977be09d69a9f9b7eaf85dbd83465c0ec8361598 (patch)
tree2955551a974a3a54b4593236ae202731b0ea0a8c
parent047fddbee9f34c16a82e66ecbe1058bb8810e82f (diff)
downloadportable-977be09d69a9f9b7eaf85dbd83465c0ec8361598.tar.gz
portable-977be09d69a9f9b7eaf85dbd83465c0ec8361598.tar.bz2
portable-977be09d69a9f9b7eaf85dbd83465c0ec8361598.zip
Fix build for MSVC
-rw-r--r--patches/crypto_namespace.h.patch33
-rw-r--r--patches/libcrypto.hidden.patch120
-rw-r--r--patches/libssl.hidden.patch15
-rw-r--r--patches/opensslfeatures.h.patch16
-rw-r--r--patches/ssl_namespace.h.patch32
5 files changed, 192 insertions, 24 deletions
diff --git a/patches/crypto_namespace.h.patch b/patches/crypto_namespace.h.patch
index 2751524..171e7f5 100644
--- a/patches/crypto_namespace.h.patch
+++ b/patches/crypto_namespace.h.patch
@@ -1,13 +1,22 @@
1--- crypto/hidden/crypto_namespace.h.orig 2023-02-28 00:41:43.212756628 -0600 1--- openbsd/src/lib/libcrypto/hidden/crypto_namespace.h 2023-03-15 11:41:37.614024500 -0600
2+++ crypto/hidden/crypto_namespace.h 2023-02-28 00:42:01.152756349 -0600 2+++ crypto/hidden/crypto_namespace.h 2023-03-15 17:12:55.297157400 -0600
3@@ -18,6 +18,10 @@ 3@@ -24,6 +24,12 @@
4 #ifndef _LIBCRYPTO_CRYPTO_NAMESPACE_H_ 4 * external calls use the latter name.
5 #define _LIBCRYPTO_CRYPTO_NAMESPACE_H_ 5 */
6 6
7+#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__) 7+#ifdef _MSC_VER
8+#define __attribute__(a) 8+# define LCRYPTO_UNUSED(x)
9+#endif 9+# define LCRYPTO_USED(x)
10+ 10+# define LCRYPTO_ALIAS1(pre, x)
11 /* 11+# define LCRYPTO_ALIAS(x)
12 * If marked as 'used', then internal calls use the name with prefix "_lcry_" 12+#else
13 * and we alias that to the normal name *and* the name with prefix "_libre_"; 13 #ifdef LIBRESSL_NAMESPACE
14 # define LCRYPTO_UNUSED(x) typeof(x) x __attribute__((deprecated))
15 #ifdef LIBRESSL_CRYPTO_NAMESPACE
16@@ -40,5 +46,6 @@
17 # define LCRYPTO_ALIAS1(pre,x)
18 # define LCRYPTO_ALIAS(x) asm("")
19 #endif
20+#endif /* _MSC_VER */
21
22 #endif /* _LIBCRYPTO_CRYPTO_NAMESPACE_H_ */
diff --git a/patches/libcrypto.hidden.patch b/patches/libcrypto.hidden.patch
new file mode 100644
index 0000000..a00a3dd
--- /dev/null
+++ b/patches/libcrypto.hidden.patch
@@ -0,0 +1,120 @@
1diff -u openbsd/src/lib/libcrypto/hidden/openssl/hmac.h crypto/hidden/openssl/hmac.h
2--- openbsd/src/lib/libcrypto/hidden/openssl/hmac.h 2023-03-15 11:41:37.632580800 -0600
3+++ crypto/hidden/openssl/hmac.h 2023-03-15 16:49:29.144080400 -0600
4@@ -18,7 +18,11 @@
5 #ifndef _LIBCRYPTO_HMAC_H_
6 #define _LIBCRYPTO_HMAC_H_
7
8+#ifdef _MSC_VER
9+#include <../include/openssl/hmac.h>
10+#else
11 #include_next <openssl/hmac.h>
12+#endif
13 #include "crypto_namespace.h"
14
15 LCRYPTO_USED(HMAC_CTX_new);
16diff -u openbsd/src/lib/libcrypto/hidden/openssl/pkcs12.h crypto/hidden/openssl/pkcs12.h
17--- openbsd/src/lib/libcrypto/hidden/openssl/pkcs12.h 2023-03-15 11:41:37.648024900 -0600
18+++ crypto/hidden/openssl/pkcs12.h 2023-03-15 17:15:36.015981800 -0600
19@@ -18,7 +18,11 @@
20 #ifndef _LIBCRYPTO_PKCS12_H
21 #define _LIBCRYPTO_PKCS12_H
22
23+#ifdef _MSC_VER
24+#include <../include/openssl/pkcs12.h>
25+#else
26 #include_next <openssl/pkcs12.h>
27+#endif
28 #include "crypto_namespace.h"
29
30 LCRYPTO_USED(PKCS12_SAFEBAG_get0_attr);
31diff -u openbsd/src/lib/libcrypto/hidden/openssl/pkcs7.h crypto/hidden/openssl/pkcs7.h
32--- openbsd/src/lib/libcrypto/hidden/openssl/pkcs7.h 2023-03-15 11:41:37.663599200 -0600
33+++ crypto/hidden/openssl/pkcs7.h 2023-03-15 16:53:43.232866600 -0600
34@@ -18,7 +18,11 @@
35 #ifndef _LIBCRYPTO_PKCS7_H
36 #define _LIBCRYPTO_PKCS7_H
37
38+#ifdef _MSC_VER
39+#include <../include/openssl/pkcs7.h>
40+#else
41 #include_next <openssl/pkcs7.h>
42+#endif
43 #include "crypto_namespace.h"
44
45 LCRYPTO_USED(PKCS7_ISSUER_AND_SERIAL_new);
46diff -u openbsd/src/lib/libcrypto/hidden/openssl/stack.h crypto/hidden/openssl/stack.h
47--- openbsd/src/lib/libcrypto/hidden/openssl/stack.h 2023-03-15 11:41:37.680453800 -0600
48+++ crypto/hidden/openssl/stack.h 2023-03-15 16:49:29.200142600 -0600
49@@ -18,7 +18,11 @@
50 #ifndef _LIBCRYPTO_STACK_H
51 #define _LIBCRYPTO_STACK_H
52
53+#ifdef _MSC_VER
54+#include <../include/openssl/stack.h>
55+#else
56 #include_next <openssl/stack.h>
57+#endif
58 #include "crypto_namespace.h"
59
60 LCRYPTO_USED(sk_num);
61diff -u openbsd/src/lib/libcrypto/hidden/openssl/ui.h crypto/hidden/openssl/ui.h
62--- openbsd/src/lib/libcrypto/hidden/openssl/ui.h 2023-03-15 11:41:37.696291800 -0600
63+++ crypto/hidden/openssl/ui.h 2023-03-15 16:49:29.222310800 -0600
64@@ -18,7 +18,11 @@
65 #ifndef _LIBCRYPTO_UI_H
66 #define _LIBCRYPTO_UI_H
67
68+#ifdef _MSC_VER
69+#include <../include/openssl/ui.h>
70+#else
71 #include_next <openssl/ui.h>
72+#endif
73 #include "crypto_namespace.h"
74
75 LCRYPTO_USED(UI_new);
76diff -u openbsd/src/lib/libcrypto/hidden/openssl/x509.h crypto/hidden/openssl/x509.h
77--- openbsd/src/lib/libcrypto/hidden/openssl/x509.h 2023-03-15 11:41:37.713302600 -0600
78+++ crypto/hidden/openssl/x509.h 2023-03-15 16:49:29.238904200 -0600
79@@ -18,7 +18,11 @@
80 #ifndef _LIBCRYPTO_X509_H
81 #define _LIBCRYPTO_X509_H
82
83+#ifdef _MSC_VER
84+#include <../include/openssl/x509.h>
85+#else
86 #include_next <openssl/x509.h>
87+#endif
88 #include "crypto_namespace.h"
89
90 LCRYPTO_USED(X509_CRL_up_ref);
91diff -u openbsd/src/lib/libcrypto/hidden/openssl/x509v3.h crypto/hidden/openssl/x509v3.h
92--- openbsd/src/lib/libcrypto/hidden/openssl/x509v3.h 2023-03-15 11:41:37.756379100 -0600
93+++ crypto/hidden/openssl/x509v3.h 2023-03-15 16:49:29.264482800 -0600
94@@ -18,7 +18,11 @@
95 #ifndef _LIBCRYPTO_X509V3_H
96 #define _LIBCRYPTO_X509V3_H
97
98+#ifdef _MSC_VER
99+#include <../include/openssl/x509v3.h>
100+#else
101 #include_next <openssl/x509v3.h>
102+#endif
103 #include "crypto_namespace.h"
104
105 LCRYPTO_USED(PROXY_POLICY_new);
106diff -u openbsd/src/lib/libcrypto/hidden/openssl/x509_vfy.h crypto/hidden/openssl/x509_vfy.h
107--- openbsd/src/lib/libcrypto/hidden/openssl/x509_vfy.h 2023-03-15 11:41:37.735995100 -0600
108+++ crypto/hidden/openssl/x509_vfy.h 2023-03-15 16:49:29.300450300 -0600
109@@ -18,7 +18,11 @@
110 #ifndef _LIBCRYPTO_X509_VFY_H
111 #define _LIBCRYPTO_X509_VFY_H
112
113+#ifdef _MSC_VER
114+#include <../include/openssl/x509_vfy.h>
115+#else
116 #include_next <openssl/x509_vfy.h>
117+#endif
118 #include "crypto_namespace.h"
119
120 LCRYPTO_USED(X509_STORE_set_depth);
diff --git a/patches/libssl.hidden.patch b/patches/libssl.hidden.patch
new file mode 100644
index 0000000..5a8c2c8
--- /dev/null
+++ b/patches/libssl.hidden.patch
@@ -0,0 +1,15 @@
1diff -u openbsd/src/lib/libssl/hidden/openssl/ssl.h ssl/hidden/openssl/ssl.h
2--- openbsd/src/lib/libssl/hidden/openssl/ssl.h 2023-03-15 11:41:52.466146400 -0600
3+++ ssl/hidden/openssl/ssl.h 2023-03-15 16:49:29.358377300 -0600
4@@ -18,7 +18,11 @@
5 #ifndef _LIBSSL_SSL_H_
6 #define _LIBSSL_SSL_H_
7
8+#ifdef _MSC_VER
9+#include <../include/openssl/ssl.h>
10+#else
11 #include_next <openssl/ssl.h>
12+#endif
13 #include "ssl_namespace.h"
14
15 LSSL_USED(BIO_f_ssl);
diff --git a/patches/opensslfeatures.h.patch b/patches/opensslfeatures.h.patch
new file mode 100644
index 0000000..8ee311d
--- /dev/null
+++ b/patches/opensslfeatures.h.patch
@@ -0,0 +1,16 @@
1--- openbsd/src/lib/libcrypto/opensslfeatures.h 2023-03-15 11:41:47.301015100 -0600
2+++ include/openssl/opensslfeatures.h 2023-03-15 18:27:57.740024800 -0600
3@@ -7,6 +7,13 @@
4 #define LIBRESSL_HAS_TLS1_3
5 #define LIBRESSL_HAS_DTLS1_2
6
7+/*
8+ * Used for compatibility with compilers lacking __attribute__
9+ */
10+#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
11+#define __attribute__(a)
12+#endif
13+
14 #define OPENSSL_THREADS
15
16 #define OPENSSL_NO_BUF_FREELISTS
diff --git a/patches/ssl_namespace.h.patch b/patches/ssl_namespace.h.patch
index 649e862..758f8dc 100644
--- a/patches/ssl_namespace.h.patch
+++ b/patches/ssl_namespace.h.patch
@@ -1,13 +1,21 @@
1--- ssl/hidden/ssl_namespace.h.orig 2023-02-28 00:42:20.928756042 -0600 1--- openbsd/src/lib/libssl/hidden/ssl_namespace.h 2023-03-15 11:41:52.481641800 -0600
2+++ ssl/hidden/ssl_namespace.h 2023-02-28 00:43:16.372755180 -0600 2+++ ssl/hidden/ssl_namespace.h 2023-03-15 17:28:04.685309300 -0600
3@@ -18,6 +18,10 @@ 3@@ -23,6 +23,11 @@
4 #ifndef _LIBSSL_SSL_NAMESPACE_H_
5 #define _LIBSSL_SSL_NAMESPACE_H_
6
7+#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
8+#define __attribute__(a)
9+#endif
10+
11 /*
12 * If marked as 'used', then internal calls use the name with prefix "_lssl_"
13 * and we alias that to the normal name. 4 * and we alias that to the normal name.
5 */
6
7+#ifdef _MSC_VER
8+#define LSSL_UNUSED(x)
9+#define LSSL_USED(x)
10+#define LSSL_ALIAS(x)
11+#else
12 #ifdef LIBRESSL_NAMESPACE
13 #define LSSL_UNUSED(x) typeof(x) x __attribute__((deprecated))
14 #define LSSL_USED(x) __attribute__((visibility("hidden"))) \
15@@ -33,5 +38,6 @@
16 #define LSSL_USED(x)
17 #define LSSL_ALIAS(x) asm("")
18 #endif
19+#endif /* _MSC_VER */
20
21 #endif /* _LIBSSL_SSL_NAMESPACE_H_ */