diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ahash.c | 2 | ||||
-rw-r--r-- | crypto/algapi.c | 6 | ||||
-rw-r--r-- | crypto/api.c | 20 | ||||
-rw-r--r-- | crypto/lrw.c | 8 | ||||
-rw-r--r-- | crypto/scatterwalk.c | 3 | ||||
-rw-r--r-- | crypto/shash.c | 7 |
6 files changed, 31 insertions, 15 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c index ba5292d69ebd..b2d1ee32cfe8 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c | |||
@@ -214,7 +214,7 @@ static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) | |||
214 | seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? | 214 | seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? |
215 | "yes" : "no"); | 215 | "yes" : "no"); |
216 | seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); | 216 | seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); |
217 | seq_printf(m, "digestsize : %u\n", alg->cra_hash.digestsize); | 217 | seq_printf(m, "digestsize : %u\n", alg->cra_ahash.digestsize); |
218 | } | 218 | } |
219 | 219 | ||
220 | const struct crypto_type crypto_ahash_type = { | 220 | const struct crypto_type crypto_ahash_type = { |
diff --git a/crypto/algapi.c b/crypto/algapi.c index 7c41e7405c41..56c62e2858d5 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -149,6 +149,9 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) | |||
149 | if (q == alg) | 149 | if (q == alg) |
150 | goto err; | 150 | goto err; |
151 | 151 | ||
152 | if (crypto_is_moribund(q)) | ||
153 | continue; | ||
154 | |||
152 | if (crypto_is_larval(q)) { | 155 | if (crypto_is_larval(q)) { |
153 | if (!strcmp(alg->cra_driver_name, q->cra_driver_name)) | 156 | if (!strcmp(alg->cra_driver_name, q->cra_driver_name)) |
154 | goto err; | 157 | goto err; |
@@ -197,7 +200,7 @@ void crypto_alg_tested(const char *name, int err) | |||
197 | 200 | ||
198 | down_write(&crypto_alg_sem); | 201 | down_write(&crypto_alg_sem); |
199 | list_for_each_entry(q, &crypto_alg_list, cra_list) { | 202 | list_for_each_entry(q, &crypto_alg_list, cra_list) { |
200 | if (!crypto_is_larval(q)) | 203 | if (crypto_is_moribund(q) || !crypto_is_larval(q)) |
201 | continue; | 204 | continue; |
202 | 205 | ||
203 | test = (struct crypto_larval *)q; | 206 | test = (struct crypto_larval *)q; |
@@ -210,6 +213,7 @@ void crypto_alg_tested(const char *name, int err) | |||
210 | goto unlock; | 213 | goto unlock; |
211 | 214 | ||
212 | found: | 215 | found: |
216 | q->cra_flags |= CRYPTO_ALG_DEAD; | ||
213 | alg = test->adult; | 217 | alg = test->adult; |
214 | if (err || list_empty(&alg->cra_list)) | 218 | if (err || list_empty(&alg->cra_list)) |
215 | goto complete; | 219 | goto complete; |
diff --git a/crypto/api.c b/crypto/api.c index 9975a7bd246c..efe77df6863f 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -557,34 +557,34 @@ err: | |||
557 | return ERR_PTR(err); | 557 | return ERR_PTR(err); |
558 | } | 558 | } |
559 | EXPORT_SYMBOL_GPL(crypto_alloc_tfm); | 559 | EXPORT_SYMBOL_GPL(crypto_alloc_tfm); |
560 | 560 | ||
561 | /* | 561 | /* |
562 | * crypto_free_tfm - Free crypto transform | 562 | * crypto_destroy_tfm - Free crypto transform |
563 | * @mem: Start of tfm slab | ||
563 | * @tfm: Transform to free | 564 | * @tfm: Transform to free |
564 | * | 565 | * |
565 | * crypto_free_tfm() frees up the transform and any associated resources, | 566 | * This function frees up the transform and any associated resources, |
566 | * then drops the refcount on the associated algorithm. | 567 | * then drops the refcount on the associated algorithm. |
567 | */ | 568 | */ |
568 | void crypto_free_tfm(struct crypto_tfm *tfm) | 569 | void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) |
569 | { | 570 | { |
570 | struct crypto_alg *alg; | 571 | struct crypto_alg *alg; |
571 | int size; | 572 | int size; |
572 | 573 | ||
573 | if (unlikely(!tfm)) | 574 | if (unlikely(!mem)) |
574 | return; | 575 | return; |
575 | 576 | ||
576 | alg = tfm->__crt_alg; | 577 | alg = tfm->__crt_alg; |
577 | size = sizeof(*tfm) + alg->cra_ctxsize; | 578 | size = ksize(mem); |
578 | 579 | ||
579 | if (!tfm->exit && alg->cra_exit) | 580 | if (!tfm->exit && alg->cra_exit) |
580 | alg->cra_exit(tfm); | 581 | alg->cra_exit(tfm); |
581 | crypto_exit_ops(tfm); | 582 | crypto_exit_ops(tfm); |
582 | crypto_mod_put(alg); | 583 | crypto_mod_put(alg); |
583 | memset(tfm, 0, size); | 584 | memset(mem, 0, size); |
584 | kfree(tfm); | 585 | kfree(mem); |
585 | } | 586 | } |
586 | 587 | EXPORT_SYMBOL_GPL(crypto_destroy_tfm); | |
587 | EXPORT_SYMBOL_GPL(crypto_free_tfm); | ||
588 | 588 | ||
589 | int crypto_has_alg(const char *name, u32 type, u32 mask) | 589 | int crypto_has_alg(const char *name, u32 type, u32 mask) |
590 | { | 590 | { |
diff --git a/crypto/lrw.c b/crypto/lrw.c index 8ef664e3bcd9..358f80be2bf9 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
@@ -45,7 +45,13 @@ struct priv { | |||
45 | 45 | ||
46 | static inline void setbit128_bbe(void *b, int bit) | 46 | static inline void setbit128_bbe(void *b, int bit) |
47 | { | 47 | { |
48 | __set_bit(bit ^ 0x78, b); | 48 | __set_bit(bit ^ (0x80 - |
49 | #ifdef __BIG_ENDIAN | ||
50 | BITS_PER_LONG | ||
51 | #else | ||
52 | BITS_PER_BYTE | ||
53 | #endif | ||
54 | ), b); | ||
49 | } | 55 | } |
50 | 56 | ||
51 | static int setkey(struct crypto_tfm *parent, const u8 *key, | 57 | static int setkey(struct crypto_tfm *parent, const u8 *key, |
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index 9aeeb52004a5..3de89a424401 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c | |||
@@ -54,7 +54,8 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out, | |||
54 | struct page *page; | 54 | struct page *page; |
55 | 55 | ||
56 | page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT); | 56 | page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT); |
57 | flush_dcache_page(page); | 57 | if (!PageSlab(page)) |
58 | flush_dcache_page(page); | ||
58 | } | 59 | } |
59 | 60 | ||
60 | if (more) { | 61 | if (more) { |
diff --git a/crypto/shash.c b/crypto/shash.c index c9df367332ff..d5a2b619c55f 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
@@ -388,10 +388,15 @@ static int crypto_init_shash_ops_compat(struct crypto_tfm *tfm) | |||
388 | struct shash_desc *desc = crypto_tfm_ctx(tfm); | 388 | struct shash_desc *desc = crypto_tfm_ctx(tfm); |
389 | struct crypto_shash *shash; | 389 | struct crypto_shash *shash; |
390 | 390 | ||
391 | if (!crypto_mod_get(calg)) | ||
392 | return -EAGAIN; | ||
393 | |||
391 | shash = __crypto_shash_cast(crypto_create_tfm( | 394 | shash = __crypto_shash_cast(crypto_create_tfm( |
392 | calg, &crypto_shash_type)); | 395 | calg, &crypto_shash_type)); |
393 | if (IS_ERR(shash)) | 396 | if (IS_ERR(shash)) { |
397 | crypto_mod_put(calg); | ||
394 | return PTR_ERR(shash); | 398 | return PTR_ERR(shash); |
399 | } | ||
395 | 400 | ||
396 | desc->tfm = shash; | 401 | desc->tfm = shash; |
397 | tfm->exit = crypto_exit_shash_ops_compat; | 402 | tfm->exit = crypto_exit_shash_ops_compat; |