• Home
  • Raw
  • Download

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()
104 &list_next_entry(n, list)->inst->alg; in crypto_more_spawns()
108 return &n->list == stack ? top : &n->inst->alg.cra_users; in crypto_more_spawns()
111 static void crypto_remove_instance(struct crypto_instance *inst, in crypto_remove_instance() argument
114 struct crypto_template *tmpl = inst->tmpl; in crypto_remove_instance()
116 if (crypto_is_dead(&inst->alg)) in crypto_remove_instance()
119 inst->alg.cra_flags |= CRYPTO_ALG_DEAD; in crypto_remove_instance()
120 if (hlist_unhashed(&inst->list)) in crypto_remove_instance()
126 crypto_notify(CRYPTO_MSG_ALG_UNREGISTER, &inst->alg); in crypto_remove_instance()
127 list_move(&inst->alg.cra_list, list); in crypto_remove_instance()
128 hlist_del(&inst->list); in crypto_remove_instance()
129 inst->alg.cra_destroy = crypto_destroy_instance; in crypto_remove_instance()
131 BUG_ON(!list_empty(&inst->alg.cra_users)); in crypto_remove_instance()
155 struct crypto_instance *inst; in crypto_remove_spawns() local
159 inst = spawn->inst; in crypto_remove_spawns()
161 BUG_ON(&inst->alg == alg); in crypto_remove_spawns()
165 if (&inst->alg == nalg) in crypto_remove_spawns()
169 spawns = &inst->alg.cra_users; in crypto_remove_spawns()
190 crypto_remove_instance(spawn->inst, list); in crypto_remove_spawns()
483 struct crypto_instance *inst; in crypto_unregister_template() local
494 hlist_for_each_entry(inst, list, list) { in crypto_unregister_template()
495 int err = crypto_remove_alg(&inst->alg, &users); in crypto_unregister_template()
504 hlist_for_each_entry_safe(inst, n, list, list) { in crypto_unregister_template()
505 BUG_ON(atomic_read(&inst->alg.cra_refcnt) != 1); in crypto_unregister_template()
506 crypto_free_instance(inst); in crypto_unregister_template()
539 struct crypto_instance *inst) in crypto_register_instance() argument
544 err = crypto_check_alg(&inst->alg); in crypto_register_instance()
548 inst->alg.cra_module = tmpl->module; in crypto_register_instance()
549 inst->alg.cra_flags |= CRYPTO_ALG_INSTANCE; in crypto_register_instance()
551 if (unlikely(!crypto_mod_get(&inst->alg))) in crypto_register_instance()
556 larval = __crypto_register_alg(&inst->alg); in crypto_register_instance()
560 hlist_add_head(&inst->list, &tmpl->instances); in crypto_register_instance()
561 inst->tmpl = tmpl; in crypto_register_instance()
573 if (!(inst->alg.cra_flags & CRYPTO_ALG_TESTED)) in crypto_register_instance()
574 crypto_unregister_instance(inst); in crypto_register_instance()
578 crypto_mod_put(&inst->alg); in crypto_register_instance()
583 int crypto_unregister_instance(struct crypto_instance *inst) in crypto_unregister_instance() argument
589 crypto_remove_spawns(&inst->alg, &list, NULL); in crypto_unregister_instance()
590 crypto_remove_instance(inst, &list); in crypto_unregister_instance()
601 struct crypto_instance *inst, u32 mask) in crypto_init_spawn() argument
605 spawn->inst = inst; in crypto_init_spawn()
621 struct crypto_instance *inst, in crypto_init_spawn2() argument
630 err = crypto_init_spawn(spawn, alg, inst, frontend->maskset); in crypto_init_spawn2()
647 err = crypto_init_spawn(spawn, alg, spawn->inst, mask); in crypto_grab_spawn()
827 int crypto_inst_setname(struct crypto_instance *inst, const char *name, in crypto_inst_setname() argument
830 if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME, "%s(%s)", name, in crypto_inst_setname()
834 if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s(%s)", in crypto_inst_setname()
845 struct crypto_instance *inst; in crypto_alloc_instance2() local
849 p = kzalloc(head + sizeof(*inst) + sizeof(struct crypto_spawn), in crypto_alloc_instance2()
854 inst = (void *)(p + head); in crypto_alloc_instance2()
856 err = crypto_inst_setname(inst, name, alg); in crypto_alloc_instance2()
871 struct crypto_instance *inst; in crypto_alloc_instance() local
875 inst = crypto_alloc_instance2(name, alg, 0); in crypto_alloc_instance()
876 if (IS_ERR(inst)) in crypto_alloc_instance()
879 spawn = crypto_instance_ctx(inst); in crypto_alloc_instance()
880 err = crypto_init_spawn(spawn, alg, inst, in crypto_alloc_instance()
886 return inst; in crypto_alloc_instance()
889 kfree(inst); in crypto_alloc_instance()
890 inst = ERR_PTR(err); in crypto_alloc_instance()
893 return inst; in crypto_alloc_instance()