aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/cryptd.c
diff options
context:
space:
mode:
authorHuang Ying <ying.huang@intel.com>2009-03-29 03:33:53 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-02 00:04:13 -0400
commit505fd21d6138545aa5e96aa738975e6a9deb98a9 (patch)
tree878db7596fb24e378d7a0f2f4a933ffb6b5b421d /crypto/cryptd.c
parent811d8f062668077e268a7292202bb923fe2ae896 (diff)
crypto: cryptd - Use nivcipher in cryptd_alloc_ablkcipher
Use crypto_alloc_base() instead of crypto_alloc_ablkcipher() to allocate underlying tfm in cryptd_alloc_ablkcipher. Because crypto_alloc_ablkcipher() prefer GENIV encapsulated crypto instead of raw one, while cryptd_alloc_ablkcipher needed the raw one. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/cryptd.c')
-rw-r--r--crypto/cryptd.c14
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}
604EXPORT_SYMBOL_GPL(cryptd_alloc_ablkcipher); 608EXPORT_SYMBOL_GPL(cryptd_alloc_ablkcipher);
605 609