view OrthancFramework/Resources/Patches/openssl-3.0.0-beta1.patch @ 4743:336571b8952f openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 Jul 2021 09:54:14 +0200
parents a9a75281cae9
children
line wrap: on
line source

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-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.
              */
+#if !defined(__LSB_VERSION__)  // "syscall()" is not available in LSB
             if (uname(&un) == 0) {
                 kernel[0] = atoi(un.release);
                 p = strchr(un.release, '.');
@@ -457,6 +458,7 @@
                     return 0;
                 }
             }
+#endif
             /* Open /dev/random and wait for it to be readable */
             if ((fd = open(DEVRANDOM_WAIT, O_RDONLY)) != -1) {
                 if (DEVRANDM_WAIT_USE_SELECT && fd < FD_SETSIZE) {