Lines Matching refs:inst
391 struct aead_instance *inst = aead_alg_instance(tfm); in crypto_ccm_init_tfm() local
392 struct ccm_instance_ctx *ictx = aead_instance_ctx(inst); in crypto_ccm_init_tfm()
433 static void crypto_ccm_free(struct aead_instance *inst) in crypto_ccm_free() argument
435 struct ccm_instance_ctx *ctx = aead_instance_ctx(inst); in crypto_ccm_free()
439 kfree(inst); in crypto_ccm_free()
449 struct aead_instance *inst; in crypto_ccm_create_common() local
458 inst = kzalloc(sizeof(*inst) + sizeof(*ictx), GFP_KERNEL); in crypto_ccm_create_common()
459 if (!inst) in crypto_ccm_create_common()
461 ictx = aead_instance_ctx(inst); in crypto_ccm_create_common()
463 err = crypto_grab_ahash(&ictx->mac, aead_crypto_instance(inst), in crypto_ccm_create_common()
474 err = crypto_grab_skcipher(&ictx->ctr, aead_crypto_instance(inst), in crypto_ccm_create_common()
491 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, in crypto_ccm_create_common()
495 if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in crypto_ccm_create_common()
500 inst->alg.base.cra_priority = (mac->base.cra_priority + in crypto_ccm_create_common()
502 inst->alg.base.cra_blocksize = 1; in crypto_ccm_create_common()
503 inst->alg.base.cra_alignmask = ctr->base.cra_alignmask; in crypto_ccm_create_common()
504 inst->alg.ivsize = 16; in crypto_ccm_create_common()
505 inst->alg.chunksize = ctr->chunksize; in crypto_ccm_create_common()
506 inst->alg.maxauthsize = 16; in crypto_ccm_create_common()
507 inst->alg.base.cra_ctxsize = sizeof(struct crypto_ccm_ctx); in crypto_ccm_create_common()
508 inst->alg.init = crypto_ccm_init_tfm; in crypto_ccm_create_common()
509 inst->alg.exit = crypto_ccm_exit_tfm; in crypto_ccm_create_common()
510 inst->alg.setkey = crypto_ccm_setkey; in crypto_ccm_create_common()
511 inst->alg.setauthsize = crypto_ccm_setauthsize; in crypto_ccm_create_common()
512 inst->alg.encrypt = crypto_ccm_encrypt; in crypto_ccm_create_common()
513 inst->alg.decrypt = crypto_ccm_decrypt; in crypto_ccm_create_common()
515 inst->free = crypto_ccm_free; in crypto_ccm_create_common()
517 err = aead_register_instance(tmpl, inst); in crypto_ccm_create_common()
520 crypto_ccm_free(inst); in crypto_ccm_create_common()
664 struct aead_instance *inst = aead_alg_instance(tfm); in crypto_rfc4309_init_tfm() local
665 struct crypto_aead_spawn *spawn = aead_instance_ctx(inst); in crypto_rfc4309_init_tfm()
694 static void crypto_rfc4309_free(struct aead_instance *inst) in crypto_rfc4309_free() argument
696 crypto_drop_aead(aead_instance_ctx(inst)); in crypto_rfc4309_free()
697 kfree(inst); in crypto_rfc4309_free()
704 struct aead_instance *inst; in crypto_rfc4309_create() local
713 inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); in crypto_rfc4309_create()
714 if (!inst) in crypto_rfc4309_create()
717 spawn = aead_instance_ctx(inst); in crypto_rfc4309_create()
718 err = crypto_grab_aead(spawn, aead_crypto_instance(inst), in crypto_rfc4309_create()
736 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, in crypto_rfc4309_create()
739 snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in crypto_rfc4309_create()
744 inst->alg.base.cra_priority = alg->base.cra_priority; in crypto_rfc4309_create()
745 inst->alg.base.cra_blocksize = 1; in crypto_rfc4309_create()
746 inst->alg.base.cra_alignmask = alg->base.cra_alignmask; in crypto_rfc4309_create()
748 inst->alg.ivsize = 8; in crypto_rfc4309_create()
749 inst->alg.chunksize = crypto_aead_alg_chunksize(alg); in crypto_rfc4309_create()
750 inst->alg.maxauthsize = 16; in crypto_rfc4309_create()
752 inst->alg.base.cra_ctxsize = sizeof(struct crypto_rfc4309_ctx); in crypto_rfc4309_create()
754 inst->alg.init = crypto_rfc4309_init_tfm; in crypto_rfc4309_create()
755 inst->alg.exit = crypto_rfc4309_exit_tfm; in crypto_rfc4309_create()
757 inst->alg.setkey = crypto_rfc4309_setkey; in crypto_rfc4309_create()
758 inst->alg.setauthsize = crypto_rfc4309_setauthsize; in crypto_rfc4309_create()
759 inst->alg.encrypt = crypto_rfc4309_encrypt; in crypto_rfc4309_create()
760 inst->alg.decrypt = crypto_rfc4309_decrypt; in crypto_rfc4309_create()
762 inst->free = crypto_rfc4309_free; in crypto_rfc4309_create()
764 err = aead_register_instance(tmpl, inst); in crypto_rfc4309_create()
767 crypto_rfc4309_free(inst); in crypto_rfc4309_create()
828 struct crypto_instance *inst = (void *)tfm->__crt_alg; in cbcmac_init_tfm() local
829 struct crypto_cipher_spawn *spawn = crypto_instance_ctx(inst); in cbcmac_init_tfm()
849 struct shash_instance *inst; in cbcmac_create() local
859 inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); in cbcmac_create()
860 if (!inst) in cbcmac_create()
862 spawn = shash_instance_ctx(inst); in cbcmac_create()
864 err = crypto_grab_cipher(spawn, shash_crypto_instance(inst), in cbcmac_create()
870 err = crypto_inst_setname(shash_crypto_instance(inst), tmpl->name, alg); in cbcmac_create()
874 inst->alg.base.cra_priority = alg->cra_priority; in cbcmac_create()
875 inst->alg.base.cra_blocksize = alg->cra_blocksize; in cbcmac_create()
877 inst->alg.digestsize = alg->cra_blocksize; in cbcmac_create()
878 inst->alg.descsize = alg->cra_blocksize; in cbcmac_create()
880 inst->alg.base.cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY; in cbcmac_create()
881 inst->alg.base.cra_ctxsize = sizeof(struct cbcmac_tfm_ctx); in cbcmac_create()
882 inst->alg.base.cra_init = cbcmac_init_tfm; in cbcmac_create()
883 inst->alg.base.cra_exit = cbcmac_exit_tfm; in cbcmac_create()
885 inst->alg.init = crypto_cbcmac_digest_init; in cbcmac_create()
886 inst->alg.update = crypto_cbcmac_digest_update; in cbcmac_create()
887 inst->alg.finup = crypto_cbcmac_digest_finup; in cbcmac_create()
888 inst->alg.setkey = crypto_cbcmac_digest_setkey; in cbcmac_create()
890 inst->free = shash_free_singlespawn_instance; in cbcmac_create()
892 err = shash_register_instance(tmpl, inst); in cbcmac_create()
895 shash_free_singlespawn_instance(inst); in cbcmac_create()