提交 a5e7a2dc 编写于 作者: J Jussi Kivilinna 提交者: Herbert Xu

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: NJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 50fc3e8d
...@@ -628,7 +628,7 @@ static int tgr128_final(struct shash_desc *desc, u8 * out) ...@@ -628,7 +628,7 @@ static int tgr128_final(struct shash_desc *desc, u8 * out)
return 0; return 0;
} }
static struct shash_alg tgr192 = { static struct shash_alg tgr_algs[3] = { {
.digestsize = TGR192_DIGEST_SIZE, .digestsize = TGR192_DIGEST_SIZE,
.init = tgr192_init, .init = tgr192_init,
.update = tgr192_update, .update = tgr192_update,
...@@ -640,9 +640,7 @@ static struct shash_alg tgr192 = { ...@@ -640,9 +640,7 @@ static struct shash_alg tgr192 = {
.cra_blocksize = TGR192_BLOCK_SIZE, .cra_blocksize = TGR192_BLOCK_SIZE,
.cra_module = THIS_MODULE, .cra_module = THIS_MODULE,
} }
}; }, {
static struct shash_alg tgr160 = {
.digestsize = TGR160_DIGEST_SIZE, .digestsize = TGR160_DIGEST_SIZE,
.init = tgr192_init, .init = tgr192_init,
.update = tgr192_update, .update = tgr192_update,
...@@ -654,9 +652,7 @@ static struct shash_alg tgr160 = { ...@@ -654,9 +652,7 @@ static struct shash_alg tgr160 = {
.cra_blocksize = TGR192_BLOCK_SIZE, .cra_blocksize = TGR192_BLOCK_SIZE,
.cra_module = THIS_MODULE, .cra_module = THIS_MODULE,
} }
}; }, {
static struct shash_alg tgr128 = {
.digestsize = TGR128_DIGEST_SIZE, .digestsize = TGR128_DIGEST_SIZE,
.init = tgr192_init, .init = tgr192_init,
.update = tgr192_update, .update = tgr192_update,
...@@ -668,38 +664,16 @@ static struct shash_alg tgr128 = { ...@@ -668,38 +664,16 @@ static struct shash_alg tgr128 = {
.cra_blocksize = TGR192_BLOCK_SIZE, .cra_blocksize = TGR192_BLOCK_SIZE,
.cra_module = THIS_MODULE, .cra_module = THIS_MODULE,
} }
}; } };
static int __init tgr192_mod_init(void) static int __init tgr192_mod_init(void)
{ {
int ret = 0; return crypto_register_shashes(tgr_algs, ARRAY_SIZE(tgr_algs));
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;
} }
static void __exit tgr192_mod_fini(void) static void __exit tgr192_mod_fini(void)
{ {
crypto_unregister_shash(&tgr192); crypto_unregister_shashes(tgr_algs, ARRAY_SIZE(tgr_algs));
crypto_unregister_shash(&tgr160);
crypto_unregister_shash(&tgr128);
} }
MODULE_ALIAS("tgr160"); MODULE_ALIAS("tgr160");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册