Refactor ossl_method_construct() in terms of ossl_algorithm_do_all()
@@ -24,24 +24,17 @@ struct construct_data_st {
void *mcm_data;
};
-static int ossl_method_construct_this(OSSL_PROVIDER *provider, void *cbdata)
+static void ossl_method_construct_this(OSSL_PROVIDER *provider,
+ const OSSL_ALGORITHM *algo,
+ int no_store, void *cbdata)
{
struct construct_data_st *data = cbdata;
- int no_store = 0; /* Assume caching is ok */
- const OSSL_ALGORITHM *map =
- ossl_provider_query_operation(provider, data->operation_id, &no_store);
-
- if (map == NULL)
- return 0;
-
- while (map->algorithm_name != NULL) {
- const OSSL_ALGORITHM *thismap = map++;
void *method = NULL;
- if ((method = data->mcm->construct(thismap->algorithm_name,
- thismap->implementation, provider,
+ if ((method = data->mcm->construct(algo->algorithm_name,
+ algo->implementation, provider,
data->mcm_data)) == NULL)
- continue;
+ return;
/*
* Note regarding putting the method in stores:
@@ -60,21 +53,18 @@ static int ossl_method_construct_this(OSSL_PROVIDER *provider, void *cbdata)
* add to the global store
*/
data->mcm->put(data->libctx, NULL, method, data->operation_id,
- thismap->algorithm_name,
- thismap->property_definition, data->mcm_data);
+ algo->algorithm_name,
+ algo->property_definition, data->mcm_data);
}
data->mcm->put(data->libctx, data->store, method, data->operation_id,
- thismap->algorithm_name, thismap->property_definition,
+ algo->algorithm_name, algo->property_definition,
data->mcm_data);
/* refcnt-- because we're dropping the reference */
data->mcm->destruct(method, data->mcm_data);
}
- return 1;
-}
-
void *ossl_method_construct(OPENSSL_CTX *libctx, int operation_id,
const char *name, const char *propquery,
int force_store,
@@ -99,8 +89,8 @@ void *ossl_method_construct(OPENSSL_CTX *libctx, int operation_id,
cbdata.force_store = force_store;
cbdata.mcm = mcm;
cbdata.mcm_data = mcm_data;
- ossl_provider_forall_loaded(libctx, ossl_method_construct_this,
- &cbdata);
+ ossl_algorithm_do_all(libctx, operation_id, NULL,
+ ossl_method_construct_this, &cbdata);
method = mcm->get(libctx, cbdata.store, operation_id, name,
propquery, mcm_data);
