diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-02-13 06:56:24 +0100 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-02-13 06:56:24 +0100 |
commit | cbe56159a3e60624b5f44cf48b640fa470436e34 (patch) | |
tree | f3dd43243be6e840dc2b0386e91c4146a4f51620 /crypto/algapi.c | |
parent | Merge branch 'master' into 83xx (diff) | |
parent | [POWERPC] spufs: Fix bitrot of the SPU mmap facility (diff) | |
download | linux-cbe56159a3e60624b5f44cf48b640fa470436e34.tar.xz linux-cbe56159a3e60624b5f44cf48b640fa470436e34.zip |
Merge branch 'master' into 83xx
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 c91530021e9c..f7d2185b2c8f 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); |