issue 34 #23
3 changed files with 9 additions and 24 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <openssl/ecdh.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
/**
|
||||
* @file openssl.hpp
|
||||
|
|
|
|||
|
|
@ -411,10 +411,6 @@ unsigned long openssl_thread_config::get_thread_id()
|
|||
|
||||
void openssl_thread_config::locking_callback(int mode, int type, const char *file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
openssl_mutexes[type].lock();
|
||||
else
|
||||
openssl_mutexes[type].unlock();
|
||||
}
|
||||
|
||||
// Warning: Things get complicated if third-party libraries also try to install their their own
|
||||
|
|
@ -423,23 +419,9 @@ void openssl_thread_config::locking_callback(int mode, int type, const char *fil
|
|||
// each library that does this to make sure they will play nice.
|
||||
openssl_thread_config::openssl_thread_config()
|
||||
{
|
||||
if (CRYPTO_get_id_callback() == NULL &&
|
||||
CRYPTO_get_locking_callback() == NULL)
|
||||
{
|
||||
openssl_mutexes = new boost::mutex[CRYPTO_num_locks()];
|
||||
CRYPTO_set_id_callback(&get_thread_id);
|
||||
CRYPTO_set_locking_callback(&locking_callback);
|
||||
}
|
||||
}
|
||||
openssl_thread_config::~openssl_thread_config()
|
||||
{
|
||||
if (CRYPTO_get_id_callback() == &get_thread_id)
|
||||
{
|
||||
CRYPTO_set_id_callback(NULL);
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
delete[] openssl_mutexes;
|
||||
openssl_mutexes = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace fc
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
#include <string>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fc/log/logger.hpp>
|
||||
|
||||
namespace fc
|
||||
{
|
||||
struct openssl_scope
|
||||
|
|
@ -15,9 +17,6 @@ namespace fc
|
|||
static path _configurationFilePath;
|
||||
openssl_scope()
|
||||
{
|
||||
ERR_load_crypto_strings();
|
||||
OpenSSL_add_all_algorithms();
|
||||
|
||||
const boost::filesystem::path& boostPath = _configurationFilePath;
|
||||
if(boostPath.empty() == false)
|
||||
{
|
||||
|
|
@ -30,13 +29,16 @@ namespace fc
|
|||
#endif
|
||||
}
|
||||
|
||||
OPENSSL_config(nullptr);
|
||||
if (CONF_modules_load_file(_configurationFilePath.string().c_str(), "fc", CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
|
||||
elog("FATAL: error loading configuration file\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
~openssl_scope()
|
||||
{
|
||||
EVP_cleanup();
|
||||
ERR_free_strings();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue