isnew = 1;
}
- if (!ossl_provider_activate(prov, 1)) {
+ if (!ossl_provider_activate(prov, 1, 0)) {
ossl_provider_free(prov);
return NULL;
}
* or it could have been explicitly loaded. If explicitly loaded we
* ignore it - i.e. we don't start treating it like a child.
*/
- if (!ossl_provider_activate_child(cprov, prov, ossl_child_provider_init))
+ if (!ossl_provider_activate(cprov, 0, 1))
goto err;
} else {
/*
1)) == NULL)
goto err;
- if (!ossl_provider_activate(cprov, 0))
+ if (!ossl_provider_activate(cprov, 0, 0))
goto err;
if (!ossl_provider_set_child(cprov, prov)
ok = provider_conf_params(prov, NULL, NULL, value, cnf);
if (ok) {
- if (!ossl_provider_activate(prov, 1)) {
+ if (!ossl_provider_activate(prov, 1, 0)) {
ok = 0;
} else if (!ossl_provider_add_to_store(prov, 0)) {
ossl_provider_deactivate(prov);
static int provider_up_ref_intern(OSSL_PROVIDER *prov, int activate)
{
if (activate)
- return ossl_provider_activate(prov, 1);
+ return ossl_provider_activate(prov, 1, 0);
return ossl_provider_up_ref(prov);
}
return 1;
}
-int ossl_provider_activate(OSSL_PROVIDER *prov, int upcalls)
+int ossl_provider_activate(OSSL_PROVIDER *prov, int upcalls, int aschild)
{
int count;
if (prov == NULL)
return 0;
+#ifndef FIPS_MODULE
+ /*
+ * If aschild is true, then we only actually do the activation if the
+ * provider is a child. If its not, this is still success.
+ */
+ if (aschild && !prov->ischild)
+ return 1;
+#endif
if ((count = provider_activate(prov, 1, upcalls)) > 0)
return count == 1 ? provider_flush_store_cache(prov) : 1;
return 1;
}
-int ossl_provider_activate_child(OSSL_PROVIDER *prov,
- const OSSL_CORE_HANDLE *handle,
- OSSL_provider_init_fn *init_function)
-{
- int flush = 0;
-
- if (!CRYPTO_THREAD_write_lock(prov->store->lock))
- return 0;
- if (!CRYPTO_THREAD_write_lock(prov->flag_lock)) {
- CRYPTO_THREAD_unlock(prov->store->lock);
- return 0;
- }
- /*
- * The provider could be in one of two states: (1) Already a child,
- * (2) Not a child (not eligible to be one).
- */
- if (prov->ischild && provider_activate(prov, 0, 0))
- flush = 1;
-
- CRYPTO_THREAD_unlock(prov->flag_lock);
- CRYPTO_THREAD_unlock(prov->store->lock);
-
- if (flush)
- provider_flush_store_cache(prov);
-
- /*
- * We report success whether or not the provider was a child. If its not
- * a child then it has been explicitly loaded as a non child provider and
- * we should keep it like that.
- */
- return 1;
-}
-
int ossl_provider_default_props_update(OSSL_LIB_CTX *libctx, const char *props)
{
#ifndef FIPS_MODULE
int ossl_provider_is_child(const OSSL_PROVIDER *prov);
int ossl_provider_set_child(OSSL_PROVIDER *prov, const OSSL_CORE_HANDLE *handle);
-int ossl_provider_activate_child(OSSL_PROVIDER *prov,
- const OSSL_CORE_HANDLE *handle,
- OSSL_provider_init_fn *init_function);
const OSSL_CORE_HANDLE *ossl_provider_get_parent(OSSL_PROVIDER *prov);
int ossl_provider_up_ref_parent(OSSL_PROVIDER *prov, int activate);
int ossl_provider_free_parent(OSSL_PROVIDER *prov, int deactivate);
* Activate the Provider
* If the Provider is a module, the module will be loaded
*/
-int ossl_provider_activate(OSSL_PROVIDER *prov, int upcalls);
+int ossl_provider_activate(OSSL_PROVIDER *prov, int upcalls, int aschild);
int ossl_provider_deactivate(OSSL_PROVIDER *prov);
int ossl_provider_add_to_store(OSSL_PROVIDER *prov, int retain_fallbacks);
int ret = 0;
ret =
- TEST_true(ossl_provider_activate(prov, 1))
+ TEST_true(ossl_provider_activate(prov, 1, 0))
&& TEST_true(ossl_provider_get_params(prov, greeting_request))
&& TEST_ptr(greeting = greeting_request[0].data)
&& TEST_size_t_gt(greeting_request[0].data_size, 0)