changeset 7181:47665da83409

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 22 Oct 2026 10:00:34 +0200
parents 0bacd6e8c21c
children e3b3fe54b737
files OrthancFramework/Resources/CMake/OpenSslConfigurationStatic.cmake OrthancFramework/Resources/Patches/openssl-3.5.9.patch
diffstat 2 files changed, 37 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic.cmake	Thu Oct 22 08:45:00 2026 +0200
+++ b/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic.cmake	Thu Oct 22 10:00:34 2026 +0200
@@ -53,10 +53,17 @@
     message(FATAL_ERROR "Error while patching a file")
   endif()
 
+
   # Execute the "config" script from the OpenSSL source distribution
+  if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
+    set(Options --with-rand-seed=devrandom)
+  else()
+    set(Options)
+  endif()
+
   execute_process(
     COMMAND ${PERL_EXECUTABLE}
-    Configure no-asm
+    Configure no-asm ${Options}
     WORKING_DIRECTORY ${OPENSSL_SOURCES_DIR}
     RESULT_VARIABLE Failure
     )
@@ -65,6 +72,7 @@
     message(FATAL_ERROR "Error while configuring OpenSSL using Perl")
   endif()
 
+
   # Create ${GENERATED_MANDATORY} targets from the Makefile of OpenSSL
   execute_process(
     COMMAND ${PERL_EXECUTABLE}
@@ -336,7 +344,7 @@
 
 if (ENABLE_OPENSSL_ENGINES)
   list(APPEND OPENSSL_SOURCES_SUBDIRS
-    ${OPENSSL_SOURCES_DIR}/engines
+    # ${OPENSSL_SOURCES_DIR}/engines   # Removed in Orthanc 1.13.1
     ${OPENSSL_SOURCES_DIR}/crypto/engine
     )
 else()
@@ -371,22 +379,32 @@
   ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
   ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
   ${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
+  ${OPENSSL_SOURCES_DIR}/crypto/bn/bn_ppc.c
+  ${OPENSSL_SOURCES_DIR}/crypto/bn/bn_sparc.c
+  ${OPENSSL_SOURCES_DIR}/crypto/chacha/chacha_ppc.c
+  ${OPENSSL_SOURCES_DIR}/crypto/chacha/chacha_riscv.c
+  ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
   ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistp224.c
   ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistp256.c
   ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistp384.c
   ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistp521.c
+  ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c
   ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
+  ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_ppc.c
   ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_s390x_nistp.c
+  ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_sm2p256.c
   ${OPENSSL_SOURCES_DIR}/crypto/ec/ecx_s390x.c
   ${OPENSSL_SOURCES_DIR}/crypto/evp/legacy_md2.c
   ${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_base2_44.c
+  ${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_ppc.c
   ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5_ecb.c
   ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5_enc.c
   ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5_skey.c
   ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5cfb64.c
   ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5ofb64.c
   ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_acvp_test_params.c
-  ${OPENSSL_SOURCES_DIR}/engines/e_devcrypto.c
+  ${OPENSSL_SOURCES_DIR}/crypto/sha/sha_ppc.c
+  ${OPENSSL_SOURCES_DIR}/crypto/sm3/sm3_riscv.c
   ${OPENSSL_SOURCES_DIR}/providers/common/securitycheck_fips.c
   ${OPENSSL_SOURCES_DIR}/providers/implementations/ciphers/cipher_rc5.c
   ${OPENSSL_SOURCES_DIR}/providers/implementations/ciphers/cipher_rc5_hw.c
@@ -396,7 +414,7 @@
 
   ${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_ieee754.c  # Fails on Visual Studio
   ${OPENSSL_SOURCES_DIR}/crypto/sha/sha_riscv.c  # Fails on LSB
-  ${OPENSSL_SOURCES_DIR}/engines/e_afalg.c  # Fails on OS X and Visual Studio
+  ${OPENSSL_SOURCES_DIR}/providers/legacyprov.c  # Fails on LSB
 
   # Disable CPUID for non-x86 platforms
   ${OPENSSL_SOURCES_DIR}/crypto/armcap.c
@@ -422,6 +440,10 @@
     ${OPENSSL_SOURCES_DIR}/providers/implementations/storemgmt/winstore_store.c
     )
 
+  if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
+    add_definitions(-DHAVE_MADVISE=0)
+  endif()
+
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
   list(APPEND OPENSSL_SOURCES
     ${OPENSSL_SOURCES_DIR}/crypto/thread/arch/thread_win.c
--- a/OrthancFramework/Resources/Patches/openssl-3.5.9.patch	Thu Oct 22 08:45:00 2026 +0200
+++ b/OrthancFramework/Resources/Patches/openssl-3.5.9.patch	Thu Oct 22 10:00:34 2026 +0200
@@ -1,46 +1,12 @@
-diff -urEb openssl-3.5.9.orig/crypto/riscvcap.c openssl-3.5.9/crypto/riscvcap.c
---- openssl-3.5.9.orig/crypto/riscvcap.c	2026-10-21 15:53:55.753158664 +0200
-+++ openssl-3.5.9/crypto/riscvcap.c	2026-10-21 15:54:38.701799356 +0200
-@@ -49,7 +49,8 @@
- 
- static void strtoupper(const char *str, char *dst, size_t dstlen)
- {
--    for (size_t i = 0; i < dstlen; i++) {
-+    size_t i;
-+    for (i = 0; i < dstlen; i++) {
-         if (i == dstlen - 1 || str[i] == '\0') {
-             dst[i] = '\0';
-             break;
-@@ -68,11 +69,12 @@
- {
-     char envstrupper[BUFLEN];
-     char buf[BUFLEN];
-+    size_t i;
- 
-     /* Convert env str to all uppercase */
-     strtoupper(envstr, envstrupper, sizeof(envstrupper));
+diff -urEb openssl-3.5.9.orig/crypto/mem_sec.c openssl-3.5.9/crypto/mem_sec.c
+--- openssl-3.5.9.orig/crypto/mem_sec.c	2026-10-22 09:47:14.564901874 +0200
++++ openssl-3.5.9/crypto/mem_sec.c	2026-10-22 09:50:29.937930234 +0200
+@@ -562,7 +562,7 @@
+         ret = 2;
+ #endif
  
--    for (size_t i = 0; i < kRISCVNumCaps; ++i) {
-+    for (i = 0; i < kRISCVNumCaps; ++i) {
-         size_t len = strlen(RISCV_capabilities[i].name);
-         /* Prefix capability with underscore in preparation for search */
-         /*
-diff -urEb openssl-3.5.9.orig/providers/implementations/rands/seeding/rand_unix.c openssl-3.5.9/providers/implementations/rands/seeding/rand_unix.c
---- openssl-3.5.9.orig/providers/implementations/rands/seeding/rand_unix.c	2026-10-21 15:53:55.778158455 +0200
-+++ openssl-3.5.9/providers/implementations/rands/seeding/rand_unix.c	2026-10-21 15:55:07.885556035 +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) {
+-#if defined(OPENSSL_SYS_LINUX) && defined(MLOCK_ONFAULT) && defined(SYS_mlock2)
++#if defined(OPENSSL_SYS_LINUX) && defined(MLOCK_ONFAULT) && defined(SYS_mlock2) && !defined(__LSB_VERSION__)  // "syscall()" is not available in LSB
+     if (syscall(SYS_mlock2, sh.arena, sh.arena_size, MLOCK_ONFAULT) < 0) {
+         if (errno == ENOSYS) {
+             if (mlock(sh.arena, sh.arena_size) < 0)