aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 13:28:48 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 13:28:48 -0400
commit7c2aed4b5632fb536721b8494d1a4a65852ffb49 (patch)
treebe004109d370b0266c4d2dcd38bb1151865bdada
parentadfefb551517a0d0d1645e94f464817b8fb1a07f (diff)
parent43518407d57f1b685f5a9f1a981734ce66a21f76 (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
-rw-r--r--crypto/Kconfig4
-rw-r--r--crypto/api.c15
2 files changed, 11 insertions, 8 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 1e2f39c21180..cbae8392ce11 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -27,7 +27,6 @@ config CRYPTO_HASH
27config CRYPTO_MANAGER 27config CRYPTO_MANAGER
28 tristate "Cryptographic algorithm manager" 28 tristate "Cryptographic algorithm manager"
29 select CRYPTO_ALGAPI 29 select CRYPTO_ALGAPI
30 default m
31 help 30 help
32 Create default cryptographic template instantiations such as 31 Create default cryptographic template instantiations such as
33 cbc(aes). 32 cbc(aes).
@@ -35,6 +34,7 @@ config CRYPTO_MANAGER
35config CRYPTO_HMAC 34config CRYPTO_HMAC
36 tristate "HMAC support" 35 tristate "HMAC support"
37 select CRYPTO_HASH 36 select CRYPTO_HASH
37 select CRYPTO_MANAGER
38 help 38 help
39 HMAC: Keyed-Hashing for Message Authentication (RFC2104). 39 HMAC: Keyed-Hashing for Message Authentication (RFC2104).
40 This is required for IPSec. 40 This is required for IPSec.
@@ -131,6 +131,7 @@ config CRYPTO_TGR192
131config CRYPTO_ECB 131config CRYPTO_ECB
132 tristate "ECB support" 132 tristate "ECB support"
133 select CRYPTO_BLKCIPHER 133 select CRYPTO_BLKCIPHER
134 select CRYPTO_MANAGER
134 default m 135 default m
135 help 136 help
136 ECB: Electronic CodeBook mode 137 ECB: Electronic CodeBook mode
@@ -140,6 +141,7 @@ config CRYPTO_ECB
140config CRYPTO_CBC 141config CRYPTO_CBC
141 tristate "CBC support" 142 tristate "CBC support"
142 select CRYPTO_BLKCIPHER 143 select CRYPTO_BLKCIPHER
144 select CRYPTO_MANAGER
143 default m 145 default m
144 help 146 help
145 CBC: Cipher Block Chaining mode 147 CBC: Cipher Block Chaining mode
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);
356out_free_tfm: 356out_free_tfm:
357 kfree(tfm); 357 kfree(tfm);
358out_err:
358 tfm = ERR_PTR(err); 359 tfm = ERR_PTR(err);
359out: 360out:
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}
440EXPORT_SYMBOL_GPL(crypto_alloc_base); 441EXPORT_SYMBOL_GPL(crypto_alloc_base);
441 442