summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 10:28:48 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 10:28:48 -0700
commit7c2aed4b5632fb536721b8494d1a4a65852ffb49 (patch)
treebe004109d370b0266c4d2dcd38bb1151865bdada
parentadfefb551517a0d0d1645e94f464817b8fb1a07f (diff)
parent43518407d57f1b685f5a9f1a981734ce66a21f76 (diff)
downloadop-kernel-dev-7c2aed4b5632fb536721b8494d1a4a65852ffb49.zip
op-kernel-dev-7c2aed4b5632fb536721b8494d1a4a65852ffb49.tar.gz
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 1e2f39c..cbae839 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -27,7 +27,6 @@ config CRYPTO_HASH
config CRYPTO_MANAGER
tristate "Cryptographic algorithm manager"
select CRYPTO_ALGAPI
- default m
help
Create default cryptographic template instantiations such as
cbc(aes).
@@ -35,6 +34,7 @@ config CRYPTO_MANAGER
config CRYPTO_HMAC
tristate "HMAC support"
select CRYPTO_HASH
+ select CRYPTO_MANAGER
help
HMAC: Keyed-Hashing for Message Authentication (RFC2104).
This is required for IPSec.
@@ -131,6 +131,7 @@ config CRYPTO_TGR192
config CRYPTO_ECB
tristate "ECB support"
select CRYPTO_BLKCIPHER
+ select CRYPTO_MANAGER
default m
help
ECB: Electronic CodeBook mode
@@ -140,6 +141,7 @@ config CRYPTO_ECB
config CRYPTO_CBC
tristate "CBC support"
select CRYPTO_BLKCIPHER
+ select CRYPTO_MANAGER
default m
help
CBC: Cipher Block Chaining mode
diff --git a/crypto/api.c b/crypto/api.c
index 2e84d4b..4fb7fa4 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)
tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags);
tfm = kzalloc(tfm_size, GFP_KERNEL);
if (tfm == NULL)
- goto out;
+ goto out_err;
tfm->__crt_alg = alg;
@@ -355,6 +355,7 @@ cra_init_failed:
crypto_exit_ops(tfm);
out_free_tfm:
kfree(tfm);
+out_err:
tfm = ERR_PTR(err);
out:
return tfm;
@@ -414,14 +415,14 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
struct crypto_alg *alg;
alg = crypto_alg_mod_lookup(alg_name, type, mask);
- err = PTR_ERR(alg);
- tfm = ERR_PTR(err);
- if (IS_ERR(alg))
+ if (IS_ERR(alg)) {
+ err = PTR_ERR(alg);
goto err;
+ }
tfm = __crypto_alloc_tfm(alg, 0);
if (!IS_ERR(tfm))
- break;
+ return tfm;
crypto_mod_put(alg);
err = PTR_ERR(tfm);
@@ -433,9 +434,9 @@ err:
err = -EINTR;
break;
}
- };
+ }
- return tfm;
+ return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(crypto_alloc_base);
OpenPOWER on IntegriCloud