summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/crypto_init.c')
-rw-r--r--src/lib/libcrypto/crypto_init.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/libcrypto/crypto_init.c b/src/lib/libcrypto/crypto_init.c
index f3d1a2bce9..ed2b5d4810 100644
--- a/src/lib/libcrypto/crypto_init.c
+++ b/src/lib/libcrypto/crypto_init.c
@@ -25,6 +25,9 @@
25#include <openssl/err.h> 25#include <openssl/err.h>
26#include "cryptlib.h" 26#include "cryptlib.h"
27 27
28int OpenSSL_config(char *);
29int OpenSSL_no_config(char *);
30
28static pthread_t crypto_init_thread; 31static pthread_t crypto_init_thread;
29 32
30static void 33static void
@@ -35,7 +38,6 @@ OPENSSL_init_crypto_internal(void)
35 ERR_load_crypto_strings(); 38 ERR_load_crypto_strings();
36 OpenSSL_add_all_ciphers(); 39 OpenSSL_add_all_ciphers();
37 OpenSSL_add_all_digests(); 40 OpenSSL_add_all_digests();
38 OPENSSL_config(NULL);
39} 41}
40 42
41int 43int
@@ -46,11 +48,16 @@ OPENSSL_init_crypto(uint64_t opts, const void *settings)
46 if (pthread_equal(pthread_self(), crypto_init_thread)) 48 if (pthread_equal(pthread_self(), crypto_init_thread))
47 return 1; /* don't recurse */ 49 return 1; /* don't recurse */
48 50
49 if (opts & OPENSSL_INIT_NO_LOAD_CONFIG)
50 OPENSSL_no_config();
51
52 if (pthread_once(&once, OPENSSL_init_crypto_internal) != 0) 51 if (pthread_once(&once, OPENSSL_init_crypto_internal) != 0)
53 return 0; 52 return 0;
54 53
54 if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG) &&
55 (OpenSSL_no_config(NULL) == 0))
56 return 0;
57
58 if ((opts & OPENSSL_INIT_LOAD_CONFIG) &&
59 (OpenSSL_config(NULL) == 0))
60 return 0;
61
55 return 1; 62 return 1;
56} 63}