Lines Matching refs:inst
188 struct crypto_instance *inst = crypto_tfm_alg_instance(tfm); in cryptd_get_queue() local
189 struct cryptd_instance_ctx *ictx = crypto_instance_ctx(inst); in cryptd_get_queue()
306 struct crypto_instance *inst = crypto_tfm_alg_instance(tfm); in cryptd_blkcipher_init_tfm() local
307 struct cryptd_instance_ctx *ictx = crypto_instance_ctx(inst); in cryptd_blkcipher_init_tfm()
329 static int cryptd_init_instance(struct crypto_instance *inst, in cryptd_init_instance() argument
332 if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, in cryptd_init_instance()
337 memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME); in cryptd_init_instance()
339 inst->alg.cra_priority = alg->cra_priority + 50; in cryptd_init_instance()
340 inst->alg.cra_blocksize = alg->cra_blocksize; in cryptd_init_instance()
341 inst->alg.cra_alignmask = alg->cra_alignmask; in cryptd_init_instance()
350 struct crypto_instance *inst; in cryptd_alloc_instance() local
353 p = kzalloc(head + sizeof(*inst) + tail, GFP_KERNEL); in cryptd_alloc_instance()
357 inst = (void *)(p + head); in cryptd_alloc_instance()
359 err = cryptd_init_instance(inst, alg); in cryptd_alloc_instance()
377 struct crypto_instance *inst; in cryptd_create_blkcipher() local
389 inst = cryptd_alloc_instance(alg, 0, sizeof(*ctx)); in cryptd_create_blkcipher()
390 err = PTR_ERR(inst); in cryptd_create_blkcipher()
391 if (IS_ERR(inst)) in cryptd_create_blkcipher()
394 ctx = crypto_instance_ctx(inst); in cryptd_create_blkcipher()
397 err = crypto_init_spawn(&ctx->spawn, alg, inst, in cryptd_create_blkcipher()
405 inst->alg.cra_flags = type; in cryptd_create_blkcipher()
406 inst->alg.cra_type = &crypto_ablkcipher_type; in cryptd_create_blkcipher()
408 inst->alg.cra_ablkcipher.ivsize = alg->cra_blkcipher.ivsize; in cryptd_create_blkcipher()
409 inst->alg.cra_ablkcipher.min_keysize = alg->cra_blkcipher.min_keysize; in cryptd_create_blkcipher()
410 inst->alg.cra_ablkcipher.max_keysize = alg->cra_blkcipher.max_keysize; in cryptd_create_blkcipher()
412 inst->alg.cra_ablkcipher.geniv = alg->cra_blkcipher.geniv; in cryptd_create_blkcipher()
414 inst->alg.cra_ctxsize = sizeof(struct cryptd_blkcipher_ctx); in cryptd_create_blkcipher()
416 inst->alg.cra_init = cryptd_blkcipher_init_tfm; in cryptd_create_blkcipher()
417 inst->alg.cra_exit = cryptd_blkcipher_exit_tfm; in cryptd_create_blkcipher()
419 inst->alg.cra_ablkcipher.setkey = cryptd_blkcipher_setkey; in cryptd_create_blkcipher()
420 inst->alg.cra_ablkcipher.encrypt = cryptd_blkcipher_encrypt_enqueue; in cryptd_create_blkcipher()
421 inst->alg.cra_ablkcipher.decrypt = cryptd_blkcipher_decrypt_enqueue; in cryptd_create_blkcipher()
423 err = crypto_register_instance(tmpl, inst); in cryptd_create_blkcipher()
427 kfree(inst); in cryptd_create_blkcipher()
437 struct crypto_instance *inst = crypto_tfm_alg_instance(tfm); in cryptd_hash_init_tfm() local
438 struct hashd_instance_ctx *ictx = crypto_instance_ctx(inst); in cryptd_hash_init_tfm()
648 struct ahash_instance *inst; in cryptd_create_hash() local
662 inst = cryptd_alloc_instance(alg, ahash_instance_headroom(), in cryptd_create_hash()
664 err = PTR_ERR(inst); in cryptd_create_hash()
665 if (IS_ERR(inst)) in cryptd_create_hash()
668 ctx = ahash_instance_ctx(inst); in cryptd_create_hash()
672 ahash_crypto_instance(inst)); in cryptd_create_hash()
676 inst->alg.halg.base.cra_flags = CRYPTO_ALG_ASYNC | in cryptd_create_hash()
680 inst->alg.halg.digestsize = salg->digestsize; in cryptd_create_hash()
681 inst->alg.halg.statesize = salg->statesize; in cryptd_create_hash()
682 inst->alg.halg.base.cra_ctxsize = sizeof(struct cryptd_hash_ctx); in cryptd_create_hash()
684 inst->alg.halg.base.cra_init = cryptd_hash_init_tfm; in cryptd_create_hash()
685 inst->alg.halg.base.cra_exit = cryptd_hash_exit_tfm; in cryptd_create_hash()
687 inst->alg.init = cryptd_hash_init_enqueue; in cryptd_create_hash()
688 inst->alg.update = cryptd_hash_update_enqueue; in cryptd_create_hash()
689 inst->alg.final = cryptd_hash_final_enqueue; in cryptd_create_hash()
690 inst->alg.finup = cryptd_hash_finup_enqueue; in cryptd_create_hash()
691 inst->alg.export = cryptd_hash_export; in cryptd_create_hash()
692 inst->alg.import = cryptd_hash_import; in cryptd_create_hash()
694 inst->alg.setkey = cryptd_hash_setkey; in cryptd_create_hash()
695 inst->alg.digest = cryptd_hash_digest_enqueue; in cryptd_create_hash()
697 err = ahash_register_instance(tmpl, inst); in cryptd_create_hash()
701 kfree(inst); in cryptd_create_hash()
804 struct aead_instance *inst = aead_alg_instance(tfm); in cryptd_aead_init_tfm() local
805 struct aead_instance_ctx *ictx = aead_instance_ctx(inst); in cryptd_aead_init_tfm()
832 struct aead_instance *inst; in cryptd_create_aead() local
845 inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); in cryptd_create_aead()
846 if (!inst) in cryptd_create_aead()
849 ctx = aead_instance_ctx(inst); in cryptd_create_aead()
852 crypto_set_aead_spawn(&ctx->aead_spawn, aead_crypto_instance(inst)); in cryptd_create_aead()
858 err = cryptd_init_instance(aead_crypto_instance(inst), &alg->base); in cryptd_create_aead()
862 inst->alg.base.cra_flags = CRYPTO_ALG_ASYNC | in cryptd_create_aead()
864 inst->alg.base.cra_ctxsize = sizeof(struct cryptd_aead_ctx); in cryptd_create_aead()
866 inst->alg.ivsize = crypto_aead_alg_ivsize(alg); in cryptd_create_aead()
867 inst->alg.maxauthsize = crypto_aead_alg_maxauthsize(alg); in cryptd_create_aead()
869 inst->alg.init = cryptd_aead_init_tfm; in cryptd_create_aead()
870 inst->alg.exit = cryptd_aead_exit_tfm; in cryptd_create_aead()
871 inst->alg.setkey = cryptd_aead_setkey; in cryptd_create_aead()
872 inst->alg.setauthsize = cryptd_aead_setauthsize; in cryptd_create_aead()
873 inst->alg.encrypt = cryptd_aead_encrypt_enqueue; in cryptd_create_aead()
874 inst->alg.decrypt = cryptd_aead_decrypt_enqueue; in cryptd_create_aead()
876 err = aead_register_instance(tmpl, inst); in cryptd_create_aead()
881 kfree(inst); in cryptd_create_aead()
908 static void cryptd_free(struct crypto_instance *inst) in cryptd_free() argument
910 struct cryptd_instance_ctx *ctx = crypto_instance_ctx(inst); in cryptd_free()
911 struct hashd_instance_ctx *hctx = crypto_instance_ctx(inst); in cryptd_free()
912 struct aead_instance_ctx *aead_ctx = crypto_instance_ctx(inst); in cryptd_free()
914 switch (inst->alg.cra_flags & CRYPTO_ALG_TYPE_MASK) { in cryptd_free()
917 kfree(ahash_instance(inst)); in cryptd_free()
921 kfree(aead_instance(inst)); in cryptd_free()
925 kfree(inst); in cryptd_free()