diff options
Diffstat (limited to 'crypto/shash.c')
-rw-r--r-- | crypto/shash.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/crypto/shash.c b/crypto/shash.c index d5a2b619c55f..7a659733f94a 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
@@ -18,15 +18,10 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | 20 | ||
21 | static const struct crypto_type crypto_shash_type; | ||
22 | |||
23 | static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm) | ||
24 | { | ||
25 | return container_of(tfm, struct crypto_shash, base); | ||
26 | } | ||
27 | |||
28 | #include "internal.h" | 21 | #include "internal.h" |
29 | 22 | ||
23 | static const struct crypto_type crypto_shash_type; | ||
24 | |||
30 | static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, | 25 | static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, |
31 | unsigned int keylen) | 26 | unsigned int keylen) |
32 | { | 27 | { |
@@ -282,8 +277,7 @@ static int crypto_init_shash_ops_async(struct crypto_tfm *tfm) | |||
282 | if (!crypto_mod_get(calg)) | 277 | if (!crypto_mod_get(calg)) |
283 | return -EAGAIN; | 278 | return -EAGAIN; |
284 | 279 | ||
285 | shash = __crypto_shash_cast(crypto_create_tfm( | 280 | shash = crypto_create_tfm(calg, &crypto_shash_type); |
286 | calg, &crypto_shash_type)); | ||
287 | if (IS_ERR(shash)) { | 281 | if (IS_ERR(shash)) { |
288 | crypto_mod_put(calg); | 282 | crypto_mod_put(calg); |
289 | return PTR_ERR(shash); | 283 | return PTR_ERR(shash); |
@@ -391,8 +385,7 @@ static int crypto_init_shash_ops_compat(struct crypto_tfm *tfm) | |||
391 | if (!crypto_mod_get(calg)) | 385 | if (!crypto_mod_get(calg)) |
392 | return -EAGAIN; | 386 | return -EAGAIN; |
393 | 387 | ||
394 | shash = __crypto_shash_cast(crypto_create_tfm( | 388 | shash = crypto_create_tfm(calg, &crypto_shash_type); |
395 | calg, &crypto_shash_type)); | ||
396 | if (IS_ERR(shash)) { | 389 | if (IS_ERR(shash)) { |
397 | crypto_mod_put(calg); | 390 | crypto_mod_put(calg); |
398 | return PTR_ERR(shash); | 391 | return PTR_ERR(shash); |
@@ -442,8 +435,6 @@ static unsigned int crypto_shash_ctxsize(struct crypto_alg *alg, u32 type, | |||
442 | static int crypto_shash_init_tfm(struct crypto_tfm *tfm, | 435 | static int crypto_shash_init_tfm(struct crypto_tfm *tfm, |
443 | const struct crypto_type *frontend) | 436 | const struct crypto_type *frontend) |
444 | { | 437 | { |
445 | if (frontend->type != CRYPTO_ALG_TYPE_SHASH) | ||
446 | return -EINVAL; | ||
447 | return 0; | 438 | return 0; |
448 | } | 439 | } |
449 | 440 | ||
@@ -482,8 +473,7 @@ static const struct crypto_type crypto_shash_type = { | |||
482 | struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type, | 473 | struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type, |
483 | u32 mask) | 474 | u32 mask) |
484 | { | 475 | { |
485 | return __crypto_shash_cast( | 476 | return crypto_alloc_tfm(alg_name, &crypto_shash_type, type, mask); |
486 | crypto_alloc_tfm(alg_name, &crypto_shash_type, type, mask)); | ||
487 | } | 477 | } |
488 | EXPORT_SYMBOL_GPL(crypto_alloc_shash); | 478 | EXPORT_SYMBOL_GPL(crypto_alloc_shash); |
489 | 479 | ||