Browse Source

Issue 2268 – Cannot start on Windows XP

https://winscp.net/tracker/2268
(cherry picked from commit c9b7c2cc3554fb3d94c7d9bb67cb3ade21d914eb)

Source commit: 58ef1c11f6d39b2fffff1406d0a4f7309c6e4aa4
Martin Prikryl 1 year ago
parent
commit
fa24a52718

+ 4 - 4
libs/openssl/Makefile

@@ -23,7 +23,7 @@ CFLAG= \
     -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_WHIRLPOOL \
     -DOPENSSL_NO_SEED -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_ENGINE -DOPENSSL_NO_ZLIB \
     -DOPENSSL_NO_QUIC -DOPENSSL_NO_BROTLI -DOPENSSL_NO_COMP -DOPENSSL_NO_COMP_ALG \
-    -DOPENSSL_NO_TFO \
+    -DOPENSSL_NO_TFO -DOPENSSL_NO_ASYNC \
     -DNO_INTERLOCKEDOR64 \
     -DWINSCP
 
@@ -272,7 +272,7 @@ CRYPTOOBJ= \
     $(OBJ_D)\ct_sct.obj $(OBJ_D)\ct_log.obj $(OBJ_D)\ct_policy.obj $(OBJ_D)\ct_sct_ctx.obj \
     $(OBJ_D)\ct_b64.obj $(OBJ_D)\ct_vfy.obj \
     $(OBJ_D)\async.obj $(OBJ_D)\async_err.obj $(OBJ_D)\async_wait.obj \
-    $(OBJ_D)\async_win.obj \
+    $(OBJ_D)\async_null.obj \
     $(OBJ_D)\ecdh_kdf.obj \
     $(OBJ_D)\store_lib.obj $(OBJ_D)\store_init.obj $(OBJ_D)\store_register.obj $(OBJ_D)\store_err.obj \
     $(OBJ_D)\store_meth.obj $(OBJ_D)\store_result.obj \
@@ -2273,8 +2273,8 @@ $(OBJ_D)\async_err.obj: $(SRC_D)\crypto\async\async_err.c
 $(OBJ_D)\async_wait.obj: $(SRC_D)\crypto\async\async_wait.c
     $(CC) -o$(OBJ_D)\async_wait.obj  $(LIB_CFLAGS) -c $(SRC_D)\crypto\async\async_wait.c
 
-$(OBJ_D)\async_win.obj: $(SRC_D)\crypto\async\arch\async_win.c
-    $(CC) -o$(OBJ_D)\async_win.obj  $(LIB_CFLAGS) -c $(SRC_D)\crypto\async\arch\async_win.c
+$(OBJ_D)\async_null.obj: $(SRC_D)\crypto\async\arch\async_null.c
+    $(CC) -o$(OBJ_D)\async_null.obj  $(LIB_CFLAGS) -c $(SRC_D)\crypto\async\arch\async_null.c
 
 $(OBJ_D)\ecdh_kdf.obj: $(SRC_D)\crypto\ec\ecdh_kdf.c
     $(CC) -o$(OBJ_D)\ecdh_kdf.obj  $(LIB_CFLAGS) -c $(SRC_D)\crypto\ec\ecdh_kdf.c

+ 38 - 0
libs/openssl/crypto/async/arch/async_null.c

@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/* This must be the first #include file */
+#include "../async_local.h"
+
+#ifdef ASYNC_NULL
+int ASYNC_is_capable(void)
+{
+    return 0;
+}
+
+int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn,
+                            ASYNC_stack_free_fn free_fn)
+{
+    return 0;
+}
+
+void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn,
+                             ASYNC_stack_free_fn *free_fn)
+{
+    if (alloc_fn != NULL)
+        *alloc_fn = NULL;
+    if (free_fn != NULL)
+        *free_fn = NULL;
+}
+
+void async_local_cleanup(void)
+{
+}
+#endif
+

+ 0 - 74
libs/openssl/crypto/async/arch/async_win.c

@@ -1,74 +0,0 @@
-/*
- * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/* This must be the first #include file */
-#include "../async_local.h"
-
-#ifdef ASYNC_WIN
-
-# include <windows.h>
-# include "internal/cryptlib.h"
-
-int ASYNC_is_capable(void)
-{
-    return 1;
-}
-
-int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn,
-                            ASYNC_stack_free_fn free_fn)
-{
-    return 0;
-}
-
-void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn,
-                             ASYNC_stack_free_fn *free_fn)
-{
-    if (alloc_fn != NULL)
-        *alloc_fn = NULL;
-    if (free_fn != NULL)
-        *free_fn = NULL;
-}
-
-void async_local_cleanup(void)
-{
-    async_ctx *ctx = async_get_ctx();
-    if (ctx != NULL) {
-        async_fibre *fibre = &ctx->dispatcher;
-        if (fibre != NULL && fibre->fibre != NULL && fibre->converted) {
-            ConvertFiberToThread();
-            fibre->fibre = NULL;
-        }
-    }
-}
-
-int async_fibre_init_dispatcher(async_fibre *fibre)
-{
-# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
-    fibre->fibre = ConvertThreadToFiberEx(NULL, FIBER_FLAG_FLOAT_SWITCH);
-# else
-    fibre->fibre = ConvertThreadToFiber(NULL);
-# endif
-    if (fibre->fibre == NULL) {
-        fibre->converted = 0;
-        fibre->fibre = GetCurrentFiber();
-        if (fibre->fibre == NULL)
-            return 0;
-    } else {
-        fibre->converted = 1;
-    }
-
-    return 1;
-}
-
-VOID CALLBACK async_start_func_win(PVOID unused)
-{
-    async_start_func();
-}
-
-#endif

+ 1 - 1
libs/openssl/crypto/threads_win.c

@@ -10,7 +10,7 @@
 #if defined(_WIN32)
 # include <windows.h>
 # if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
-#  define USE_RWLOCK
+// WINSCP #  define USE_RWLOCK
 # endif
 #endif