Lines Matching full:alg

283 static void ahash_set_needkey(struct crypto_ahash *tfm, struct ahash_alg *alg)  in ahash_set_needkey()  argument
285 if (alg->setkey != ahash_nosetkey && in ahash_set_needkey()
286 !(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) in ahash_set_needkey()
305 struct ahash_alg *alg = crypto_ahash_alg(tfm); in crypto_ahash_setkey() local
308 err = alg->setkey(tfm, key, keylen); in crypto_ahash_setkey()
313 ahash_set_needkey(tfm, alg); in crypto_ahash_setkey()
689 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_exit_tfm() local
691 if (alg->exit_tfm) in crypto_ahash_exit_tfm()
692 alg->exit_tfm(hash); in crypto_ahash_exit_tfm()
703 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_init_tfm() local
707 crypto_ahash_set_statesize(hash, alg->halg.statesize); in crypto_ahash_init_tfm()
725 ahash_set_needkey(hash, alg); in crypto_ahash_init_tfm()
729 if (alg->init_tfm) in crypto_ahash_init_tfm()
730 err = alg->init_tfm(hash); in crypto_ahash_init_tfm()
750 if (alg->exit_tfm) in crypto_ahash_init_tfm()
751 alg->exit_tfm(hash); in crypto_ahash_init_tfm()
760 static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) in crypto_ahash_extsize() argument
762 if (alg->cra_type == &crypto_shash_type) in crypto_ahash_extsize()
765 return crypto_alg_extsize(alg); in crypto_ahash_extsize()
776 struct sk_buff *skb, struct crypto_alg *alg) in crypto_ahash_report() argument
784 rhash.blocksize = alg->cra_blocksize; in crypto_ahash_report()
785 rhash.digestsize = __crypto_hash_alg_common(alg)->digestsize; in crypto_ahash_report()
790 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
792 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) in crypto_ahash_show() argument
796 str_yes_no(alg->cra_flags & CRYPTO_ALG_ASYNC)); in crypto_ahash_show()
797 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_ahash_show()
799 __crypto_hash_alg_common(alg)->digestsize); in crypto_ahash_show()
843 struct crypto_alg *alg = &halg->base; in crypto_hash_alg_has_setkey() local
845 if (alg->cra_type == &crypto_shash_type) in crypto_hash_alg_has_setkey()
846 return crypto_shash_alg_has_setkey(__crypto_shash_alg(alg)); in crypto_hash_alg_has_setkey()
848 return __crypto_ahash_alg(alg)->setkey != ahash_nosetkey; in crypto_hash_alg_has_setkey()
858 struct ahash_alg *alg; in crypto_clone_ahash() local
902 alg = crypto_ahash_alg(hash); in crypto_clone_ahash()
903 if (!alg->clone_tfm) in crypto_clone_ahash()
906 err = alg->clone_tfm(nhash, hash); in crypto_clone_ahash()
932 static int ahash_prepare_alg(struct ahash_alg *alg) in ahash_prepare_alg() argument
934 struct crypto_alg *base = &alg->halg.base; in ahash_prepare_alg()
937 if (alg->halg.statesize == 0) in ahash_prepare_alg()
940 if (base->cra_reqsize && base->cra_reqsize < alg->halg.statesize) in ahash_prepare_alg()
951 err = hash_prepare_alg(&alg->halg); in ahash_prepare_alg()
963 if (!alg->setkey) in ahash_prepare_alg()
964 alg->setkey = ahash_nosetkey; in ahash_prepare_alg()
968 if (!alg->finup) in ahash_prepare_alg()
972 alg->halg.statesize += base->cra_blocksize + 1; in ahash_prepare_alg()
973 alg->export_core = alg->export; in ahash_prepare_alg()
974 alg->import_core = alg->import; in ahash_prepare_alg()
975 } else if (!alg->export_core || !alg->import_core) { in ahash_prepare_alg()
976 alg->export_core = ahash_default_export_core; in ahash_prepare_alg()
977 alg->import_core = ahash_default_import_core; in ahash_prepare_alg()
984 int crypto_register_ahash(struct ahash_alg *alg) in crypto_register_ahash() argument
986 struct crypto_alg *base = &alg->halg.base; in crypto_register_ahash()
989 err = ahash_prepare_alg(alg); in crypto_register_ahash()
997 void crypto_unregister_ahash(struct ahash_alg *alg) in crypto_unregister_ahash() argument
999 crypto_unregister_alg(&alg->halg.base); in crypto_unregister_ahash()
1040 err = ahash_prepare_alg(&inst->alg); in ahash_register_instance()