diff options
-rw-r--r-- | crypto/cryptd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index d14b22658d7a..ae5fa99d5d36 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
@@ -586,20 +586,24 @@ struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name, | |||
586 | u32 type, u32 mask) | 586 | u32 type, u32 mask) |
587 | { | 587 | { |
588 | char cryptd_alg_name[CRYPTO_MAX_ALG_NAME]; | 588 | char cryptd_alg_name[CRYPTO_MAX_ALG_NAME]; |
589 | struct crypto_ablkcipher *tfm; | 589 | struct crypto_tfm *tfm; |
590 | 590 | ||
591 | if (snprintf(cryptd_alg_name, CRYPTO_MAX_ALG_NAME, | 591 | if (snprintf(cryptd_alg_name, CRYPTO_MAX_ALG_NAME, |
592 | "cryptd(%s)", alg_name) >= CRYPTO_MAX_ALG_NAME) | 592 | "cryptd(%s)", alg_name) >= CRYPTO_MAX_ALG_NAME) |
593 | return ERR_PTR(-EINVAL); | 593 | return ERR_PTR(-EINVAL); |
594 | tfm = crypto_alloc_ablkcipher(cryptd_alg_name, type, mask); | 594 | type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); |
595 | type |= CRYPTO_ALG_TYPE_BLKCIPHER; | ||
596 | mask &= ~CRYPTO_ALG_TYPE_MASK; | ||
597 | mask |= (CRYPTO_ALG_GENIV | CRYPTO_ALG_TYPE_BLKCIPHER_MASK); | ||
598 | tfm = crypto_alloc_base(cryptd_alg_name, type, mask); | ||
595 | if (IS_ERR(tfm)) | 599 | if (IS_ERR(tfm)) |
596 | return ERR_CAST(tfm); | 600 | return ERR_CAST(tfm); |
597 | if (crypto_ablkcipher_tfm(tfm)->__crt_alg->cra_module != THIS_MODULE) { | 601 | if (tfm->__crt_alg->cra_module != THIS_MODULE) { |
598 | crypto_free_ablkcipher(tfm); | 602 | crypto_free_tfm(tfm); |
599 | return ERR_PTR(-EINVAL); | 603 | return ERR_PTR(-EINVAL); |
600 | } | 604 | } |
601 | 605 | ||
602 | return __cryptd_ablkcipher_cast(tfm); | 606 | return __cryptd_ablkcipher_cast(__crypto_ablkcipher_cast(tfm)); |
603 | } | 607 | } |
604 | EXPORT_SYMBOL_GPL(cryptd_alloc_ablkcipher); | 608 | EXPORT_SYMBOL_GPL(cryptd_alloc_ablkcipher); |
605 | 609 | ||