summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2023-08-02 10:44:47 +1000
committerPauli <pauli@openssl.org>2023-08-04 11:58:09 +1000
commitcea699c512bf1e3a22edae2715cb993c7953eb91 (patch)
treed99923084dc4100d0026b3d09e79fbd2507b6bd7
parent4a4d84a976e00ed50f2bcfc4a4e7a9b48ba36e2f (diff)
no_autoload: make the no-autoload-config option work again.
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/21621) (cherry picked from commit cb8e64131e7ce230a9268bdd7cc4664868ff0dc9)
-rw-r--r--crypto/asn1/a_strnid.c2
-rw-r--r--crypto/engine/eng_table.c2
-rw-r--r--crypto/objects/obj_dat.c2
-rw-r--r--crypto/property/property.c6
-rw-r--r--crypto/provider_core.c6
5 files changed, 12 insertions, 6 deletions
diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c
index 9e54db9292..c960daf5cb 100644
--- a/crypto/asn1/a_strnid.c
+++ b/crypto/asn1/a_strnid.c
@@ -129,8 +129,10 @@ ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
int idx;
ASN1_STRING_TABLE fnd;
+#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
/* "stable" can be impacted by config, so load the config file first */
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
+#endif
fnd.nid = nid;
if (stable) {
diff --git a/crypto/engine/eng_table.c b/crypto/engine/eng_table.c
index a8209d9e71..d6a7452c76 100644
--- a/crypto/engine/eng_table.c
+++ b/crypto/engine/eng_table.c
@@ -201,8 +201,10 @@ ENGINE *ossl_engine_table_select(ENGINE_TABLE **table, int nid,
ENGINE_PILE tmplate, *fnd = NULL;
int initres, loop = 0;
+#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
/* Load the config before trying to check if engines are available */
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
+#endif
if (!(*table)) {
OSSL_TRACE3(ENGINE_TABLE,
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index dec7ac29ee..341f0b20c7 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -81,8 +81,10 @@ DEFINE_RUN_ONCE_STATIC(obj_lock_initialise)
static ossl_inline int ossl_init_added_lock(void)
{
+#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
/* Make sure we've loaded config before checking for any "added" objects */
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
+#endif
return RUN_ONCE(&ossl_obj_lock_init, obj_lock_initialise);
}
diff --git a/crypto/property/property.c b/crypto/property/property.c
index 7794c84a49..1d3cb30018 100644
--- a/crypto/property/property.c
+++ b/crypto/property/property.c
@@ -124,11 +124,11 @@ void *ossl_ctx_global_properties_new(OSSL_LIB_CTX *ctx)
}
OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *libctx,
- int loadconfig)
+ ossl_unused int loadconfig)
{
OSSL_GLOBAL_PROPERTIES *globp;
-#ifndef FIPS_MODULE
+#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
if (loadconfig && !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
return NULL;
#endif
@@ -505,7 +505,7 @@ int ossl_method_store_fetch(OSSL_METHOD_STORE *store,
if (nid <= 0 || method == NULL || store == NULL)
return 0;
-#ifndef FIPS_MODULE
+#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
if (ossl_lib_ctx_is_default(store->ctx)
&& !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
return 0;
diff --git a/crypto/provider_core.c b/crypto/provider_core.c
index c6925b4028..fbda28f16e 100644
--- a/crypto/provider_core.c
+++ b/crypto/provider_core.c
@@ -400,7 +400,7 @@ int ossl_provider_info_add_to_store(OSSL_LIB_CTX *libctx,
}
OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name,
- int noconfig)
+ ossl_unused int noconfig)
{
struct provider_store_st *store = NULL;
OSSL_PROVIDER *prov = NULL;
@@ -409,7 +409,7 @@ OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name,
OSSL_PROVIDER tmpl = { 0, };
int i;
-#ifndef FIPS_MODULE
+#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
/*
* Make sure any providers are loaded from config before we try to find
* them.
@@ -1348,7 +1348,7 @@ int ossl_provider_doall_activated(OSSL_LIB_CTX *ctx,
struct provider_store_st *store = get_provider_store(ctx);
STACK_OF(OSSL_PROVIDER) *provs = NULL;
-#ifndef FIPS_MODULE
+#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
/*
* Make sure any providers are loaded from config before we try to use
* them.