Skip to content

Commit 0bd2223

Browse files
Ard Biesheuvelherbertx
authored andcommitted
crypto: cryptd - initialize child shash_desc on import
When calling .import() on a cryptd ahash_request, the structure members that describe the child transform in the shash_desc need to be initialized like they are when calling .init() Cc: [email protected] Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 8b18e23 commit 0bd2223

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crypto/cryptd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,14 @@ static int cryptd_hash_export(struct ahash_request *req, void *out)
631631

632632
static int cryptd_hash_import(struct ahash_request *req, const void *in)
633633
{
634-
struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req);
634+
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
635+
struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm);
636+
struct shash_desc *desc = cryptd_shash_desc(req);
637+
638+
desc->tfm = ctx->child;
639+
desc->flags = req->base.flags;
635640

636-
return crypto_shash_import(&rctx->desc, in);
641+
return crypto_shash_import(desc, in);
637642
}
638643

639644
static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,

0 commit comments

Comments
 (0)