changeset 4709:a9a75281cae9 openssl-3.x

fix build on MSVC 2008 32bit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Jun 2021 10:26:27 +0200
parents a53a58489cc0
children 816a9ecc6ea1
files OrthancFramework/Resources/Patches/openssl-3.0.0-beta1.patch
diffstat 1 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/Patches/openssl-3.0.0-beta1.patch	Tue Jun 22 09:29:29 2021 +0200
+++ b/OrthancFramework/Resources/Patches/openssl-3.0.0-beta1.patch	Tue Jun 22 10:26:27 2021 +0200
@@ -1,6 +1,42 @@
+diff -urEb openssl-3.0.0-beta1.orig/crypto/threads_win.c openssl-3.0.0-beta1/crypto/threads_win.c
+--- openssl-3.0.0-beta1.orig/crypto/threads_win.c	2021-06-22 10:11:05.149557746 +0200
++++ openssl-3.0.0-beta1/crypto/threads_win.c	2021-06-22 10:24:32.510628161 +0200
+@@ -208,13 +208,32 @@
+ int CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret,
+                      CRYPTO_RWLOCK *lock)
+ {
++#if defined(_WIN32) && !defined(_WIN64)
++    /**
++     * Prevents the following error, at least on Visual Studio 2008,
++     * but most probably on any Window 32bit system:
++     * "CoreLibrary.lib(threads_win.obj) : error LNK2019: unresolved
++     * external symbol _InterlockedOr64 referenced in function
++     * _CRYPTO_atomic_or". TODO - The lock should be locked!
++     * https://developercommunity.visualstudio.com/t/-interlockedexchangeadd64-is-unresolved-on-x86/1227636
++     **/
++    *ret = (*val) | op;
++#else
+     *ret = (uint64_t)InterlockedOr64((LONG64 volatile *)val, (LONG64)op) | op;
++#endif
++
+     return 1;
+ }
+ 
+ int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock)
+ {
++#if defined(_WIN32) && !defined(_WIN64)
++    /* See comment above */
++    *ret = *val;
++#else
+     *ret = (uint64_t)InterlockedOr64((LONG64 volatile *)val, 0);
++#endif
++
+     return 1;
+ }
+ 
 diff -urEb openssl-3.0.0-beta1.orig/providers/implementations/rands/seeding/rand_unix.c openssl-3.0.0-beta1/providers/implementations/rands/seeding/rand_unix.c
---- openssl-3.0.0-beta1.orig/providers/implementations/rands/seeding/rand_unix.c	2021-06-21 18:25:55.220224494 +0200
-+++ openssl-3.0.0-beta1/providers/implementations/rands/seeding/rand_unix.c	2021-06-21 18:26:44.884237640 +0200
+--- openssl-3.0.0-beta1.orig/providers/implementations/rands/seeding/rand_unix.c	2021-06-22 10:11:05.177557799 +0200
++++ openssl-3.0.0-beta1/providers/implementations/rands/seeding/rand_unix.c	2021-06-22 10:12:19.449692057 +0200
 @@ -447,6 +447,7 @@
               * system call and this should always succeed which renders
               * this alternative but essentially identical source moot.