Mercurial > hg > orthanc
comparison Core/HttpClient.cpp @ 2677:0196d07a900f jobs
migrate OpenSSL initialization to Toolbox
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 15 Jun 2018 11:16:37 +0200 |
parents | 0c57f40e2fbf |
children | ad2c32082653 |
comparison
equal
deleted
inserted
replaced
2676:d2f70c8f8bfd | 2677:0196d07a900f |
---|---|
44 #include <curl/curl.h> | 44 #include <curl/curl.h> |
45 #include <boost/algorithm/string/predicate.hpp> | 45 #include <boost/algorithm/string/predicate.hpp> |
46 #include <boost/thread/mutex.hpp> | 46 #include <boost/thread/mutex.hpp> |
47 | 47 |
48 | 48 |
49 #if ORTHANC_ENABLE_SSL == 1 | |
50 // For OpenSSL initialization and finalization | |
51 # include <openssl/conf.h> | |
52 # include <openssl/engine.h> | |
53 # include <openssl/err.h> | |
54 # include <openssl/evp.h> | |
55 # include <openssl/ssl.h> | |
56 #endif | |
57 | |
58 | |
59 #if ORTHANC_ENABLE_PKCS11 == 1 | 49 #if ORTHANC_ENABLE_PKCS11 == 1 |
60 # include "Pkcs11.h" | 50 # include "Pkcs11.h" |
61 #endif | 51 #endif |
62 | 52 |
63 | 53 |
810 #else | 800 #else |
811 LOG(ERROR) << "This version of Orthanc is compiled without support for PKCS#11"; | 801 LOG(ERROR) << "This version of Orthanc is compiled without support for PKCS#11"; |
812 throw OrthancException(ErrorCode_InternalError); | 802 throw OrthancException(ErrorCode_InternalError); |
813 #endif | 803 #endif |
814 } | 804 } |
815 | |
816 | |
817 void HttpClient::InitializeOpenSsl() | |
818 { | |
819 #if ORTHANC_ENABLE_SSL == 1 | |
820 // https://wiki.openssl.org/index.php/Library_Initialization | |
821 SSL_library_init(); | |
822 SSL_load_error_strings(); | |
823 OpenSSL_add_all_algorithms(); | |
824 ERR_load_crypto_strings(); | |
825 #endif | |
826 } | |
827 | |
828 | |
829 void HttpClient::FinalizeOpenSsl() | |
830 { | |
831 #if ORTHANC_ENABLE_SSL == 1 | |
832 // Finalize OpenSSL | |
833 // https://wiki.openssl.org/index.php/Library_Initialization#Cleanup | |
834 #ifdef FIPS_mode_set | |
835 FIPS_mode_set(0); | |
836 #endif | |
837 ENGINE_cleanup(); | |
838 CONF_modules_unload(1); | |
839 EVP_cleanup(); | |
840 CRYPTO_cleanup_all_ex_data(); | |
841 ERR_remove_state(0); | |
842 ERR_free_strings(); | |
843 #endif | |
844 } | |
845 } | 805 } |