359 | 359 |
}
|
360 | 360 |
ossl_property_unlock(store);
|
361 | 361 |
return 0;
|
|
362 |
}
|
|
363 |
|
|
364 |
static void alg_do_one(ALGORITHM *alg, IMPLEMENTATION *impl,
|
|
365 |
void (*fn)(int id, void *method, void *fnarg),
|
|
366 |
void *fnarg)
|
|
367 |
{
|
|
368 |
fn(alg->nid, impl->method.method, fnarg);
|
|
369 |
}
|
|
370 |
|
|
371 |
struct alg_do_each_data_st {
|
|
372 |
void (*fn)(int id, void *method, void *fnarg);
|
|
373 |
void *fnarg;
|
|
374 |
};
|
|
375 |
|
|
376 |
static void alg_do_each(ossl_uintmax_t idx, ALGORITHM *alg, void *arg)
|
|
377 |
{
|
|
378 |
struct alg_do_each_data_st *data = arg;
|
|
379 |
int i, end = sk_IMPLEMENTATION_num(alg->impls);
|
|
380 |
|
|
381 |
for (i = 0; i < end; i++) {
|
|
382 |
IMPLEMENTATION *impl = sk_IMPLEMENTATION_value(alg->impls, i);
|
|
383 |
|
|
384 |
alg_do_one(alg, impl, data->fn, data->fnarg);
|
|
385 |
}
|
|
386 |
}
|
|
387 |
|
|
388 |
void ossl_method_store_do_all(OSSL_METHOD_STORE *store,
|
|
389 |
void (*fn)(int id, void *method, void *fnarg),
|
|
390 |
void *fnarg)
|
|
391 |
{
|
|
392 |
struct alg_do_each_data_st data;
|
|
393 |
|
|
394 |
data.fn = fn;
|
|
395 |
data.fnarg = fnarg;
|
|
396 |
if (store != NULL)
|
|
397 |
ossl_sa_ALGORITHM_doall_arg(store->algs, alg_do_each, &data);
|
362 | 398 |
}
|
363 | 399 |
|
364 | 400 |
int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
|