Commit 7c2aed4b authored by Linus Torvalds's avatar Linus Torvalds

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
parents adfefb55 43518407
...@@ -27,7 +27,6 @@ config CRYPTO_HASH ...@@ -27,7 +27,6 @@ config CRYPTO_HASH
config CRYPTO_MANAGER config CRYPTO_MANAGER
tristate "Cryptographic algorithm manager" tristate "Cryptographic algorithm manager"
select CRYPTO_ALGAPI select CRYPTO_ALGAPI
default m
help help
Create default cryptographic template instantiations such as Create default cryptographic template instantiations such as
cbc(aes). cbc(aes).
...@@ -35,6 +34,7 @@ config CRYPTO_MANAGER ...@@ -35,6 +34,7 @@ config CRYPTO_MANAGER
config CRYPTO_HMAC config CRYPTO_HMAC
tristate "HMAC support" tristate "HMAC support"
select CRYPTO_HASH select CRYPTO_HASH
select CRYPTO_MANAGER
help help
HMAC: Keyed-Hashing for Message Authentication (RFC2104). HMAC: Keyed-Hashing for Message Authentication (RFC2104).
This is required for IPSec. This is required for IPSec.
...@@ -131,6 +131,7 @@ config CRYPTO_TGR192 ...@@ -131,6 +131,7 @@ config CRYPTO_TGR192
config CRYPTO_ECB config CRYPTO_ECB
tristate "ECB support" tristate "ECB support"
select CRYPTO_BLKCIPHER select CRYPTO_BLKCIPHER
select CRYPTO_MANAGER
default m default m
help help
ECB: Electronic CodeBook mode ECB: Electronic CodeBook mode
...@@ -140,6 +141,7 @@ config CRYPTO_ECB ...@@ -140,6 +141,7 @@ config CRYPTO_ECB
config CRYPTO_CBC config CRYPTO_CBC
tristate "CBC support" tristate "CBC support"
select CRYPTO_BLKCIPHER select CRYPTO_BLKCIPHER
select CRYPTO_MANAGER
default m default m
help help
CBC: Cipher Block Chaining mode CBC: Cipher Block Chaining mode
......
...@@ -331,7 +331,7 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags) ...@@ -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_size = sizeof(*tfm) + crypto_ctxsize(alg, flags);
tfm = kzalloc(tfm_size, GFP_KERNEL); tfm = kzalloc(tfm_size, GFP_KERNEL);
if (tfm == NULL) if (tfm == NULL)
goto out; goto out_err;
tfm->__crt_alg = alg; tfm->__crt_alg = alg;
...@@ -355,6 +355,7 @@ cra_init_failed: ...@@ -355,6 +355,7 @@ cra_init_failed:
crypto_exit_ops(tfm); crypto_exit_ops(tfm);
out_free_tfm: out_free_tfm:
kfree(tfm); kfree(tfm);
out_err:
tfm = ERR_PTR(err); tfm = ERR_PTR(err);
out: out:
return tfm; return tfm;
...@@ -414,14 +415,14 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask) ...@@ -414,14 +415,14 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
struct crypto_alg *alg; struct crypto_alg *alg;
alg = crypto_alg_mod_lookup(alg_name, type, mask); alg = crypto_alg_mod_lookup(alg_name, type, mask);
if (IS_ERR(alg)) {
err = PTR_ERR(alg); err = PTR_ERR(alg);
tfm = ERR_PTR(err);
if (IS_ERR(alg))
goto err; goto err;
}
tfm = __crypto_alloc_tfm(alg, 0); tfm = __crypto_alloc_tfm(alg, 0);
if (!IS_ERR(tfm)) if (!IS_ERR(tfm))
break; return tfm;
crypto_mod_put(alg); crypto_mod_put(alg);
err = PTR_ERR(tfm); err = PTR_ERR(tfm);
...@@ -433,9 +434,9 @@ err: ...@@ -433,9 +434,9 @@ err:
err = -EINTR; err = -EINTR;
break; break;
} }
}; }
return tfm; return ERR_PTR(err);
} }
EXPORT_SYMBOL_GPL(crypto_alloc_base); EXPORT_SYMBOL_GPL(crypto_alloc_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment