Lines Matching refs:inst

70 static void crypto_free_instance(struct crypto_instance *inst)  in crypto_free_instance()  argument
72 if (!inst->alg.cra_type->free) { in crypto_free_instance()
73 inst->tmpl->free(inst); in crypto_free_instance()
77 inst->alg.cra_type->free(inst); in crypto_free_instance()
82 struct crypto_instance *inst = (void *)alg; in crypto_destroy_instance() local
83 struct crypto_template *tmpl = inst->tmpl; in crypto_destroy_instance()
85 crypto_free_instance(inst); in crypto_destroy_instance()
105 list)->inst->alg; in crypto_more_spawns()
109 return &n->list == stack ? top : &n->inst->alg.cra_users; in crypto_more_spawns()
112 static void crypto_remove_instance(struct crypto_instance *inst, in crypto_remove_instance() argument
115 struct crypto_template *tmpl = inst->tmpl; in crypto_remove_instance()
117 if (crypto_is_dead(&inst->alg)) in crypto_remove_instance()
120 inst->alg.cra_flags |= CRYPTO_ALG_DEAD; in crypto_remove_instance()
121 if (hlist_unhashed(&inst->list)) in crypto_remove_instance()
127 crypto_notify(CRYPTO_MSG_ALG_UNREGISTER, &inst->alg); in crypto_remove_instance()
128 list_move(&inst->alg.cra_list, list); in crypto_remove_instance()
129 hlist_del(&inst->list); in crypto_remove_instance()
130 inst->alg.cra_destroy = crypto_destroy_instance; in crypto_remove_instance()
132 BUG_ON(!list_empty(&inst->alg.cra_users)); in crypto_remove_instance()
156 struct crypto_instance *inst; in crypto_remove_spawns() local
160 inst = spawn->inst; in crypto_remove_spawns()
162 BUG_ON(&inst->alg == alg); in crypto_remove_spawns()
166 if (&inst->alg == nalg) in crypto_remove_spawns()
170 spawns = &inst->alg.cra_users; in crypto_remove_spawns()
179 crypto_remove_instance(spawn->inst, list); in crypto_remove_spawns()
471 struct crypto_instance *inst; in crypto_unregister_template() local
482 hlist_for_each_entry(inst, list, list) { in crypto_unregister_template()
483 int err = crypto_remove_alg(&inst->alg, &users); in crypto_unregister_template()
492 hlist_for_each_entry_safe(inst, n, list, list) { in crypto_unregister_template()
493 BUG_ON(atomic_read(&inst->alg.cra_refcnt) != 1); in crypto_unregister_template()
494 crypto_free_instance(inst); in crypto_unregister_template()
527 struct crypto_instance *inst) in crypto_register_instance() argument
532 err = crypto_check_alg(&inst->alg); in crypto_register_instance()
536 inst->alg.cra_module = tmpl->module; in crypto_register_instance()
537 inst->alg.cra_flags |= CRYPTO_ALG_INSTANCE; in crypto_register_instance()
539 if (unlikely(!crypto_mod_get(&inst->alg))) in crypto_register_instance()
544 larval = __crypto_register_alg(&inst->alg); in crypto_register_instance()
548 hlist_add_head(&inst->list, &tmpl->instances); in crypto_register_instance()
549 inst->tmpl = tmpl; in crypto_register_instance()
561 if (!(inst->alg.cra_flags & CRYPTO_ALG_TESTED)) in crypto_register_instance()
562 crypto_unregister_instance(inst); in crypto_register_instance()
566 crypto_mod_put(&inst->alg); in crypto_register_instance()
571 int crypto_unregister_instance(struct crypto_instance *inst) in crypto_unregister_instance() argument
577 crypto_remove_spawns(&inst->alg, &list, NULL); in crypto_unregister_instance()
578 crypto_remove_instance(inst, &list); in crypto_unregister_instance()
589 struct crypto_instance *inst, u32 mask) in crypto_init_spawn() argument
593 spawn->inst = inst; in crypto_init_spawn()
609 struct crypto_instance *inst, in crypto_init_spawn2() argument
618 err = crypto_init_spawn(spawn, alg, inst, frontend->maskset); in crypto_init_spawn2()
635 err = crypto_init_spawn(spawn, alg, spawn->inst, mask); in crypto_grab_spawn()
818 struct crypto_instance *inst; in crypto_alloc_instance2() local
822 p = kzalloc(head + sizeof(*inst) + sizeof(struct crypto_spawn), in crypto_alloc_instance2()
827 inst = (void *)(p + head); in crypto_alloc_instance2()
830 if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME, "%s(%s)", name, in crypto_alloc_instance2()
834 if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s(%s)", in crypto_alloc_instance2()
849 struct crypto_instance *inst; in crypto_alloc_instance() local
853 inst = crypto_alloc_instance2(name, alg, 0); in crypto_alloc_instance()
854 if (IS_ERR(inst)) in crypto_alloc_instance()
857 spawn = crypto_instance_ctx(inst); in crypto_alloc_instance()
858 err = crypto_init_spawn(spawn, alg, inst, in crypto_alloc_instance()
864 return inst; in crypto_alloc_instance()
867 kfree(inst); in crypto_alloc_instance()
868 inst = ERR_PTR(err); in crypto_alloc_instance()
871 return inst; in crypto_alloc_instance()