aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/cbc.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-12-16 18:05:58 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2007-02-06 17:21:01 -0500
commit2e306ee016fd4750289e65c3b1856db569f1f3f2 (patch)
tree53ace6081967c640f052d53397250657af855c25 /crypto/cbc.c
parentf1ddcaf3393b7a3871809b97fae90fac841a1f39 (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/cbc.c')
-rw-r--r--crypto/cbc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/cbc.c b/crypto/cbc.c
index f5542b4db387..136fea7e7000 100644
--- a/crypto/cbc.c
+++ b/crypto/cbc.c
@@ -243,6 +243,7 @@ static int crypto_cbc_init_tfm(struct crypto_tfm *tfm)
243 struct crypto_instance *inst = (void *)tfm->__crt_alg; 243 struct crypto_instance *inst = (void *)tfm->__crt_alg;
244 struct crypto_spawn *spawn = crypto_instance_ctx(inst); 244 struct crypto_spawn *spawn = crypto_instance_ctx(inst);
245 struct crypto_cbc_ctx *ctx = crypto_tfm_ctx(tfm); 245 struct crypto_cbc_ctx *ctx = crypto_tfm_ctx(tfm);
246 struct crypto_cipher *cipher;
246 247
247 switch (crypto_tfm_alg_blocksize(tfm)) { 248 switch (crypto_tfm_alg_blocksize(tfm)) {
248 case 8: 249 case 8:
@@ -260,11 +261,11 @@ static int crypto_cbc_init_tfm(struct crypto_tfm *tfm)
260 ctx->xor = xor_quad; 261 ctx->xor = xor_quad;
261 } 262 }
262 263
263 tfm = crypto_spawn_tfm(spawn); 264 cipher = crypto_spawn_cipher(spawn);
264 if (IS_ERR(tfm)) 265 if (IS_ERR(cipher))
265 return PTR_ERR(tfm); 266 return PTR_ERR(cipher);
266 267
267 ctx->child = crypto_cipher_cast(tfm); 268 ctx->child = cipher;
268 return 0; 269 return 0;
269} 270}
270 271