Lines Matching refs:tfm

348 static void crypto_exit_ops(struct crypto_tfm *tfm)  in crypto_exit_ops()  argument
350 const struct crypto_type *type = tfm->__crt_alg->cra_type; in crypto_exit_ops()
352 if (type && tfm->exit) in crypto_exit_ops()
353 tfm->exit(tfm); in crypto_exit_ops()
392 struct crypto_tfm *tfm = NULL; in __crypto_alloc_tfmgfp() local
396 tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, type, mask); in __crypto_alloc_tfmgfp()
397 tfm = kzalloc(tfm_size, gfp); in __crypto_alloc_tfmgfp()
398 if (tfm == NULL) in __crypto_alloc_tfmgfp()
401 tfm->__crt_alg = alg; in __crypto_alloc_tfmgfp()
402 refcount_set(&tfm->refcnt, 1); in __crypto_alloc_tfmgfp()
404 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in __crypto_alloc_tfmgfp()
410 crypto_exit_ops(tfm); in __crypto_alloc_tfmgfp()
413 kfree(tfm); in __crypto_alloc_tfmgfp()
415 tfm = ERR_PTR(err); in __crypto_alloc_tfmgfp()
417 return tfm; in __crypto_alloc_tfmgfp()
452 struct crypto_tfm *tfm; in crypto_alloc_base() local
464 tfm = __crypto_alloc_tfm(alg, type, mask); in crypto_alloc_base()
465 if (!IS_ERR(tfm)) in crypto_alloc_base()
466 return tfm; in crypto_alloc_base()
469 err = PTR_ERR(tfm); in crypto_alloc_base()
488 struct crypto_tfm *tfm; in crypto_alloc_tfmmem() local
494 total = tfmsize + sizeof(*tfm) + frontend->extsize(alg); in crypto_alloc_tfmmem()
500 tfm = (struct crypto_tfm *)(mem + tfmsize); in crypto_alloc_tfmmem()
501 tfm->__crt_alg = alg; in crypto_alloc_tfmmem()
502 tfm->node = node; in crypto_alloc_tfmmem()
503 refcount_set(&tfm->refcnt, 1); in crypto_alloc_tfmmem()
512 struct crypto_tfm *tfm; in crypto_create_tfm_node() local
520 tfm = (struct crypto_tfm *)(mem + frontend->tfmsize); in crypto_create_tfm_node()
522 err = frontend->init_tfm(tfm); in crypto_create_tfm_node()
526 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in crypto_create_tfm_node()
532 crypto_exit_ops(tfm); in crypto_create_tfm_node()
547 struct crypto_tfm *tfm; in crypto_clone_tfm() local
560 tfm = (struct crypto_tfm *)(mem + frontend->tfmsize); in crypto_clone_tfm()
561 tfm->crt_flags = otfm->crt_flags; in crypto_clone_tfm()
562 tfm->exit = otfm->exit; in crypto_clone_tfm()
611 void *tfm; in crypto_alloc_tfm_node() local
623 tfm = crypto_create_tfm_node(alg, frontend, node); in crypto_alloc_tfm_node()
624 if (!IS_ERR(tfm)) in crypto_alloc_tfm_node()
625 return tfm; in crypto_alloc_tfm_node()
628 err = PTR_ERR(tfm); in crypto_alloc_tfm_node()
651 void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) in crypto_destroy_tfm() argument
658 if (!refcount_dec_and_test(&tfm->refcnt)) in crypto_destroy_tfm()
660 alg = tfm->__crt_alg; in crypto_destroy_tfm()
662 if (!tfm->exit && alg->cra_exit) in crypto_destroy_tfm()
663 alg->cra_exit(tfm); in crypto_destroy_tfm()
664 crypto_exit_ops(tfm); in crypto_destroy_tfm()