diff options
Diffstat (limited to 'crypto/api.c')
-rw-r--r-- | crypto/api.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/crypto/api.c b/crypto/api.c index 314dab96840e..d5944f92b416 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -217,13 +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 | 221 | ||
222 | request_module(name); | 222 | if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask & |
223 | 223 | CRYPTO_ALG_NEED_FALLBACK)) | |
224 | if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask) && | 224 | request_module("%s-all", name); |
225 | snprintf(tmp, sizeof(tmp), "%s-all", name) < sizeof(tmp)) | ||
226 | request_module(tmp); | ||
227 | 225 | ||
228 | alg = crypto_alg_lookup(name, type, mask); | 226 | alg = crypto_alg_lookup(name, type, mask); |
229 | } | 227 | } |
@@ -579,20 +577,17 @@ EXPORT_SYMBOL_GPL(crypto_alloc_tfm); | |||
579 | void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) | 577 | void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) |
580 | { | 578 | { |
581 | struct crypto_alg *alg; | 579 | struct crypto_alg *alg; |
582 | int size; | ||
583 | 580 | ||
584 | if (unlikely(!mem)) | 581 | if (unlikely(!mem)) |
585 | return; | 582 | return; |
586 | 583 | ||
587 | alg = tfm->__crt_alg; | 584 | alg = tfm->__crt_alg; |
588 | size = ksize(mem); | ||
589 | 585 | ||
590 | if (!tfm->exit && alg->cra_exit) | 586 | if (!tfm->exit && alg->cra_exit) |
591 | alg->cra_exit(tfm); | 587 | alg->cra_exit(tfm); |
592 | crypto_exit_ops(tfm); | 588 | crypto_exit_ops(tfm); |
593 | crypto_mod_put(alg); | 589 | crypto_mod_put(alg); |
594 | memset(mem, 0, size); | 590 | kzfree(mem); |
595 | kfree(mem); | ||
596 | } | 591 | } |
597 | EXPORT_SYMBOL_GPL(crypto_destroy_tfm); | 592 | EXPORT_SYMBOL_GPL(crypto_destroy_tfm); |
598 | 593 | ||