diff options
author | James Morris <jmorris@namei.org> | 2009-03-23 19:52:46 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-03-23 19:52:46 -0400 |
commit | 703a3cd72817e99201cef84a8a7aecc60b2b3581 (patch) | |
tree | 3e943755178ff410694722bb031f523136fbc432 /crypto | |
parent | df7f54c012b92ec93d56b68547351dcdf8a163d3 (diff) | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) |
Merge branch 'master' into next
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ahash.c | 2 | ||||
-rw-r--r-- | crypto/algapi.c | 6 | ||||
-rw-r--r-- | crypto/api.c | 35 | ||||
-rw-r--r-- | crypto/lrw.c | 8 | ||||
-rw-r--r-- | crypto/scatterwalk.c | 3 | ||||
-rw-r--r-- | crypto/shash.c | 7 |
6 files changed, 44 insertions, 17 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..38a2bc02a98c 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -215,8 +215,19 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask) | |||
215 | mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD); | 215 | mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD); |
216 | type &= mask; | 216 | type &= mask; |
217 | 217 | ||
218 | alg = try_then_request_module(crypto_alg_lookup(name, type, mask), | 218 | alg = crypto_alg_lookup(name, type, mask); |
219 | name); | 219 | if (!alg) { |
220 | char tmp[CRYPTO_MAX_ALG_NAME]; | ||
221 | |||
222 | request_module(name); | ||
223 | |||
224 | if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask) && | ||
225 | snprintf(tmp, sizeof(tmp), "%s-all", name) < sizeof(tmp)) | ||
226 | request_module(tmp); | ||
227 | |||
228 | alg = crypto_alg_lookup(name, type, mask); | ||
229 | } | ||
230 | |||
220 | if (alg) | 231 | if (alg) |
221 | return crypto_is_larval(alg) ? crypto_larval_wait(alg) : alg; | 232 | return crypto_is_larval(alg) ? crypto_larval_wait(alg) : alg; |
222 | 233 | ||
@@ -557,34 +568,34 @@ err: | |||
557 | return ERR_PTR(err); | 568 | return ERR_PTR(err); |
558 | } | 569 | } |
559 | EXPORT_SYMBOL_GPL(crypto_alloc_tfm); | 570 | EXPORT_SYMBOL_GPL(crypto_alloc_tfm); |
560 | 571 | ||
561 | /* | 572 | /* |
562 | * crypto_free_tfm - Free crypto transform | 573 | * crypto_destroy_tfm - Free crypto transform |
574 | * @mem: Start of tfm slab | ||
563 | * @tfm: Transform to free | 575 | * @tfm: Transform to free |
564 | * | 576 | * |
565 | * crypto_free_tfm() frees up the transform and any associated resources, | 577 | * This function frees up the transform and any associated resources, |
566 | * then drops the refcount on the associated algorithm. | 578 | * then drops the refcount on the associated algorithm. |
567 | */ | 579 | */ |
568 | void crypto_free_tfm(struct crypto_tfm *tfm) | 580 | void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) |
569 | { | 581 | { |
570 | struct crypto_alg *alg; | 582 | struct crypto_alg *alg; |
571 | int size; | 583 | int size; |
572 | 584 | ||
573 | if (unlikely(!tfm)) | 585 | if (unlikely(!mem)) |
574 | return; | 586 | return; |
575 | 587 | ||
576 | alg = tfm->__crt_alg; | 588 | alg = tfm->__crt_alg; |
577 | size = sizeof(*tfm) + alg->cra_ctxsize; | 589 | size = ksize(mem); |
578 | 590 | ||
579 | if (!tfm->exit && alg->cra_exit) | 591 | if (!tfm->exit && alg->cra_exit) |
580 | alg->cra_exit(tfm); | 592 | alg->cra_exit(tfm); |
581 | crypto_exit_ops(tfm); | 593 | crypto_exit_ops(tfm); |
582 | crypto_mod_put(alg); | 594 | crypto_mod_put(alg); |
583 | memset(tfm, 0, size); | 595 | memset(mem, 0, size); |
584 | kfree(tfm); | 596 | kfree(mem); |
585 | } | 597 | } |
586 | 598 | EXPORT_SYMBOL_GPL(crypto_destroy_tfm); | |
587 | EXPORT_SYMBOL_GPL(crypto_free_tfm); | ||
588 | 599 | ||
589 | int crypto_has_alg(const char *name, u32 type, u32 mask) | 600 | int crypto_has_alg(const char *name, u32 type, u32 mask) |
590 | { | 601 | { |
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; |