Skip to content

Commit

Permalink
openssl: avoid config file load/race
Browse files Browse the repository at this point in the history
  • Loading branch information
theuni committed Jul 14, 2015
1 parent 3d9362d commit d4b1d5a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
#include <boost/thread.hpp>
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <openssl/conf.h>

// Work around clang compilation problem in Boost 1.46:
// /usr/include/boost/program_options/detail/config_file.hpp:163:17: error: call to function 'to_internal' that is neither visible in the template definition nor found by argument-dependent lookup
Expand Down Expand Up @@ -134,6 +135,13 @@ class CInit
ppmutexOpenSSL[i] = new CCriticalSection();
CRYPTO_set_locking_callback(locking_callback);

// OpenSSL can optionally load a config file which lists optional loadable modules and engines.
// We don't use them so we don't require the config. However some of our libs may call functions
// which attempt to load the config file, possibly resulting in an exit() or crash if it is missing
// or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be
// that the config appears to have been loaded and there are no modules/engines available.
OPENSSL_no_config();

#ifdef WIN32
// Seed OpenSSL PRNG with current contents of the screen
RAND_screen();
Expand Down

0 comments on commit d4b1d5a

Please sign in to comment.