Lines Matching refs:alg
346 static unsigned int crypto_ablkcipher_ctxsize(struct crypto_alg *alg, u32 type, in crypto_ablkcipher_ctxsize() argument
349 return alg->cra_ctxsize; in crypto_ablkcipher_ctxsize()
365 struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher; in crypto_init_ablkcipher_ops() local
368 if (alg->ivsize > PAGE_SIZE / 8) in crypto_init_ablkcipher_ops()
372 crt->encrypt = alg->encrypt; in crypto_init_ablkcipher_ops()
373 crt->decrypt = alg->decrypt; in crypto_init_ablkcipher_ops()
374 if (!alg->ivsize) { in crypto_init_ablkcipher_ops()
379 crt->ivsize = alg->ivsize; in crypto_init_ablkcipher_ops()
385 static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_ablkcipher_report() argument
390 strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>", in crypto_ablkcipher_report()
393 rblkcipher.blocksize = alg->cra_blocksize; in crypto_ablkcipher_report()
394 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; in crypto_ablkcipher_report()
395 rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize; in crypto_ablkcipher_report()
396 rblkcipher.ivsize = alg->cra_ablkcipher.ivsize; in crypto_ablkcipher_report()
407 static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_ablkcipher_report() argument
413 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
415 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) in crypto_ablkcipher_show() argument
417 struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; in crypto_ablkcipher_show()
420 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? in crypto_ablkcipher_show()
422 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_ablkcipher_show()
447 struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher; in crypto_init_givcipher_ops() local
450 if (alg->ivsize > PAGE_SIZE / 8) in crypto_init_givcipher_ops()
454 alg->setkey : setkey; in crypto_init_givcipher_ops()
455 crt->encrypt = alg->encrypt; in crypto_init_givcipher_ops()
456 crt->decrypt = alg->decrypt; in crypto_init_givcipher_ops()
457 crt->givencrypt = alg->givencrypt; in crypto_init_givcipher_ops()
458 crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt; in crypto_init_givcipher_ops()
460 crt->ivsize = alg->ivsize; in crypto_init_givcipher_ops()
466 static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_givcipher_report() argument
471 strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>", in crypto_givcipher_report()
474 rblkcipher.blocksize = alg->cra_blocksize; in crypto_givcipher_report()
475 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; in crypto_givcipher_report()
476 rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize; in crypto_givcipher_report()
477 rblkcipher.ivsize = alg->cra_ablkcipher.ivsize; in crypto_givcipher_report()
488 static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_givcipher_report() argument
494 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
496 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) in crypto_givcipher_show() argument
498 struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; in crypto_givcipher_show()
501 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? in crypto_givcipher_show()
503 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_givcipher_show()
520 const char *crypto_default_geniv(const struct crypto_alg *alg) in crypto_default_geniv() argument
522 if (((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_default_geniv()
523 CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : in crypto_default_geniv()
524 alg->cra_ablkcipher.ivsize) != in crypto_default_geniv()
525 alg->cra_blocksize) in crypto_default_geniv()
531 static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask) in crypto_givcipher_default() argument
548 larval = crypto_larval_lookup(alg->cra_driver_name, in crypto_givcipher_default()
570 memcpy(palg.data.name, alg->cra_driver_name, CRYPTO_MAX_ALG_NAME); in crypto_givcipher_default()
575 if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_givcipher_default()
577 geniv = alg->cra_blkcipher.geniv; in crypto_givcipher_default()
579 geniv = alg->cra_ablkcipher.geniv; in crypto_givcipher_default()
582 geniv = crypto_default_geniv(alg); in crypto_givcipher_default()
610 crypto_mod_put(alg); in crypto_givcipher_default()
616 struct crypto_alg *alg; in crypto_lookup_skcipher() local
618 alg = crypto_alg_mod_lookup(name, type, mask); in crypto_lookup_skcipher()
619 if (IS_ERR(alg)) in crypto_lookup_skcipher()
620 return alg; in crypto_lookup_skcipher()
622 if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
624 return alg; in crypto_lookup_skcipher()
626 if (!((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
627 CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : in crypto_lookup_skcipher()
628 alg->cra_ablkcipher.ivsize)) in crypto_lookup_skcipher()
629 return alg; in crypto_lookup_skcipher()
631 crypto_mod_put(alg); in crypto_lookup_skcipher()
632 alg = crypto_alg_mod_lookup(name, type | CRYPTO_ALG_TESTED, in crypto_lookup_skcipher()
634 if (IS_ERR(alg)) in crypto_lookup_skcipher()
635 return alg; in crypto_lookup_skcipher()
637 if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
639 if ((alg->cra_flags ^ type ^ ~mask) & CRYPTO_ALG_TESTED) { in crypto_lookup_skcipher()
640 crypto_mod_put(alg); in crypto_lookup_skcipher()
641 alg = ERR_PTR(-ENOENT); in crypto_lookup_skcipher()
643 return alg; in crypto_lookup_skcipher()
646 BUG_ON(!((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
647 CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : in crypto_lookup_skcipher()
648 alg->cra_ablkcipher.ivsize)); in crypto_lookup_skcipher()
650 return ERR_PTR(crypto_givcipher_default(alg, type, mask)); in crypto_lookup_skcipher()
657 struct crypto_alg *alg; in crypto_grab_skcipher() local
663 alg = crypto_lookup_skcipher(name, type, mask); in crypto_grab_skcipher()
664 if (IS_ERR(alg)) in crypto_grab_skcipher()
665 return PTR_ERR(alg); in crypto_grab_skcipher()
667 err = crypto_init_spawn(&spawn->base, alg, spawn->base.inst, mask); in crypto_grab_skcipher()
668 crypto_mod_put(alg); in crypto_grab_skcipher()
683 struct crypto_alg *alg; in crypto_alloc_ablkcipher() local
685 alg = crypto_lookup_skcipher(alg_name, type, mask); in crypto_alloc_ablkcipher()
686 if (IS_ERR(alg)) { in crypto_alloc_ablkcipher()
687 err = PTR_ERR(alg); in crypto_alloc_ablkcipher()
691 tfm = __crypto_alloc_tfm(alg, type, mask); in crypto_alloc_ablkcipher()
695 crypto_mod_put(alg); in crypto_alloc_ablkcipher()