Lines Matching refs:tfm
362 static void crypto_exit_ops(struct crypto_tfm *tfm) in crypto_exit_ops() argument
364 const struct crypto_type *type = tfm->__crt_alg->cra_type; in crypto_exit_ops()
366 if (type && tfm->exit) in crypto_exit_ops()
367 tfm->exit(tfm); in crypto_exit_ops()
402 struct crypto_tfm *tfm; in __crypto_alloc_tfmgfp() local
406 tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, type, mask); in __crypto_alloc_tfmgfp()
407 tfm = kzalloc(tfm_size, gfp); in __crypto_alloc_tfmgfp()
408 if (tfm == NULL) in __crypto_alloc_tfmgfp()
411 tfm->__crt_alg = alg; in __crypto_alloc_tfmgfp()
412 refcount_set(&tfm->refcnt, 1); in __crypto_alloc_tfmgfp()
414 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in __crypto_alloc_tfmgfp()
420 crypto_exit_ops(tfm); in __crypto_alloc_tfmgfp()
423 kfree(tfm); in __crypto_alloc_tfmgfp()
425 tfm = ERR_PTR(err); in __crypto_alloc_tfmgfp()
427 return tfm; in __crypto_alloc_tfmgfp()
462 struct crypto_tfm *tfm; in crypto_alloc_base() local
474 tfm = __crypto_alloc_tfm(alg, type, mask); in crypto_alloc_base()
475 if (!IS_ERR(tfm)) in crypto_alloc_base()
476 return tfm; in crypto_alloc_base()
479 err = PTR_ERR(tfm); in crypto_alloc_base()
498 struct crypto_tfm *tfm; in crypto_alloc_tfmmem() local
504 total = tfmsize + sizeof(*tfm) + frontend->extsize(alg); in crypto_alloc_tfmmem()
510 tfm = (struct crypto_tfm *)(mem + tfmsize); in crypto_alloc_tfmmem()
511 tfm->__crt_alg = alg; in crypto_alloc_tfmmem()
512 tfm->node = node; in crypto_alloc_tfmmem()
513 refcount_set(&tfm->refcnt, 1); in crypto_alloc_tfmmem()
522 struct crypto_tfm *tfm; in crypto_create_tfm_node() local
530 tfm = (struct crypto_tfm *)(mem + frontend->tfmsize); in crypto_create_tfm_node()
532 err = frontend->init_tfm(tfm); in crypto_create_tfm_node()
536 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in crypto_create_tfm_node()
542 crypto_exit_ops(tfm); in crypto_create_tfm_node()
557 struct crypto_tfm *tfm; in crypto_clone_tfm() local
570 tfm = (struct crypto_tfm *)(mem + frontend->tfmsize); in crypto_clone_tfm()
571 tfm->crt_flags = otfm->crt_flags; in crypto_clone_tfm()
572 tfm->exit = otfm->exit; in crypto_clone_tfm()
621 void *tfm; in crypto_alloc_tfm_node() local
633 tfm = crypto_create_tfm_node(alg, frontend, node); in crypto_alloc_tfm_node()
634 if (!IS_ERR(tfm)) in crypto_alloc_tfm_node()
635 return tfm; in crypto_alloc_tfm_node()
638 err = PTR_ERR(tfm); in crypto_alloc_tfm_node()
661 void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) in crypto_destroy_tfm() argument
668 if (!refcount_dec_and_test(&tfm->refcnt)) in crypto_destroy_tfm()
670 alg = tfm->__crt_alg; in crypto_destroy_tfm()
672 if (!tfm->exit && alg->cra_exit) in crypto_destroy_tfm()
673 alg->cra_exit(tfm); in crypto_destroy_tfm()
674 crypto_exit_ops(tfm); in crypto_destroy_tfm()