Lines Matching refs:tfm

334 static int crypto_init_ops(struct crypto_tfm *tfm, u32 type, u32 mask)  in crypto_init_ops()  argument
336 const struct crypto_type *type_obj = tfm->__crt_alg->cra_type; in crypto_init_ops()
339 return type_obj->init(tfm, type, mask); in crypto_init_ops()
343 static void crypto_exit_ops(struct crypto_tfm *tfm) in crypto_exit_ops() argument
345 const struct crypto_type *type = tfm->__crt_alg->cra_type; in crypto_exit_ops()
347 if (type && tfm->exit) in crypto_exit_ops()
348 tfm->exit(tfm); in crypto_exit_ops()
387 struct crypto_tfm *tfm = NULL; in __crypto_alloc_tfm() local
391 tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, type, mask); in __crypto_alloc_tfm()
392 tfm = kzalloc(tfm_size, GFP_KERNEL); in __crypto_alloc_tfm()
393 if (tfm == NULL) in __crypto_alloc_tfm()
396 tfm->__crt_alg = alg; in __crypto_alloc_tfm()
398 err = crypto_init_ops(tfm, type, mask); in __crypto_alloc_tfm()
402 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in __crypto_alloc_tfm()
408 crypto_exit_ops(tfm); in __crypto_alloc_tfm()
412 kfree(tfm); in __crypto_alloc_tfm()
414 tfm = ERR_PTR(err); in __crypto_alloc_tfm()
416 return tfm; in __crypto_alloc_tfm()
444 struct crypto_tfm *tfm; in crypto_alloc_base() local
456 tfm = __crypto_alloc_tfm(alg, type, mask); in crypto_alloc_base()
457 if (!IS_ERR(tfm)) in crypto_alloc_base()
458 return tfm; in crypto_alloc_base()
461 err = PTR_ERR(tfm); in crypto_alloc_base()
481 struct crypto_tfm *tfm = NULL; in crypto_create_tfm_node() local
487 total = tfmsize + sizeof(*tfm) + frontend->extsize(alg); in crypto_create_tfm_node()
493 tfm = (struct crypto_tfm *)(mem + tfmsize); in crypto_create_tfm_node()
494 tfm->__crt_alg = alg; in crypto_create_tfm_node()
495 tfm->node = node; in crypto_create_tfm_node()
497 err = frontend->init_tfm(tfm); in crypto_create_tfm_node()
501 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) in crypto_create_tfm_node()
507 crypto_exit_ops(tfm); in crypto_create_tfm_node()
561 void *tfm; in crypto_alloc_tfm_node() local
573 tfm = crypto_create_tfm_node(alg, frontend, node); in crypto_alloc_tfm_node()
574 if (!IS_ERR(tfm)) in crypto_alloc_tfm_node()
575 return tfm; in crypto_alloc_tfm_node()
578 err = PTR_ERR(tfm); in crypto_alloc_tfm_node()
601 void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) in crypto_destroy_tfm() argument
608 alg = tfm->__crt_alg; in crypto_destroy_tfm()
610 if (!tfm->exit && alg->cra_exit) in crypto_destroy_tfm()
611 alg->cra_exit(tfm); in crypto_destroy_tfm()
612 crypto_exit_ops(tfm); in crypto_destroy_tfm()