Lines Matching refs:store

160     struct provider_store_st *store; /* The store this instance belongs to */  member
288 struct provider_store_st *store = vstore; in ossl_provider_store_free() local
291 if (store == NULL) in ossl_provider_store_free()
293 store->freeing = 1; in ossl_provider_store_free()
294 OPENSSL_free(store->default_path); in ossl_provider_store_free()
295 sk_OSSL_PROVIDER_pop_free(store->providers, provider_deactivate_free); in ossl_provider_store_free()
297 sk_OSSL_PROVIDER_CHILD_CB_pop_free(store->child_cbs, in ossl_provider_store_free()
300 CRYPTO_THREAD_lock_free(store->default_path_lock); in ossl_provider_store_free()
301 CRYPTO_THREAD_lock_free(store->lock); in ossl_provider_store_free()
302 for (i = 0; i < store->numprovinfo; i++) in ossl_provider_store_free()
303 ossl_provider_info_clear(&store->provinfo[i]); in ossl_provider_store_free()
304 OPENSSL_free(store->provinfo); in ossl_provider_store_free()
305 OPENSSL_free(store); in ossl_provider_store_free()
310 struct provider_store_st *store = OPENSSL_zalloc(sizeof(*store)); in ossl_provider_store_new() local
312 if (store == NULL in ossl_provider_store_new()
313 || (store->providers = sk_OSSL_PROVIDER_new(ossl_provider_cmp)) == NULL in ossl_provider_store_new()
314 || (store->default_path_lock = CRYPTO_THREAD_lock_new()) == NULL in ossl_provider_store_new()
316 || (store->child_cbs = sk_OSSL_PROVIDER_CHILD_CB_new_null()) == NULL in ossl_provider_store_new()
318 || (store->lock = CRYPTO_THREAD_lock_new()) == NULL) { in ossl_provider_store_new()
319 ossl_provider_store_free(store); in ossl_provider_store_new()
322 store->libctx = ctx; in ossl_provider_store_new()
323 store->use_fallbacks = 1; in ossl_provider_store_new()
325 return store; in ossl_provider_store_new()
330 struct provider_store_st *store = NULL; in get_provider_store() local
332 store = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_STORE_INDEX); in get_provider_store()
333 if (store == NULL) in get_provider_store()
335 return store; in get_provider_store()
340 struct provider_store_st *store; in ossl_provider_disable_fallback_loading() local
342 if ((store = get_provider_store(libctx)) != NULL) { in ossl_provider_disable_fallback_loading()
343 if (!CRYPTO_THREAD_write_lock(store->lock)) in ossl_provider_disable_fallback_loading()
345 store->use_fallbacks = 0; in ossl_provider_disable_fallback_loading()
346 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_disable_fallback_loading()
357 struct provider_store_st *store = get_provider_store(libctx); in ossl_provider_info_add_to_store() local
365 if (store == NULL) { in ossl_provider_info_add_to_store()
370 if (!CRYPTO_THREAD_write_lock(store->lock)) in ossl_provider_info_add_to_store()
372 if (store->provinfosz == 0) { in ossl_provider_info_add_to_store()
373 store->provinfo = OPENSSL_zalloc(sizeof(*store->provinfo) in ossl_provider_info_add_to_store()
375 if (store->provinfo == NULL) in ossl_provider_info_add_to_store()
377 store->provinfosz = BUILTINS_BLOCK_SIZE; in ossl_provider_info_add_to_store()
378 } else if (store->numprovinfo == store->provinfosz) { in ossl_provider_info_add_to_store()
380 size_t newsz = store->provinfosz + BUILTINS_BLOCK_SIZE; in ossl_provider_info_add_to_store()
382 tmpbuiltins = OPENSSL_realloc(store->provinfo, in ossl_provider_info_add_to_store()
383 sizeof(*store->provinfo) * newsz); in ossl_provider_info_add_to_store()
386 store->provinfo = tmpbuiltins; in ossl_provider_info_add_to_store()
387 store->provinfosz = newsz; in ossl_provider_info_add_to_store()
389 store->provinfo[store->numprovinfo] = *entry; in ossl_provider_info_add_to_store()
390 store->numprovinfo++; in ossl_provider_info_add_to_store()
394 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_info_add_to_store()
401 struct provider_store_st *store = NULL; in ossl_provider_find() local
404 if ((store = get_provider_store(libctx)) != NULL) { in ossl_provider_find()
420 if (!CRYPTO_THREAD_write_lock(store->lock)) in ossl_provider_find()
422 sk_OSSL_PROVIDER_sort(store->providers); in ossl_provider_find()
423 if ((i = sk_OSSL_PROVIDER_find(store->providers, &tmpl)) != -1) in ossl_provider_find()
424 prov = sk_OSSL_PROVIDER_value(store->providers, i); in ossl_provider_find()
425 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_find()
522 struct provider_store_st *store = NULL; in ossl_provider_new() local
526 if ((store = get_provider_store(libctx)) == NULL) in ossl_provider_new()
543 if (!CRYPTO_THREAD_read_lock(store->lock)) in ossl_provider_new()
545 for (i = 0, p = store->provinfo; i < store->numprovinfo; p++, i++) { in ossl_provider_new()
551 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_new()
608 struct provider_store_st *store = prov->store; in create_provider_children() local
612 max = sk_OSSL_PROVIDER_CHILD_CB_num(store->child_cbs); in create_provider_children()
618 child_cb = sk_OSSL_PROVIDER_CHILD_CB_value(store->child_cbs, i); in create_provider_children()
629 struct provider_store_st *store; in ossl_provider_add_to_store() local
637 if ((store = get_provider_store(prov->libctx)) == NULL) in ossl_provider_add_to_store()
640 if (!CRYPTO_THREAD_write_lock(store->lock)) in ossl_provider_add_to_store()
644 idx = sk_OSSL_PROVIDER_find(store->providers, &tmpl); in ossl_provider_add_to_store()
648 actualtmp = sk_OSSL_PROVIDER_value(store->providers, idx); in ossl_provider_add_to_store()
651 if (sk_OSSL_PROVIDER_push(store->providers, prov) == 0) in ossl_provider_add_to_store()
653 prov->store = store; in ossl_provider_add_to_store()
655 sk_OSSL_PROVIDER_delete_ptr(store->providers, prov); in ossl_provider_add_to_store()
659 store->use_fallbacks = 0; in ossl_provider_add_to_store()
662 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_add_to_store()
700 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_add_to_store()
833 struct provider_store_st *store; in OSSL_PROVIDER_set_default_search_path() local
841 if ((store = get_provider_store(libctx)) != NULL in OSSL_PROVIDER_set_default_search_path()
842 && CRYPTO_THREAD_write_lock(store->default_path_lock)) { in OSSL_PROVIDER_set_default_search_path()
843 OPENSSL_free(store->default_path); in OSSL_PROVIDER_set_default_search_path()
844 store->default_path = p; in OSSL_PROVIDER_set_default_search_path()
845 CRYPTO_THREAD_unlock(store->default_path_lock); in OSSL_PROVIDER_set_default_search_path()
854 struct provider_store_st *store; in OSSL_PROVIDER_get0_default_search_path() local
857 if ((store = get_provider_store(libctx)) != NULL in OSSL_PROVIDER_get0_default_search_path()
858 && CRYPTO_THREAD_read_lock(store->default_path_lock)) { in OSSL_PROVIDER_get0_default_search_path()
859 path = store->default_path; in OSSL_PROVIDER_get0_default_search_path()
860 CRYPTO_THREAD_unlock(store->default_path_lock); in OSSL_PROVIDER_get0_default_search_path()
900 struct provider_store_st *store; in provider_init()
907 if ((store = get_provider_store(prov->libctx)) == NULL in provider_init()
908 || !CRYPTO_THREAD_read_lock(store->default_path_lock)) in provider_init()
911 if (store->default_path != NULL) { in provider_init()
912 allocated_load_dir = OPENSSL_strdup(store->default_path); in provider_init()
913 CRYPTO_THREAD_unlock(store->default_path_lock); in provider_init()
918 CRYPTO_THREAD_unlock(store->default_path_lock); in provider_init()
1090 struct provider_store_st *store; in provider_deactivate() local
1103 store = get_provider_store(prov->libctx); in provider_deactivate()
1104 if (store == NULL) in provider_deactivate()
1107 if (lock && !CRYPTO_THREAD_read_lock(store->lock)) in provider_deactivate()
1110 CRYPTO_THREAD_unlock(store->lock); in provider_deactivate()
1135 if (removechildren && store != NULL) { in provider_deactivate()
1136 int i, max = sk_OSSL_PROVIDER_CHILD_CB_num(store->child_cbs); in provider_deactivate()
1140 child_cb = sk_OSSL_PROVIDER_CHILD_CB_value(store->child_cbs, i); in provider_deactivate()
1147 CRYPTO_THREAD_unlock(store->lock); in provider_deactivate()
1173 struct provider_store_st *store; in provider_activate() local
1176 store = prov->store; in provider_activate()
1181 if (store == NULL) { in provider_activate()
1192 if (lock && !CRYPTO_THREAD_read_lock(store->lock)) { in provider_activate()
1201 CRYPTO_THREAD_unlock(store->lock); in provider_activate()
1211 if (count == 1 && store != NULL) { in provider_activate()
1217 CRYPTO_THREAD_unlock(store->lock); in provider_activate()
1236 struct provider_store_st *store; in provider_flush_store_cache() local
1239 if ((store = get_provider_store(prov->libctx)) == NULL) in provider_flush_store_cache()
1242 if (!CRYPTO_THREAD_read_lock(store->lock)) in provider_flush_store_cache()
1244 freeing = store->freeing; in provider_flush_store_cache()
1245 CRYPTO_THREAD_unlock(store->lock); in provider_flush_store_cache()
1268 struct provider_store_st *store; in provider_remove_store_methods() local
1271 if ((store = get_provider_store(prov->libctx)) == NULL) in provider_remove_store_methods()
1274 if (!CRYPTO_THREAD_read_lock(store->lock)) in provider_remove_store_methods()
1276 freeing = store->freeing; in provider_remove_store_methods()
1277 CRYPTO_THREAD_unlock(store->lock); in provider_remove_store_methods()
1346 static int provider_activate_fallbacks(struct provider_store_st *store) in provider_activate_fallbacks() argument
1353 if (!CRYPTO_THREAD_read_lock(store->lock)) in provider_activate_fallbacks()
1355 use_fallbacks = store->use_fallbacks; in provider_activate_fallbacks()
1356 CRYPTO_THREAD_unlock(store->lock); in provider_activate_fallbacks()
1360 if (!CRYPTO_THREAD_write_lock(store->lock)) in provider_activate_fallbacks()
1363 use_fallbacks = store->use_fallbacks; in provider_activate_fallbacks()
1365 CRYPTO_THREAD_unlock(store->lock); in provider_activate_fallbacks()
1381 prov->libctx = store->libctx; in provider_activate_fallbacks()
1396 prov->store = store; in provider_activate_fallbacks()
1397 if (sk_OSSL_PROVIDER_push(store->providers, prov) == 0) { in provider_activate_fallbacks()
1405 store->use_fallbacks = 0; in provider_activate_fallbacks()
1409 CRYPTO_THREAD_unlock(store->lock); in provider_activate_fallbacks()
1419 struct provider_store_st *store = get_provider_store(ctx); in ossl_provider_doall_activated() local
1431 if (store == NULL) in ossl_provider_doall_activated()
1433 if (!provider_activate_fallbacks(store)) in ossl_provider_doall_activated()
1440 if (!CRYPTO_THREAD_read_lock(store->lock)) in ossl_provider_doall_activated()
1442 provs = sk_OSSL_PROVIDER_dup(store->providers); in ossl_provider_doall_activated()
1444 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_doall_activated()
1485 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_doall_activated()
1504 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_doall_activated()
1554 struct provider_store_st *store = get_provider_store(libctx); in OSSL_PROVIDER_available() local
1556 if (store == NULL || !provider_activate_fallbacks(store)) in OSSL_PROVIDER_available()
1970 struct provider_store_st *store = NULL; in ossl_provider_default_props_update() local
1974 if ((store = get_provider_store(libctx)) == NULL) in ossl_provider_default_props_update()
1977 if (!CRYPTO_THREAD_read_lock(store->lock)) in ossl_provider_default_props_update()
1980 max = sk_OSSL_PROVIDER_CHILD_CB_num(store->child_cbs); in ossl_provider_default_props_update()
1982 child_cb = sk_OSSL_PROVIDER_CHILD_CB_value(store->child_cbs, i); in ossl_provider_default_props_update()
1986 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_default_props_update()
2010 struct provider_store_st *store = NULL; in ossl_provider_register_child_cb() local
2015 if ((store = get_provider_store(libctx)) == NULL) in ossl_provider_register_child_cb()
2027 if (!CRYPTO_THREAD_write_lock(store->lock)) { in ossl_provider_register_child_cb()
2037 max = sk_OSSL_PROVIDER_num(store->providers); in ossl_provider_register_child_cb()
2041 prov = sk_OSSL_PROVIDER_value(store->providers, i); in ossl_provider_register_child_cb()
2061 ret = sk_OSSL_PROVIDER_CHILD_CB_push(store->child_cbs, child_cb); in ossl_provider_register_child_cb()
2066 prov = sk_OSSL_PROVIDER_value(store->providers, i); in ossl_provider_register_child_cb()
2072 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_register_child_cb()
2085 struct provider_store_st *store = NULL; in ossl_provider_deregister_child_cb() local
2089 if ((store = get_provider_store(libctx)) == NULL) in ossl_provider_deregister_child_cb()
2092 if (!CRYPTO_THREAD_write_lock(store->lock)) in ossl_provider_deregister_child_cb()
2094 max = sk_OSSL_PROVIDER_CHILD_CB_num(store->child_cbs); in ossl_provider_deregister_child_cb()
2096 child_cb = sk_OSSL_PROVIDER_CHILD_CB_value(store->child_cbs, i); in ossl_provider_deregister_child_cb()
2099 sk_OSSL_PROVIDER_CHILD_CB_delete(store->child_cbs, i); in ossl_provider_deregister_child_cb()
2104 CRYPTO_THREAD_unlock(store->lock); in ossl_provider_deregister_child_cb()