aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/api.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-07 05:15:40 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-07 05:15:40 -0400
commit5e34437840d33554f69380584311743b39e8fbeb (patch)
treee081135619ee146af5efb9ee883afca950df5757 /crypto/api.c
parent77d05632baee21b1cef8730d7c06aa69601e4dca (diff)
parentd508afb437daee7cf07da085b635c44a4ebf9b38 (diff)
Merge branch 'linus' into core/softlockup
Conflicts: kernel/sysctl.c
Diffstat (limited to 'crypto/api.c')
-rw-r--r--crypto/api.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/crypto/api.c b/crypto/api.c
index efe77df6863f..314dab96840e 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
@@ -244,7 +255,7 @@ struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask)
244 struct crypto_alg *larval; 255 struct crypto_alg *larval;
245 int ok; 256 int ok;
246 257
247 if (!(mask & CRYPTO_ALG_TESTED)) { 258 if (!((type | mask) & CRYPTO_ALG_TESTED)) {
248 type |= CRYPTO_ALG_TESTED; 259 type |= CRYPTO_ALG_TESTED;
249 mask |= CRYPTO_ALG_TESTED; 260 mask |= CRYPTO_ALG_TESTED;
250 } 261 }
@@ -453,8 +464,8 @@ err:
453} 464}
454EXPORT_SYMBOL_GPL(crypto_alloc_base); 465EXPORT_SYMBOL_GPL(crypto_alloc_base);
455 466
456struct crypto_tfm *crypto_create_tfm(struct crypto_alg *alg, 467void *crypto_create_tfm(struct crypto_alg *alg,
457 const struct crypto_type *frontend) 468 const struct crypto_type *frontend)
458{ 469{
459 char *mem; 470 char *mem;
460 struct crypto_tfm *tfm = NULL; 471 struct crypto_tfm *tfm = NULL;
@@ -488,9 +499,9 @@ out_free_tfm:
488 crypto_shoot_alg(alg); 499 crypto_shoot_alg(alg);
489 kfree(mem); 500 kfree(mem);
490out_err: 501out_err:
491 tfm = ERR_PTR(err); 502 mem = ERR_PTR(err);
492out: 503out:
493 return tfm; 504 return mem;
494} 505}
495EXPORT_SYMBOL_GPL(crypto_create_tfm); 506EXPORT_SYMBOL_GPL(crypto_create_tfm);
496 507
@@ -514,12 +525,11 @@ EXPORT_SYMBOL_GPL(crypto_create_tfm);
514 * 525 *
515 * In case of error the return value is an error pointer. 526 * In case of error the return value is an error pointer.
516 */ 527 */
517struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, 528void *crypto_alloc_tfm(const char *alg_name,
518 const struct crypto_type *frontend, 529 const struct crypto_type *frontend, u32 type, u32 mask)
519 u32 type, u32 mask)
520{ 530{
521 struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask); 531 struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask);
522 struct crypto_tfm *tfm; 532 void *tfm;
523 int err; 533 int err;
524 534
525 type &= frontend->maskclear; 535 type &= frontend->maskclear;