diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-12-16 18:05:58 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2007-02-06 17:21:01 -0500 |
commit | 2e306ee016fd4750289e65c3b1856db569f1f3f2 (patch) | |
tree | 53ace6081967c640f052d53397250657af855c25 /crypto/lrw.c | |
parent | f1ddcaf3393b7a3871809b97fae90fac841a1f39 (diff) |
[CRYPTO] api: Add type-safe spawns
This patch allows spawns of specific types (e.g., cipher) to be allocated.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/lrw.c')
-rw-r--r-- | crypto/lrw.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crypto/lrw.c b/crypto/lrw.c index 56642586d84f..b4105080ac7a 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
@@ -201,21 +201,22 @@ static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
201 | 201 | ||
202 | static int init_tfm(struct crypto_tfm *tfm) | 202 | static int init_tfm(struct crypto_tfm *tfm) |
203 | { | 203 | { |
204 | struct crypto_cipher *cipher; | ||
204 | struct crypto_instance *inst = (void *)tfm->__crt_alg; | 205 | struct crypto_instance *inst = (void *)tfm->__crt_alg; |
205 | struct crypto_spawn *spawn = crypto_instance_ctx(inst); | 206 | struct crypto_spawn *spawn = crypto_instance_ctx(inst); |
206 | struct priv *ctx = crypto_tfm_ctx(tfm); | 207 | struct priv *ctx = crypto_tfm_ctx(tfm); |
207 | u32 *flags = &tfm->crt_flags; | 208 | u32 *flags = &tfm->crt_flags; |
208 | 209 | ||
209 | tfm = crypto_spawn_tfm(spawn); | 210 | cipher = crypto_spawn_cipher(spawn); |
210 | if (IS_ERR(tfm)) | 211 | if (IS_ERR(cipher)) |
211 | return PTR_ERR(tfm); | 212 | return PTR_ERR(cipher); |
212 | 213 | ||
213 | if (crypto_tfm_alg_blocksize(tfm) != 16) { | 214 | if (crypto_cipher_blocksize(cipher) != 16) { |
214 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; | 215 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; |
215 | return -EINVAL; | 216 | return -EINVAL; |
216 | } | 217 | } |
217 | 218 | ||
218 | ctx->child = crypto_cipher_cast(tfm); | 219 | ctx->child = cipher; |
219 | return 0; | 220 | return 0; |
220 | } | 221 | } |
221 | 222 | ||