Skip to content

Commit ed789ce

Browse files
committed
Merge pull request #6438
d4b1d5a openssl: avoid config file load/race (Cory Fields)
2 parents 5bdc218 + d4b1d5a commit ed789ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/util.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
#include <boost/thread.hpp>
8484
#include <openssl/crypto.h>
8585
#include <openssl/rand.h>
86+
#include <openssl/conf.h>
8687

8788
// Work around clang compilation problem in Boost 1.46:
8889
// /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
@@ -134,6 +135,13 @@ class CInit
134135
ppmutexOpenSSL[i] = new CCriticalSection();
135136
CRYPTO_set_locking_callback(locking_callback);
136137

138+
// OpenSSL can optionally load a config file which lists optional loadable modules and engines.
139+
// We don't use them so we don't require the config. However some of our libs may call functions
140+
// which attempt to load the config file, possibly resulting in an exit() or crash if it is missing
141+
// or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be
142+
// that the config appears to have been loaded and there are no modules/engines available.
143+
OPENSSL_no_config();
144+
137145
#ifdef WIN32
138146
// Seed OpenSSL PRNG with current contents of the screen
139147
RAND_screen();

0 commit comments

Comments
 (0)