xref: /aoo42x/main/openssl/openssl.patch (revision 97977252)
1diff --git misc/build/openssl-3.0.13/crypto/bio/bio_sock2.c misc/build/openssl-3.0.13/crypto/bio/bio_sock2.c
2index 8bdad0c0b6..e52cd4f00e 100644
3--- misc/build/openssl-3.0.13/crypto/bio/bio_sock2.c
4+++ misc/build/openssl-3.0.13/crypto/bio/bio_sock2.c
5@@ -270,6 +270,10 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
6          * Therefore we always have to use setsockopt here.
7          */
8         on = options & BIO_SOCK_V6_ONLY ? 1 : 0;
9+/* Windows < XP needs this: */
10+#  if !defined(IPPROTO_IPV6)
11+#    define IPPROTO_IPV6 41
12+#  endif
13         if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
14                        (const void *)&on, sizeof(on)) != 0) {
15             ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
16diff --git misc/build/openssl-3.0.13/crypto/init.c misc/build/openssl-3.0.13/crypto/init.c
17index cacf637c89..0728c0a20d 100644
18--- misc/build/openssl-3.0.13/crypto/init.c
19+++ misc/build/openssl-3.0.13/crypto/init.c
20@@ -131,7 +131,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
21
22 #if !defined(OPENSSL_USE_NODELETE) \
23     && !defined(OPENSSL_NO_PINSHARED)
24-# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
25+# if defined(DSO_WIN32) && !defined(_WIN32_WCE) && _WIN32_WINNT >= 0x0500
26     {
27         HMODULE handle = NULL;
28         BOOL ret;
29@@ -659,7 +659,7 @@ int OPENSSL_atexit(void (*handler)(void))
30 #if !defined(OPENSSL_USE_NODELETE)\
31     && !defined(OPENSSL_NO_PINSHARED)
32     {
33-# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
34+# if defined(DSO_WIN32) && !defined(_WIN32_WCE) && _WIN32_WINNT >= 0x0500
35         HMODULE handle = NULL;
36         BOOL ret;
37         union {
38diff --git misc/build/openssl-3.0.13/crypto/threads_win.c misc/build/openssl-3.0.13/crypto/threads_win.c
39index dbeda74d73..c599e88c59 100644
40--- misc/build/openssl-3.0.13/crypto/threads_win.c
41+++ misc/build/openssl-3.0.13/crypto/threads_win.c
42@@ -54,7 +54,7 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
43         return NULL;
44     }
45
46-#  if !defined(_WIN32_WCE)
47+#  if !defined(_WIN32_WCE) && _WIN32_WINNT >= 0x0403
48     /* 0x400 is the spin count value suggested in the documentation */
49     if (!InitializeCriticalSectionAndSpinCount(lock, 0x400)) {
50         OPENSSL_free(lock);
51