Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Goetz Goerisch <ggoerisch@gmail.com>
To: gregkh@linuxfoundation.org
Cc: ggoerisch@gmail.com, herbert@gondor.apana.org.au,
	herve.codina@bootlin.com, linux-crypto@vger.kernel.org,
	miquel.raynal@bootlin.com, paul.louvel@bootlin.com,
	sashal@kernel.org, stable@vger.kernel.org,
	thomas.petazzoni@bootlin.com, Eric Biggers <ebiggers@google.com>
Subject: [PATCH 3/5] crypto: talitos - stop using crypto_ahash::init
Date: Thu,  9 Jul 2026 21:39:54 +0200	[thread overview]
Message-ID: <20260709193956.15619-4-ggoerisch@gmail.com> (raw)
In-Reply-To: <20260709193956.15619-1-ggoerisch@gmail.com>

From: Eric Biggers <ebiggers@google.com>

commit 9826d1d6ed5f86cb3d61610b3b1fe31e96a40418 upstream.

The function pointer crypto_ahash::init is an internal implementation
detail of the ahash API that exists to help it support both ahash and
shash algorithms.  With an upcoming refactoring of how the ahash API
supports shash algorithms, this field will be removed.

Some drivers are invoking crypto_ahash::init to call into their own
code, which is unnecessary and inefficient.  The talitos driver is one
of those drivers.  Make it just call its own code directly.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 drivers/crypto/talitos.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 4ca4fbd227bc..a941ec08817e 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -2119,13 +2119,14 @@ static int ahash_finup(struct ahash_request *areq)
 
 static int ahash_digest(struct ahash_request *areq)
 {
-	struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
-	struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq);
-
-	ahash->init(areq);
-	req_ctx->last = 1;
+	ahash_init(areq);
+	return ahash_finup(areq);
+}
 
-	return ahash_process_req(areq, areq->nbytes);
+static int ahash_digest_sha224_swinit(struct ahash_request *areq)
+{
+	ahash_init_sha224_swinit(areq);
+	return ahash_finup(areq);
 }
 
 static int ahash_export(struct ahash_request *areq, void *out)
@@ -3242,6 +3243,8 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
 		    (!strcmp(alg->cra_name, "sha224") ||
 		     !strcmp(alg->cra_name, "hmac(sha224)"))) {
 			t_alg->algt.alg.hash.init = ahash_init_sha224_swinit;
+			t_alg->algt.alg.hash.digest =
+				ahash_digest_sha224_swinit;
 			t_alg->algt.desc_hdr_template =
 					DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
 					DESC_HDR_SEL0_MDEUA |
-- 
2.55.0


  parent reply	other threads:[~2026-07-09 19:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <142603430.61540.1779296295550@app.mailbox.org>
2026-05-21 10:16 ` [PATCH] crypto: talitos - fix rename first/last to first_desc/last_desc Paul Louvel
2026-05-21 10:20   ` Paul Louvel
2026-05-21 15:25     ` Goetz Goerisch
2026-05-22  5:12       ` Greg Kroah-Hartman
2026-05-23 15:10         ` [PATCH 0/5] " Goetz Goerisch
2026-05-23 15:10           ` [PATCH 1/5] Revert "crypto: talitos - rename first/last to first_desc/last_desc" Goetz Goerisch
2026-07-09 14:27             ` Greg KH
2026-07-09 19:28               ` [PATCH 6.6.y v2 0/5] crypto: talitos - fix rename first/last to first_desc/last_desc Goetz Goerisch
2026-07-09 19:28                 ` [PATCH 1/5] Revert "crypto: talitos - rename first/last to first_desc/last_desc" Goetz Goerisch
2026-07-09 19:28                 ` [PATCH 2/5] Revert "crypto: talitos - fix SEC1 32k ahash request limitation" Goetz Goerisch
2026-07-09 19:28                 ` [PATCH 3/5] crypto: talitos - stop using crypto_ahash::init Goetz Goerisch
2026-07-09 19:28                 ` [PATCH 4/5] crypto: talitos - fix SEC1 32k ahash request limitation Goetz Goerisch
2026-07-09 19:28                 ` [PATCH 5/5] crypto: talitos - rename first/last to first_desc/last_desc Goetz Goerisch
2026-07-09 19:39               ` [PATCH 6.6.y v3 0/5] crypto: talitos - fix " Goetz Goerisch
2026-07-09 19:39                 ` [PATCH 1/5] Revert "crypto: talitos - rename first/last to first_desc/last_desc" Goetz Goerisch
2026-07-09 19:39                 ` [PATCH 2/5] Revert "crypto: talitos - fix SEC1 32k ahash request limitation" Goetz Goerisch
2026-07-09 19:39                 ` Goetz Goerisch [this message]
2026-07-09 19:39                 ` [PATCH 4/5] crypto: talitos - fix SEC1 32k ahash request limitation Goetz Goerisch
2026-07-09 19:39                 ` [PATCH 5/5] crypto: talitos - rename first/last to first_desc/last_desc Goetz Goerisch
2026-07-10 21:02                 ` [PATCH 6.6.y v3 0/5] crypto: talitos - fix " Sasha Levin
2026-05-23 15:10           ` [PATCH 2/5] Revert "crypto: talitos - fix SEC1 32k ahash request limitation" Goetz Goerisch
2026-05-23 15:10           ` [PATCH 3/5] crypto: talitos - stop using crypto_ahash::init Goetz Goerisch
2026-05-23 15:10           ` [PATCH 4/5] crypto: talitos - fix SEC1 32k ahash request limitation Goetz Goerisch
2026-05-23 15:10           ` [PATCH 5/5] crypto: talitos - rename first/last to first_desc/last_desc Goetz Goerisch

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=20260709193956.15619-4-ggoerisch@gmail.com \
    --to=ggoerisch@gmail.com \
    --cc=ebiggers@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=herve.codina@bootlin.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=paul.louvel@bootlin.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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