summaryrefslogtreecommitdiff
path: root/crypto/xcbc.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-12-17 10:05:58 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2007-02-07 09:21:01 +1100
commitd9a91492c748af0c5e4fdc3537f628a063646660 (patch)
treef37d88202b49e5d8c4f3359945ad471e306ba3c9 /crypto/xcbc.c
parent280d39ea8e872bcc1eb62f5b1e18acd87fc469f7 (diff)
downloadlinux-crypto-d9a91492c748af0c5e4fdc3537f628a063646660.tar.gz
linux-crypto-d9a91492c748af0c5e4fdc3537f628a063646660.zip
[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/xcbc.c')
-rw-r--r--crypto/xcbc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/xcbc.c b/crypto/xcbc.c
index 317e9f08..d7b4be0a 100644
--- a/crypto/xcbc.c
+++ b/crypto/xcbc.c
@@ -254,14 +254,15 @@ static int crypto_xcbc_digest(struct hash_desc *pdesc,
static int xcbc_init_tfm(struct crypto_tfm *tfm)
{
+ struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct crypto_xcbc_ctx *ctx = crypto_hash_ctx_aligned(__crypto_hash_cast(tfm));
int bs = crypto_hash_blocksize(__crypto_hash_cast(tfm));
- tfm = crypto_spawn_tfm(spawn);
- if (IS_ERR(tfm))
- return PTR_ERR(tfm);
+ cipher = crypto_spawn_cipher(spawn);
+ if (IS_ERR(cipher))
+ return PTR_ERR(cipher);
switch(bs) {
case 16:
@@ -271,7 +272,7 @@ static int xcbc_init_tfm(struct crypto_tfm *tfm)
return -EINVAL;
}
- ctx->child = crypto_cipher_cast(tfm);
+ ctx->child = cipher;
ctx->odds = (u8*)(ctx+1);
ctx->prev = ctx->odds + bs;
ctx->key = ctx->prev + bs;