diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-02-08 15:25:18 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-08 15:25:18 -0800 |
commit | 9783e1df7a6bd1e4dc5e2cafcdc29b65a47473d6 (patch) | |
tree | 9216a285bfe23aa799ca6efa01a3f4063d798e64 /crypto/algapi.c | |
parent | 4387ff75f29412a234d394b0276c2b239d3d3844 (diff) | |
parent | dc2e2f33bbf07344995357314fd8887f6564dba7 (diff) | |
download | op-kernel-dev-9783e1df7a6bd1e4dc5e2cafcdc29b65a47473d6.zip op-kernel-dev-9783e1df7a6bd1e4dc5e2cafcdc29b65a47473d6.tar.gz |
Merge branch 'HEAD' of master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
Conflicts:
crypto/Kconfig
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r-- | crypto/algapi.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index c915300..f7d2185 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -377,7 +377,8 @@ void crypto_drop_spawn(struct crypto_spawn *spawn) } EXPORT_SYMBOL_GPL(crypto_drop_spawn); -struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn) +struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, + u32 mask) { struct crypto_alg *alg; struct crypto_alg *alg2; @@ -396,10 +397,18 @@ struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn) return ERR_PTR(-EAGAIN); } - tfm = __crypto_alloc_tfm(alg, 0); + tfm = ERR_PTR(-EINVAL); + if (unlikely((alg->cra_flags ^ type) & mask)) + goto out_put_alg; + + tfm = __crypto_alloc_tfm(alg, type, mask); if (IS_ERR(tfm)) - crypto_mod_put(alg); + goto out_put_alg; + + return tfm; +out_put_alg: + crypto_mod_put(alg); return tfm; } EXPORT_SYMBOL_GPL(crypto_spawn_tfm); |