Skip to content

Commit 0303b7f

Browse files
committed
crypto: cryptd - Convert hash to use modern init_tfm/exit_tfm
The cryptd hash template was still using the obsolete cra_init/cra_exit interface. Make it use the modern ahash init_tfm/exit_tfm instead. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 8538e60 commit 0303b7f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crypto/cryptd.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -427,28 +427,28 @@ static int cryptd_create_skcipher(struct crypto_template *tmpl,
427427
return err;
428428
}
429429

430-
static int cryptd_hash_init_tfm(struct crypto_tfm *tfm)
430+
static int cryptd_hash_init_tfm(struct crypto_ahash *tfm)
431431
{
432-
struct crypto_instance *inst = crypto_tfm_alg_instance(tfm);
433-
struct hashd_instance_ctx *ictx = crypto_instance_ctx(inst);
432+
struct ahash_instance *inst = ahash_alg_instance(tfm);
433+
struct hashd_instance_ctx *ictx = ahash_instance_ctx(inst);
434434
struct crypto_shash_spawn *spawn = &ictx->spawn;
435-
struct cryptd_hash_ctx *ctx = crypto_tfm_ctx(tfm);
435+
struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm);
436436
struct crypto_shash *hash;
437437

438438
hash = crypto_spawn_shash(spawn);
439439
if (IS_ERR(hash))
440440
return PTR_ERR(hash);
441441

442442
ctx->child = hash;
443-
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
443+
crypto_ahash_set_reqsize(tfm,
444444
sizeof(struct cryptd_hash_request_ctx) +
445445
crypto_shash_descsize(hash));
446446
return 0;
447447
}
448448

449-
static void cryptd_hash_exit_tfm(struct crypto_tfm *tfm)
449+
static void cryptd_hash_exit_tfm(struct crypto_ahash *tfm)
450450
{
451-
struct cryptd_hash_ctx *ctx = crypto_tfm_ctx(tfm);
451+
struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm);
452452

453453
crypto_free_shash(ctx->child);
454454
}
@@ -677,8 +677,8 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
677677
inst->alg.halg.statesize = alg->statesize;
678678
inst->alg.halg.base.cra_ctxsize = sizeof(struct cryptd_hash_ctx);
679679

680-
inst->alg.halg.base.cra_init = cryptd_hash_init_tfm;
681-
inst->alg.halg.base.cra_exit = cryptd_hash_exit_tfm;
680+
inst->alg.init_tfm = cryptd_hash_init_tfm;
681+
inst->alg.exit_tfm = cryptd_hash_exit_tfm;
682682

683683
inst->alg.init = cryptd_hash_init_enqueue;
684684
inst->alg.update = cryptd_hash_update_enqueue;

0 commit comments

Comments
 (0)