Lines Matching refs:alg
48 struct crypto_alg *alg) in __crypto_skcipher_alg() argument
50 return container_of(alg, struct skcipher_alg, base); in __crypto_skcipher_alg()
287 struct skcipher_alg *alg; in skcipher_walk_virt() local
291 alg = crypto_skcipher_alg(tfm); in skcipher_walk_virt()
312 if (alg->co.base.cra_type != &crypto_skcipher_type) in skcipher_walk_virt()
313 walk->stride = alg->co.chunksize; in skcipher_walk_virt()
315 walk->stride = alg->walksize; in skcipher_walk_virt()
438 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_encrypt() local
442 if (alg->co.base.cra_type != &crypto_skcipher_type) in crypto_skcipher_encrypt()
444 return alg->encrypt(req); in crypto_skcipher_encrypt()
451 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_decrypt() local
455 if (alg->co.base.cra_type != &crypto_skcipher_type) in crypto_skcipher_decrypt()
457 return alg->decrypt(req); in crypto_skcipher_decrypt()
500 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_export() local
502 if (alg->co.base.cra_type != &crypto_skcipher_type) in crypto_skcipher_export()
504 return alg->export(req, out); in crypto_skcipher_export()
511 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_import() local
513 if (alg->co.base.cra_type != &crypto_skcipher_type) in crypto_skcipher_import()
515 return alg->import(req, in); in crypto_skcipher_import()
522 struct skcipher_alg *alg = crypto_skcipher_alg(skcipher); in crypto_skcipher_exit_tfm() local
524 alg->exit(skcipher); in crypto_skcipher_exit_tfm()
530 struct skcipher_alg *alg = crypto_skcipher_alg(skcipher); in crypto_skcipher_init_tfm() local
546 if (alg->exit) in crypto_skcipher_init_tfm()
549 if (alg->init) in crypto_skcipher_init_tfm()
550 return alg->init(skcipher); in crypto_skcipher_init_tfm()
555 static unsigned int crypto_skcipher_extsize(struct crypto_alg *alg) in crypto_skcipher_extsize() argument
557 if (alg->cra_type != &crypto_skcipher_type) in crypto_skcipher_extsize()
560 return crypto_alg_extsize(alg); in crypto_skcipher_extsize()
571 static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg)
573 static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg) in crypto_skcipher_show() argument
575 struct skcipher_alg *skcipher = __crypto_skcipher_alg(alg); in crypto_skcipher_show()
579 str_yes_no(alg->cra_flags & CRYPTO_ALG_ASYNC)); in crypto_skcipher_show()
580 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_skcipher_show()
590 struct sk_buff *skb, struct crypto_alg *alg) in crypto_skcipher_report() argument
592 struct skcipher_alg *skcipher = __crypto_skcipher_alg(alg); in crypto_skcipher_report()
600 rblkcipher.blocksize = alg->cra_blocksize; in crypto_skcipher_report()
672 int skcipher_prepare_alg_common(struct skcipher_alg_common *alg) in skcipher_prepare_alg_common() argument
674 struct crypto_alg *base = &alg->base; in skcipher_prepare_alg_common()
676 if (alg->ivsize > PAGE_SIZE / 8 || alg->chunksize > PAGE_SIZE / 8 || in skcipher_prepare_alg_common()
677 alg->statesize > PAGE_SIZE / 2 || in skcipher_prepare_alg_common()
678 (alg->ivsize + alg->statesize) > PAGE_SIZE / 2) in skcipher_prepare_alg_common()
681 if (!alg->chunksize) in skcipher_prepare_alg_common()
682 alg->chunksize = base->cra_blocksize; in skcipher_prepare_alg_common()
689 static int skcipher_prepare_alg(struct skcipher_alg *alg) in skcipher_prepare_alg() argument
691 struct crypto_alg *base = &alg->base; in skcipher_prepare_alg()
694 err = skcipher_prepare_alg_common(&alg->co); in skcipher_prepare_alg()
698 if (alg->walksize > PAGE_SIZE / 8) in skcipher_prepare_alg()
701 if (!alg->walksize) in skcipher_prepare_alg()
702 alg->walksize = alg->chunksize; in skcipher_prepare_alg()
704 if (!alg->statesize) { in skcipher_prepare_alg()
705 alg->import = skcipher_noimport; in skcipher_prepare_alg()
706 alg->export = skcipher_noexport; in skcipher_prepare_alg()
707 } else if (!(alg->import && alg->export)) in skcipher_prepare_alg()
716 int crypto_register_skcipher(struct skcipher_alg *alg) in crypto_register_skcipher() argument
718 struct crypto_alg *base = &alg->base; in crypto_register_skcipher()
721 err = skcipher_prepare_alg(alg); in crypto_register_skcipher()
729 void crypto_unregister_skcipher(struct skcipher_alg *alg) in crypto_unregister_skcipher() argument
731 crypto_unregister_alg(&alg->base); in crypto_unregister_skcipher()
772 err = skcipher_prepare_alg(&inst->alg); in skcipher_register_instance()
867 inst->alg.base.cra_blocksize = cipher_alg->cra_blocksize; in skcipher_alloc_instance_simple()
868 inst->alg.base.cra_alignmask = cipher_alg->cra_alignmask; in skcipher_alloc_instance_simple()
869 inst->alg.base.cra_priority = cipher_alg->cra_priority; in skcipher_alloc_instance_simple()
870 inst->alg.min_keysize = cipher_alg->cra_cipher.cia_min_keysize; in skcipher_alloc_instance_simple()
871 inst->alg.max_keysize = cipher_alg->cra_cipher.cia_max_keysize; in skcipher_alloc_instance_simple()
872 inst->alg.ivsize = cipher_alg->cra_blocksize; in skcipher_alloc_instance_simple()
875 inst->alg.base.cra_ctxsize = sizeof(struct skcipher_ctx_simple); in skcipher_alloc_instance_simple()
876 inst->alg.setkey = skcipher_setkey_simple; in skcipher_alloc_instance_simple()
877 inst->alg.init = skcipher_init_tfm_simple; in skcipher_alloc_instance_simple()
878 inst->alg.exit = skcipher_exit_tfm_simple; in skcipher_alloc_instance_simple()