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/hmac.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/hmac.c')
-rw-r--r-- | crypto/hmac.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/hmac.c b/crypto/hmac.c index b521bcd2b2c6..44187c5ee593 100644 --- a/crypto/hmac.c +++ b/crypto/hmac.c | |||
@@ -172,15 +172,16 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg, | |||
172 | 172 | ||
173 | static int hmac_init_tfm(struct crypto_tfm *tfm) | 173 | static int hmac_init_tfm(struct crypto_tfm *tfm) |
174 | { | 174 | { |
175 | struct crypto_hash *hash; | ||
175 | struct crypto_instance *inst = (void *)tfm->__crt_alg; | 176 | struct crypto_instance *inst = (void *)tfm->__crt_alg; |
176 | struct crypto_spawn *spawn = crypto_instance_ctx(inst); | 177 | struct crypto_spawn *spawn = crypto_instance_ctx(inst); |
177 | struct hmac_ctx *ctx = hmac_ctx(__crypto_hash_cast(tfm)); | 178 | struct hmac_ctx *ctx = hmac_ctx(__crypto_hash_cast(tfm)); |
178 | 179 | ||
179 | tfm = crypto_spawn_tfm(spawn); | 180 | hash = crypto_spawn_hash(spawn); |
180 | if (IS_ERR(tfm)) | 181 | if (IS_ERR(hash)) |
181 | return PTR_ERR(tfm); | 182 | return PTR_ERR(hash); |
182 | 183 | ||
183 | ctx->child = crypto_hash_cast(tfm); | 184 | ctx->child = hash; |
184 | return 0; | 185 | return 0; |
185 | } | 186 | } |
186 | 187 | ||