Lines Matching refs:alg
109 ALGORITHM *alg);
218 static void impl_cache_flush_alg(ossl_uintmax_t idx, ALGORITHM *alg) in impl_cache_flush_alg() argument
220 lh_QUERY_doall(alg->cache, &impl_cache_free); in impl_cache_flush_alg()
221 lh_QUERY_flush(alg->cache); in impl_cache_flush_alg()
286 static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg) in ossl_method_store_insert() argument
288 return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg); in ossl_method_store_insert()
296 ALGORITHM *alg = NULL; in ossl_method_store_add() local
339 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_add()
340 if (alg == NULL) { in ossl_method_store_add()
341 if ((alg = OPENSSL_zalloc(sizeof(*alg))) == NULL in ossl_method_store_add()
342 || (alg->impls = sk_IMPLEMENTATION_new_null()) == NULL in ossl_method_store_add()
343 || (alg->cache = lh_QUERY_new(&query_hash, &query_cmp)) == NULL) in ossl_method_store_add()
345 alg->nid = nid; in ossl_method_store_add()
346 if (!ossl_method_store_insert(store, alg)) in ossl_method_store_add()
351 for (i = 0; i < sk_IMPLEMENTATION_num(alg->impls); i++) { in ossl_method_store_add()
352 const IMPLEMENTATION *tmpimpl = sk_IMPLEMENTATION_value(alg->impls, i); in ossl_method_store_add()
358 if (i == sk_IMPLEMENTATION_num(alg->impls) in ossl_method_store_add()
359 && sk_IMPLEMENTATION_push(alg->impls, impl)) in ossl_method_store_add()
368 alg_cleanup(0, alg, NULL); in ossl_method_store_add()
376 ALGORITHM *alg = NULL; in ossl_method_store_remove() local
385 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_remove()
386 if (alg == NULL) { in ossl_method_store_remove()
396 for (i = 0; i < sk_IMPLEMENTATION_num(alg->impls); i++) { in ossl_method_store_remove()
397 IMPLEMENTATION *impl = sk_IMPLEMENTATION_value(alg->impls, i); in ossl_method_store_remove()
401 (void)sk_IMPLEMENTATION_delete(alg->impls, i); in ossl_method_store_remove()
416 alg_cleanup_by_provider(ossl_uintmax_t idx, ALGORITHM *alg, void *arg) in alg_cleanup_by_provider() argument
425 for (count = 0, i = sk_IMPLEMENTATION_num(alg->impls); i-- > 0;) { in alg_cleanup_by_provider()
426 IMPLEMENTATION *impl = sk_IMPLEMENTATION_value(alg->impls, i); in alg_cleanup_by_provider()
430 (void)sk_IMPLEMENTATION_delete(alg->impls, i); in alg_cleanup_by_provider()
442 ossl_method_cache_flush_alg(data->store, alg); in alg_cleanup_by_provider()
459 static void alg_do_one(ALGORITHM *alg, IMPLEMENTATION *impl, in alg_do_one() argument
463 fn(alg->nid, impl->method.method, fnarg); in alg_do_one()
466 static void alg_copy(ossl_uintmax_t idx, ALGORITHM *alg, void *arg) in alg_copy() argument
470 (void)sk_ALGORITHM_push(newalg, alg); in alg_copy()
480 ALGORITHM *alg; in ossl_method_store_do_all() local
498 alg = sk_ALGORITHM_value(tmpalgs, i); in ossl_method_store_do_all()
499 numimps = sk_IMPLEMENTATION_num(alg->impls); in ossl_method_store_do_all()
501 alg_do_one(alg, sk_IMPLEMENTATION_value(alg->impls, j), fn, fnarg); in ossl_method_store_do_all()
512 ALGORITHM *alg; in ossl_method_store_fetch() local
531 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_fetch()
532 if (alg == NULL) { in ossl_method_store_fetch()
553 for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) { in ossl_method_store_fetch()
554 if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL in ossl_method_store_fetch()
564 for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) { in ossl_method_store_fetch()
565 if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL in ossl_method_store_fetch()
591 ALGORITHM *alg) in ossl_method_cache_flush_alg() argument
593 store->cache_nelem -= lh_QUERY_num_items(alg->cache); in ossl_method_cache_flush_alg()
594 impl_cache_flush_alg(0, alg); in ossl_method_cache_flush_alg()
599 ALGORITHM *alg = ossl_method_store_retrieve(store, nid); in ossl_method_cache_flush() local
601 if (alg != NULL) in ossl_method_cache_flush()
602 ossl_method_cache_flush_alg(store, alg); in ossl_method_cache_flush()
656 static void impl_cache_flush_one_alg(ossl_uintmax_t idx, ALGORITHM *alg, in impl_cache_flush_one_alg() argument
660 unsigned long orig_down_load = lh_QUERY_get_down_load(alg->cache); in impl_cache_flush_one_alg()
662 state->cache = alg->cache; in impl_cache_flush_one_alg()
663 lh_QUERY_set_down_load(alg->cache, 0); in impl_cache_flush_one_alg()
666 lh_QUERY_set_down_load(alg->cache, orig_down_load); in impl_cache_flush_one_alg()
692 ALGORITHM *alg; in ossl_method_store_cache_get() local
701 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_cache_get()
702 if (alg == NULL) in ossl_method_store_cache_get()
707 r = lh_QUERY_retrieve(alg->cache, &elem); in ossl_method_store_cache_get()
725 ALGORITHM *alg; in ossl_method_store_cache_set() local
739 alg = ossl_method_store_retrieve(store, nid); in ossl_method_store_cache_set()
740 if (alg == NULL) in ossl_method_store_cache_set()
746 if ((old = lh_QUERY_delete(alg->cache, &elem)) != NULL) { in ossl_method_store_cache_set()
762 if ((old = lh_QUERY_insert(alg->cache, p)) != NULL) { in ossl_method_store_cache_set()
766 if (!lh_QUERY_error(alg->cache)) { in ossl_method_store_cache_set()