summaryrefslogtreecommitdiffstats
path: root/crypto/conf/conf_lib.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-03-20 20:25:39 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-03-20 20:25:39 +1000
commit22e27978b29b2cdc1db79659ed653d6cf31834ab (patch)
treef156d63b1f889794d723167e59108d088fbe5907 /crypto/conf/conf_lib.c
parent0f2deef59d13e852a4bde0e853e9b49bab51a108 (diff)
Add support for passing the libctx to the config loader
The self tests for the fips module are triggered on startup and they need to know the core's libctx in order to function correctly. As the provider can be autoloaded via configuration it then needs to propagate the callers libctx down to the provider via the config load. Note that OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, ..) is still called, but will only load the default configuration if the OPENSSL_CONF environment variable is set. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11240)
Diffstat (limited to 'crypto/conf/conf_lib.c')
-rw-r--r--crypto/conf/conf_lib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
index 833b7a6551..c06718d249 100644
--- a/crypto/conf/conf_lib.c
+++ b/crypto/conf/conf_lib.c
@@ -174,7 +174,7 @@ int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out)
* the "CONF classic" functions, for consistency.
*/
-CONF *NCONF_new(CONF_METHOD *meth)
+CONF *NCONF_new_with_libctx(OPENSSL_CTX *libctx, CONF_METHOD *meth)
{
CONF *ret;
@@ -183,13 +183,19 @@ CONF *NCONF_new(CONF_METHOD *meth)
ret = meth->create(meth);
if (ret == NULL) {
- CONFerr(CONF_F_NCONF_NEW, ERR_R_MALLOC_FAILURE);
+ CONFerr(0, ERR_R_MALLOC_FAILURE);
return NULL;
}
+ ret->libctx = libctx;
return ret;
}
+CONF *NCONF_new(CONF_METHOD *meth)
+{
+ return NCONF_new_with_libctx(NULL, meth);
+}
+
void NCONF_free(CONF *conf)
{
if (conf == NULL)