Lines Matching refs:alg
344 static unsigned int crypto_ablkcipher_ctxsize(struct crypto_alg *alg, u32 type, in crypto_ablkcipher_ctxsize() argument
347 return alg->cra_ctxsize; in crypto_ablkcipher_ctxsize()
363 struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher; in crypto_init_ablkcipher_ops() local
366 if (alg->ivsize > PAGE_SIZE / 8) in crypto_init_ablkcipher_ops()
370 crt->encrypt = alg->encrypt; in crypto_init_ablkcipher_ops()
371 crt->decrypt = alg->decrypt; in crypto_init_ablkcipher_ops()
372 if (!alg->ivsize) { in crypto_init_ablkcipher_ops()
377 crt->ivsize = alg->ivsize; in crypto_init_ablkcipher_ops()
383 static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_ablkcipher_report() argument
388 strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>", in crypto_ablkcipher_report()
391 rblkcipher.blocksize = alg->cra_blocksize; in crypto_ablkcipher_report()
392 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; in crypto_ablkcipher_report()
393 rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize; in crypto_ablkcipher_report()
394 rblkcipher.ivsize = alg->cra_ablkcipher.ivsize; in crypto_ablkcipher_report()
405 static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_ablkcipher_report() argument
411 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
413 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) in crypto_ablkcipher_show() argument
415 struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; in crypto_ablkcipher_show()
418 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? in crypto_ablkcipher_show()
420 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_ablkcipher_show()
445 struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher; in crypto_init_givcipher_ops() local
448 if (alg->ivsize > PAGE_SIZE / 8) in crypto_init_givcipher_ops()
452 alg->setkey : setkey; in crypto_init_givcipher_ops()
453 crt->encrypt = alg->encrypt; in crypto_init_givcipher_ops()
454 crt->decrypt = alg->decrypt; in crypto_init_givcipher_ops()
455 crt->givencrypt = alg->givencrypt; in crypto_init_givcipher_ops()
456 crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt; in crypto_init_givcipher_ops()
458 crt->ivsize = alg->ivsize; in crypto_init_givcipher_ops()
464 static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_givcipher_report() argument
469 strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>", in crypto_givcipher_report()
472 rblkcipher.blocksize = alg->cra_blocksize; in crypto_givcipher_report()
473 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; in crypto_givcipher_report()
474 rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize; in crypto_givcipher_report()
475 rblkcipher.ivsize = alg->cra_ablkcipher.ivsize; in crypto_givcipher_report()
486 static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_givcipher_report() argument
492 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
494 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) in crypto_givcipher_show() argument
496 struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; in crypto_givcipher_show()
499 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? in crypto_givcipher_show()
501 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); in crypto_givcipher_show()
518 const char *crypto_default_geniv(const struct crypto_alg *alg) in crypto_default_geniv() argument
520 if (((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_default_geniv()
521 CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : in crypto_default_geniv()
522 alg->cra_ablkcipher.ivsize) != in crypto_default_geniv()
523 alg->cra_blocksize) in crypto_default_geniv()
529 static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask) in crypto_givcipher_default() argument
546 larval = crypto_larval_lookup(alg->cra_driver_name, in crypto_givcipher_default()
568 memcpy(palg.data.name, alg->cra_driver_name, CRYPTO_MAX_ALG_NAME); in crypto_givcipher_default()
573 if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_givcipher_default()
575 geniv = alg->cra_blkcipher.geniv; in crypto_givcipher_default()
577 geniv = alg->cra_ablkcipher.geniv; in crypto_givcipher_default()
580 geniv = crypto_default_geniv(alg); in crypto_givcipher_default()
607 crypto_mod_put(alg); in crypto_givcipher_default()
613 struct crypto_alg *alg; in crypto_lookup_skcipher() local
615 alg = crypto_alg_mod_lookup(name, type, mask); in crypto_lookup_skcipher()
616 if (IS_ERR(alg)) in crypto_lookup_skcipher()
617 return alg; in crypto_lookup_skcipher()
619 if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
621 return alg; in crypto_lookup_skcipher()
623 if (!((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
624 CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : in crypto_lookup_skcipher()
625 alg->cra_ablkcipher.ivsize)) in crypto_lookup_skcipher()
626 return alg; in crypto_lookup_skcipher()
628 crypto_mod_put(alg); in crypto_lookup_skcipher()
629 alg = crypto_alg_mod_lookup(name, type | CRYPTO_ALG_TESTED, in crypto_lookup_skcipher()
631 if (IS_ERR(alg)) in crypto_lookup_skcipher()
632 return alg; in crypto_lookup_skcipher()
634 if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
636 if ((alg->cra_flags ^ type ^ ~mask) & CRYPTO_ALG_TESTED) { in crypto_lookup_skcipher()
637 crypto_mod_put(alg); in crypto_lookup_skcipher()
638 alg = ERR_PTR(-ENOENT); in crypto_lookup_skcipher()
640 return alg; in crypto_lookup_skcipher()
643 BUG_ON(!((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_lookup_skcipher()
644 CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : in crypto_lookup_skcipher()
645 alg->cra_ablkcipher.ivsize)); in crypto_lookup_skcipher()
647 return ERR_PTR(crypto_givcipher_default(alg, type, mask)); in crypto_lookup_skcipher()
654 struct crypto_alg *alg; in crypto_grab_skcipher() local
660 alg = crypto_lookup_skcipher(name, type, mask); in crypto_grab_skcipher()
661 if (IS_ERR(alg)) in crypto_grab_skcipher()
662 return PTR_ERR(alg); in crypto_grab_skcipher()
664 err = crypto_init_spawn(&spawn->base, alg, spawn->base.inst, mask); in crypto_grab_skcipher()
665 crypto_mod_put(alg); in crypto_grab_skcipher()
680 struct crypto_alg *alg; in crypto_alloc_ablkcipher() local
682 alg = crypto_lookup_skcipher(alg_name, type, mask); in crypto_alloc_ablkcipher()
683 if (IS_ERR(alg)) { in crypto_alloc_ablkcipher()
684 err = PTR_ERR(alg); in crypto_alloc_ablkcipher()
688 tfm = __crypto_alloc_tfm(alg, type, mask); in crypto_alloc_ablkcipher()
692 crypto_mod_put(alg); in crypto_alloc_ablkcipher()