diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:28:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:28:48 -0400 |
commit | 7c2aed4b5632fb536721b8494d1a4a65852ffb49 (patch) | |
tree | be004109d370b0266c4d2dcd38bb1151865bdada /crypto/api.c | |
parent | adfefb551517a0d0d1645e94f464817b8fb1a07f (diff) | |
parent | 43518407d57f1b685f5a9f1a981734ce66a21f76 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
[CRYPTO] api: Select cryptomgr where needed
[CRYPTO] api: fix crypto_alloc_base() return value
Diffstat (limited to 'crypto/api.c')
-rw-r--r-- | crypto/api.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crypto/api.c b/crypto/api.c index 2e84d4b54790..4fb7fa45cb0d 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -331,7 +331,7 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags) | |||
331 | tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags); | 331 | tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags); |
332 | tfm = kzalloc(tfm_size, GFP_KERNEL); | 332 | tfm = kzalloc(tfm_size, GFP_KERNEL); |
333 | if (tfm == NULL) | 333 | if (tfm == NULL) |
334 | goto out; | 334 | goto out_err; |
335 | 335 | ||
336 | tfm->__crt_alg = alg; | 336 | tfm->__crt_alg = alg; |
337 | 337 | ||
@@ -355,6 +355,7 @@ cra_init_failed: | |||
355 | crypto_exit_ops(tfm); | 355 | crypto_exit_ops(tfm); |
356 | out_free_tfm: | 356 | out_free_tfm: |
357 | kfree(tfm); | 357 | kfree(tfm); |
358 | out_err: | ||
358 | tfm = ERR_PTR(err); | 359 | tfm = ERR_PTR(err); |
359 | out: | 360 | out: |
360 | return tfm; | 361 | return tfm; |
@@ -414,14 +415,14 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask) | |||
414 | struct crypto_alg *alg; | 415 | struct crypto_alg *alg; |
415 | 416 | ||
416 | alg = crypto_alg_mod_lookup(alg_name, type, mask); | 417 | alg = crypto_alg_mod_lookup(alg_name, type, mask); |
417 | err = PTR_ERR(alg); | 418 | if (IS_ERR(alg)) { |
418 | tfm = ERR_PTR(err); | 419 | err = PTR_ERR(alg); |
419 | if (IS_ERR(alg)) | ||
420 | goto err; | 420 | goto err; |
421 | } | ||
421 | 422 | ||
422 | tfm = __crypto_alloc_tfm(alg, 0); | 423 | tfm = __crypto_alloc_tfm(alg, 0); |
423 | if (!IS_ERR(tfm)) | 424 | if (!IS_ERR(tfm)) |
424 | break; | 425 | return tfm; |
425 | 426 | ||
426 | crypto_mod_put(alg); | 427 | crypto_mod_put(alg); |
427 | err = PTR_ERR(tfm); | 428 | err = PTR_ERR(tfm); |
@@ -433,9 +434,9 @@ err: | |||
433 | err = -EINTR; | 434 | err = -EINTR; |
434 | break; | 435 | break; |
435 | } | 436 | } |
436 | }; | 437 | } |
437 | 438 | ||
438 | return tfm; | 439 | return ERR_PTR(err); |
439 | } | 440 | } |
440 | EXPORT_SYMBOL_GPL(crypto_alloc_base); | 441 | EXPORT_SYMBOL_GPL(crypto_alloc_base); |
441 | 442 | ||