summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_init.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2018-03-30 19:19:56 +0100
committerMatt Caswell <matt@openssl.org>2018-04-05 15:30:12 +0100
commitd8f031e890d35887047c35b60347ac385b989065 (patch)
treeee6c353be64840cf86030b5e5ffca02321310641 /ssl/ssl_init.c
parent4845aeba4c49e1bd65259a5014d7e3ab38657d42 (diff)
Move the loading of the ssl_conf module to libcrypto
The GOST engine needs to be loaded before we initialise libssl. Otherwise the GOST ciphersuites are not enabled. However the SSL conf module must be loaded before we initialise libcrypto. Otherwise we will fail to read the SSL config from a config file properly. Another problem is that an application may make use of both libcrypto and libssl. If it performs libcrypto stuff first and OPENSSL_init_crypto() is called and loads a config file it will fail if that config file has any libssl stuff in it. This commit separates out the loading of the SSL conf module from the interpretation of its contents. The loading piece doesn't know anything about SSL so this can be moved to libcrypto. The interpretation of what it means remains in libssl. This means we can load the SSL conf data before libssl is there and interpret it when it later becomes available. Fixes #5809 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5818)
Diffstat (limited to 'ssl/ssl_init.c')
-rw-r--r--ssl/ssl_init.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ssl/ssl_init.c b/ssl/ssl_init.c
index 34e67736d1..bc84aa8473 100644
--- a/ssl/ssl_init.c
+++ b/ssl/ssl_init.c
@@ -106,7 +106,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base)
fprintf(stderr, "OPENSSL_INIT: ossl_init_ssl_base: "
"SSL_add_ssl_module()\n");
#endif
- SSL_add_ssl_module();
/*
* We ignore an error return here. Not much we can do - but not that bad
* either. We can still safely continue.
@@ -195,11 +194,14 @@ int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS * settings)
return 0;
}
- if (!RUN_ONCE(&ssl_base, ossl_init_ssl_base))
+ if (!OPENSSL_init_crypto(opts
+ | OPENSSL_INIT_LOAD_CONFIG
+ | OPENSSL_INIT_ADD_ALL_CIPHERS
+ | OPENSSL_INIT_ADD_ALL_DIGESTS,
+ settings))
return 0;
- if (!OPENSSL_init_crypto(opts | OPENSSL_INIT_ADD_ALL_CIPHERS
- | OPENSSL_INIT_ADD_ALL_DIGESTS, settings))
+ if (!RUN_ONCE(&ssl_base, ossl_init_ssl_base))
return 0;
if ((opts & OPENSSL_INIT_NO_LOAD_SSL_STRINGS)