comparison Core/HttpClient.cpp @ 2099:bcbc9137a535

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Oct 2016 11:13:41 +0200
parents 72a7624215ae
children 58a0ee0b4be1
comparison
equal deleted inserted replaced
2098:7d184e11043e 2099:bcbc9137a535
42 #include <curl/curl.h> 42 #include <curl/curl.h>
43 #include <boost/algorithm/string/predicate.hpp> 43 #include <boost/algorithm/string/predicate.hpp>
44 #include <boost/thread/mutex.hpp> 44 #include <boost/thread/mutex.hpp>
45 45
46 46
47 #if ORTHANC_SSL_ENABLED == 1
48 // For OpenSSL initialization and finalization
49 # include <openssl/conf.h>
50 # include <openssl/engine.h>
51 # include <openssl/err.h>
52 # include <openssl/evp.h>
53 # include <openssl/ssl.h>
54 #endif
55
56
47 #if ORTHANC_PKCS11_ENABLED == 1 57 #if ORTHANC_PKCS11_ENABLED == 1
48 # include "Pkcs11.h" 58 # include "Pkcs11.h"
49 #endif 59 #endif
50 60
51 61
782 #else 792 #else
783 LOG(ERROR) << "This version of Orthanc is compiled without support for PKCS#11"; 793 LOG(ERROR) << "This version of Orthanc is compiled without support for PKCS#11";
784 throw OrthancException(ErrorCode_InternalError); 794 throw OrthancException(ErrorCode_InternalError);
785 #endif 795 #endif
786 } 796 }
797
798
799 void HttpClient::InitializeOpenSsl()
800 {
801 #if ORTHANC_SSL_ENABLED == 1
802 // https://wiki.openssl.org/index.php/Library_Initialization
803 SSL_library_init();
804 SSL_load_error_strings();
805 OpenSSL_add_all_algorithms();
806 ERR_load_crypto_strings();
807 #endif
808 }
809
810
811 void HttpClient::FinalizeOpenSsl()
812 {
813 #if ORTHANC_SSL_ENABLED == 1
814 // Finalize OpenSSL
815 // https://wiki.openssl.org/index.php/Library_Initialization#Cleanup
816 FIPS_mode_set(0);
817 ENGINE_cleanup();
818 CONF_modules_unload(1);
819 EVP_cleanup();
820 CRYPTO_cleanup_all_ex_data();
821 ERR_remove_state(0);
822 ERR_free_strings();
823 #endif
824 }
787 } 825 }