linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: omap-sham: fix digcnt register handling with export/import
@ 2020-09-07  7:56 Tero Kristo
  2020-09-18  7:28 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Tero Kristo @ 2020-09-07  7:56 UTC (permalink / raw)
  To: herbert, davem, linux-crypto; +Cc: linux-omap

Running export/import for hashes in peculiar order (mostly done by
openssl) can mess up the internal book keeping of the OMAP SHA core.
Fix by forcibly writing the correct DIGCNT back to hardware. This issue
was noticed while transitioning to openssl 1.1 support.

Fixes: 0d373d603202 ("crypto: omap-sham - Add OMAP4/AM33XX SHAM Support")
Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/crypto/omap-sham.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index b2b930a1fb04..a3b38d2c92e7 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -460,6 +460,9 @@ static void omap_sham_write_ctrl_omap4(struct omap_sham_dev *dd, size_t length,
 	struct omap_sham_reqctx *ctx = ahash_request_ctx(dd->req);
 	u32 val, mask;
 
+	if (likely(ctx->digcnt))
+		omap_sham_write(dd, SHA_REG_DIGCNT(dd), ctx->digcnt);
+
 	/*
 	 * Setting ALGO_CONST only for the first iteration and
 	 * CLOSE_HASH only for the last one. Note that flags mode bits
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: omap-sham: fix digcnt register handling with export/import
  2020-09-07  7:56 [PATCH] crypto: omap-sham: fix digcnt register handling with export/import Tero Kristo
@ 2020-09-18  7:28 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2020-09-18  7:28 UTC (permalink / raw)
  To: Tero Kristo; +Cc: davem, linux-crypto, linux-omap

On Mon, Sep 07, 2020 at 10:56:24AM +0300, Tero Kristo wrote:
> Running export/import for hashes in peculiar order (mostly done by
> openssl) can mess up the internal book keeping of the OMAP SHA core.
> Fix by forcibly writing the correct DIGCNT back to hardware. This issue
> was noticed while transitioning to openssl 1.1 support.
> 
> Fixes: 0d373d603202 ("crypto: omap-sham - Add OMAP4/AM33XX SHAM Support")
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> ---
>  drivers/crypto/omap-sham.c | 3 +++
>  1 file changed, 3 insertions(+)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-18  7:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07  7:56 [PATCH] crypto: omap-sham: fix digcnt register handling with export/import Tero Kristo
2020-09-18  7:28 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).