summaryrefslogtreecommitdiffstats
path: root/crypto/tgr192.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2012-07-11 14:20:25 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2012-08-01 17:47:26 +0800
commita5e7a2dcfcf360f285db9edd479491b1e2207b4f (patch)
tree6580bcc10cc61aed07d3f91f6c75d9a4a173cc2b /crypto/tgr192.c
parent50fc3e8d2c9d1ee72c67b751e5ac5d76ebc5a12e (diff)
downloadop-kernel-dev-a5e7a2dcfcf360f285db9edd479491b1e2207b4f.zip
op-kernel-dev-a5e7a2dcfcf360f285db9edd479491b1e2207b4f.tar.gz
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/tgr192.c')
-rw-r--r--crypto/tgr192.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/crypto/tgr192.c b/crypto/tgr192.c
index cbca4f2..8740355 100644
--- a/crypto/tgr192.c
+++ b/crypto/tgr192.c
@@ -628,7 +628,7 @@ static int tgr128_final(struct shash_desc *desc, u8 * out)
return 0;
}
-static struct shash_alg tgr192 = {
+static struct shash_alg tgr_algs[3] = { {
.digestsize = TGR192_DIGEST_SIZE,
.init = tgr192_init,
.update = tgr192_update,
@@ -640,9 +640,7 @@ static struct shash_alg tgr192 = {
.cra_blocksize = TGR192_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
-};
-
-static struct shash_alg tgr160 = {
+}, {
.digestsize = TGR160_DIGEST_SIZE,
.init = tgr192_init,
.update = tgr192_update,
@@ -654,9 +652,7 @@ static struct shash_alg tgr160 = {
.cra_blocksize = TGR192_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
-};
-
-static struct shash_alg tgr128 = {
+}, {
.digestsize = TGR128_DIGEST_SIZE,
.init = tgr192_init,
.update = tgr192_update,
@@ -668,38 +664,16 @@ static struct shash_alg tgr128 = {
.cra_blocksize = TGR192_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
-};
+} };
static int __init tgr192_mod_init(void)
{
- int ret = 0;
-
- ret = crypto_register_shash(&tgr192);
-
- if (ret < 0) {
- goto out;
- }
-
- ret = crypto_register_shash(&tgr160);
- if (ret < 0) {
- crypto_unregister_shash(&tgr192);
- goto out;
- }
-
- ret = crypto_register_shash(&tgr128);
- if (ret < 0) {
- crypto_unregister_shash(&tgr192);
- crypto_unregister_shash(&tgr160);
- }
- out:
- return ret;
+ return crypto_register_shashes(tgr_algs, ARRAY_SIZE(tgr_algs));
}
static void __exit tgr192_mod_fini(void)
{
- crypto_unregister_shash(&tgr192);
- crypto_unregister_shash(&tgr160);
- crypto_unregister_shash(&tgr128);
+ crypto_unregister_shashes(tgr_algs, ARRAY_SIZE(tgr_algs));
}
MODULE_ALIAS("tgr160");
OpenPOWER on IntegriCloud