return 1;
}
+int ossl_provider_forall_loaded(OPENSSL_CTX *ctx,
+ int (*cb)(OSSL_PROVIDER *provider,
+ void *cbdata),
+ void *cbdata)
+{
+ int ret = 1;
+ int i;
+ struct provider_store_st *store = get_provider_store(ctx);
+
+ if (store != NULL) {
+ CRYPTO_THREAD_read_lock(store->lock);
+ for (i = 0; i < sk_OSSL_PROVIDER_num(store->providers); i++) {
+ OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(store->providers, i);
+
+ if (prov->flag_initialized
+ && !(ret = cb(prov, cbdata)))
+ break;
+ }
+ CRYPTO_THREAD_unlock(store->lock);
+ }
+
+ return ret;
+}
+
/* Getters of Provider Object data */
const char *ossl_provider_name(OSSL_PROVIDER *prov)
{
ossl_provider_find, ossl_provider_new, ossl_provider_upref,
ossl_provider_free, ossl_provider_add_module_location,
-ossl_provider_activate, ossl_provider_name, ossl_provider_dso,
+ossl_provider_activate, ossl_provider_forall_loaded,
+ossl_provider_name, ossl_provider_dso,
ossl_provider_module_name, ossl_provider_module_path,
ossl_provider_teardown, ossl_provider_get_param_types,
ossl_provider_get_params - internal provider routines
/* Load and initialize the Provider */
int ossl_provider_activate(OSSL_PROVIDER *prov);
+ /* Iterate over all loaded providers */
+ int ossl_provider_forall_loaded(OPENSSL_CTX *,
+ int (*cb)(OSSL_PROVIDER *provider,
+ void *cbdata),
+ void *cbdata);
+
/* Getters for other library functions */
const char *ossl_provider_name(OSSL_PROVIDER *prov);
const DSO *ossl_provider_dso(OSSL_PROVIDER *prov);
=back
+ossl_provider_forall_loaded() iterates over all the currently
+"activated" providers, and calls C<cb> for each of them.
+
ossl_provider_name() returns the name that was given with
ossl_provider_new().
*/
int ossl_provider_activate(OSSL_PROVIDER *prov);
+/* Iterate over all loaded providers */
+int ossl_provider_forall_loaded(OPENSSL_CTX *,
+ int (*cb)(OSSL_PROVIDER *provider,
+ void *cbdata),
+ void *cbdata);
+
/* Getters for other library functions */
const char *ossl_provider_name(OSSL_PROVIDER *prov);
const DSO *ossl_provider_dso(OSSL_PROVIDER *prov);