diff options
Diffstat (limited to 'crypto/sha256_generic.c')
-rw-r--r-- | crypto/sha256_generic.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c index c48459ebf05b..c3ed4ec924e1 100644 --- a/crypto/sha256_generic.c +++ b/crypto/sha256_generic.c | |||
@@ -336,7 +336,7 @@ static int sha256_import(struct shash_desc *desc, const void *in) | |||
336 | return 0; | 336 | return 0; |
337 | } | 337 | } |
338 | 338 | ||
339 | static struct shash_alg sha256 = { | 339 | static struct shash_alg sha256_algs[2] = { { |
340 | .digestsize = SHA256_DIGEST_SIZE, | 340 | .digestsize = SHA256_DIGEST_SIZE, |
341 | .init = sha256_init, | 341 | .init = sha256_init, |
342 | .update = sha256_update, | 342 | .update = sha256_update, |
@@ -352,9 +352,7 @@ static struct shash_alg sha256 = { | |||
352 | .cra_blocksize = SHA256_BLOCK_SIZE, | 352 | .cra_blocksize = SHA256_BLOCK_SIZE, |
353 | .cra_module = THIS_MODULE, | 353 | .cra_module = THIS_MODULE, |
354 | } | 354 | } |
355 | }; | 355 | }, { |
356 | |||
357 | static struct shash_alg sha224 = { | ||
358 | .digestsize = SHA224_DIGEST_SIZE, | 356 | .digestsize = SHA224_DIGEST_SIZE, |
359 | .init = sha224_init, | 357 | .init = sha224_init, |
360 | .update = sha256_update, | 358 | .update = sha256_update, |
@@ -367,29 +365,16 @@ static struct shash_alg sha224 = { | |||
367 | .cra_blocksize = SHA224_BLOCK_SIZE, | 365 | .cra_blocksize = SHA224_BLOCK_SIZE, |
368 | .cra_module = THIS_MODULE, | 366 | .cra_module = THIS_MODULE, |
369 | } | 367 | } |
370 | }; | 368 | } }; |
371 | 369 | ||
372 | static int __init sha256_generic_mod_init(void) | 370 | static int __init sha256_generic_mod_init(void) |
373 | { | 371 | { |
374 | int ret = 0; | 372 | return crypto_register_shashes(sha256_algs, ARRAY_SIZE(sha256_algs)); |
375 | |||
376 | ret = crypto_register_shash(&sha224); | ||
377 | |||
378 | if (ret < 0) | ||
379 | return ret; | ||
380 | |||
381 | ret = crypto_register_shash(&sha256); | ||
382 | |||
383 | if (ret < 0) | ||
384 | crypto_unregister_shash(&sha224); | ||
385 | |||
386 | return ret; | ||
387 | } | 373 | } |
388 | 374 | ||
389 | static void __exit sha256_generic_mod_fini(void) | 375 | static void __exit sha256_generic_mod_fini(void) |
390 | { | 376 | { |
391 | crypto_unregister_shash(&sha224); | 377 | crypto_unregister_shashes(sha256_algs, ARRAY_SIZE(sha256_algs)); |
392 | crypto_unregister_shash(&sha256); | ||
393 | } | 378 | } |
394 | 379 | ||
395 | module_init(sha256_generic_mod_init); | 380 | module_init(sha256_generic_mod_init); |