changeset 5228:993a6b23f032

upgraded to openssl 3.1.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Apr 2023 09:46:09 +0200
parents 5874e5dd9a38
children 365eb5ea5492 1ade4e65eba3
files NEWS OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-3.0.cmake OrthancFramework/Resources/Patches/openssl-3.0.5.patch OrthancFramework/Resources/Patches/openssl-3.1.0.patch OrthancServer/UnitTestsSources/VersionsTests.cpp
diffstat 5 files changed, 31 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Apr 03 22:31:32 2023 +0200
+++ b/NEWS	Tue Apr 04 09:46:09 2023 +0200
@@ -24,6 +24,8 @@
 * Fix Housekeeper plugin infinite loop if Orthanc is empty.
 * Fix a crash in /tools/reconstruct triggered by the Housekeeper plugin 
   when only changing the StorageCompression.
+* Upgraded dependencies for static builds:
+  - openssl 3.1.0
 
 
 Version 1.11.3 (2023-02-03)
--- a/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-3.0.cmake	Mon Apr 03 22:31:32 2023 +0200
+++ b/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-3.0.cmake	Tue Apr 04 09:46:09 2023 +0200
@@ -20,13 +20,13 @@
 
 
 set(OPENSSL_VERSION_MAJOR 3)
-set(OPENSSL_VERSION_MINOR 0)
-set(OPENSSL_VERSION_PATCH 5)
+set(OPENSSL_VERSION_MINOR 1)
+set(OPENSSL_VERSION_PATCH 0)
 set(OPENSSL_VERSION_PRE_RELEASE "")
 set(OPENSSL_VERSION_FULL "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_PATCH}${OPENSSL_VERSION_PRE_RELEASE}")
 SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-${OPENSSL_VERSION_FULL})
 SET(OPENSSL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/openssl-${OPENSSL_VERSION_FULL}.tar.gz")
-SET(OPENSSL_MD5 "163bb3e58c143793d1dc6a6ec7d185d5")
+SET(OPENSSL_MD5 "f6c520aa2206d4d1fa71ea30b5e9a56d")
 
 if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
   set(FirstRun OFF)
@@ -326,6 +326,8 @@
   # Disable SPARC sources
   ${OPENSSL_SOURCES_DIR}/crypto/bn/bn_sparc.c
   ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
+
+  ${OPENSSL_SOURCES_DIR}/crypto/loongarchcap.c
   )
 
 
--- a/OrthancFramework/Resources/Patches/openssl-3.0.5.patch	Mon Apr 03 22:31:32 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-diff -urEb openssl-3.0.5.orig/crypto/threads_win.c openssl-3.0.5/crypto/threads_win.c
---- openssl-3.0.5.orig/crypto/threads_win.c	2022-08-15 15:37:28.944910076 +0200
-+++ openssl-3.0.5/crypto/threads_win.c	2022-08-15 15:38:34.120081931 +0200
-@@ -207,13 +207,30 @@
- 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.5.orig/providers/implementations/rands/seeding/rand_unix.c openssl-3.0.5/providers/implementations/rands/seeding/rand_unix.c
---- openssl-3.0.5.orig/providers/implementations/rands/seeding/rand_unix.c	2022-08-15 15:37:28.968909770 +0200
-+++ openssl-3.0.5/providers/implementations/rands/seeding/rand_unix.c	2022-08-15 15:39:00.963742658 +0200
-@@ -453,6 +453,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, '.');
-@@ -463,6 +464,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) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Resources/Patches/openssl-3.1.0.patch	Tue Apr 04 09:46:09 2023 +0200
@@ -0,0 +1,19 @@
+diff -urEb openssl-3.1.0.orig/providers/implementations/rands/seeding/rand_unix.c openssl-3.1.0/providers/implementations/rands/seeding/rand_unix.c
+--- openssl-3.1.0.orig/providers/implementations/rands/seeding/rand_unix.c	2023-04-04 09:23:30.574295136 +0200
++++ openssl-3.1.0/providers/implementations/rands/seeding/rand_unix.c	2023-04-04 09:23:57.766784026 +0200
+@@ -452,6 +452,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, '.');
+@@ -462,6 +463,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) {
--- a/OrthancServer/UnitTestsSources/VersionsTests.cpp	Mon Apr 03 22:31:32 2023 +0200
+++ b/OrthancServer/UnitTestsSources/VersionsTests.cpp	Tue Apr 04 09:46:09 2023 +0200
@@ -167,11 +167,11 @@
 #if ORTHANC_ENABLE_SSL == 1
 TEST(Version, OpenSslStatic)
 {
-  // openssl-3.0.5
-  ASSERT_EQ(3 * 0x10000000L +
-            0 * 0x00100000L +
-            1 * 0x00000050L +
-            0 * 0x0000000fL, OPENSSL_VERSION_NUMBER);
+  // openssl-3.1.0
+  // https://www.openssl.org/docs/man3.0/man3/OPENSSL_VERSION_NUMBER.html
+  ASSERT_EQ(3 /* major */ * 0x10000000L +
+            1 /* minor */ * 0x00100000L +
+            0 /* patch */ * 0x00000010L, OPENSSL_VERSION_NUMBER);
 }
 #endif