All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>
Cc: phone-devel@vger.kernel.org, Stefan Hansson <newbyte@disroot.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v3 03/16] crypto: ux500/hash: Pass context to zero message digest
Date: Tue, 16 Aug 2022 16:00:36 +0200	[thread overview]
Message-ID: <20220816140049.102306-4-linus.walleij@linaro.org> (raw)
In-Reply-To: <20220816140049.102306-1-linus.walleij@linaro.org>

This function obtains the current context from the device state
pointer, which is fragile. Pass the context explicitly instead.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Rebased on v6.0-rc1
ChangeLog v1->v2:
- No changes
---
 drivers/crypto/ux500/hash/hash_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
index 5c2da6d42121..aa6bbae107cd 100644
--- a/drivers/crypto/ux500/hash/hash_core.c
+++ b/drivers/crypto/ux500/hash/hash_core.c
@@ -183,11 +183,10 @@ static int hash_dma_write(struct hash_ctx *ctx,
  * @zero_digest:	True if zero_digest returned.
  */
 static int get_empty_message_digest(
-		struct hash_device_data *device_data,
+		struct hash_device_data *device_data, struct hash_ctx *ctx,
 		u8 *zero_hash, u32 *zero_hash_size, bool *zero_digest)
 {
 	int ret = 0;
-	struct hash_ctx *ctx = device_data->current_ctx;
 	*zero_digest = false;
 
 	/**
@@ -889,7 +888,7 @@ static int hash_hw_final(struct ahash_request *req)
 		 * Use a pre-calculated empty message digest
 		 * (workaround since hw return zeroes, hw bug!?)
 		 */
-		ret = get_empty_message_digest(device_data, &zero_hash[0],
+		ret = get_empty_message_digest(device_data, ctx, &zero_hash[0],
 				&zero_hash_size, &zero_digest);
 		if (!ret && likely(zero_hash_size == ctx->digestsize) &&
 		    zero_digest) {
-- 
2.37.2


  parent reply	other threads:[~2022-08-16 14:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 14:00 [PATCH v3 00/16] Ux500 hash cleanup Linus Walleij
2022-08-16 14:00 ` [PATCH v3 01/16] crypto: ux500/hash: Pass ctx to hash_setconfiguration() Linus Walleij
2022-08-16 14:00 ` [PATCH v3 02/16] crypto: ux500/hash: Get rid of custom device list Linus Walleij
2022-08-16 14:00 ` Linus Walleij [this message]
2022-08-16 14:00 ` [PATCH v3 04/16] crypto: ux500/hash: Drop custom state save/restore Linus Walleij
2022-08-16 14:00 ` [PATCH v3 05/16] crypto: ux500/hash: Drop bit index Linus Walleij
2022-08-16 14:00 ` [PATCH v3 06/16] crypto: ux500/hash: Break while/do instead of if/else Linus Walleij
2022-08-16 14:00 ` [PATCH v3 07/16] crypto: ux500/hash: Rename and switch type of member Linus Walleij
2022-08-16 14:00 ` [PATCH v3 08/16] crypto: ux500/hash: Stop saving/restoring compulsively Linus Walleij
2022-08-16 14:00 ` [PATCH v3 09/16] crypto: ux500/hash: Get rid of state from request context Linus Walleij
2022-08-16 14:00 ` [PATCH v3 10/16] crypto: ux500/hash: Implement .export and .import Linus Walleij
2022-08-25  9:30   ` Herbert Xu
2022-09-13 19:14     ` Linus Walleij
2022-09-18  3:16       ` Herbert Xu
2022-08-16 14:00 ` [PATCH v3 11/16] crypto: ux500/hash: Drop custom uint64 type Linus Walleij
2022-08-16 14:00 ` [PATCH v3 12/16] crypto: ux500/hash: Drop regulator handling Linus Walleij
2022-08-16 14:00 ` [PATCH v3 13/16] crypto: ux500/hash: Convert to regmap MMIO Linus Walleij
2022-08-16 14:00 ` [PATCH v3 14/16] crypto: ux500/hash: Use AMBA core primecell IDs Linus Walleij
2022-08-16 14:00 ` [PATCH v3 15/16] crypto: ux500/hash: Implement runtime PM Linus Walleij
2022-08-16 14:00 ` [PATCH v3 16/16] crypto: ux500/hash: Use accelerated noinc MMIO Linus Walleij

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=20220816140049.102306-4-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=newbyte@disroot.org \
    --cc=phone-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.