changeset 4861:d1aae7c3dd5d openssl-3.x

upgraded openssl to 3.0.1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 24 Dec 2021 17:12:49 +0100
parents 3e9a76464e8a
children 0a5d05637701
files NEWS OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-3.0.cmake OrthancFramework/Resources/Patches/openssl-3.0.0-beta1.patch OrthancFramework/Resources/Patches/openssl-3.0.1.patch OrthancServer/UnitTestsSources/VersionsTests.cpp
diffstat 5 files changed, 60 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Dec 24 16:52:51 2021 +0100
+++ b/NEWS	Fri Dec 24 17:12:49 2021 +0100
@@ -13,7 +13,7 @@
   https://en.wikipedia.org/wiki/OpenSSL#Licensing
   https://people.gnome.org/~markmc/openssl-and-the-gpl.html
 * Upgraded dependencies for static builds (notably on Windows and LSB):
-  - openssl 3.0.0-beta1
+  - openssl 3.0.1
 
 General
 -------
--- a/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-3.0.cmake	Fri Dec 24 16:52:51 2021 +0100
+++ b/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-3.0.cmake	Fri Dec 24 17:12:49 2021 +0100
@@ -20,12 +20,12 @@
 
 set(OPENSSL_VERSION_MAJOR 3)
 set(OPENSSL_VERSION_MINOR 0)
-set(OPENSSL_VERSION_PATCH 0)
-set(OPENSSL_VERSION_PRE_RELEASE "-beta1")
+set(OPENSSL_VERSION_PATCH 1)
+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 "437b21bd0e09fbaa0a89151c6c0130a7")
+SET(OPENSSL_MD5 "7d07e849d77d276891edd579a8832bb3")
 
 if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
   set(FirstRun OFF)
@@ -40,7 +40,7 @@
   # Apply the patches
   execute_process(
     COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
-    ${CMAKE_CURRENT_LIST_DIR}/../Patches/openssl-3.0.0-beta1.patch
+    ${CMAKE_CURRENT_LIST_DIR}/../Patches/openssl-${OPENSSL_VERSION_FULL}.patch
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     RESULT_VARIABLE Failure
     )
@@ -81,7 +81,7 @@
   set(VERSION_VERSION_OFFSET 15)
 endif()
 
-math(EXPR OPENSSL_CONFIGURED_API "${OPENSSL_VERSION_MAJOR} * 10000 + ${OPENSSL_VERSION_MINOR} * 100 + ${OPENSSL_VERSION_PATCH}")
+math(EXPR OPENSSL_CONFIGURED_API "${OPENSSL_VERSION_MAJOR} * 10000 + ${OPENSSL_VERSION_MINOR} * 100")
 
 # This macro is normally defined in "opensslv.h.in"
 math(EXPR OPENSSL_VERSION_NUMBER "(${OPENSSL_VERSION_MAJOR} << 28) + (${OPENSSL_VERSION_MINOR} << 20) + (${OPENSSL_VERSION_PATCH} << 4) + ${VERSION_VERSION_OFFSET}")
--- a/OrthancFramework/Resources/Patches/openssl-3.0.0-beta1.patch	Fri Dec 24 16:52:51 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-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) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Resources/Patches/openssl-3.0.1.patch	Fri Dec 24 17:12:49 2021 +0100
@@ -0,0 +1,53 @@
+diff -urEb openssl-3.0.1.orig/crypto/threads_win.c openssl-3.0.1/crypto/threads_win.c
+--- openssl-3.0.1.orig/crypto/threads_win.c	2021-12-24 16:56:23.016304241 +0100
++++ openssl-3.0.1/crypto/threads_win.c	2021-12-24 16:58:09.436272646 +0100
+@@ -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.1.orig/providers/implementations/rands/seeding/rand_unix.c openssl-3.0.1/providers/implementations/rands/seeding/rand_unix.c
+--- openssl-3.0.1.orig/providers/implementations/rands/seeding/rand_unix.c	2021-12-24 16:56:23.056304227 +0100
++++ openssl-3.0.1/providers/implementations/rands/seeding/rand_unix.c	2021-12-24 16:57:03.408290650 +0100
+@@ -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) {
--- a/OrthancServer/UnitTestsSources/VersionsTests.cpp	Fri Dec 24 16:52:51 2021 +0100
+++ b/OrthancServer/UnitTestsSources/VersionsTests.cpp	Fri Dec 24 17:12:49 2021 +0100
@@ -166,7 +166,7 @@
 #if ORTHANC_ENABLE_SSL == 1
 TEST(Version, OpenSslStatic)
 {
-  ASSERT_EQ(0x3000000fL /* openssl-3.0.0 */, OPENSSL_VERSION_NUMBER);
+  ASSERT_EQ(0x3000100fL /* openssl-3.0.1 */, OPENSSL_VERSION_NUMBER);
 }
 #endif