annotate OrthancFramework/Resources/Patches/openssl-3.0.0-beta1.patch @ 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 312e0e29de90
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4709
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
1 diff -urEb openssl-3.0.0-beta1.orig/crypto/threads_win.c openssl-3.0.0-beta1/crypto/threads_win.c
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
2 --- openssl-3.0.0-beta1.orig/crypto/threads_win.c 2021-06-22 10:11:05.149557746 +0200
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
3 +++ openssl-3.0.0-beta1/crypto/threads_win.c 2021-06-22 10:24:32.510628161 +0200
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
4 @@ -208,13 +208,32 @@
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
5 int CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret,
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
6 CRYPTO_RWLOCK *lock)
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
7 {
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
8 +#if defined(_WIN32) && !defined(_WIN64)
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
9 + /**
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
10 + * Prevents the following error, at least on Visual Studio 2008,
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
11 + * but most probably on any Window 32bit system:
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
12 + * "CoreLibrary.lib(threads_win.obj) : error LNK2019: unresolved
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
13 + * external symbol _InterlockedOr64 referenced in function
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
14 + * _CRYPTO_atomic_or". TODO - The lock should be locked!
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
15 + * https://developercommunity.visualstudio.com/t/-interlockedexchangeadd64-is-unresolved-on-x86/1227636
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
16 + **/
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
17 + *ret = (*val) | op;
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
18 +#else
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
19 *ret = (uint64_t)InterlockedOr64((LONG64 volatile *)val, (LONG64)op) | op;
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
20 +#endif
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
21 +
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
22 return 1;
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
23 }
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
24
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
25 int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock)
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
26 {
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
27 +#if defined(_WIN32) && !defined(_WIN64)
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
28 + /* See comment above */
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
29 + *ret = *val;
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
30 +#else
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
31 *ret = (uint64_t)InterlockedOr64((LONG64 volatile *)val, 0);
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
32 +#endif
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
33 +
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
34 return 1;
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
35 }
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
36
4702
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 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
4709
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
38 --- openssl-3.0.0-beta1.orig/providers/implementations/rands/seeding/rand_unix.c 2021-06-22 10:11:05.177557799 +0200
a9a75281cae9 fix build on MSVC 2008 32bit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4702
diff changeset
39 +++ openssl-3.0.0-beta1/providers/implementations/rands/seeding/rand_unix.c 2021-06-22 10:12:19.449692057 +0200
4702
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 @@ -447,6 +447,7 @@
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 * system call and this should always succeed which renders
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 * this alternative but essentially identical source moot.
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 */
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 +#if !defined(__LSB_VERSION__) // "syscall()" is not available in LSB
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 if (uname(&un) == 0) {
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 kernel[0] = atoi(un.release);
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 p = strchr(un.release, '.');
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 @@ -457,6 +458,7 @@
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 return 0;
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 }
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 +#endif
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 /* Open /dev/random and wait for it to be readable */
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 if ((fd = open(DEVRANDOM_WAIT, O_RDONLY)) != -1) {
312e0e29de90 compilation using openssl-3.0.0-beta1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 if (DEVRANDM_WAIT_USE_SELECT && fd < FD_SETSIZE) {