aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2012-07-11 07:20:25 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-08-01 05:47:26 -0400
commita5e7a2dcfcf360f285db9edd479491b1e2207b4f (patch)
tree6580bcc10cc61aed07d3f91f6c75d9a4a173cc2b /crypto
parent50fc3e8d2c9d1ee72c67b751e5ac5d76ebc5a12e (diff)
crypto: tiger - use crypto_[un]register_shashes
Combine all shash algs to be registered and use new crypto_[un]register_shashes functions. This simplifies init/exit code. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tgr192.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/crypto/tgr192.c b/crypto/tgr192.c
index cbca4f208c9f..87403556fd0b 100644
--- a/crypto/tgr192.c
+++ b/crypto/tgr192.c
@@ -628,7 +628,7 @@ static int tgr128_final(struct shash_desc *desc, u8 * out)
628 return 0; 628 return 0;
629} 629}
630 630
631static struct shash_alg tgr192 = { 631static struct shash_alg tgr_algs[3] = { {
632 .digestsize = TGR192_DIGEST_SIZE, 632 .digestsize = TGR192_DIGEST_SIZE,
633 .init = tgr192_init, 633 .init = tgr192_init,
634 .update = tgr192_update, 634 .update = tgr192_update,
@@ -640,9 +640,7 @@ static struct shash_alg tgr192 = {
640 .cra_blocksize = TGR192_BLOCK_SIZE, 640 .cra_blocksize = TGR192_BLOCK_SIZE,
641 .cra_module = THIS_MODULE, 641 .cra_module = THIS_MODULE,
642 } 642 }
643}; 643}, {
644
645static struct shash_alg tgr160 = {
646 .digestsize = TGR160_DIGEST_SIZE, 644 .digestsize = TGR160_DIGEST_SIZE,
647 .init = tgr192_init, 645 .init = tgr192_init,
648 .update = tgr192_update, 646 .update = tgr192_update,
@@ -654,9 +652,7 @@ static struct shash_alg tgr160 = {
654 .cra_blocksize = TGR192_BLOCK_SIZE, 652 .cra_blocksize = TGR192_BLOCK_SIZE,
655 .cra_module = THIS_MODULE, 653 .cra_module = THIS_MODULE,
656 } 654 }
657}; 655}, {
658
659static struct shash_alg tgr128 = {
660 .digestsize = TGR128_DIGEST_SIZE, 656 .digestsize = TGR128_DIGEST_SIZE,
661 .init = tgr192_init, 657 .init = tgr192_init,
662 .update = tgr192_update, 658 .update = tgr192_update,
@@ -668,38 +664,16 @@ static struct shash_alg tgr128 = {
668 .cra_blocksize = TGR192_BLOCK_SIZE, 664 .cra_blocksize = TGR192_BLOCK_SIZE,
669 .cra_module = THIS_MODULE, 665 .cra_module = THIS_MODULE,
670 } 666 }
671}; 667} };
672 668
673static int __init tgr192_mod_init(void) 669static int __init tgr192_mod_init(void)
674{ 670{
675 int ret = 0; 671 return crypto_register_shashes(tgr_algs, ARRAY_SIZE(tgr_algs));
676
677 ret = crypto_register_shash(&tgr192);
678
679 if (ret < 0) {
680 goto out;
681 }
682
683 ret = crypto_register_shash(&tgr160);
684 if (ret < 0) {
685 crypto_unregister_shash(&tgr192);
686 goto out;
687 }
688
689 ret = crypto_register_shash(&tgr128);
690 if (ret < 0) {
691 crypto_unregister_shash(&tgr192);
692 crypto_unregister_shash(&tgr160);
693 }
694 out:
695 return ret;
696} 672}
697 673
698static void __exit tgr192_mod_fini(void) 674static void __exit tgr192_mod_fini(void)
699{ 675{
700 crypto_unregister_shash(&tgr192); 676 crypto_unregister_shashes(tgr_algs, ARRAY_SIZE(tgr_algs));
701 crypto_unregister_shash(&tgr160);
702 crypto_unregister_shash(&tgr128);
703} 677}
704 678
705MODULE_ALIAS("tgr160"); 679MODULE_ALIAS("tgr160");