Lines Matching refs:alg
217 static void ahash_set_needkey(struct crypto_ahash *tfm, struct ahash_alg *alg) in ahash_set_needkey() argument
219 if (alg->setkey != ahash_nosetkey && in ahash_set_needkey()
220 !(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) in ahash_set_needkey()
239 struct ahash_alg *alg = crypto_ahash_alg(tfm); in crypto_ahash_setkey() local
242 err = alg->setkey(tfm, key, keylen); in crypto_ahash_setkey()
244 ahash_set_needkey(tfm, alg); in crypto_ahash_setkey()
465 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_exit_tfm() local
467 alg->exit_tfm(hash); in crypto_ahash_exit_tfm()
473 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_init_tfm() local
475 crypto_ahash_set_statesize(hash, alg->halg.statesize); in crypto_ahash_init_tfm()
480 ahash_set_needkey(hash, alg); in crypto_ahash_init_tfm()
482 if (alg->exit_tfm) in crypto_ahash_init_tfm()
485 return alg->init_tfm ? alg->init_tfm(hash) : 0; in crypto_ahash_init_tfm()
488 static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) in crypto_ahash_extsize() argument
490 if (alg->cra_type == &crypto_shash_type) in crypto_ahash_extsize()
493 return crypto_alg_extsize(alg); in crypto_ahash_extsize()
504 struct sk_buff *skb, struct crypto_alg *alg) in crypto_ahash_report() argument
512 rhash.blocksize = alg->cra_blocksize; in crypto_ahash_report()
513 rhash.digestsize = __crypto_hash_alg_common(alg)->digestsize; in crypto_ahash_report()
518 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
520 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) in crypto_ahash_show() argument
523 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? in crypto_ahash_show()
525 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_ahash_show()
527 __crypto_hash_alg_common(alg)->digestsize); in crypto_ahash_show()
570 struct crypto_alg *alg = &halg->base; in crypto_hash_alg_has_setkey() local
572 if (alg->cra_type == &crypto_shash_type) in crypto_hash_alg_has_setkey()
573 return crypto_shash_alg_has_setkey(__crypto_shash_alg(alg)); in crypto_hash_alg_has_setkey()
575 return __crypto_ahash_alg(alg)->setkey != ahash_nosetkey; in crypto_hash_alg_has_setkey()
583 struct ahash_alg *alg; in crypto_clone_ahash() local
617 alg = crypto_ahash_alg(hash); in crypto_clone_ahash()
618 if (!alg->clone_tfm) in crypto_clone_ahash()
621 err = alg->clone_tfm(nhash, hash); in crypto_clone_ahash()
633 static int ahash_prepare_alg(struct ahash_alg *alg) in ahash_prepare_alg() argument
635 struct crypto_alg *base = &alg->halg.base; in ahash_prepare_alg()
638 if (alg->halg.statesize == 0) in ahash_prepare_alg()
641 err = hash_prepare_alg(&alg->halg); in ahash_prepare_alg()
648 if (!alg->finup) in ahash_prepare_alg()
649 alg->finup = ahash_def_finup; in ahash_prepare_alg()
650 if (!alg->setkey) in ahash_prepare_alg()
651 alg->setkey = ahash_nosetkey; in ahash_prepare_alg()
656 int crypto_register_ahash(struct ahash_alg *alg) in crypto_register_ahash() argument
658 struct crypto_alg *base = &alg->halg.base; in crypto_register_ahash()
661 err = ahash_prepare_alg(alg); in crypto_register_ahash()
669 void crypto_unregister_ahash(struct ahash_alg *alg) in crypto_unregister_ahash() argument
671 crypto_unregister_alg(&alg->halg.base); in crypto_unregister_ahash()
712 err = ahash_prepare_alg(&inst->alg); in ahash_register_instance()