Lines Matching refs:tfm
365 static void crypto_exit_ops(struct crypto_tfm *tfm) in crypto_exit_ops() argument
367 const struct crypto_type *type = tfm->__crt_alg->cra_type; in crypto_exit_ops()
369 if (type && tfm->exit) in crypto_exit_ops()
370 tfm->exit(tfm); in crypto_exit_ops()
409 struct crypto_tfm *tfm; in __crypto_alloc_tfmgfp() local
413 tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, type, mask); in __crypto_alloc_tfmgfp()
414 tfm = kzalloc(tfm_size, gfp); in __crypto_alloc_tfmgfp()
415 if (tfm == NULL) in __crypto_alloc_tfmgfp()
418 tfm->__crt_alg = alg; in __crypto_alloc_tfmgfp()
419 refcount_set(&tfm->refcnt, 1); in __crypto_alloc_tfmgfp()
421 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in __crypto_alloc_tfmgfp()
427 crypto_exit_ops(tfm); in __crypto_alloc_tfmgfp()
430 kfree(tfm); in __crypto_alloc_tfmgfp()
432 tfm = ERR_PTR(err); in __crypto_alloc_tfmgfp()
434 return tfm; in __crypto_alloc_tfmgfp()
469 struct crypto_tfm *tfm; in crypto_alloc_base() local
481 tfm = __crypto_alloc_tfm(alg, type, mask); in crypto_alloc_base()
482 if (!IS_ERR(tfm)) in crypto_alloc_base()
483 return tfm; in crypto_alloc_base()
486 err = PTR_ERR(tfm); in crypto_alloc_base()
505 struct crypto_tfm *tfm; in crypto_alloc_tfmmem() local
511 total = tfmsize + sizeof(*tfm) + frontend->extsize(alg); in crypto_alloc_tfmmem()
517 tfm = (struct crypto_tfm *)(mem + tfmsize); in crypto_alloc_tfmmem()
518 tfm->__crt_alg = alg; in crypto_alloc_tfmmem()
519 tfm->node = node; in crypto_alloc_tfmmem()
520 refcount_set(&tfm->refcnt, 1); in crypto_alloc_tfmmem()
529 struct crypto_tfm *tfm; in crypto_create_tfm_node() local
537 tfm = (struct crypto_tfm *)(mem + frontend->tfmsize); in crypto_create_tfm_node()
539 err = frontend->init_tfm(tfm); in crypto_create_tfm_node()
543 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in crypto_create_tfm_node()
549 crypto_exit_ops(tfm); in crypto_create_tfm_node()
564 struct crypto_tfm *tfm; in crypto_clone_tfm() local
577 tfm = (struct crypto_tfm *)(mem + frontend->tfmsize); in crypto_clone_tfm()
578 tfm->crt_flags = otfm->crt_flags; in crypto_clone_tfm()
579 tfm->exit = otfm->exit; in crypto_clone_tfm()
628 void *tfm; in crypto_alloc_tfm_node() local
640 tfm = crypto_create_tfm_node(alg, frontend, node); in crypto_alloc_tfm_node()
641 if (!IS_ERR(tfm)) in crypto_alloc_tfm_node()
642 return tfm; in crypto_alloc_tfm_node()
645 err = PTR_ERR(tfm); in crypto_alloc_tfm_node()
668 void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) in crypto_destroy_tfm() argument
675 if (!refcount_dec_and_test(&tfm->refcnt)) in crypto_destroy_tfm()
677 alg = tfm->__crt_alg; in crypto_destroy_tfm()
679 if (!tfm->exit && alg->cra_exit) in crypto_destroy_tfm()
680 alg->cra_exit(tfm); in crypto_destroy_tfm()
681 crypto_exit_ops(tfm); in crypto_destroy_tfm()