diff options
| -rw-r--r-- | crypto/cryptd.c | 1 | ||||
| -rw-r--r-- | crypto/crypto_user_base.c | 3 | ||||
| -rw-r--r-- | lib/mpi/mpi-pow.c | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 1ce1bf6d3bab..5f76c6e222c6 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
| @@ -388,6 +388,7 @@ static void cryptd_skcipher_free(struct skcipher_instance *inst) | |||
| 388 | struct skcipherd_instance_ctx *ctx = skcipher_instance_ctx(inst); | 388 | struct skcipherd_instance_ctx *ctx = skcipher_instance_ctx(inst); |
| 389 | 389 | ||
| 390 | crypto_drop_skcipher(&ctx->spawn); | 390 | crypto_drop_skcipher(&ctx->spawn); |
| 391 | kfree(inst); | ||
| 391 | } | 392 | } |
| 392 | 393 | ||
| 393 | static int cryptd_create_skcipher(struct crypto_template *tmpl, | 394 | static int cryptd_create_skcipher(struct crypto_template *tmpl, |
diff --git a/crypto/crypto_user_base.c b/crypto/crypto_user_base.c index d5d5d155340b..c65e39005ce2 100644 --- a/crypto/crypto_user_base.c +++ b/crypto/crypto_user_base.c | |||
| @@ -44,6 +44,9 @@ struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) | |||
| 44 | list_for_each_entry(q, &crypto_alg_list, cra_list) { | 44 | list_for_each_entry(q, &crypto_alg_list, cra_list) { |
| 45 | int match = 0; | 45 | int match = 0; |
| 46 | 46 | ||
| 47 | if (crypto_is_larval(q)) | ||
| 48 | continue; | ||
| 49 | |||
| 47 | if ((q->cra_flags ^ p->cru_type) & p->cru_mask) | 50 | if ((q->cra_flags ^ p->cru_type) & p->cru_mask) |
| 48 | continue; | 51 | continue; |
| 49 | 52 | ||
diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c index 82b19e4f1189..2fd7a46d55ec 100644 --- a/lib/mpi/mpi-pow.c +++ b/lib/mpi/mpi-pow.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) | 24 | int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) |
| 25 | { | 25 | { |
| 26 | mpi_ptr_t mp_marker = NULL, bp_marker = NULL, ep_marker = NULL; | 26 | mpi_ptr_t mp_marker = NULL, bp_marker = NULL, ep_marker = NULL; |
| 27 | struct karatsuba_ctx karactx = {}; | ||
| 27 | mpi_ptr_t xp_marker = NULL; | 28 | mpi_ptr_t xp_marker = NULL; |
| 28 | mpi_ptr_t tspace = NULL; | 29 | mpi_ptr_t tspace = NULL; |
| 29 | mpi_ptr_t rp, ep, mp, bp; | 30 | mpi_ptr_t rp, ep, mp, bp; |
| @@ -150,13 +151,11 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) | |||
| 150 | int c; | 151 | int c; |
| 151 | mpi_limb_t e; | 152 | mpi_limb_t e; |
| 152 | mpi_limb_t carry_limb; | 153 | mpi_limb_t carry_limb; |
| 153 | struct karatsuba_ctx karactx; | ||
| 154 | 154 | ||
| 155 | xp = xp_marker = mpi_alloc_limb_space(2 * (msize + 1)); | 155 | xp = xp_marker = mpi_alloc_limb_space(2 * (msize + 1)); |
| 156 | if (!xp) | 156 | if (!xp) |
| 157 | goto enomem; | 157 | goto enomem; |
| 158 | 158 | ||
| 159 | memset(&karactx, 0, sizeof karactx); | ||
| 160 | negative_result = (ep[0] & 1) && base->sign; | 159 | negative_result = (ep[0] & 1) && base->sign; |
| 161 | 160 | ||
| 162 | i = esize - 1; | 161 | i = esize - 1; |
| @@ -281,8 +280,6 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) | |||
| 281 | if (mod_shift_cnt) | 280 | if (mod_shift_cnt) |
| 282 | mpihelp_rshift(rp, rp, rsize, mod_shift_cnt); | 281 | mpihelp_rshift(rp, rp, rsize, mod_shift_cnt); |
| 283 | MPN_NORMALIZE(rp, rsize); | 282 | MPN_NORMALIZE(rp, rsize); |
| 284 | |||
| 285 | mpihelp_release_karatsuba_ctx(&karactx); | ||
| 286 | } | 283 | } |
| 287 | 284 | ||
| 288 | if (negative_result && rsize) { | 285 | if (negative_result && rsize) { |
| @@ -299,6 +296,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) | |||
| 299 | leave: | 296 | leave: |
| 300 | rc = 0; | 297 | rc = 0; |
| 301 | enomem: | 298 | enomem: |
| 299 | mpihelp_release_karatsuba_ctx(&karactx); | ||
| 302 | if (assign_rp) | 300 | if (assign_rp) |
| 303 | mpi_assign_limb_space(res, rp, size); | 301 | mpi_assign_limb_space(res, rp, size); |
| 304 | if (mp_marker) | 302 | if (mp_marker) |
