diff options
| -rw-r--r-- | crypto/tgr192.c | 38 |
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 | ||
| 631 | static struct shash_alg tgr192 = { | 631 | static 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 | |||
| 645 | static 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 | |||
| 659 | static 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 | ||
| 673 | static int __init tgr192_mod_init(void) | 669 | static 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 | ||
| 698 | static void __exit tgr192_mod_fini(void) | 674 | static 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 | ||
| 705 | MODULE_ALIAS("tgr160"); | 679 | MODULE_ALIAS("tgr160"); |
