# HG changeset patch # User Benjamin Golinvaux # Date 1583693517 -3600 # Node ID 982c24a70dfd7e888f0712eed9e2643b574e4bd5 # Parent 0b3aacdf77f5db59ac55d7dc2332a0c9f2c5000f# Parent 090022f1b5e182c0696a2d072ea1faf423395828 Merge diff -r 0b3aacdf77f5 -r 982c24a70dfd CMakeLists.txt --- a/CMakeLists.txt Sun Mar 08 19:51:22 2020 +0100 +++ b/CMakeLists.txt Sun Mar 08 19:51:57 2020 +0100 @@ -17,7 +17,7 @@ set(ENABLE_JPEG ON) set(ENABLE_LOCALE ON) set(ENABLE_LUA ON) -set(ENABLE_OPENSSL_ENGINES ON) +set(ENABLE_OPENSSL_ENGINES ON) # OpenSSL engines are necessary for PKCS11 set(ENABLE_PNG ON) set(ENABLE_PUGIXML ON) set(ENABLE_SQLITE ON) diff -r 0b3aacdf77f5 -r 982c24a70dfd Core/DicomParsing/FromDcmtkBridge.cpp --- a/Core/DicomParsing/FromDcmtkBridge.cpp Sun Mar 08 19:51:22 2020 +0100 +++ b/Core/DicomParsing/FromDcmtkBridge.cpp Sun Mar 08 19:51:57 2020 +0100 @@ -107,10 +107,16 @@ #if ORTHANC_ENABLE_DCMTK_JPEG == 1 # include +# if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 +# include +# endif #endif #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 # include +# if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 +# include +# endif #endif @@ -2045,12 +2051,18 @@ { #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 LOG(INFO) << "Registering JPEG Lossless codecs in DCMTK"; - DJLSDecoderRegistration::registerCodecs(); + DJLSDecoderRegistration::registerCodecs(); +# if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 + DJLSEncoderRegistration::registerCodecs(); +# endif #endif #if ORTHANC_ENABLE_DCMTK_JPEG == 1 LOG(INFO) << "Registering JPEG codecs in DCMTK"; DJDecoderRegistration::registerCodecs(); +# if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 + DJEncoderRegistration::registerCodecs(); +# endif #endif } @@ -2060,11 +2072,17 @@ #if ORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS == 1 // Unregister JPEG-LS codecs DJLSDecoderRegistration::cleanup(); +# if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 + DJLSEncoderRegistration::cleanup(); +# endif #endif #if ORTHANC_ENABLE_DCMTK_JPEG == 1 // Unregister JPEG codecs DJDecoderRegistration::cleanup(); +# if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 + DJDecoderRegistration::cleanup(); +# endif #endif } @@ -2551,4 +2569,181 @@ Encoding encoding = DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); ApplyVisitorToDataset(dataset, visitor, parentTags, parentIndexes, encoding, hasCodeExtensions); } + + + // This function is autogenerated by the script + // "Resources/GenerateTransferSyntaxes.py" + bool FromDcmtkBridge::GetDcmtkTransferSyntax(E_TransferSyntax& target, + DicomTransferSyntax syntax) + { + switch (syntax) + { + case DicomTransferSyntax_LittleEndianImplicit: + target = EXS_LittleEndianImplicit; + return true; + + case DicomTransferSyntax_LittleEndianExplicit: + target = EXS_LittleEndianExplicit; + return true; + + case DicomTransferSyntax_DeflatedLittleEndianExplicit: + target = EXS_DeflatedLittleEndianExplicit; + return true; + + case DicomTransferSyntax_BigEndianExplicit: + target = EXS_BigEndianExplicit; + return true; + + case DicomTransferSyntax_JPEGProcess1: + target = EXS_JPEGProcess1; + return true; + + case DicomTransferSyntax_JPEGProcess2_4: + target = EXS_JPEGProcess2_4; + return true; + + case DicomTransferSyntax_JPEGProcess3_5: + target = EXS_JPEGProcess3_5; + return true; + + case DicomTransferSyntax_JPEGProcess6_8: + target = EXS_JPEGProcess6_8; + return true; + + case DicomTransferSyntax_JPEGProcess7_9: + target = EXS_JPEGProcess7_9; + return true; + + case DicomTransferSyntax_JPEGProcess10_12: + target = EXS_JPEGProcess10_12; + return true; + + case DicomTransferSyntax_JPEGProcess11_13: + target = EXS_JPEGProcess11_13; + return true; + + case DicomTransferSyntax_JPEGProcess14: + target = EXS_JPEGProcess14; + return true; + + case DicomTransferSyntax_JPEGProcess15: + target = EXS_JPEGProcess15; + return true; + + case DicomTransferSyntax_JPEGProcess16_18: + target = EXS_JPEGProcess16_18; + return true; + + case DicomTransferSyntax_JPEGProcess17_19: + target = EXS_JPEGProcess17_19; + return true; + + case DicomTransferSyntax_JPEGProcess20_22: + target = EXS_JPEGProcess20_22; + return true; + + case DicomTransferSyntax_JPEGProcess21_23: + target = EXS_JPEGProcess21_23; + return true; + + case DicomTransferSyntax_JPEGProcess24_26: + target = EXS_JPEGProcess24_26; + return true; + + case DicomTransferSyntax_JPEGProcess25_27: + target = EXS_JPEGProcess25_27; + return true; + + case DicomTransferSyntax_JPEGProcess28: + target = EXS_JPEGProcess28; + return true; + + case DicomTransferSyntax_JPEGProcess29: + target = EXS_JPEGProcess29; + return true; + + case DicomTransferSyntax_JPEGProcess14SV1: + target = EXS_JPEGProcess14SV1; + return true; + + case DicomTransferSyntax_JPEGLSLossless: + target = EXS_JPEGLSLossless; + return true; + + case DicomTransferSyntax_JPEGLSLossy: + target = EXS_JPEGLSLossy; + return true; + + case DicomTransferSyntax_JPEG2000LosslessOnly: + target = EXS_JPEG2000LosslessOnly; + return true; + + case DicomTransferSyntax_JPEG2000: + target = EXS_JPEG2000; + return true; + + case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly: + target = EXS_JPEG2000MulticomponentLosslessOnly; + return true; + + case DicomTransferSyntax_JPEG2000Multicomponent: + target = EXS_JPEG2000Multicomponent; + return true; + + case DicomTransferSyntax_JPIPReferenced: + target = EXS_JPIPReferenced; + return true; + + case DicomTransferSyntax_JPIPReferencedDeflate: + target = EXS_JPIPReferencedDeflate; + return true; + + case DicomTransferSyntax_MPEG2MainProfileAtMainLevel: + target = EXS_MPEG2MainProfileAtMainLevel; + return true; + + case DicomTransferSyntax_MPEG2MainProfileAtHighLevel: + target = EXS_MPEG2MainProfileAtHighLevel; + return true; + + case DicomTransferSyntax_MPEG4HighProfileLevel4_1: + target = EXS_MPEG4HighProfileLevel4_1; + return true; + + case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1: + target = EXS_MPEG4BDcompatibleHighProfileLevel4_1; + return true; + + case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo: + target = EXS_MPEG4HighProfileLevel4_2_For2DVideo; + return true; + + case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo: + target = EXS_MPEG4HighProfileLevel4_2_For3DVideo; + return true; + + case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2: + target = EXS_MPEG4StereoHighProfileLevel4_2; + return true; + +#if DCMTK_VERSION_NUMBER >= 362 + case DicomTransferSyntax_HEVCMainProfileLevel5_1: + target = EXS_HEVCMainProfileLevel5_1; + return true; +#endif + +#if DCMTK_VERSION_NUMBER >= 362 + case DicomTransferSyntax_HEVCMain10ProfileLevel5_1: + target = EXS_HEVCMain10ProfileLevel5_1; + return true; +#endif + + case DicomTransferSyntax_RLELossless: + target = EXS_RLELossless; + return true; + + default: + return false; + } + } } diff -r 0b3aacdf77f5 -r 982c24a70dfd Core/DicomParsing/FromDcmtkBridge.h --- a/Core/DicomParsing/FromDcmtkBridge.h Sun Mar 08 19:51:22 2020 +0100 +++ b/Core/DicomParsing/FromDcmtkBridge.h Sun Mar 08 19:51:57 2020 +0100 @@ -270,5 +270,8 @@ static void Apply(DcmItem& dataset, ITagVisitor& visitor, Encoding defaultEncoding); + + static bool GetDcmtkTransferSyntax(E_TransferSyntax& target, + DicomTransferSyntax syntax); }; } diff -r 0b3aacdf77f5 -r 982c24a70dfd Core/Enumerations.cpp --- a/Core/Enumerations.cpp Sun Mar 08 19:51:22 2020 +0100 +++ b/Core/Enumerations.cpp Sun Mar 08 19:51:57 2020 +0100 @@ -2245,4 +2245,141 @@ LOG(INFO) << "Default encoding for DICOM was changed to: " << name; } + + // This function is autogenerated by the script + // "Resources/GenerateTransferSyntaxes.py" + const char* GetTransferSyntaxUid(DicomTransferSyntax syntax) + { + switch (syntax) + { + case DicomTransferSyntax_LittleEndianImplicit: + return "1.2.840.10008.1.2"; + + case DicomTransferSyntax_LittleEndianExplicit: + return "1.2.840.10008.1.2.1"; + + case DicomTransferSyntax_DeflatedLittleEndianExplicit: + return "1.2.840.10008.1.2.1.99"; + + case DicomTransferSyntax_BigEndianExplicit: + return "1.2.840.10008.1.2.2"; + + case DicomTransferSyntax_JPEGProcess1: + return "1.2.840.10008.1.2.4.50"; + + case DicomTransferSyntax_JPEGProcess2_4: + return "1.2.840.10008.1.2.4.51"; + + case DicomTransferSyntax_JPEGProcess3_5: + return "1.2.840.10008.1.2.4.52"; + + case DicomTransferSyntax_JPEGProcess6_8: + return "1.2.840.10008.1.2.4.53"; + + case DicomTransferSyntax_JPEGProcess7_9: + return "1.2.840.10008.1.2.4.54"; + + case DicomTransferSyntax_JPEGProcess10_12: + return "1.2.840.10008.1.2.4.55"; + + case DicomTransferSyntax_JPEGProcess11_13: + return "1.2.840.10008.1.2.4.56"; + + case DicomTransferSyntax_JPEGProcess14: + return "1.2.840.10008.1.2.4.57"; + + case DicomTransferSyntax_JPEGProcess15: + return "1.2.840.10008.1.2.4.58"; + + case DicomTransferSyntax_JPEGProcess16_18: + return "1.2.840.10008.1.2.4.59"; + + case DicomTransferSyntax_JPEGProcess17_19: + return "1.2.840.10008.1.2.4.60"; + + case DicomTransferSyntax_JPEGProcess20_22: + return "1.2.840.10008.1.2.4.61"; + + case DicomTransferSyntax_JPEGProcess21_23: + return "1.2.840.10008.1.2.4.62"; + + case DicomTransferSyntax_JPEGProcess24_26: + return "1.2.840.10008.1.2.4.63"; + + case DicomTransferSyntax_JPEGProcess25_27: + return "1.2.840.10008.1.2.4.64"; + + case DicomTransferSyntax_JPEGProcess28: + return "1.2.840.10008.1.2.4.65"; + + case DicomTransferSyntax_JPEGProcess29: + return "1.2.840.10008.1.2.4.66"; + + case DicomTransferSyntax_JPEGProcess14SV1: + return "1.2.840.10008.1.2.4.70"; + + case DicomTransferSyntax_JPEGLSLossless: + return "1.2.840.10008.1.2.4.80"; + + case DicomTransferSyntax_JPEGLSLossy: + return "1.2.840.10008.1.2.4.81"; + + case DicomTransferSyntax_JPEG2000LosslessOnly: + return "1.2.840.10008.1.2.4.90"; + + case DicomTransferSyntax_JPEG2000: + return "1.2.840.10008.1.2.4.91"; + + case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly: + return "1.2.840.10008.1.2.4.92"; + + case DicomTransferSyntax_JPEG2000Multicomponent: + return "1.2.840.10008.1.2.4.93"; + + case DicomTransferSyntax_JPIPReferenced: + return "1.2.840.10008.1.2.4.94"; + + case DicomTransferSyntax_JPIPReferencedDeflate: + return "1.2.840.10008.1.2.4.95"; + + case DicomTransferSyntax_MPEG2MainProfileAtMainLevel: + return "1.2.840.10008.1.2.4.100"; + + case DicomTransferSyntax_MPEG2MainProfileAtHighLevel: + return "1.2.840.10008.1.2.4.101"; + + case DicomTransferSyntax_MPEG4HighProfileLevel4_1: + return "1.2.840.10008.1.2.4.102"; + + case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1: + return "1.2.840.10008.1.2.4.103"; + + case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo: + return "1.2.840.10008.1.2.4.104"; + + case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo: + return "1.2.840.10008.1.2.4.105"; + + case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2: + return "1.2.840.10008.1.2.4.106"; + + case DicomTransferSyntax_HEVCMainProfileLevel5_1: + return "1.2.840.10008.1.2.4.107"; + + case DicomTransferSyntax_HEVCMain10ProfileLevel5_1: + return "1.2.840.10008.1.2.4.108"; + + case DicomTransferSyntax_RLELossless: + return "1.2.840.10008.1.2.5"; + + case DicomTransferSyntax_RFC2557MimeEncapsulation: + return "1.2.840.10008.1.2.6.1"; + + case DicomTransferSyntax_XML: + return "1.2.840.10008.1.2.6.2"; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } } diff -r 0b3aacdf77f5 -r 982c24a70dfd Core/Enumerations.h --- a/Core/Enumerations.h Sun Mar 08 19:51:22 2020 +0100 +++ b/Core/Enumerations.h Sun Mar 08 19:51:57 2020 +0100 @@ -243,6 +243,54 @@ ErrorCode_START_PLUGINS = 1000000 }; + // This enumeration is autogenerated by the script + // "Resources/GenerateTransferSyntaxes.py" + enum DicomTransferSyntax + { + DicomTransferSyntax_LittleEndianImplicit /*!< Implicit VR Little Endian */, + DicomTransferSyntax_LittleEndianExplicit /*!< Explicit VR Little Endian */, + DicomTransferSyntax_DeflatedLittleEndianExplicit /*!< Deflated Explicit VR Little Endian */, + DicomTransferSyntax_BigEndianExplicit /*!< Explicit VR Big Endian */, + DicomTransferSyntax_JPEGProcess1 /*!< JPEG Baseline (process 1, lossy) */, + DicomTransferSyntax_JPEGProcess2_4 /*!< JPEG Extended Sequential (processes 2 & 4) */, + DicomTransferSyntax_JPEGProcess3_5 /*!< JPEG Extended Sequential (lossy, 8/12 bit), arithmetic coding */, + DicomTransferSyntax_JPEGProcess6_8 /*!< JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit) */, + DicomTransferSyntax_JPEGProcess7_9 /*!< JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit), arithmetic coding */, + DicomTransferSyntax_JPEGProcess10_12 /*!< JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit) */, + DicomTransferSyntax_JPEGProcess11_13 /*!< JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit), arithmetic coding */, + DicomTransferSyntax_JPEGProcess14 /*!< JPEG Lossless, Nonhierarchical with any selection value (process 14) */, + DicomTransferSyntax_JPEGProcess15 /*!< JPEG Lossless with any selection value, arithmetic coding */, + DicomTransferSyntax_JPEGProcess16_18 /*!< JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit) */, + DicomTransferSyntax_JPEGProcess17_19 /*!< JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit), arithmetic coding */, + DicomTransferSyntax_JPEGProcess20_22 /*!< JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit) */, + DicomTransferSyntax_JPEGProcess21_23 /*!< JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit), arithmetic coding */, + DicomTransferSyntax_JPEGProcess24_26 /*!< JPEG Full Progression, Hierarchical (lossy, 8/12 bit) */, + DicomTransferSyntax_JPEGProcess25_27 /*!< JPEG Full Progression, Hierarchical (lossy, 8/12 bit), arithmetic coding */, + DicomTransferSyntax_JPEGProcess28 /*!< JPEG Lossless, Hierarchical */, + DicomTransferSyntax_JPEGProcess29 /*!< JPEG Lossless, Hierarchical, arithmetic coding */, + DicomTransferSyntax_JPEGProcess14SV1 /*!< JPEG Lossless, Nonhierarchical, First-Order Prediction (Processes 14 [Selection Value 1]) */, + DicomTransferSyntax_JPEGLSLossless /*!< JPEG-LS (lossless) */, + DicomTransferSyntax_JPEGLSLossy /*!< JPEG-LS (lossy or near-lossless) */, + DicomTransferSyntax_JPEG2000LosslessOnly /*!< JPEG 2000 (lossless) */, + DicomTransferSyntax_JPEG2000 /*!< JPEG 2000 (lossless or lossy) */, + DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly /*!< JPEG 2000 part 2 multicomponent extensions (lossless) */, + DicomTransferSyntax_JPEG2000Multicomponent /*!< JPEG 2000 part 2 multicomponent extensions (lossless or lossy) */, + DicomTransferSyntax_JPIPReferenced /*!< JPIP Referenced */, + DicomTransferSyntax_JPIPReferencedDeflate /*!< JPIP Referenced Deflate */, + DicomTransferSyntax_MPEG2MainProfileAtMainLevel /*!< MPEG2 Main Profile at Main Level */, + DicomTransferSyntax_MPEG2MainProfileAtHighLevel /*!< MPEG2 Main Profile at High Level */, + DicomTransferSyntax_MPEG4HighProfileLevel4_1 /*!< MPEG4 High Profile / Level 4.1 */, + DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1 /*!< MPEG4 BD-compatible High Profile / Level 4.1 */, + DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo /*!< MPEG4 High Profile / Level 4.2 For 2D Video */, + DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo /*!< MPEG4 High Profile / Level 4.2 For 3D Video */, + DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2 /*!< 1.2.840.10008.1.2.4.106 */, + DicomTransferSyntax_HEVCMainProfileLevel5_1 /*!< HEVC/H.265 Main Profile / Level 5.1 */, + DicomTransferSyntax_HEVCMain10ProfileLevel5_1 /*!< HEVC/H.265 Main 10 Profile / Level 5.1 */, + DicomTransferSyntax_RLELossless /*!< RLE - Run Length Encoding (lossless) */, + DicomTransferSyntax_RFC2557MimeEncapsulation /*!< RFC 2557 MIME Encapsulation */, + DicomTransferSyntax_XML /*!< XML Encoding */ + }; + enum LogLevel { LogLevel_Error, @@ -798,4 +846,6 @@ Encoding GetDefaultDicomEncoding(); void SetDefaultDicomEncoding(Encoding encoding); + + const char* GetTransferSyntaxUid(DicomTransferSyntax syntax); } diff -r 0b3aacdf77f5 -r 982c24a70dfd Core/Pkcs11.cpp --- a/Core/Pkcs11.cpp Sun Mar 08 19:51:22 2020 +0100 +++ b/Core/Pkcs11.cpp Sun Mar 08 19:51:57 2020 +0100 @@ -213,10 +213,11 @@ !ENGINE_set_load_privkey_function(engine, EngineLoadPrivateKey) || !ENGINE_set_RSA(engine, PKCS11_get_rsa_method()) || + +#if OPENSSL_VERSION_NUMBER < 0x10100000L // OpenSSL 1.0.2 !ENGINE_set_ECDSA(engine, PKCS11_get_ecdsa_method()) || !ENGINE_set_ECDH(engine, PKCS11_get_ecdh_method()) || - -#if OPENSSL_VERSION_NUMBER >= 0x10100002L +#else !ENGINE_set_EC(engine, PKCS11_get_ec_key_method()) || #endif diff -r 0b3aacdf77f5 -r 982c24a70dfd Core/Toolbox.cpp --- a/Core/Toolbox.cpp Sun Mar 08 19:51:22 2020 +0100 +++ b/Core/Toolbox.cpp Sun Mar 08 19:51:57 2020 +0100 @@ -1700,7 +1700,11 @@ #ifdef FIPS_mode_set FIPS_mode_set(0); #endif + +#if !defined(OPENSSL_NO_ENGINE) ENGINE_cleanup(); +#endif + CONF_modules_unload(1); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); diff -r 0b3aacdf77f5 -r 982c24a70dfd NEWS --- a/NEWS Sun Mar 08 19:51:22 2020 +0100 +++ b/NEWS Sun Mar 08 19:51:57 2020 +0100 @@ -46,6 +46,10 @@ * Fix issue #166 (CMake find_boost version is now broken with newer boost/cmake) * Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association) * Fix issue #168 (Plugins can't read private tags from the configuration file) +* Upgraded dependencies for static builds (notably on Windows): + - dcmtk 3.6.5 + - openssl 1.1.1d + - jsoncpp 0.10.7 for pre-C++11 compilers Version 1.5.8 (2019-10-16) diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/DcmtkConfiguration.cmake --- a/Resources/CMake/DcmtkConfiguration.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/CMake/DcmtkConfiguration.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -9,6 +9,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.2.cmake) elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.4") include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.4.cmake) + elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.5") + include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.5.cmake) else() message(FATAL_ERROR "Unsupported version of DCMTK: ${DCMTK_STATIC_VERSION}") endif() diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/DcmtkConfigurationStatic-3.6.5.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CMake/DcmtkConfigurationStatic-3.6.5.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,195 @@ +SET(DCMTK_VERSION_NUMBER 365) +SET(DCMTK_PACKAGE_VERSION "3.6.5") +SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.5) +SET(DCMTK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/dcmtk-3.6.5.tar.gz") +SET(DCMTK_MD5 "e19707f64ee5695c496b9c1e48e39d07") + +macro(DCMTK_UNSET) +endmacro() + +macro(DCMTK_UNSET_CACHE) +endmacro() + +set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/) +set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/) + +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js +else() + set(DCMTK_WITH_THREADS ON) +endif() + +add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1) + +if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") + set(FirstRun OFF) +else() + set(FirstRun ON) +endif() + +DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") + + +if (FirstRun) + # Apply the patches + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.5.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (Failure) + message(FATAL_ERROR "Error while patching a file") + endif() + + configure_file( + ${ORTHANC_ROOT}/Resources/Patches/dcmtk-dcdict_orthanc.cc + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc + COPYONLY) +else() + message("The patches for DCMTK have already been applied") +endif() + + +include_directories( + ${DCMTK_SOURCES_DIR}/dcmiod/include + ) + + +# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake" +IF (CMAKE_CROSSCOMPILING) + if (CMAKE_COMPILER_IS_GNUCXX AND + CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW + SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") + + elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js + + # Check out "../WebAssembly/ArithmeticTests/" to regenerate the + # "arith.h" file + configure_file( + ${ORTHANC_ROOT}/Resources/WebAssembly/arith.h + ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h + COPYONLY) + + UNSET(C_CHAR_UNSIGNED CACHE) + SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "") + + else() + message(FATAL_ERROR "Support your platform here") + endif() +ENDIF() + + +if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "") + SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "") +endif() + + +SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR}) +include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) +include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) + + +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or + # asm.js The macros below are not properly discovered by DCMTK + # when using WebAssembly. Check out "../WebAssembly/arith.h" for + # how we produced these values. This step MUST be after + # "GenerateDCMTKConfigure" and before the generation of + # "osconfig.h". + UNSET(SIZEOF_VOID_P CACHE) + UNSET(SIZEOF_CHAR CACHE) + UNSET(SIZEOF_DOUBLE CACHE) + UNSET(SIZEOF_FLOAT CACHE) + UNSET(SIZEOF_INT CACHE) + UNSET(SIZEOF_LONG CACHE) + UNSET(SIZEOF_SHORT CACHE) + UNSET(SIZEOF_VOID_P CACHE) + + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") + SET(SIZEOF_CHAR 1 CACHE INTERNAL "") + SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "") + SET(SIZEOF_FLOAT 4 CACHE INTERNAL "") + SET(SIZEOF_INT 4 CACHE INTERNAL "") + SET(SIZEOF_LONG 4 CACHE INTERNAL "") + SET(SIZEOF_SHORT 2 CACHE INTERNAL "") + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") +endif() + + +set(DCMTK_PACKAGE_VERSION_SUFFIX "") +set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER}) + +CONFIGURE_FILE( + ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in + ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + link_libraries(netapi32) # For NetWkstaUserGetInfo@12 + link_libraries(iphlpapi) # For GetAdaptersInfo@8 + + # Configure Wine if cross-compiling for Windows + if (CMAKE_COMPILER_IS_GNUCXX) + include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake) + FIND_PROGRAM(WINE_WINE_PROGRAM wine) + FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath) + list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static") + endif() +endif() + +# This step must be after the generation of "osconfig.h" +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES() +endif() + + +# Source for the logging facility of DCMTK +AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR + ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc + ) + +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc + ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc + ) +endif() + + +list(REMOVE_ITEM DCMTK_SOURCES + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc + ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc + ) + + +# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by +# default since this does not seem to be appropriate (anymore) for +# most modern operating systems. In order to change this default, the +# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt +# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can +# be defined to change this setting at compilation time (see +# macros.txt for details). +# https://forum.dcmtk.org/viewtopic.php?t=4632 +add_definitions( + -DDISABLE_NAGLE_ALGORITHM=1 + ) + + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND + CMAKE_COMPILER_IS_GNUCXX) + # This is MinGW + add_definitions( + -DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS + -DDCMTK_LOG4CPLUS_SINGLE_THREADED + ) +endif() diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/JsonCppConfiguration.cmake --- a/Resources/CMake/JsonCppConfiguration.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/CMake/JsonCppConfiguration.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -2,9 +2,9 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_JSONCPP) if (USE_LEGACY_JSONCPP) - set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.6) - set(JSONCPP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/jsoncpp-0.10.6.tar.gz") - set(JSONCPP_MD5 "13d1991d79697df8cadbc25c93e37c83") + set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.7) + set(JSONCPP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/jsoncpp-0.10.7.tar.gz") + set(JSONCPP_MD5 "3a8072ca6a1fa9cbaf7715ae625f134f") add_definitions(-DORTHANC_LEGACY_JSONCPP=1) else() set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-1.8.4) diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/LibCurlConfiguration.cmake --- a/Resources/CMake/LibCurlConfiguration.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/CMake/LibCurlConfiguration.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -60,7 +60,7 @@ ) endif() - if (NOT EXISTS "${CURL_SOURCES_DIR}/lib/curl_config.h") + if (NOT EXISTS "${CURL_SOURCES_DIR}/lib/vauth/vauth/vauth.h") #file(WRITE ${CURL_SOURCES_DIR}/lib/curl_config.h "") file(WRITE ${CURL_SOURCES_DIR}/lib/vauth/vauth/vauth.h "#include \"../vauth.h\"\n") diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/OpenSslConfiguration.cmake --- a/Resources/CMake/OpenSslConfiguration.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/CMake/OpenSslConfiguration.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -1,335 +1,10 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL) - SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.0.2p) - SET(OPENSSL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/openssl-1.0.2p.tar.gz") - SET(OPENSSL_MD5 "ac5eb30bf5798aa14b1ae6d0e7da58df") - - if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}") - set(FirstRun OFF) + if (OPENSSL_STATIC_VERSION STREQUAL "1.0.2") + include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-1.0.2.cmake) + elseif (OPENSSL_STATIC_VERSION STREQUAL "1.1.1") + include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-1.1.1.cmake) else() - set(FirstRun ON) - endif() - - DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}") - - if (FirstRun) - file(MAKE_DIRECTORY ${OPENSSL_SOURCES_DIR}/include/openssl) - - foreach(header - ${OPENSSL_SOURCES_DIR}/crypto/aes/aes.h - ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1.h - ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1_mac.h - ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1t.h - ${OPENSSL_SOURCES_DIR}/crypto/bf/blowfish.h - ${OPENSSL_SOURCES_DIR}/crypto/bio/bio.h - ${OPENSSL_SOURCES_DIR}/crypto/bn/bn.h - ${OPENSSL_SOURCES_DIR}/crypto/buffer/buffer.h - ${OPENSSL_SOURCES_DIR}/crypto/camellia/camellia.h - ${OPENSSL_SOURCES_DIR}/crypto/cast/cast.h - ${OPENSSL_SOURCES_DIR}/crypto/cmac/cmac.h - ${OPENSSL_SOURCES_DIR}/crypto/cms/cms.h - ${OPENSSL_SOURCES_DIR}/crypto/comp/comp.h - ${OPENSSL_SOURCES_DIR}/crypto/conf/conf.h - ${OPENSSL_SOURCES_DIR}/crypto/conf/conf_api.h - ${OPENSSL_SOURCES_DIR}/crypto/crypto.h - ${OPENSSL_SOURCES_DIR}/crypto/des/des.h - ${OPENSSL_SOURCES_DIR}/crypto/des/des_old.h - ${OPENSSL_SOURCES_DIR}/crypto/dh/dh.h - ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsa.h - ${OPENSSL_SOURCES_DIR}/crypto/dso/dso.h - ${OPENSSL_SOURCES_DIR}/crypto/ebcdic.h - ${OPENSSL_SOURCES_DIR}/crypto/ec/ec.h - ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdh.h - ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsa.h - ${OPENSSL_SOURCES_DIR}/crypto/engine/engine.h - ${OPENSSL_SOURCES_DIR}/crypto/err/err.h - ${OPENSSL_SOURCES_DIR}/crypto/evp/evp.h - ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmac.h - ${OPENSSL_SOURCES_DIR}/crypto/idea/idea.h - ${OPENSSL_SOURCES_DIR}/crypto/jpake/jpake.h - ${OPENSSL_SOURCES_DIR}/crypto/krb5/krb5_asn.h - ${OPENSSL_SOURCES_DIR}/crypto/lhash/lhash.h - ${OPENSSL_SOURCES_DIR}/crypto/md2/md2.h - ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.h - ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.h - ${OPENSSL_SOURCES_DIR}/crypto/mdc2/mdc2.h - ${OPENSSL_SOURCES_DIR}/crypto/modes/modes.h - ${OPENSSL_SOURCES_DIR}/crypto/objects/obj_mac.h - ${OPENSSL_SOURCES_DIR}/crypto/objects/objects.h - ${OPENSSL_SOURCES_DIR}/crypto/ocsp/ocsp.h - ${OPENSSL_SOURCES_DIR}/crypto/opensslconf.h - ${OPENSSL_SOURCES_DIR}/crypto/opensslv.h - ${OPENSSL_SOURCES_DIR}/crypto/ossl_typ.h - ${OPENSSL_SOURCES_DIR}/crypto/pem/pem.h - ${OPENSSL_SOURCES_DIR}/crypto/pem/pem2.h - ${OPENSSL_SOURCES_DIR}/crypto/pkcs12/pkcs12.h - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pkcs7.h - ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pqueue.h - ${OPENSSL_SOURCES_DIR}/crypto/rand/rand.h - ${OPENSSL_SOURCES_DIR}/crypto/rc2/rc2.h - ${OPENSSL_SOURCES_DIR}/crypto/rc4/rc4.h - ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5.h - ${OPENSSL_SOURCES_DIR}/crypto/ripemd/ripemd.h - ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa.h - ${OPENSSL_SOURCES_DIR}/crypto/seed/seed.h - ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.h - ${OPENSSL_SOURCES_DIR}/crypto/srp/srp.h - ${OPENSSL_SOURCES_DIR}/crypto/stack/safestack.h - ${OPENSSL_SOURCES_DIR}/crypto/stack/stack.h - ${OPENSSL_SOURCES_DIR}/crypto/store/store.h - ${OPENSSL_SOURCES_DIR}/crypto/symhacks.h - ${OPENSSL_SOURCES_DIR}/crypto/ts/ts.h - ${OPENSSL_SOURCES_DIR}/crypto/txt_db/txt_db.h - ${OPENSSL_SOURCES_DIR}/crypto/ui/ui.h - ${OPENSSL_SOURCES_DIR}/crypto/ui/ui_compat.h - ${OPENSSL_SOURCES_DIR}/crypto/whrlpool/whrlpool.h - ${OPENSSL_SOURCES_DIR}/crypto/x509/x509.h - ${OPENSSL_SOURCES_DIR}/crypto/x509/x509_vfy.h - ${OPENSSL_SOURCES_DIR}/crypto/x509v3/x509v3.h - ${OPENSSL_SOURCES_DIR}/e_os2.h - ${OPENSSL_SOURCES_DIR}/ssl/dtls1.h - ${OPENSSL_SOURCES_DIR}/ssl/kssl.h - ${OPENSSL_SOURCES_DIR}/ssl/srtp.h - ${OPENSSL_SOURCES_DIR}/ssl/ssl.h - ${OPENSSL_SOURCES_DIR}/ssl/ssl2.h - ${OPENSSL_SOURCES_DIR}/ssl/ssl23.h - ${OPENSSL_SOURCES_DIR}/ssl/ssl3.h - ${OPENSSL_SOURCES_DIR}/ssl/tls1.h - ) - file(COPY ${header} DESTINATION ${OPENSSL_SOURCES_DIR}/include/openssl) - endforeach() - - file(RENAME - ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h - ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2_source.h) - - # The following patch of "e_os2.h" prevents from building OpenSSL - # as a DLL under Windows. Otherwise, symbols have inconsistent - # linkage if ${OPENSSL_SOURCES} is used to create a DLL (notably - # if building an Orthanc plugin such as MySQL). - file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h " -#include \"e_os2_source.h\" -#if defined(_WIN32) -# undef OPENSSL_EXPORT -# undef OPENSSL_IMPORT -# undef OPENSSL_EXTERN -# undef OPENSSL_GLOBAL -# define OPENSSL_EXPORT -# define OPENSSL_IMPORT -# define OPENSSL_EXTERN extern -# define OPENSSL_GLOBAL -#endif -") - endif() - - add_definitions( - -DOPENSSL_THREADS - -DOPENSSL_IA32_SSE2 - -DOPENSSL_NO_ASM - -DOPENSSL_NO_DYNAMIC_ENGINE - -DNO_WINDOWS_BRAINDEATH - - -DOPENSSL_NO_BF - -DOPENSSL_NO_CAMELLIA - -DOPENSSL_NO_CAST - -DOPENSSL_NO_EC_NISTP_64_GCC_128 - -DOPENSSL_NO_GMP - -DOPENSSL_NO_GOST - -DOPENSSL_NO_HW - -DOPENSSL_NO_JPAKE - -DOPENSSL_NO_IDEA - -DOPENSSL_NO_KRB5 - -DOPENSSL_NO_MD2 - -DOPENSSL_NO_MDC2 - #-DOPENSSL_NO_MD4 # MD4 is necessary for MariaDB/MySQL client - -DOPENSSL_NO_RC2 - -DOPENSSL_NO_RC4 - -DOPENSSL_NO_RC5 - -DOPENSSL_NO_RFC3779 - -DOPENSSL_NO_SCTP - -DOPENSSL_NO_STORE - -DOPENSSL_NO_SEED - -DOPENSSL_NO_WHIRLPOOL - -DOPENSSL_NO_RIPEMD - ) - - include_directories( - ${OPENSSL_SOURCES_DIR} - ${OPENSSL_SOURCES_DIR}/crypto - ${OPENSSL_SOURCES_DIR}/crypto/asn1 - ${OPENSSL_SOURCES_DIR}/crypto/modes - ${OPENSSL_SOURCES_DIR}/crypto/evp - ${OPENSSL_SOURCES_DIR}/include - ) - - set(OPENSSL_SOURCES_SUBDIRS - ${OPENSSL_SOURCES_DIR}/crypto - ${OPENSSL_SOURCES_DIR}/crypto/aes - ${OPENSSL_SOURCES_DIR}/crypto/asn1 - ${OPENSSL_SOURCES_DIR}/crypto/bio - ${OPENSSL_SOURCES_DIR}/crypto/bn - ${OPENSSL_SOURCES_DIR}/crypto/buffer - ${OPENSSL_SOURCES_DIR}/crypto/cmac - ${OPENSSL_SOURCES_DIR}/crypto/cms - ${OPENSSL_SOURCES_DIR}/crypto/comp - ${OPENSSL_SOURCES_DIR}/crypto/conf - ${OPENSSL_SOURCES_DIR}/crypto/des - ${OPENSSL_SOURCES_DIR}/crypto/dh - ${OPENSSL_SOURCES_DIR}/crypto/dsa - ${OPENSSL_SOURCES_DIR}/crypto/dso - ${OPENSSL_SOURCES_DIR}/crypto/engine - ${OPENSSL_SOURCES_DIR}/crypto/err - ${OPENSSL_SOURCES_DIR}/crypto/evp - ${OPENSSL_SOURCES_DIR}/crypto/hmac - ${OPENSSL_SOURCES_DIR}/crypto/lhash - ${OPENSSL_SOURCES_DIR}/crypto/md4 - ${OPENSSL_SOURCES_DIR}/crypto/md5 - ${OPENSSL_SOURCES_DIR}/crypto/modes - ${OPENSSL_SOURCES_DIR}/crypto/objects - ${OPENSSL_SOURCES_DIR}/crypto/ocsp - ${OPENSSL_SOURCES_DIR}/crypto/pem - ${OPENSSL_SOURCES_DIR}/crypto/pkcs12 - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7 - ${OPENSSL_SOURCES_DIR}/crypto/pqueue - ${OPENSSL_SOURCES_DIR}/crypto/rand - ${OPENSSL_SOURCES_DIR}/crypto/rsa - ${OPENSSL_SOURCES_DIR}/crypto/sha - ${OPENSSL_SOURCES_DIR}/crypto/srp - ${OPENSSL_SOURCES_DIR}/crypto/stack - ${OPENSSL_SOURCES_DIR}/crypto/ts - ${OPENSSL_SOURCES_DIR}/crypto/txt_db - ${OPENSSL_SOURCES_DIR}/crypto/ui - ${OPENSSL_SOURCES_DIR}/crypto/x509 - ${OPENSSL_SOURCES_DIR}/crypto/x509v3 - ${OPENSSL_SOURCES_DIR}/ssl - ) - - if (ENABLE_OPENSSL_ENGINES) - list(APPEND OPENSSL_SOURCES_SUBDIRS - ${OPENSSL_SOURCES_DIR}/engines - ) - endif() - - list(APPEND OPENSSL_SOURCES_SUBDIRS - # EC, ECDH and ECDSA are necessary for PKCS11, and for contacting - # HTTPS servers that use TLS certificate encrypted with ECDSA - # (check the output of a recent version of the "sslscan" - # command). Until Orthanc <= 1.4.1, these features were only - # enabled if ENABLE_PKCS11 support was set to "ON". - # https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ - ${OPENSSL_SOURCES_DIR}/crypto/ec - ${OPENSSL_SOURCES_DIR}/crypto/ecdh - ${OPENSSL_SOURCES_DIR}/crypto/ecdsa - ) - - foreach(d ${OPENSSL_SOURCES_SUBDIRS}) - AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES) - endforeach() - - list(REMOVE_ITEM OPENSSL_SOURCES - ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c - ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c - ${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/armcap.c - ${OPENSSL_SOURCES_DIR}/crypto/bf/bfs.cpp - ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_rtcp.c - ${OPENSSL_SOURCES_DIR}/crypto/bn/exp.c - ${OPENSSL_SOURCES_DIR}/crypto/conf/cnf_save.c - ${OPENSSL_SOURCES_DIR}/crypto/conf/test.c - ${OPENSSL_SOURCES_DIR}/crypto/des/des.c - ${OPENSSL_SOURCES_DIR}/crypto/des/des3s.cpp - ${OPENSSL_SOURCES_DIR}/crypto/des/des_opts.c - ${OPENSSL_SOURCES_DIR}/crypto/des/dess.cpp - ${OPENSSL_SOURCES_DIR}/crypto/des/read_pwd.c - ${OPENSSL_SOURCES_DIR}/crypto/des/speed.c - ${OPENSSL_SOURCES_DIR}/crypto/evp/e_dsa.c - ${OPENSSL_SOURCES_DIR}/crypto/evp/m_ripemd.c - ${OPENSSL_SOURCES_DIR}/crypto/lhash/lh_test.c - ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.c - ${OPENSSL_SOURCES_DIR}/crypto/md4/md4s.cpp - ${OPENSSL_SOURCES_DIR}/crypto/md4/md4test.c - ${OPENSSL_SOURCES_DIR}/crypto/md5/md5s.cpp - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/bio_ber.c - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pk7_enc.c - ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c - ${OPENSSL_SOURCES_DIR}/crypto/rand/randtest.c - ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c - ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c - ${OPENSSL_SOURCES_DIR}/crypto/x509v3/tabtest.c - ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3conf.c - ${OPENSSL_SOURCES_DIR}/ssl/ssl_task.c - ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c - ${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c - ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c - ${OPENSSL_SOURCES_DIR}/crypto/bn/bntest.c - ${OPENSSL_SOURCES_DIR}/crypto/bn/expspeed.c - ${OPENSSL_SOURCES_DIR}/crypto/bn/exptest.c - ${OPENSSL_SOURCES_DIR}/crypto/engine/enginetest.c - ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_test.c - ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmactest.c - ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.c - ${OPENSSL_SOURCES_DIR}/crypto/md5/md5test.c - ${OPENSSL_SOURCES_DIR}/crypto/o_dir_test.c - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/dec.c - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/enc.c - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/sign.c - ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/verify.c - ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_test.c - ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.c - ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1.c - ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1t.c - ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1test.c - ${OPENSSL_SOURCES_DIR}/crypto/sha/sha256t.c - ${OPENSSL_SOURCES_DIR}/crypto/sha/sha512t.c - ${OPENSSL_SOURCES_DIR}/crypto/sha/shatest.c - ${OPENSSL_SOURCES_DIR}/crypto/srp/srptest.c - - ${OPENSSL_SOURCES_DIR}/crypto/bn/divtest.c - ${OPENSSL_SOURCES_DIR}/crypto/bn/bnspeed.c - ${OPENSSL_SOURCES_DIR}/crypto/des/destest.c - ${OPENSSL_SOURCES_DIR}/crypto/dh/p192.c - ${OPENSSL_SOURCES_DIR}/crypto/dh/p512.c - ${OPENSSL_SOURCES_DIR}/crypto/dh/p1024.c - ${OPENSSL_SOURCES_DIR}/crypto/des/rpw.c - ${OPENSSL_SOURCES_DIR}/ssl/ssltest.c - ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsagen.c - ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsatest.c - ${OPENSSL_SOURCES_DIR}/crypto/dh/dhtest.c - ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pq_test.c - ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c - - ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_extra_test.c - ${OPENSSL_SOURCES_DIR}/crypto/evp/verify_extra_test.c - ${OPENSSL_SOURCES_DIR}/crypto/x509/verify_extra_test.c - ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3prin.c - ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3nametest.c - ${OPENSSL_SOURCES_DIR}/crypto/constant_time_test.c - - ${OPENSSL_SOURCES_DIR}/ssl/heartbeat_test.c - ${OPENSSL_SOURCES_DIR}/ssl/fatalerrtest.c - ${OPENSSL_SOURCES_DIR}/ssl/dtlstest.c - ${OPENSSL_SOURCES_DIR}/ssl/bad_dtls_test.c - ${OPENSSL_SOURCES_DIR}/ssl/clienthellotest.c - ${OPENSSL_SOURCES_DIR}/ssl/sslv2conftest.c - - ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c - ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c - ${OPENSSL_SOURCES_DIR}/crypto/ec/ectest.c - ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdhtest.c - ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsatest.c - ) - - - if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - set_source_files_properties( - ${OPENSSL_SOURCES} - PROPERTIES COMPILE_DEFINITIONS - "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN") - - if (ENABLE_OPENSSL_ENGINES) - link_libraries(crypt32) - endif() + message(FATAL_ERROR "Unsupported version of OpenSSL: ${OPENSSL_STATIC_VERSION}") endif() source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*) diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/OpenSslConfigurationStatic-1.0.2.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CMake/OpenSslConfigurationStatic-1.0.2.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,332 @@ +SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.0.2p) +SET(OPENSSL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/openssl-1.0.2p.tar.gz") +SET(OPENSSL_MD5 "ac5eb30bf5798aa14b1ae6d0e7da58df") + +if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}") + set(FirstRun OFF) +else() + set(FirstRun ON) +endif() + +DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}") + +if (FirstRun) + file(MAKE_DIRECTORY ${OPENSSL_SOURCES_DIR}/include/openssl) + + foreach(header + ${OPENSSL_SOURCES_DIR}/crypto/aes/aes.h + ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1.h + ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1_mac.h + ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1t.h + ${OPENSSL_SOURCES_DIR}/crypto/bf/blowfish.h + ${OPENSSL_SOURCES_DIR}/crypto/bio/bio.h + ${OPENSSL_SOURCES_DIR}/crypto/bn/bn.h + ${OPENSSL_SOURCES_DIR}/crypto/buffer/buffer.h + ${OPENSSL_SOURCES_DIR}/crypto/camellia/camellia.h + ${OPENSSL_SOURCES_DIR}/crypto/cast/cast.h + ${OPENSSL_SOURCES_DIR}/crypto/cmac/cmac.h + ${OPENSSL_SOURCES_DIR}/crypto/cms/cms.h + ${OPENSSL_SOURCES_DIR}/crypto/comp/comp.h + ${OPENSSL_SOURCES_DIR}/crypto/conf/conf.h + ${OPENSSL_SOURCES_DIR}/crypto/conf/conf_api.h + ${OPENSSL_SOURCES_DIR}/crypto/crypto.h + ${OPENSSL_SOURCES_DIR}/crypto/des/des.h + ${OPENSSL_SOURCES_DIR}/crypto/des/des_old.h + ${OPENSSL_SOURCES_DIR}/crypto/dh/dh.h + ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsa.h + ${OPENSSL_SOURCES_DIR}/crypto/dso/dso.h + ${OPENSSL_SOURCES_DIR}/crypto/ebcdic.h + ${OPENSSL_SOURCES_DIR}/crypto/ec/ec.h + ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdh.h + ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsa.h + ${OPENSSL_SOURCES_DIR}/crypto/engine/engine.h + ${OPENSSL_SOURCES_DIR}/crypto/err/err.h + ${OPENSSL_SOURCES_DIR}/crypto/evp/evp.h + ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmac.h + ${OPENSSL_SOURCES_DIR}/crypto/idea/idea.h + ${OPENSSL_SOURCES_DIR}/crypto/jpake/jpake.h + ${OPENSSL_SOURCES_DIR}/crypto/krb5/krb5_asn.h + ${OPENSSL_SOURCES_DIR}/crypto/lhash/lhash.h + ${OPENSSL_SOURCES_DIR}/crypto/md2/md2.h + ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.h + ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.h + ${OPENSSL_SOURCES_DIR}/crypto/mdc2/mdc2.h + ${OPENSSL_SOURCES_DIR}/crypto/modes/modes.h + ${OPENSSL_SOURCES_DIR}/crypto/objects/obj_mac.h + ${OPENSSL_SOURCES_DIR}/crypto/objects/objects.h + ${OPENSSL_SOURCES_DIR}/crypto/ocsp/ocsp.h + ${OPENSSL_SOURCES_DIR}/crypto/opensslconf.h + ${OPENSSL_SOURCES_DIR}/crypto/opensslv.h + ${OPENSSL_SOURCES_DIR}/crypto/ossl_typ.h + ${OPENSSL_SOURCES_DIR}/crypto/pem/pem.h + ${OPENSSL_SOURCES_DIR}/crypto/pem/pem2.h + ${OPENSSL_SOURCES_DIR}/crypto/pkcs12/pkcs12.h + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pkcs7.h + ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pqueue.h + ${OPENSSL_SOURCES_DIR}/crypto/rand/rand.h + ${OPENSSL_SOURCES_DIR}/crypto/rc2/rc2.h + ${OPENSSL_SOURCES_DIR}/crypto/rc4/rc4.h + ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5.h + ${OPENSSL_SOURCES_DIR}/crypto/ripemd/ripemd.h + ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa.h + ${OPENSSL_SOURCES_DIR}/crypto/seed/seed.h + ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.h + ${OPENSSL_SOURCES_DIR}/crypto/srp/srp.h + ${OPENSSL_SOURCES_DIR}/crypto/stack/safestack.h + ${OPENSSL_SOURCES_DIR}/crypto/stack/stack.h + ${OPENSSL_SOURCES_DIR}/crypto/store/store.h + ${OPENSSL_SOURCES_DIR}/crypto/symhacks.h + ${OPENSSL_SOURCES_DIR}/crypto/ts/ts.h + ${OPENSSL_SOURCES_DIR}/crypto/txt_db/txt_db.h + ${OPENSSL_SOURCES_DIR}/crypto/ui/ui.h + ${OPENSSL_SOURCES_DIR}/crypto/ui/ui_compat.h + ${OPENSSL_SOURCES_DIR}/crypto/whrlpool/whrlpool.h + ${OPENSSL_SOURCES_DIR}/crypto/x509/x509.h + ${OPENSSL_SOURCES_DIR}/crypto/x509/x509_vfy.h + ${OPENSSL_SOURCES_DIR}/crypto/x509v3/x509v3.h + ${OPENSSL_SOURCES_DIR}/e_os2.h + ${OPENSSL_SOURCES_DIR}/ssl/dtls1.h + ${OPENSSL_SOURCES_DIR}/ssl/kssl.h + ${OPENSSL_SOURCES_DIR}/ssl/srtp.h + ${OPENSSL_SOURCES_DIR}/ssl/ssl.h + ${OPENSSL_SOURCES_DIR}/ssl/ssl2.h + ${OPENSSL_SOURCES_DIR}/ssl/ssl23.h + ${OPENSSL_SOURCES_DIR}/ssl/ssl3.h + ${OPENSSL_SOURCES_DIR}/ssl/tls1.h + ) + file(COPY ${header} DESTINATION ${OPENSSL_SOURCES_DIR}/include/openssl) + endforeach() + + file(RENAME + ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h + ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2_source.h) + + # The following patch of "e_os2.h" prevents from building OpenSSL + # as a DLL under Windows. Otherwise, symbols have inconsistent + # linkage if ${OPENSSL_SOURCES} is used to create a DLL (notably + # if building an Orthanc plugin such as MySQL). + file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h " +#include \"e_os2_source.h\" +#if defined(_WIN32) +# undef OPENSSL_EXPORT +# undef OPENSSL_IMPORT +# undef OPENSSL_EXTERN +# undef OPENSSL_GLOBAL +# define OPENSSL_EXPORT +# define OPENSSL_IMPORT +# define OPENSSL_EXTERN extern +# define OPENSSL_GLOBAL +#endif +") +endif() + +add_definitions( + -DOPENSSL_THREADS + -DOPENSSL_IA32_SSE2 + -DOPENSSL_NO_ASM + -DOPENSSL_NO_DYNAMIC_ENGINE + -DNO_WINDOWS_BRAINDEATH + + -DOPENSSL_NO_BF + -DOPENSSL_NO_CAMELLIA + -DOPENSSL_NO_CAST + -DOPENSSL_NO_EC_NISTP_64_GCC_128 + -DOPENSSL_NO_GMP + -DOPENSSL_NO_GOST + -DOPENSSL_NO_HW + -DOPENSSL_NO_JPAKE + -DOPENSSL_NO_IDEA + -DOPENSSL_NO_KRB5 + -DOPENSSL_NO_MD2 + -DOPENSSL_NO_MDC2 + #-DOPENSSL_NO_MD4 # MD4 is necessary for MariaDB/MySQL client + -DOPENSSL_NO_RC2 + -DOPENSSL_NO_RC4 + -DOPENSSL_NO_RC5 + -DOPENSSL_NO_RFC3779 + -DOPENSSL_NO_SCTP + -DOPENSSL_NO_STORE + -DOPENSSL_NO_SEED + -DOPENSSL_NO_WHIRLPOOL + -DOPENSSL_NO_RIPEMD + ) + +include_directories( + ${OPENSSL_SOURCES_DIR} + ${OPENSSL_SOURCES_DIR}/crypto + ${OPENSSL_SOURCES_DIR}/crypto/asn1 + ${OPENSSL_SOURCES_DIR}/crypto/modes + ${OPENSSL_SOURCES_DIR}/crypto/evp + ${OPENSSL_SOURCES_DIR}/include + ) + +set(OPENSSL_SOURCES_SUBDIRS + ${OPENSSL_SOURCES_DIR}/crypto + ${OPENSSL_SOURCES_DIR}/crypto/aes + ${OPENSSL_SOURCES_DIR}/crypto/asn1 + ${OPENSSL_SOURCES_DIR}/crypto/bio + ${OPENSSL_SOURCES_DIR}/crypto/bn + ${OPENSSL_SOURCES_DIR}/crypto/buffer + ${OPENSSL_SOURCES_DIR}/crypto/cmac + ${OPENSSL_SOURCES_DIR}/crypto/cms + ${OPENSSL_SOURCES_DIR}/crypto/comp + ${OPENSSL_SOURCES_DIR}/crypto/conf + ${OPENSSL_SOURCES_DIR}/crypto/des + ${OPENSSL_SOURCES_DIR}/crypto/dh + ${OPENSSL_SOURCES_DIR}/crypto/dsa + ${OPENSSL_SOURCES_DIR}/crypto/dso + ${OPENSSL_SOURCES_DIR}/crypto/engine + ${OPENSSL_SOURCES_DIR}/crypto/err + ${OPENSSL_SOURCES_DIR}/crypto/evp + ${OPENSSL_SOURCES_DIR}/crypto/hmac + ${OPENSSL_SOURCES_DIR}/crypto/lhash + ${OPENSSL_SOURCES_DIR}/crypto/md4 + ${OPENSSL_SOURCES_DIR}/crypto/md5 + ${OPENSSL_SOURCES_DIR}/crypto/modes + ${OPENSSL_SOURCES_DIR}/crypto/objects + ${OPENSSL_SOURCES_DIR}/crypto/ocsp + ${OPENSSL_SOURCES_DIR}/crypto/pem + ${OPENSSL_SOURCES_DIR}/crypto/pkcs12 + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7 + ${OPENSSL_SOURCES_DIR}/crypto/pqueue + ${OPENSSL_SOURCES_DIR}/crypto/rand + ${OPENSSL_SOURCES_DIR}/crypto/rsa + ${OPENSSL_SOURCES_DIR}/crypto/sha + ${OPENSSL_SOURCES_DIR}/crypto/srp + ${OPENSSL_SOURCES_DIR}/crypto/stack + ${OPENSSL_SOURCES_DIR}/crypto/ts + ${OPENSSL_SOURCES_DIR}/crypto/txt_db + ${OPENSSL_SOURCES_DIR}/crypto/ui + ${OPENSSL_SOURCES_DIR}/crypto/x509 + ${OPENSSL_SOURCES_DIR}/crypto/x509v3 + ${OPENSSL_SOURCES_DIR}/ssl + ) + +if (ENABLE_OPENSSL_ENGINES) + list(APPEND OPENSSL_SOURCES_SUBDIRS + ${OPENSSL_SOURCES_DIR}/engines + ) +endif() + +list(APPEND OPENSSL_SOURCES_SUBDIRS + # EC, ECDH and ECDSA are necessary for PKCS11, and for contacting + # HTTPS servers that use TLS certificate encrypted with ECDSA + # (check the output of a recent version of the "sslscan" + # command). Until Orthanc <= 1.4.1, these features were only + # enabled if ENABLE_PKCS11 support was set to "ON". + # https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ + ${OPENSSL_SOURCES_DIR}/crypto/ec + ${OPENSSL_SOURCES_DIR}/crypto/ecdh + ${OPENSSL_SOURCES_DIR}/crypto/ecdsa + ) + +foreach(d ${OPENSSL_SOURCES_SUBDIRS}) + AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES) +endforeach() + +list(REMOVE_ITEM OPENSSL_SOURCES + ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c + ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c + ${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/armcap.c + ${OPENSSL_SOURCES_DIR}/crypto/bf/bfs.cpp + ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_rtcp.c + ${OPENSSL_SOURCES_DIR}/crypto/bn/exp.c + ${OPENSSL_SOURCES_DIR}/crypto/conf/cnf_save.c + ${OPENSSL_SOURCES_DIR}/crypto/conf/test.c + ${OPENSSL_SOURCES_DIR}/crypto/des/des.c + ${OPENSSL_SOURCES_DIR}/crypto/des/des3s.cpp + ${OPENSSL_SOURCES_DIR}/crypto/des/des_opts.c + ${OPENSSL_SOURCES_DIR}/crypto/des/dess.cpp + ${OPENSSL_SOURCES_DIR}/crypto/des/read_pwd.c + ${OPENSSL_SOURCES_DIR}/crypto/des/speed.c + ${OPENSSL_SOURCES_DIR}/crypto/evp/e_dsa.c + ${OPENSSL_SOURCES_DIR}/crypto/evp/m_ripemd.c + ${OPENSSL_SOURCES_DIR}/crypto/lhash/lh_test.c + ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.c + ${OPENSSL_SOURCES_DIR}/crypto/md4/md4s.cpp + ${OPENSSL_SOURCES_DIR}/crypto/md4/md4test.c + ${OPENSSL_SOURCES_DIR}/crypto/md5/md5s.cpp + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/bio_ber.c + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pk7_enc.c + ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c + ${OPENSSL_SOURCES_DIR}/crypto/rand/randtest.c + ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c + ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c + ${OPENSSL_SOURCES_DIR}/crypto/x509v3/tabtest.c + ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3conf.c + ${OPENSSL_SOURCES_DIR}/ssl/ssl_task.c + ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c + ${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c + ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c + ${OPENSSL_SOURCES_DIR}/crypto/bn/bntest.c + ${OPENSSL_SOURCES_DIR}/crypto/bn/expspeed.c + ${OPENSSL_SOURCES_DIR}/crypto/bn/exptest.c + ${OPENSSL_SOURCES_DIR}/crypto/engine/enginetest.c + ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_test.c + ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmactest.c + ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.c + ${OPENSSL_SOURCES_DIR}/crypto/md5/md5test.c + ${OPENSSL_SOURCES_DIR}/crypto/o_dir_test.c + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/dec.c + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/enc.c + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/sign.c + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/verify.c + ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_test.c + ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.c + ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1.c + ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1t.c + ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1test.c + ${OPENSSL_SOURCES_DIR}/crypto/sha/sha256t.c + ${OPENSSL_SOURCES_DIR}/crypto/sha/sha512t.c + ${OPENSSL_SOURCES_DIR}/crypto/sha/shatest.c + ${OPENSSL_SOURCES_DIR}/crypto/srp/srptest.c + + ${OPENSSL_SOURCES_DIR}/crypto/bn/divtest.c + ${OPENSSL_SOURCES_DIR}/crypto/bn/bnspeed.c + ${OPENSSL_SOURCES_DIR}/crypto/des/destest.c + ${OPENSSL_SOURCES_DIR}/crypto/dh/p192.c + ${OPENSSL_SOURCES_DIR}/crypto/dh/p512.c + ${OPENSSL_SOURCES_DIR}/crypto/dh/p1024.c + ${OPENSSL_SOURCES_DIR}/crypto/des/rpw.c + ${OPENSSL_SOURCES_DIR}/ssl/ssltest.c + ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsagen.c + ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsatest.c + ${OPENSSL_SOURCES_DIR}/crypto/dh/dhtest.c + ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pq_test.c + ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c + + ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_extra_test.c + ${OPENSSL_SOURCES_DIR}/crypto/evp/verify_extra_test.c + ${OPENSSL_SOURCES_DIR}/crypto/x509/verify_extra_test.c + ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3prin.c + ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3nametest.c + ${OPENSSL_SOURCES_DIR}/crypto/constant_time_test.c + + ${OPENSSL_SOURCES_DIR}/ssl/heartbeat_test.c + ${OPENSSL_SOURCES_DIR}/ssl/fatalerrtest.c + ${OPENSSL_SOURCES_DIR}/ssl/dtlstest.c + ${OPENSSL_SOURCES_DIR}/ssl/bad_dtls_test.c + ${OPENSSL_SOURCES_DIR}/ssl/clienthellotest.c + ${OPENSSL_SOURCES_DIR}/ssl/sslv2conftest.c + + ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c + ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c + ${OPENSSL_SOURCES_DIR}/crypto/ec/ectest.c + ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdhtest.c + ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsatest.c + ) + + +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + set_source_files_properties( + ${OPENSSL_SOURCES} + PROPERTIES COMPILE_DEFINITIONS + "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN") + + if (ENABLE_OPENSSL_ENGINES) + link_libraries(crypt32) + endif() +endif() diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,245 @@ +SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.1.1d) +SET(OPENSSL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/openssl-1.1.1d.tar.gz") +SET(OPENSSL_MD5 "3be209000dbc7e1b95bcdf47980a3baa") + +if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}") + set(FirstRun OFF) +else() + set(FirstRun ON) +endif() + +DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}") + +if (FirstRun) + file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/buildinf.h " +#define DATE \"\" +#define PLATFORM \"\" +#define compiler_flags \"\" +") + file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/include/internal/bn_conf.h "") + file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/include/internal/dso_conf.h "") + + configure_file( + ${ORTHANC_ROOT}/Resources/Patches/openssl-1.1.1d-conf.h.in + ${OPENSSL_SOURCES_DIR}/include/openssl/opensslconf.h + ) + + # Apply the patches + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/openssl-1.1.1d.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (Failure) + message(FATAL_ERROR "Error while patching a file") + endif() +else() + message("The patches for OpenSSL have already been applied") +endif() + +add_definitions( + -DOPENSSL_THREADS + -DOPENSSL_IA32_SSE2 + -DOPENSSL_NO_ASM + -DOPENSSL_NO_DYNAMIC_ENGINE + -DOPENSSL_NO_DEVCRYPTOENG + + -DOPENSSL_NO_BF + -DOPENSSL_NO_CAMELLIA + -DOPENSSL_NO_CAST + -DOPENSSL_NO_EC_NISTP_64_GCC_128 + -DOPENSSL_NO_GMP + -DOPENSSL_NO_GOST + -DOPENSSL_NO_HW + -DOPENSSL_NO_JPAKE + -DOPENSSL_NO_IDEA + -DOPENSSL_NO_KRB5 + -DOPENSSL_NO_MD2 + -DOPENSSL_NO_MDC2 + #-DOPENSSL_NO_MD4 # MD4 is necessary for MariaDB/MySQL client + -DOPENSSL_NO_RC2 + -DOPENSSL_NO_RC4 + -DOPENSSL_NO_RC5 + -DOPENSSL_NO_RFC3779 + -DOPENSSL_NO_SCTP + -DOPENSSL_NO_STORE + -DOPENSSL_NO_SEED + -DOPENSSL_NO_WHIRLPOOL + -DOPENSSL_NO_RIPEMD + -DOPENSSL_NO_AFALGENG + + -DOPENSSLDIR="/usr/local/ssl" + ) + + +include_directories( + ${OPENSSL_SOURCES_DIR} + ${OPENSSL_SOURCES_DIR}/crypto + ${OPENSSL_SOURCES_DIR}/crypto/asn1 + ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448 + ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32 + ${OPENSSL_SOURCES_DIR}/crypto/evp + ${OPENSSL_SOURCES_DIR}/crypto/include + ${OPENSSL_SOURCES_DIR}/crypto/modes + ${OPENSSL_SOURCES_DIR}/include + ) + + +set(OPENSSL_SOURCES_SUBDIRS + ${OPENSSL_SOURCES_DIR}/crypto + ${OPENSSL_SOURCES_DIR}/crypto/aes + ${OPENSSL_SOURCES_DIR}/crypto/aria + ${OPENSSL_SOURCES_DIR}/crypto/asn1 + ${OPENSSL_SOURCES_DIR}/crypto/async + ${OPENSSL_SOURCES_DIR}/crypto/async/arch + ${OPENSSL_SOURCES_DIR}/crypto/bio + ${OPENSSL_SOURCES_DIR}/crypto/blake2 + ${OPENSSL_SOURCES_DIR}/crypto/bn + ${OPENSSL_SOURCES_DIR}/crypto/buffer + ${OPENSSL_SOURCES_DIR}/crypto/chacha + ${OPENSSL_SOURCES_DIR}/crypto/cmac + ${OPENSSL_SOURCES_DIR}/crypto/cms + ${OPENSSL_SOURCES_DIR}/crypto/comp + ${OPENSSL_SOURCES_DIR}/crypto/conf + ${OPENSSL_SOURCES_DIR}/crypto/ct + ${OPENSSL_SOURCES_DIR}/crypto/des + ${OPENSSL_SOURCES_DIR}/crypto/dh + ${OPENSSL_SOURCES_DIR}/crypto/dsa + ${OPENSSL_SOURCES_DIR}/crypto/dso + ${OPENSSL_SOURCES_DIR}/crypto/ec + ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448 + ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32 + ${OPENSSL_SOURCES_DIR}/crypto/err + ${OPENSSL_SOURCES_DIR}/crypto/evp + ${OPENSSL_SOURCES_DIR}/crypto/hmac + ${OPENSSL_SOURCES_DIR}/crypto/kdf + ${OPENSSL_SOURCES_DIR}/crypto/lhash + ${OPENSSL_SOURCES_DIR}/crypto/md4 + ${OPENSSL_SOURCES_DIR}/crypto/md5 + ${OPENSSL_SOURCES_DIR}/crypto/modes + ${OPENSSL_SOURCES_DIR}/crypto/objects + ${OPENSSL_SOURCES_DIR}/crypto/ocsp + ${OPENSSL_SOURCES_DIR}/crypto/pem + ${OPENSSL_SOURCES_DIR}/crypto/pkcs12 + ${OPENSSL_SOURCES_DIR}/crypto/pkcs7 + ${OPENSSL_SOURCES_DIR}/crypto/poly1305 + ${OPENSSL_SOURCES_DIR}/crypto/pqueue + ${OPENSSL_SOURCES_DIR}/crypto/rand + ${OPENSSL_SOURCES_DIR}/crypto/ripemd + ${OPENSSL_SOURCES_DIR}/crypto/rsa + ${OPENSSL_SOURCES_DIR}/crypto/sha + ${OPENSSL_SOURCES_DIR}/crypto/siphash + ${OPENSSL_SOURCES_DIR}/crypto/sm2 + ${OPENSSL_SOURCES_DIR}/crypto/sm3 + ${OPENSSL_SOURCES_DIR}/crypto/sm4 + ${OPENSSL_SOURCES_DIR}/crypto/srp + ${OPENSSL_SOURCES_DIR}/crypto/stack + ${OPENSSL_SOURCES_DIR}/crypto/store + ${OPENSSL_SOURCES_DIR}/crypto/ts + ${OPENSSL_SOURCES_DIR}/crypto/txt_db + ${OPENSSL_SOURCES_DIR}/crypto/ui + ${OPENSSL_SOURCES_DIR}/crypto/x509 + ${OPENSSL_SOURCES_DIR}/crypto/x509v3 + ${OPENSSL_SOURCES_DIR}/ssl + ${OPENSSL_SOURCES_DIR}/ssl/record + ${OPENSSL_SOURCES_DIR}/ssl/statem + ) + +if (ENABLE_OPENSSL_ENGINES) + add_definitions( + #-DENGINESDIR="/usr/local/lib/engines-1.1" # On GNU/Linux + -DENGINESDIR="." + ) + + list(APPEND OPENSSL_SOURCES_SUBDIRS + ${OPENSSL_SOURCES_DIR}/engines + ${OPENSSL_SOURCES_DIR}/crypto/engine + ) +else() + add_definitions(-DOPENSSL_NO_ENGINE) +endif() + +list(APPEND OPENSSL_SOURCES_SUBDIRS + # EC, ECDH and ECDSA are necessary for PKCS11, and for contacting + # HTTPS servers that use TLS certificate encrypted with ECDSA + # (check the output of a recent version of the "sslscan" + # command). Until Orthanc <= 1.4.1, these features were only + # enabled if ENABLE_PKCS11 support was set to "ON". + # https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ + ${OPENSSL_SOURCES_DIR}/crypto/ec + ${OPENSSL_SOURCES_DIR}/crypto/ecdh + ${OPENSSL_SOURCES_DIR}/crypto/ecdsa + ) + +foreach(d ${OPENSSL_SOURCES_SUBDIRS}) + AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES) +endforeach() + +list(REMOVE_ITEM OPENSSL_SOURCES + ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c + ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c + ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c + ${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/aes/aes_x86core.c + ${OPENSSL_SOURCES_DIR}/crypto/armcap.c + ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c + ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c + ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c + ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c + ${OPENSSL_SOURCES_DIR}/crypto/engine/eng_devcrypto.c + ${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_base2_44.c # Cannot be compiled with MinGW + ${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_ieee754.c # Cannot be compiled with MinGW + ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c + ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c + ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c + ${OPENSSL_SOURCES_DIR}/engines/e_afalg.c # Cannot be compiled with MinGW + ) + +# Check out "${OPENSSL_SOURCES_DIR}/Configurations/README": "This is +# default if no option is specified, it works on any supported +# system." It is mandatory to define it as a macro, as it is used by +# all the source files that include OpenSSL (e.g. "Core/Toolbox.cpp" +# or curl) +add_definitions(-DTHIRTY_TWO_BIT) + + +if (NOT CMAKE_COMPILER_IS_GNUCXX OR + "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR + "${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + # Disable the use of a gcc extension, that is neither available on + # MinGW, nor on LSB + add_definitions( + -DOPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE + ) +endif() + + +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + set(OPENSSL_DEFINITIONS + "${OPENSSL_DEFINITIONS};OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;NO_WINDOWS_BRAINDEATH") + + if (ENABLE_OPENSSL_ENGINES) + link_libraries(crypt32) + endif() + + add_definitions( + -DOPENSSL_RAND_SEED_OS # ${OPENSSL_SOURCES_DIR}/crypto/rand/rand_win.c + ) + +elseif ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + # In order for "crypto/mem_sec.c" to compile on LSB + add_definitions( + -DOPENSSL_NO_SECURE_MEMORY + ) +endif() + + +set_source_files_properties( + ${OPENSSL_SOURCES} + PROPERTIES COMPILE_DEFINITIONS + "${OPENSSL_DEFINITIONS};DSO_NONE" + ) diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/OrthancFrameworkConfiguration.cmake --- a/Resources/CMake/OrthancFrameworkConfiguration.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -107,6 +107,7 @@ add_definitions( -DORTHANC_ENABLE_DCMTK=0 -DORTHANC_ENABLE_DCMTK_NETWORKING=0 + -DORTHANC_ENABLE_DCMTK_TRANSCODING=0 ) unset(DCMTK_DICTIONARY_DIR CACHE) unset(DCMTK_VERSION CACHE) @@ -494,6 +495,13 @@ add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=0) endif() + # New in Orthanc 1.6.0 + if (ENABLE_DCMTK_TRANSCODING) + add_definitions(-DORTHANC_ENABLE_DCMTK_TRANSCODING=1) + else() + add_definitions(-DORTHANC_ENABLE_DCMTK_TRANSCODING=0) + endif() + if (STANDALONE_BUILD AND NOT HAS_EMBEDDED_RESOURCES) EmbedResources( ${DCMTK_DICTIONARIES} diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/CMake/OrthancFrameworkParameters.cmake --- a/Resources/CMake/OrthancFrameworkParameters.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/CMake/OrthancFrameworkParameters.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -57,7 +57,7 @@ # Parameters specific to DCMTK set(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)") -set(DCMTK_STATIC_VERSION "3.6.4" CACHE STRING "Version of DCMTK to be used in static builds (can be \"3.6.0\", \"3.6.2\", or \"3.6.4\")") +set(DCMTK_STATIC_VERSION "3.6.5" CACHE STRING "Version of DCMTK to be used in static builds (can be \"3.6.0\", \"3.6.2\", \"3.6.4\", or \"3.6.5\")") set(USE_DCMTK_362_PRIVATE_DIC ON CACHE BOOL "Use the dictionary of private tags from DCMTK 3.6.2 if using DCMTK 3.6.0") set(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK") set(ENABLE_DCMTK_LOG ON CACHE BOOL "Enable logging internal to DCMTK") @@ -73,6 +73,7 @@ set(USE_LEGACY_LIBICU OFF CACHE BOOL "Use icu icu4c-58_2, latest version not requiring a C++11 compiler (for LSB and old versions of Visual Studio)") set(MSVC_MULTIPLE_PROCESSES OFF CACHE BOOL "Add the /MP option to build with multiple processes if using Visual Studio") set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND OFF CACHE BOOL "Sets the compiler flags required to use the LLVM Web Assembly backend in emscripten") +set(OPENSSL_STATIC_VERSION "1.1.1" CACHE STRING "Version of OpenSSL to be used in static builds (can be \"1.0.2\", or \"1.1.1\")") mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE) mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS) @@ -102,6 +103,7 @@ set(ENABLE_WEB_SERVER OFF CACHE INTERNAL "Enable embedded Web server") set(ENABLE_DCMTK OFF CACHE INTERNAL "Enable DCMTK") set(ENABLE_DCMTK_NETWORKING OFF CACHE INTERNAL "Enable DICOM networking in DCMTK") +set(ENABLE_DCMTK_TRANSCODING OFF CACHE INTERNAL "Enable DICOM transcoding in DCMTK") set(ENABLE_OPENSSL_ENGINES OFF CACHE INTERNAL "Enable support of engines in OpenSSL") set(HAS_EMBEDDED_RESOURCES OFF CACHE INTERNAL diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/DicomTransferSyntaxes.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/DicomTransferSyntaxes.json Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,353 @@ +[ + { + "UID" : "1.2.840.10008.1.2", + "Name" : "Implicit VR Little Endian", + "Value" : "LittleEndianImplicit", + "Retired" : false, + "DCMTK" : "EXS_LittleEndianImplicit", + "GDCM" : "gdcm::TransferSyntax::ImplicitVRLittleEndian" + }, + + { + "UID" : "1.2.840.10008.1.2.1", + "Name" : "Explicit VR Little Endian", + "Value" : "LittleEndianExplicit", + "Retired" : false, + "DCMTK" : "EXS_LittleEndianExplicit", + "GDCM" : "gdcm::TransferSyntax::ExplicitVRLittleEndian" + }, + + { + "UID" : "1.2.840.10008.1.2.1.99", + "Name" : "Deflated Explicit VR Little Endian", + "Value" : "DeflatedLittleEndianExplicit", + "Retired" : false, + "DCMTK" : "EXS_DeflatedLittleEndianExplicit" + }, + + { + "UID" : "1.2.840.10008.1.2.2", + "Name" : "Explicit VR Big Endian", + "Value" : "BigEndianExplicit", + "Retired" : false, + "DCMTK" : "EXS_BigEndianExplicit" + }, + + { + "UID" : "1.2.840.10008.1.2.4.50", + "Name" : "JPEG Baseline (process 1, lossy)", + "Value" : "JPEGProcess1", + "Retired" : false, + "Note" : "Default Transfer Syntax for Lossy JPEG 8-bit Image Compression", + "DCMTK" : "EXS_JPEGProcess1", + "GDCM" : "gdcm::TransferSyntax::JPEGBaselineProcess1" + }, + + { + "UID" : "1.2.840.10008.1.2.4.51", + "Name" : "JPEG Extended Sequential (processes 2 & 4)", + "Value" : "JPEGProcess2_4", + "Retired" : false, + "Note" : "Default Transfer Syntax for Lossy JPEG (lossy, 8/12 bit), 12-bit Image Compression (Process 4 only)", + "DCMTK" : "EXS_JPEGProcess2_4", + "GDCM" : "gdcm::TransferSyntax::JPEGExtendedProcess2_4" + }, + + { + "UID" : "1.2.840.10008.1.2.4.52", + "Name" : "JPEG Extended Sequential (lossy, 8/12 bit), arithmetic coding", + "Value" : "JPEGProcess3_5", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess3_5" + }, + + { + "UID" : "1.2.840.10008.1.2.4.53", + "Name" : "JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit)", + "Value" : "JPEGProcess6_8", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess6_8" + }, + + { + "UID" : "1.2.840.10008.1.2.4.54", + "Name" : "JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit), arithmetic coding", + "Value" : "JPEGProcess7_9", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess7_9" + }, + + { + "UID" : "1.2.840.10008.1.2.4.55", + "Name" : "JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit)", + "Value" : "JPEGProcess10_12", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess10_12" + }, + + { + "UID" : "1.2.840.10008.1.2.4.56", + "Name" : "JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit), arithmetic coding", + "Value" : "JPEGProcess11_13", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess11_13" + }, + + { + "UID" : "1.2.840.10008.1.2.4.57", + "Name" : "JPEG Lossless, Nonhierarchical with any selection value (process 14)", + "Value" : "JPEGProcess14", + "Retired" : false, + "DCMTK" : "EXS_JPEGProcess14", + "GDCM" : "gdcm::TransferSyntax::JPEGLosslessProcess14" + }, + + { + "UID" : "1.2.840.10008.1.2.4.58", + "Name" : "JPEG Lossless with any selection value, arithmetic coding", + "Value" : "JPEGProcess15", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess15" + }, + + { + "UID" : "1.2.840.10008.1.2.4.59", + "Name" : "JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit)", + "Value" : "JPEGProcess16_18", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess16_18" + }, + + { + "UID" : "1.2.840.10008.1.2.4.60", + "Name" : "JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit), arithmetic coding", + "Value" : "JPEGProcess17_19", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess17_19" + }, + + { + "UID" : "1.2.840.10008.1.2.4.61", + "Name" : "JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit)", + "Value" : "JPEGProcess20_22", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess20_22" + }, + + { + "UID" : "1.2.840.10008.1.2.4.62", + "Name" : "JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit), arithmetic coding", + "Value" : "JPEGProcess21_23", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess21_23" + }, + + { + "UID" : "1.2.840.10008.1.2.4.63", + "Name" : "JPEG Full Progression, Hierarchical (lossy, 8/12 bit)", + "Value" : "JPEGProcess24_26", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess24_26" + }, + + { + "UID" : "1.2.840.10008.1.2.4.64", + "Name" : "JPEG Full Progression, Hierarchical (lossy, 8/12 bit), arithmetic coding", + "Value" : "JPEGProcess25_27", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess25_27" + }, + + { + "UID" : "1.2.840.10008.1.2.4.65", + "Name" : "JPEG Lossless, Hierarchical", + "Value" : "JPEGProcess28", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess28" + }, + + { + "UID" : "1.2.840.10008.1.2.4.66", + "Name" : "JPEG Lossless, Hierarchical, arithmetic coding", + "Value" : "JPEGProcess29", + "Retired" : true, + "DCMTK" : "EXS_JPEGProcess29" + }, + + { + "UID" : "1.2.840.10008.1.2.4.70", + "Name" : "JPEG Lossless, Nonhierarchical, First-Order Prediction (Processes 14 [Selection Value 1])", + "Value" : "JPEGProcess14SV1", + "Retired" : false, + "Note" : "Default Transfer Syntax for Lossless JPEG Image Compression", + "DCMTK" : "EXS_JPEGProcess14SV1", + "GDCM" : "gdcm::TransferSyntax::JPEGLosslessProcess14_1" + }, + + { + "UID" : "1.2.840.10008.1.2.4.80", + "Name" : "JPEG-LS (lossless)", + "Value" : "JPEGLSLossless", + "Retired" : false, + "DCMTK" : "EXS_JPEGLSLossless", + "GDCM" : "gdcm::TransferSyntax::JPEGLSLossless" + }, + + { + "UID" : "1.2.840.10008.1.2.4.81", + "Name" : "JPEG-LS (lossy or near-lossless)", + "Value" : "JPEGLSLossy", + "Retired" : false, + "DCMTK" : "EXS_JPEGLSLossy", + "GDCM" : "gdcm::TransferSyntax::JPEGLSNearLossless" + }, + + { + "UID" : "1.2.840.10008.1.2.4.90", + "Name" : "JPEG 2000 (lossless)", + "Value" : "JPEG2000LosslessOnly", + "Retired" : false, + "DCMTK" : "EXS_JPEG2000LosslessOnly", + "GDCM" : "gdcm::TransferSyntax::JPEG2000Lossless" + }, + + { + "UID" : "1.2.840.10008.1.2.4.91", + "Name" : "JPEG 2000 (lossless or lossy)", + "Value" : "JPEG2000", + "Retired" : false, + "DCMTK" : "EXS_JPEG2000", + "GDCM" : "gdcm::TransferSyntax::JPEG2000" + }, + + { + "UID" : "1.2.840.10008.1.2.4.92", + "Name" : "JPEG 2000 part 2 multicomponent extensions (lossless)", + "Value" : "JPEG2000MulticomponentLosslessOnly", + "Retired" : false, + "DCMTK" : "EXS_JPEG2000MulticomponentLosslessOnly", + "GDCM" : "gdcm::TransferSyntax::JPEG2000Part2Lossless" + }, + + { + "UID" : "1.2.840.10008.1.2.4.93", + "Name" : "JPEG 2000 part 2 multicomponent extensions (lossless or lossy)", + "Value" : "JPEG2000Multicomponent", + "Retired" : false, + "DCMTK" : "EXS_JPEG2000Multicomponent", + "GDCM" : "gdcm::TransferSyntax::JPEG2000Part2" + }, + + { + "UID" : "1.2.840.10008.1.2.4.94", + "Name" : "JPIP Referenced", + "Value" : "JPIPReferenced", + "Retired" : false, + "DCMTK" : "EXS_JPIPReferenced" + }, + + { + "UID" : "1.2.840.10008.1.2.4.95", + "Name" : "JPIP Referenced Deflate", + "Value" : "JPIPReferencedDeflate", + "Retired" : false, + "DCMTK" : "EXS_JPIPReferencedDeflate" + }, + + { + "UID" : "1.2.840.10008.1.2.4.100", + "Name" : "MPEG2 Main Profile at Main Level", + "Value" : "MPEG2MainProfileAtMainLevel", + "Retired" : false, + "DCMTK" : "EXS_MPEG2MainProfileAtMainLevel" + }, + + { + "UID" : "1.2.840.10008.1.2.4.101", + "Name" : "MPEG2 Main Profile at High Level", + "Value" : "MPEG2MainProfileAtHighLevel", + "Retired" : false, + "DCMTK" : "EXS_MPEG2MainProfileAtHighLevel" + }, + + { + "UID" : "1.2.840.10008.1.2.4.102", + "Name" : "MPEG4 High Profile / Level 4.1", + "Value" : "MPEG4HighProfileLevel4_1", + "Retired" : false, + "DCMTK" : "EXS_MPEG4HighProfileLevel4_1" + }, + + { + "UID" : "1.2.840.10008.1.2.4.103", + "Name" : "MPEG4 BD-compatible High Profile / Level 4.1", + "Value" : "MPEG4BDcompatibleHighProfileLevel4_1", + "Retired" : false, + "DCMTK" : "EXS_MPEG4BDcompatibleHighProfileLevel4_1" + }, + + { + "UID" : "1.2.840.10008.1.2.4.104", + "Name" : "MPEG4 High Profile / Level 4.2 For 2D Video", + "Value" : "MPEG4HighProfileLevel4_2_For2DVideo", + "Retired" : false, + "DCMTK" : "EXS_MPEG4HighProfileLevel4_2_For2DVideo" + }, + + { + "UID" : "1.2.840.10008.1.2.4.105", + "Name" : "MPEG4 High Profile / Level 4.2 For 3D Video", + "Value" : "MPEG4HighProfileLevel4_2_For3DVideo", + "Retired" : false, + "DCMTK" : "EXS_MPEG4HighProfileLevel4_2_For3DVideo" + }, + + { + "UID" : "1.2.840.10008.1.2.4.106", + "Name" : "1.2.840.10008.1.2.4.106", + "Value" : "MPEG4StereoHighProfileLevel4_2", + "Retired" : false, + "DCMTK" : "EXS_MPEG4StereoHighProfileLevel4_2" + }, + + { + "UID" : "1.2.840.10008.1.2.4.107", + "Name" : "HEVC/H.265 Main Profile / Level 5.1", + "Value" : "HEVCMainProfileLevel5_1", + "Retired" : false, + "DCMTK" : "EXS_HEVCMainProfileLevel5_1", + "SinceDCMTK" : "362" + }, + + { + "UID" : "1.2.840.10008.1.2.4.108", + "Name" : "HEVC/H.265 Main 10 Profile / Level 5.1", + "Value" : "HEVCMain10ProfileLevel5_1", + "Retired" : false, + "DCMTK" : "EXS_HEVCMain10ProfileLevel5_1", + "SinceDCMTK" : "362" + }, + + { + "UID" : "1.2.840.10008.1.2.5", + "Name" : "RLE - Run Length Encoding (lossless)", + "Value" : "RLELossless", + "Retired" : false, + "DCMTK" : "EXS_RLELossless", + "GDCM" : "gdcm::TransferSyntax::RLELossless" + }, + + { + "UID" : "1.2.840.10008.1.2.6.1", + "Name" : "RFC 2557 MIME Encapsulation", + "Value" : "RFC2557MimeEncapsulation", + "Retired" : true + }, + + { + "UID" : "1.2.840.10008.1.2.6.2", + "Name" : "XML Encoding", + "Value" : "XML", + "Retired" : true + } +] diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/DownloadOrthancFramework.cmake --- a/Resources/DownloadOrthancFramework.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/DownloadOrthancFramework.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -112,6 +112,17 @@ set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8") set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336") + + # Below this point are development snapshots that were used to + # release some plugin, before an official release of the Orthanc + # framework was available. Here is the command to be used to + # generate a proper archive: + # + # $ hg archive /tmp/Orthanc-`hg id -i | sed 's/\+//'`.tar.gz + # + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df") + # DICOMweb 1.1 (framework pre-1.6.0) + set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645") endif() endif() endif() diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/GenerateTransferSyntaxes.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/GenerateTransferSyntaxes.py Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,107 @@ +#!/usr/bin/python + +# Orthanc - A Lightweight, RESTful DICOM Store +# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics +# Department, University Hospital of Liege, Belgium +# Copyright (C) 2017-2020 Osimis S.A., Belgium +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# In addition, as a special exception, the copyright holders of this +# program give permission to link the code of its release with the +# OpenSSL project's "OpenSSL" library (or with modified versions of it +# that use the same license as the "OpenSSL" library), and distribute +# the linked executables. You must obey the GNU General Public License +# in all respects for all of the code used other than "OpenSSL". If you +# modify file(s) with this exception, you may extend this exception to +# your version of the file(s), but you are not obligated to do so. If +# you do not wish to do so, delete this exception statement from your +# version. If you delete this exception statement from all source files +# in the program, then also delete it here. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +import json +import os +import re +import sys + +BASE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + + + +## https://www.dicomlibrary.com/dicom/transfer-syntax/ +## https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=EDICOM_transfer_syntax + + +with open(os.path.join(BASE, 'Resources', 'DicomTransferSyntaxes.json'), 'r') as f: + SYNTAXES = json.loads(f.read()) + + + +## +## Generate the "DicomTransferSyntax" enumeration in "Enumerations.h" +## + +path = os.path.join(BASE, 'Core', 'Enumerations.h') +with open(path, 'r') as f: + a = f.read() + +s = ',\n'.join(map(lambda x: ' DicomTransferSyntax_%s /*!< %s */' % (x['Value'], x['Name']), SYNTAXES)) + +a = re.sub('(enum DicomTransferSyntax\s*{)[^}]*?(\s*};)', r'\1\n%s\2' % s, a, re.DOTALL) + +with open(path, 'w') as f: + f.write(a) + + + +## +## Generate the "GetTransferSyntaxUid()" function in +## "Enumerations.cpp" +## + +path = os.path.join(BASE, 'Core', 'Enumerations.cpp') +with open(path, 'r') as f: + a = f.read() + +s = '\n\n'.join(map(lambda x: ' case DicomTransferSyntax_%s:\n return "%s";' % (x['Value'], x['UID']), SYNTAXES)) +a = re.sub('(GetTransferSyntaxUid\(DicomTransferSyntax.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)', + r'\1\n%s\2' % s, a, re.DOTALL) + +with open(path, 'w') as f: + f.write(a) + + +## +## Generate the "GetDcmtkTransferSyntax()" function in +## "FromDcmtkBridge.cpp" +## + +path = os.path.join(BASE, 'Core', 'DicomParsing', 'FromDcmtkBridge.cpp') +with open(path, 'r') as f: + a = f.read() + +def Format(x): + t = ' case DicomTransferSyntax_%s:\n target = %s;\n return true;' % (x['Value'], x['DCMTK']) + if 'SinceDCMTK' in x: + return '#if DCMTK_VERSION_NUMBER >= %s\n%s\n#endif' % (x['SinceDCMTK'], t) + else: + return t + +s = '\n\n'.join(map(Format, filter(lambda x: 'DCMTK' in x, SYNTAXES))) +a = re.sub('(GetDcmtkTransferSyntax\(E_TransferSyntax.*?\s*DicomTransferSyntax.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)', + r'\1\n%s\2' % s, a, re.DOTALL) + +with open(path, 'w') as f: + f.write(a) diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/LinuxStandardBaseToolchain.cmake --- a/Resources/LinuxStandardBaseToolchain.cmake Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/LinuxStandardBaseToolchain.cmake Sun Mar 08 19:51:57 2020 +0100 @@ -1,4 +1,4 @@ -# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu +# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu -G Ninja INCLUDE(CMakeForceCompiler) diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/Patches/dcmtk-3.6.5.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Patches/dcmtk-3.6.5.patch Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,113 @@ +diff -urEb dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h +--- dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-03-05 19:43:37.678302817 +0100 ++++ dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-03-05 19:43:41.198312828 +0100 +@@ -152,6 +152,12 @@ + /// returns an iterator to the end of the repeating tag dictionary + DcmDictEntryListIterator repeatingEnd() { return repDict.end(); } + ++ // Function by the Orthanc project to load a dictionary from a ++ // memory buffer, which is necessary in sandboxed ++ // environments. This is an adapted version of ++ // DcmDataDictionary::loadDictionary(). ++ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue); ++ + private: + + /** private undefined assignment operator +diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc +--- dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc 2020-03-05 19:43:37.682302828 +0100 ++++ dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc 2020-03-05 19:43:41.198312828 +0100 +@@ -900,3 +900,6 @@ + wrlock().clear(); + wrunlock(); + } ++ ++ ++#include "dcdict_orthanc.cc" +diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc +--- dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc 2020-03-05 19:43:37.682302828 +0100 ++++ dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc 2020-03-05 19:43:41.198312828 +0100 +@@ -36,6 +36,9 @@ + #include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */ + #include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */ + ++#undef max ++#include "dcmtk/ofstd/oflimits.h" ++ + + // ******************************** + +diff -urEb dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h +--- dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-03-05 19:43:37.686302839 +0100 ++++ dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-03-05 19:43:41.198312828 +0100 +@@ -63,7 +63,7 @@ + + DCMTK_LOG4CPLUS_INLINE_EXPORT + Mutex::Mutex (Mutex::Type t) +- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0) ++ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t))) + { } + + +@@ -106,7 +106,7 @@ + DCMTK_LOG4CPLUS_INLINE_EXPORT + Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max), + unsigned DCMTK_LOG4CPLUS_THREADED (initial)) +- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)) + 0) ++ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial))) + { } + + +@@ -148,7 +148,7 @@ + + DCMTK_LOG4CPLUS_INLINE_EXPORT + FairMutex::FairMutex () +- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex) + 0) ++ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex)) + { } + + +@@ -190,7 +190,7 @@ + + DCMTK_LOG4CPLUS_INLINE_EXPORT + ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig)) +- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)) + 0) ++ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig))) + { } + + +@@ -252,7 +252,7 @@ + + DCMTK_LOG4CPLUS_INLINE_EXPORT + SharedMutex::SharedMutex () +- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex) + 0) ++ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex)) + { } + + +diff -urEb dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc dcmtk-3.6.5/oflog/libsrc/oflog.cc +--- dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc 2020-03-05 19:43:37.690302851 +0100 ++++ dcmtk-3.6.5/oflog/libsrc/oflog.cc 2020-03-05 19:43:54.622350144 +0100 +@@ -19,6 +19,10 @@ + * + */ + ++#ifdef __MINGW32__ ++# include ++#endif ++ + #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ + #include "dcmtk/oflog/oflog.h" + +diff -urEb dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h +--- dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h 2020-03-05 19:43:37.714302919 +0100 ++++ dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h 2020-03-05 19:43:41.198312828 +0100 +@@ -575,7 +575,7 @@ + */ + void setlinebuf() + { +-#if defined(_WIN32) || defined(__hpux) ++#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__) + this->setvbuf(NULL, _IOLBF, 0); + #else + :: setlinebuf(file_); diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/Patches/libp11-0.4.0.patch --- a/Resources/Patches/libp11-0.4.0.patch Sun Mar 08 19:51:22 2020 +0100 +++ b/Resources/Patches/libp11-0.4.0.patch Sun Mar 08 19:51:57 2020 +0100 @@ -1,6 +1,6 @@ diff -urEb libp11-0.4.0.orig/src/atfork.c libp11-0.4.0/src/atfork.c ---- libp11-0.4.0.orig/src/atfork.c 2016-06-20 13:38:43.845575107 +0200 -+++ libp11-0.4.0/src/atfork.c 2016-06-20 13:46:52.969575591 +0200 +--- libp11-0.4.0.orig/src/atfork.c 2020-03-05 20:48:55.447852662 +0100 ++++ libp11-0.4.0/src/atfork.c 2020-03-05 20:49:05.983770656 +0100 @@ -25,7 +25,7 @@ #include #include @@ -11,8 +11,8 @@ #ifdef __sun # pragma fini(lib_deinit) diff -urEb libp11-0.4.0.orig/src/engine.h libp11-0.4.0/src/engine.h ---- libp11-0.4.0.orig/src/engine.h 2016-06-20 13:38:43.845575107 +0200 -+++ libp11-0.4.0/src/engine.h 2016-06-20 13:46:27.421575566 +0200 +--- libp11-0.4.0.orig/src/engine.h 2020-03-05 20:48:55.447852662 +0100 ++++ libp11-0.4.0/src/engine.h 2020-03-05 20:49:05.983770656 +0100 @@ -29,7 +29,7 @@ #define _ENGINE_PKCS11_H @@ -23,8 +23,8 @@ #include "libp11.h" diff -urEb libp11-0.4.0.orig/src/libp11-int.h libp11-0.4.0/src/libp11-int.h ---- libp11-0.4.0.orig/src/libp11-int.h 2016-06-20 13:38:43.845575107 +0200 -+++ libp11-0.4.0/src/libp11-int.h 2016-06-20 13:46:27.421575566 +0200 +--- libp11-0.4.0.orig/src/libp11-int.h 2020-03-05 20:48:55.447852662 +0100 ++++ libp11-0.4.0/src/libp11-int.h 2020-03-05 20:49:05.983770656 +0100 @@ -20,7 +20,7 @@ #define _LIBP11_INT_H @@ -34,3 +34,31 @@ #endif #include "libp11.h" +diff -urEb libp11-0.4.0.orig/src/p11_key.c libp11-0.4.0/src/p11_key.c +--- libp11-0.4.0.orig/src/p11_key.c 2020-03-05 20:48:55.447852662 +0100 ++++ libp11-0.4.0/src/p11_key.c 2020-03-05 20:49:24.959625180 +0100 +@@ -21,6 +21,10 @@ + #include + #include + ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L // OpenSSL 1.0.2 ++# include ++#endif ++ + #ifdef _WIN32 + #define strncasecmp strnicmp + #endif +diff -urEb libp11-0.4.0.orig/src/p11_rsa.c libp11-0.4.0/src/p11_rsa.c +--- libp11-0.4.0.orig/src/p11_rsa.c 2020-03-05 20:48:55.447852662 +0100 ++++ libp11-0.4.0/src/p11_rsa.c 2020-03-05 20:49:20.095662204 +0100 +@@ -27,6 +27,10 @@ + #include + #include + ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L // OpenSSL 1.0.2 ++# include ++#endif ++ + static int rsa_ex_index = 0; + + #if OPENSSL_VERSION_NUMBER < 0x10100003L diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/Patches/openssl-1.1.1d-conf.h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Patches/openssl-1.1.1d-conf.h.in Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,122 @@ +/* + * {- join("\n * ", @autowarntext) -} + * + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_ALGORITHM_DEFINES +# error OPENSSL_ALGORITHM_DEFINES no longer supported +#endif + + +/* + * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers + * don't like that. This will hopefully silence them. + */ +#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; + +/* + * Applications should use -DOPENSSL_API_COMPAT= to suppress the + * declarations of functions deprecated in or before . Otherwise, they + * still won't see them if the library has been built to disable deprecated + * functions. + */ +#ifndef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f; +# ifdef __GNUC__ +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) +# undef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); +# endif +# endif +#endif + +#ifndef OPENSSL_FILE +# ifdef OPENSSL_NO_FILENAMES +# define OPENSSL_FILE "" +# define OPENSSL_LINE 0 +# else +# define OPENSSL_FILE __FILE__ +# define OPENSSL_LINE __LINE__ +# endif +#endif + +#ifndef OPENSSL_MIN_API +# define OPENSSL_MIN_API 0 +#endif + +#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API +# undef OPENSSL_API_COMPAT +# define OPENSSL_API_COMPAT OPENSSL_MIN_API +#endif + +/* + * Do not deprecate things to be deprecated in version 1.2.0 before the + * OpenSSL version number matches. + */ +#if OPENSSL_VERSION_NUMBER < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) f; +#elif OPENSSL_API_COMPAT < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_2_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10100000L +# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_1_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10000000L +# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_0_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x00908000L +# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_0_9_8(f) +#endif + + +#define OPENSSL_UNISTD + +#if 0 +/* Generate 80386 code? */ +{- ${processor} eq "386" ? "#define" : "#undef" -} I386_ONLY + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD {- ${unistd} -} + +{- ${export_var_as_fn} ? "#define" : "#undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* + * The following are cipher-specific, but are part of the public API. + */ +#if !defined(OPENSSL_SYS_UEFI) +{- ${bn_ll} ? "# define" : "# undef" -} BN_LLONG +/* Only one for the following should be defined */ +{- ${b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG +{- ${b64} ? "# define" : "# undef" -} SIXTY_FOUR_BIT +{- ${b32} ? "# define" : "# undef" -} THIRTY_TWO_BIT +#endif + +#define RC4_INT {- ${rc4_int} -} +#endif + +#ifdef __cplusplus +} +#endif diff -r 0b3aacdf77f5 -r 982c24a70dfd Resources/Patches/openssl-1.1.1d.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Patches/openssl-1.1.1d.patch Sun Mar 08 19:51:57 2020 +0100 @@ -0,0 +1,12 @@ +diff -urEb openssl-1.1.1d.orig/crypto/rand/rand_unix.c openssl-1.1.1d/crypto/rand/rand_unix.c +--- openssl-1.1.1d.orig/crypto/rand/rand_unix.c 2019-09-10 15:13:07.000000000 +0200 ++++ openssl-1.1.1d/crypto/rand/rand_unix.c 2020-03-05 16:29:33.030136203 +0100 +@@ -340,7 +340,7 @@ + # endif + + /* Linux supports this since version 3.17 */ +-# if defined(__linux) && defined(__NR_getrandom) ++# if defined(__linux) && defined(__NR_getrandom) && !defined(__LSB_VERSION__) + return syscall(__NR_getrandom, buf, buflen, 0); + # elif (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND) + return sysctl_random(buf, buflen); diff -r 0b3aacdf77f5 -r 982c24a70dfd UnitTestsSources/FromDcmtkTests.cpp --- a/UnitTestsSources/FromDcmtkTests.cpp Sun Mar 08 19:51:22 2020 +0100 +++ b/UnitTestsSources/FromDcmtkTests.cpp Sun Mar 08 19:51:57 2020 +0100 @@ -1912,3 +1912,123 @@ ASSERT_TRUE(lines[3].empty()); } + + + +#if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 + +#include + +static bool Transcode(std::string& buffer, + DcmDataset& dataSet, + E_TransferSyntax xfer) +{ + // Determine the transfer syntax which shall be used to write the + // information to the file. We always switch to the Little Endian + // syntax, with explicit length. + + // http://support.dcmtk.org/docs/dcxfer_8h-source.html + + + /** + * Note that up to Orthanc 0.7.1 (inclusive), the + * "EXS_LittleEndianExplicit" was always used to save the DICOM + * dataset into memory. We now keep the original transfer syntax + * (if available). + **/ + //E_TransferSyntax xfer = dataSet.getOriginalXfer(); + if (xfer == EXS_Unknown) + { + // No information about the original transfer syntax: This is + // most probably a DICOM dataset that was read from memory. + xfer = EXS_LittleEndianExplicit; + } + + E_EncodingType encodingType = /*opt_sequenceType*/ EET_ExplicitLength; + + // Create the meta-header information + DcmFileFormat ff(&dataSet); + ff.validateMetaInfo(xfer); + ff.removeInvalidGroups(); + + // Create a memory buffer with the proper size + { + const uint32_t estimatedSize = ff.calcElementLength(xfer, encodingType); // (*) + buffer.resize(estimatedSize); + } + + DcmOutputBufferStream ob(&buffer[0], buffer.size()); + + // Fill the memory buffer with the meta-header and the dataset + ff.transferInit(); + OFCondition c = ff.write(ob, xfer, encodingType, NULL, + /*opt_groupLength*/ EGL_recalcGL, + /*opt_paddingType*/ EPD_withoutPadding); + ff.transferEnd(); + + if (c.good()) + { + // The DICOM file is successfully written, truncate the target + // buffer if its size was overestimated by (*) + ob.flush(); + + size_t effectiveSize = static_cast(ob.tell()); + if (effectiveSize < buffer.size()) + { + buffer.resize(effectiveSize); + } + + return true; + } + else + { + // Error + buffer.clear(); + return false; + } +} + +#include "dcmtk/dcmjpeg/djrploss.h" /* for DJ_RPLossy */ +#include "dcmtk/dcmjpeg/djrplol.h" /* for DJ_RPLossless */ + +TEST(Toto, Transcode) +{ + OFLog::configure(OFLogger::DEBUG_LOG_LEVEL); + std::string s; + //SystemToolbox::ReadFile(s, "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/1.2.840.10008.1.2.4.50.dcm"); + //SystemToolbox::ReadFile(s, "/home/jodogne/DICOM/Alain.dcm"); + SystemToolbox::ReadFile(s, "/home/jodogne/Subversion/orthanc-tests/Database/Brainix/Epi/IM-0001-0002.dcm"); + + std::auto_ptr dicom(FromDcmtkBridge::LoadFromMemoryBuffer(s.c_str(), s.size())); + + // less /home/jodogne/Downloads/dcmtk-3.6.4/dcmdata/include/dcmtk/dcmdata/dcxfer.h + printf(">> %d\n", dicom->getDataset()->getOriginalXfer()); // => 4 == EXS_JPEGProcess1 + + const DcmRepresentationParameter *p; + +#if 0 + E_TransferSyntax target = EXS_LittleEndianExplicit; + p = NULL; +#elif 1 + E_TransferSyntax target = EXS_JPEGProcess14SV1; + DJ_RPLossless rp_lossless(6, 0); + p = &rp_lossless; +#else + E_TransferSyntax target = EXS_JPEGProcess1; + DJ_RPLossy rp_lossy(90); // quality + p = &rp_lossy; +#endif + + //E_TransferSyntax target = EXS_LittleEndianImplicit; + + ASSERT_TRUE(dicom->getDataset()->chooseRepresentation(target, p).good()); + ASSERT_TRUE(dicom->getDataset()->canWriteXfer(target)); + + std::string t; + ASSERT_TRUE(Transcode(t, *dicom->getDataset(), target)); + + SystemToolbox::WriteFile(s, "source.dcm"); + SystemToolbox::WriteFile(t, "target.dcm"); +} + +#endif diff -r 0b3aacdf77f5 -r 982c24a70dfd UnitTestsSources/VersionsTests.cpp --- a/UnitTestsSources/VersionsTests.cpp Sun Mar 08 19:51:22 2020 +0100 +++ b/UnitTestsSources/VersionsTests.cpp Sun Mar 08 19:51:57 2020 +0100 @@ -184,7 +184,8 @@ #if ORTHANC_ENABLE_SSL == 1 TEST(Version, OpenSslStatic) { - ASSERT_EQ(0x1000210fL /* openssl-1.0.2p */, OPENSSL_VERSION_NUMBER); + ASSERT_TRUE(OPENSSL_VERSION_NUMBER == 0x1000210fL /* openssl-1.0.2p */ || + OPENSSL_VERSION_NUMBER == 0x1010104fL /* openssl-1.1.1d */); } #endif