Lines Matching refs:alg
453 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_init_tfm() local
460 hash->init = alg->init; in crypto_ahash_init_tfm()
461 hash->update = alg->update; in crypto_ahash_init_tfm()
462 hash->final = alg->final; in crypto_ahash_init_tfm()
463 hash->finup = alg->finup ?: ahash_def_finup; in crypto_ahash_init_tfm()
464 hash->digest = alg->digest; in crypto_ahash_init_tfm()
465 hash->export = alg->export; in crypto_ahash_init_tfm()
466 hash->import = alg->import; in crypto_ahash_init_tfm()
468 if (alg->setkey) { in crypto_ahash_init_tfm()
469 hash->setkey = alg->setkey; in crypto_ahash_init_tfm()
470 if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) in crypto_ahash_init_tfm()
477 static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) in crypto_ahash_extsize() argument
479 if (alg->cra_type != &crypto_ahash_type) in crypto_ahash_extsize()
482 return crypto_alg_extsize(alg); in crypto_ahash_extsize()
486 static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_ahash_report() argument
492 rhash.blocksize = alg->cra_blocksize; in crypto_ahash_report()
493 rhash.digestsize = __crypto_hash_alg_common(alg)->digestsize; in crypto_ahash_report()
504 static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_ahash_report() argument
510 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
512 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) in crypto_ahash_show() argument
515 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? in crypto_ahash_show()
517 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_ahash_show()
519 __crypto_hash_alg_common(alg)->digestsize); in crypto_ahash_show()
549 static int ahash_prepare_alg(struct ahash_alg *alg) in ahash_prepare_alg() argument
551 struct crypto_alg *base = &alg->halg.base; in ahash_prepare_alg()
553 if (alg->halg.digestsize > PAGE_SIZE / 8 || in ahash_prepare_alg()
554 alg->halg.statesize > PAGE_SIZE / 8 || in ahash_prepare_alg()
555 alg->halg.statesize == 0) in ahash_prepare_alg()
565 int crypto_register_ahash(struct ahash_alg *alg) in crypto_register_ahash() argument
567 struct crypto_alg *base = &alg->halg.base; in crypto_register_ahash()
570 err = ahash_prepare_alg(alg); in crypto_register_ahash()
578 int crypto_unregister_ahash(struct ahash_alg *alg) in crypto_unregister_ahash() argument
580 return crypto_unregister_alg(&alg->halg.base); in crypto_unregister_ahash()
618 err = ahash_prepare_alg(&inst->alg); in ahash_register_instance()
634 struct hash_alg_common *alg, in crypto_init_ahash_spawn() argument
637 return crypto_init_spawn2(&spawn->base, &alg->base, inst, in crypto_init_ahash_spawn()
644 struct crypto_alg *alg; in ahash_attr_alg() local
646 alg = crypto_attr_alg2(rta, &crypto_ahash_type, type, mask); in ahash_attr_alg()
647 return IS_ERR(alg) ? ERR_CAST(alg) : __crypto_hash_alg_common(alg); in ahash_attr_alg()
653 struct crypto_alg *alg = &halg->base; in crypto_hash_alg_has_setkey() local
655 if (alg->cra_type != &crypto_ahash_type) in crypto_hash_alg_has_setkey()
656 return crypto_shash_alg_has_setkey(__crypto_shash_alg(alg)); in crypto_hash_alg_has_setkey()
658 return __crypto_ahash_alg(alg)->setkey != NULL; in crypto_hash_alg_has_setkey()