# HG changeset patch # User Sebastien Jodogne # Date 1585824885 -7200 # Node ID 6462ecaa045b4624ad3c43dacab643e9caeaaac0 # Parent 9fe1d64a748cc0fe81ef29cfb8e83f302e0bee11 fix unit test, reorganization of OpenSSL initialization diff -r 9fe1d64a748c -r 6462ecaa045b Core/Toolbox.cpp --- a/Core/Toolbox.cpp Thu Apr 02 11:24:47 2020 +0200 +++ b/Core/Toolbox.cpp Thu Apr 02 12:54:45 2020 +0200 @@ -1680,21 +1680,36 @@ #endif + +#if ORTHANC_ENABLE_SSL == 0 + /** + * OpenSSL is disabled + **/ void Toolbox::InitializeOpenSsl() { -#if ORTHANC_ENABLE_SSL == 1 + } + + void Toolbox::FinalizeOpenSsl() + { + } + + +#elif (ORTHANC_ENABLE_SSL == 1 && \ + OPENSSL_VERSION_NUMBER < 0x10100000L) + /** + * OpenSSL < 1.1.0 + **/ + void Toolbox::InitializeOpenSsl() + { // https://wiki.openssl.org/index.php/Library_Initialization SSL_library_init(); SSL_load_error_strings(); OpenSSL_add_all_algorithms(); ERR_load_crypto_strings(); -#endif } - void Toolbox::FinalizeOpenSsl() { -#if ORTHANC_ENABLE_SSL == 1 // Finalize OpenSSL // https://wiki.openssl.org/index.php/Library_Initialization#Cleanup #ifdef FIPS_mode_set @@ -1710,8 +1725,28 @@ CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); ERR_free_strings(); + } + + +#elif (ORTHANC_ENABLE_SSL == 1 && \ + OPENSSL_VERSION_NUMBER >= 0x10100000L) + /** + * OpenSSL >= 1.1.0. In this case, the initialization is + * automatically done by the functions of OpenSSL. + * https://wiki.openssl.org/index.php/Library_Initialization + **/ + void Toolbox::InitializeOpenSsl() + { + } + + void Toolbox::FinalizeOpenSsl() + { + } + +#else +# error "Support your platform here" #endif - } + std::string Toolbox::GenerateUuid() diff -r 9fe1d64a748c -r 6462ecaa045b Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake --- a/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake Thu Apr 02 11:24:47 2020 +0200 +++ b/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake Thu Apr 02 12:54:45 2020 +0200 @@ -234,6 +234,15 @@ # In order for "crypto/mem_sec.c" to compile on LSB add_definitions( -DOPENSSL_NO_SECURE_MEMORY + -DOPENSSL_RAND_SEED_OS + ) + +else() + # Fixes error "OpenSSL error: error:2406C06E:random number + # generator:RAND_DRBG_instantiate:error retrieving entropy" that was + # present in Orthanc 1.6.0, if statically linking on Ubuntu 18.04 + add_definitions( + -DOPENSSL_RAND_SEED_OS ) endif() diff -r 9fe1d64a748c -r 6462ecaa045b Resources/Patches/civetweb-1.12.patch --- a/Resources/Patches/civetweb-1.12.patch Thu Apr 02 11:24:47 2020 +0200 +++ b/Resources/Patches/civetweb-1.12.patch Thu Apr 02 12:54:45 2020 +0200 @@ -1,6 +1,6 @@ diff -urEb civetweb-1.12.orig/include/civetweb.h civetweb-1.12/include/civetweb.h ---- civetweb-1.12.orig/include/civetweb.h 2020-04-02 10:56:55.681988632 +0200 -+++ civetweb-1.12/include/civetweb.h 2020-04-02 10:57:36.413858039 +0200 +--- civetweb-1.12.orig/include/civetweb.h 2020-04-02 12:07:20.727054140 +0200 ++++ civetweb-1.12/include/civetweb.h 2020-04-02 12:07:42.734996559 +0200 @@ -1614,6 +1614,9 @@ struct mg_error_data *error); #endif @@ -12,12 +12,12 @@ } #endif /* __cplusplus */ diff -urEb civetweb-1.12.orig/src/civetweb.c civetweb-1.12/src/civetweb.c ---- civetweb-1.12.orig/src/civetweb.c 2020-04-02 10:56:55.685988619 +0200 -+++ civetweb-1.12/src/civetweb.c 2020-04-02 11:00:31.345304121 +0200 -@@ -20705,4 +20705,13 @@ +--- civetweb-1.12.orig/src/civetweb.c 2020-04-02 12:07:20.731054129 +0200 ++++ civetweb-1.12/src/civetweb.c 2020-04-02 12:07:52.250971600 +0200 +@@ -20704,5 +20704,12 @@ + return 1; } - +// Added by SJ +void mg_disable_keep_alive(struct mg_connection *conn) +{ @@ -25,6 +25,5 @@ + conn->must_close = 1; + } +} -+ -+ + /* End of civetweb.c */ diff -r 9fe1d64a748c -r 6462ecaa045b UnitTestsSources/VersionsTests.cpp --- a/UnitTestsSources/VersionsTests.cpp Thu Apr 02 11:24:47 2020 +0200 +++ b/UnitTestsSources/VersionsTests.cpp Thu Apr 02 12:54:45 2020 +0200 @@ -208,7 +208,7 @@ TEST(Version, Civetweb) { ASSERT_EQ(1, CIVETWEB_VERSION_MAJOR); - ASSERT_EQ(11, CIVETWEB_VERSION_MINOR); + ASSERT_EQ(12, CIVETWEB_VERSION_MINOR); ASSERT_EQ(0, CIVETWEB_VERSION_PATCH); } #endif