From: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
To: herbert@gondor.apana.org.au, davem@davemloft.net
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
Subject: [PATCH] crypto: xcbc - use init_tfm & exit_tfm instead of cra_int & cra_exit
Date: Mon, 23 Nov 2026 16:10:30 +0530 [thread overview]
Message-ID: <20261123104030.5378-1-raizudeen.kerneldev@gmail.com> (raw)
The cra_init and cra_exit fields of struct crypto_alg are deprecated.
Switch to the shash-speicific init_tfm & exit_tfm callbacks, which take
a struct crypto_shash directly.
This also removes (void *) cast of tfm->__crt_alg and the manual
crypto_instance_ctx() conversion and drops a stray semicolon after
xcbc_init_tfm().
No functional change.
Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
---
crypto/xcbc.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/crypto/xcbc.c b/crypto/xcbc.c
index 6c5f6766fdd6..6bb3cddb391b 100644
--- a/crypto/xcbc.c
+++ b/crypto/xcbc.c
@@ -102,13 +102,14 @@ static int crypto_xcbc_digest_finup(struct shash_desc *pdesc, const u8 *src,
return 0;
}
-static int xcbc_init_tfm(struct crypto_tfm *tfm)
+static int xcbc_init_tfm(struct crypto_shash *tfm)
{
+ struct shash_instance *inst = shash_alg_instance(tfm);
+ struct xcbc_tfm_ctx *ctx = crypto_shash_ctx(tfm);
+ struct crypto_cipher_spawn *spawn;
struct crypto_cipher *cipher;
- struct crypto_instance *inst = (void *)tfm->__crt_alg;
- struct crypto_cipher_spawn *spawn = crypto_instance_ctx(inst);
- struct xcbc_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
+ spawn = shash_instance_ctx(inst);
cipher = crypto_spawn_cipher(spawn);
if (IS_ERR(cipher))
return PTR_ERR(cipher);
@@ -116,11 +117,11 @@ static int xcbc_init_tfm(struct crypto_tfm *tfm)
ctx->child = cipher;
return 0;
-};
+}
-static void xcbc_exit_tfm(struct crypto_tfm *tfm)
+static void xcbc_exit_tfm(struct crypto_shash *tfm)
{
- struct xcbc_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
+ struct xcbc_tfm_ctx *ctx = crypto_shash_ctx(tfm);
crypto_free_cipher(ctx->child);
}
@@ -165,8 +166,8 @@ static int xcbc_create(struct crypto_template *tmpl, struct rtattr **tb)
inst->alg.digestsize = alg->cra_blocksize;
inst->alg.descsize = alg->cra_blocksize;
- inst->alg.base.cra_init = xcbc_init_tfm;
- inst->alg.base.cra_exit = xcbc_exit_tfm;
+ inst->alg.init_tfm = xcbc_init_tfm;
+ inst->alg.exit_tfm = xcbc_exit_tfm;
inst->alg.init = crypto_xcbc_digest_init;
inst->alg.update = crypto_xcbc_digest_update;
--
2.53.0
reply other threads:[~2026-11-23 10:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123104030.5378-1-raizudeen.kerneldev@gmail.com \
--to=raizudeen.kerneldev@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®