Lines Matching refs:alg
110 ALGORITHM *alg);
219 static void impl_cache_flush_alg(ossl_uintmax_t idx, ALGORITHM *alg) in impl_cache_flush_alg() argument
221 lh_QUERY_doall(alg->cache, &impl_cache_free); in impl_cache_flush_alg()
222 lh_QUERY_flush(alg->cache); in impl_cache_flush_alg()
287 static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg) in ossl_method_store_insert() argument
289 return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg); in ossl_method_store_insert()
322 ALGORITHM *alg = NULL; in ossl_method_store_add() local
388 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_add()
389 if (alg == NULL) { in ossl_method_store_add()
390 if ((alg = OPENSSL_zalloc(sizeof(*alg))) == NULL in ossl_method_store_add()
391 || (alg->impls = sk_IMPLEMENTATION_new_null()) == NULL in ossl_method_store_add()
392 || (alg->cache = lh_QUERY_new(&query_hash, &query_cmp)) == NULL) in ossl_method_store_add()
394 alg->nid = nid; in ossl_method_store_add()
395 if (!ossl_method_store_insert(store, alg)) in ossl_method_store_add()
401 for (i = 0; i < sk_IMPLEMENTATION_num(alg->impls); i++) { in ossl_method_store_add()
402 const IMPLEMENTATION *tmpimpl = sk_IMPLEMENTATION_value(alg->impls, i); in ossl_method_store_add()
409 if (i == sk_IMPLEMENTATION_num(alg->impls) in ossl_method_store_add()
410 && sk_IMPLEMENTATION_push(alg->impls, impl)) { in ossl_method_store_add()
429 alg_cleanup(0, alg, NULL); in ossl_method_store_add()
437 ALGORITHM *alg = NULL; in ossl_method_store_remove() local
446 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_remove()
447 if (alg == NULL) { in ossl_method_store_remove()
457 for (i = 0; i < sk_IMPLEMENTATION_num(alg->impls); i++) { in ossl_method_store_remove()
458 IMPLEMENTATION *impl = sk_IMPLEMENTATION_value(alg->impls, i); in ossl_method_store_remove()
462 (void)sk_IMPLEMENTATION_delete(alg->impls, i); in ossl_method_store_remove()
492 alg_cleanup_by_provider(ossl_uintmax_t idx, ALGORITHM *alg, void *arg) in alg_cleanup_by_provider() argument
501 for (count = 0, i = sk_IMPLEMENTATION_num(alg->impls); i-- > 0;) { in alg_cleanup_by_provider()
502 IMPLEMENTATION *impl = sk_IMPLEMENTATION_value(alg->impls, i); in alg_cleanup_by_provider()
520 (void)sk_IMPLEMENTATION_delete(alg->impls, i); in alg_cleanup_by_provider()
533 ossl_method_cache_flush_alg(data->store, alg); in alg_cleanup_by_provider()
550 static void alg_do_one(ALGORITHM *alg, IMPLEMENTATION *impl, in alg_do_one() argument
554 fn(alg->nid, impl->method.method, fnarg); in alg_do_one()
557 static void alg_copy(ossl_uintmax_t idx, ALGORITHM *alg, void *arg) in alg_copy() argument
561 (void)sk_ALGORITHM_push(newalg, alg); in alg_copy()
571 ALGORITHM *alg; in ossl_method_store_do_all() local
589 alg = sk_ALGORITHM_value(tmpalgs, i); in ossl_method_store_do_all()
590 numimps = sk_IMPLEMENTATION_num(alg->impls); in ossl_method_store_do_all()
592 alg_do_one(alg, sk_IMPLEMENTATION_value(alg->impls, j), fn, fnarg); in ossl_method_store_do_all()
626 ALGORITHM *alg; in ossl_method_store_fetch() local
647 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_fetch()
648 if (alg == NULL) { in ossl_method_store_fetch()
687 for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) { in ossl_method_store_fetch()
688 if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL in ossl_method_store_fetch()
704 for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) { in ossl_method_store_fetch()
705 if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL in ossl_method_store_fetch()
746 ALGORITHM *alg) in ossl_method_cache_flush_alg() argument
748 store->cache_nelem -= lh_QUERY_num_items(alg->cache); in ossl_method_cache_flush_alg()
749 impl_cache_flush_alg(0, alg); in ossl_method_cache_flush_alg()
754 ALGORITHM *alg = ossl_method_store_retrieve(store, nid); in ossl_method_cache_flush() local
756 if (alg != NULL) in ossl_method_cache_flush()
757 ossl_method_cache_flush_alg(store, alg); in ossl_method_cache_flush()
811 static void impl_cache_flush_one_alg(ossl_uintmax_t idx, ALGORITHM *alg, in impl_cache_flush_one_alg() argument
815 unsigned long orig_down_load = lh_QUERY_get_down_load(alg->cache); in impl_cache_flush_one_alg()
817 state->cache = alg->cache; in impl_cache_flush_one_alg()
818 lh_QUERY_set_down_load(alg->cache, 0); in impl_cache_flush_one_alg()
821 lh_QUERY_set_down_load(alg->cache, orig_down_load); in impl_cache_flush_one_alg()
847 ALGORITHM *alg; in ossl_method_store_cache_get() local
856 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_cache_get()
857 if (alg == NULL) in ossl_method_store_cache_get()
862 r = lh_QUERY_retrieve(alg->cache, &elem); in ossl_method_store_cache_get()
880 ALGORITHM *alg; in ossl_method_store_cache_set() local
894 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_cache_set()
895 if (alg == NULL) in ossl_method_store_cache_set()
901 if ((old = lh_QUERY_delete(alg->cache, &elem)) != NULL) { in ossl_method_store_cache_set()
917 if ((old = lh_QUERY_insert(alg->cache, p)) != NULL) { in ossl_method_store_cache_set()
921 if (!lh_QUERY_error(alg->cache)) { in ossl_method_store_cache_set()