aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/api.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/api.c')
-rw-r--r--crypto/api.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/crypto/api.c b/crypto/api.c
index fd2545decb28..d5944f92b416 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -217,14 +217,11 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
217 217
218 alg = crypto_alg_lookup(name, type, mask); 218 alg = crypto_alg_lookup(name, type, mask);
219 if (!alg) { 219 if (!alg) {
220 char tmp[CRYPTO_MAX_ALG_NAME]; 220 request_module("%s", name);
221
222 request_module(name);
223 221
224 if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask & 222 if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
225 CRYPTO_ALG_NEED_FALLBACK) && 223 CRYPTO_ALG_NEED_FALLBACK))
226 snprintf(tmp, sizeof(tmp), "%s-all", name) < sizeof(tmp)) 224 request_module("%s-all", name);
227 request_module(tmp);
228 225
229 alg = crypto_alg_lookup(name, type, mask); 226 alg = crypto_alg_lookup(name, type, mask);
230 } 227 }
@@ -580,20 +577,17 @@ EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
580void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) 577void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
581{ 578{
582 struct crypto_alg *alg; 579 struct crypto_alg *alg;
583 int size;
584 580
585 if (unlikely(!mem)) 581 if (unlikely(!mem))
586 return; 582 return;
587 583
588 alg = tfm->__crt_alg; 584 alg = tfm->__crt_alg;
589 size = ksize(mem);
590 585
591 if (!tfm->exit && alg->cra_exit) 586 if (!tfm->exit && alg->cra_exit)
592 alg->cra_exit(tfm); 587 alg->cra_exit(tfm);
593 crypto_exit_ops(tfm); 588 crypto_exit_ops(tfm);
594 crypto_mod_put(alg); 589 crypto_mod_put(alg);
595 memset(mem, 0, size); 590 kzfree(mem);
596 kfree(mem);
597} 591}
598EXPORT_SYMBOL_GPL(crypto_destroy_tfm); 592EXPORT_SYMBOL_GPL(crypto_destroy_tfm);
599 593