Lines Matching refs: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()
703 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_exit_tfm() local
705 if (alg->exit_tfm) in crypto_ahash_exit_tfm()
706 alg->exit_tfm(hash); in crypto_ahash_exit_tfm()
717 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_init_tfm() local
721 crypto_ahash_set_statesize(hash, alg->halg.statesize); in crypto_ahash_init_tfm()
739 ahash_set_needkey(hash, alg); in crypto_ahash_init_tfm()
743 if (alg->init_tfm) in crypto_ahash_init_tfm()
744 err = alg->init_tfm(hash); in crypto_ahash_init_tfm()
764 if (alg->exit_tfm) in crypto_ahash_init_tfm()
765 alg->exit_tfm(hash); in crypto_ahash_init_tfm()
774 static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) in crypto_ahash_extsize() argument
776 if (alg->cra_type == &crypto_shash_type) in crypto_ahash_extsize()
779 return crypto_alg_extsize(alg); in crypto_ahash_extsize()
790 struct sk_buff *skb, struct crypto_alg *alg) in crypto_ahash_report() argument
798 rhash.blocksize = alg->cra_blocksize; in crypto_ahash_report()
799 rhash.digestsize = __crypto_hash_alg_common(alg)->digestsize; in crypto_ahash_report()
804 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
806 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) in crypto_ahash_show() argument
810 str_yes_no(alg->cra_flags & CRYPTO_ALG_ASYNC)); in crypto_ahash_show()
811 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_ahash_show()
813 __crypto_hash_alg_common(alg)->digestsize); in crypto_ahash_show()
857 struct crypto_alg *alg = &halg->base; in crypto_hash_alg_has_setkey() local
859 if (alg->cra_type == &crypto_shash_type) in crypto_hash_alg_has_setkey()
860 return crypto_shash_alg_has_setkey(__crypto_shash_alg(alg)); in crypto_hash_alg_has_setkey()
862 return __crypto_ahash_alg(alg)->setkey != ahash_nosetkey; in crypto_hash_alg_has_setkey()
872 struct ahash_alg *alg; in crypto_clone_ahash() local
916 alg = crypto_ahash_alg(hash); in crypto_clone_ahash()
917 if (!alg->clone_tfm) in crypto_clone_ahash()
920 err = alg->clone_tfm(nhash, hash); in crypto_clone_ahash()
946 static int ahash_prepare_alg(struct ahash_alg *alg) in ahash_prepare_alg() argument
948 struct crypto_alg *base = &alg->halg.base; in ahash_prepare_alg()
951 if (alg->halg.statesize == 0) in ahash_prepare_alg()
954 if (base->cra_reqsize && base->cra_reqsize < alg->halg.statesize) in ahash_prepare_alg()
965 err = hash_prepare_alg(&alg->halg); in ahash_prepare_alg()
977 if (!alg->setkey) in ahash_prepare_alg()
978 alg->setkey = ahash_nosetkey; in ahash_prepare_alg()
982 if (!alg->finup) in ahash_prepare_alg()
986 alg->halg.statesize += base->cra_blocksize + 1; in ahash_prepare_alg()
987 alg->export_core = alg->export; in ahash_prepare_alg()
988 alg->import_core = alg->import; in ahash_prepare_alg()
989 } else if (!alg->export_core || !alg->import_core) { in ahash_prepare_alg()
990 alg->export_core = ahash_default_export_core; in ahash_prepare_alg()
991 alg->import_core = ahash_default_import_core; in ahash_prepare_alg()
998 int crypto_register_ahash(struct ahash_alg *alg) in crypto_register_ahash() argument
1000 struct crypto_alg *base = &alg->halg.base; in crypto_register_ahash()
1003 err = ahash_prepare_alg(alg); in crypto_register_ahash()
1011 void crypto_unregister_ahash(struct ahash_alg *alg) in crypto_unregister_ahash() argument
1013 crypto_unregister_alg(&alg->halg.base); in crypto_unregister_ahash()
1054 err = ahash_prepare_alg(&inst->alg); in ahash_register_instance()