diff OrthancServer/OrthancInitialization.cpp @ 2099:bcbc9137a535

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Oct 2016 11:13:41 +0200
parents 27fd34970c52
children a657f7772e69
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp	Thu Oct 06 17:28:43 2016 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Fri Oct 07 11:13:41 2016 +0200
@@ -50,23 +50,13 @@
 #include <boost/thread.hpp>
 
 
-#if ORTHANC_SSL_ENABLED == 1
-// For OpenSSL initialization and finalization
-#include <openssl/conf.h>
-#include <openssl/engine.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/ssl.h>
-#endif
-
-
 #if ORTHANC_JPEG_ENABLED == 1
-#include <dcmtk/dcmjpeg/djdecode.h>
+#  include <dcmtk/dcmjpeg/djdecode.h>
 #endif
 
 
 #if ORTHANC_JPEG_LOSSLESS_ENABLED == 1
-#include <dcmtk/dcmjpls/djdecode.h>
+#  include <dcmtk/dcmjpls/djdecode.h>
 #endif
 
 
@@ -471,13 +461,7 @@
   {
     boost::recursive_mutex::scoped_lock lock(globalMutex_);
 
-#if ORTHANC_SSL_ENABLED == 1
-    // https://wiki.openssl.org/index.php/Library_Initialization
-    SSL_library_init();
-    SSL_load_error_strings();
-    OpenSSL_add_all_algorithms();
-    ERR_load_crypto_strings();
-#endif
+    HttpClient::InitializeOpenSsl();
 
     InitializeServerEnumerations();
 
@@ -531,17 +515,7 @@
     DJDecoderRegistration::cleanup();
 #endif
 
-#if ORTHANC_SSL_ENABLED == 1
-    // Finalize OpenSSL
-    // https://wiki.openssl.org/index.php/Library_Initialization#Cleanup
-    FIPS_mode_set(0);
-    ENGINE_cleanup();
-    CONF_modules_unload(1);
-    EVP_cleanup();
-    CRYPTO_cleanup_all_ex_data();
-    ERR_remove_state(0);
-    ERR_free_strings();
-#endif
+    HttpClient::FinalizeOpenSsl();
   }