devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas BOURGOIN <thomas.bourgoin@foss.st.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Lionel Debieve <lionel.debieve@foss.st.com>,
	<linux-crypto@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/7] crypto: stm32 - add new algorithms support
Date: Wed, 12 Jul 2023 09:58:36 +0200	[thread overview]
Message-ID: <a584c152-329e-9c79-ec62-795485302a55@foss.st.com> (raw)
In-Reply-To: <CACRpkdaHn8fhZtuhU4sXHK1xoxO3-xYg_Xb=3=bX8i-uJM9KDA@mail.gmail.com>

Hi Linus,

Did you run your test only with the patch adding the support for 
STM32MP13 or did you try the whole patch set ?

The error is on the test vector number 4, which is an HASH of 64 bytes 
which is exactly the size of a blcok for SHA1.

Did you try to run the test for SHA256 ? (I guess you will see the same 
error on test vector 4)

I have two hypothesis :
	- it could be related to the padding of the data. (I don't think, the 
patch does not modify these lines)
	- it could come from the way the first block of data is handle. To 
start the first pre computation, we have to write 1 block + 1 word. The 
test only write one block so maybe the issue is here.

On 7/6/23 09:37, Thomas BOURGOIN wrote:
 > +		/*
 > +		 * After first block + 1 words are fill up,
 > +		 * we only need to fill 1 block to start partial computation
 > +		 */
 > +		rctx->state.blocklen -= sizeof(u32);
 > +

I found a typo in the number of CSR to save/restore for the SHA1 and 
SHA256 algorithm. It should be 38 instead of 22.
Tell me if it fixes the regression.

It could be possible to divide the patch in 2 (one patch rework 
preparing MP13 and one patch with the new algorithm) but for the 
upstream I do not know if it is relevant to have 2 patches instead of one.

Best regards,

Thomas

---
  drivers/crypto/stm32/stm32-hash.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/stm32/stm32-hash.c 
b/drivers/crypto/stm32/stm32-hash.c
index a50d73c18d5c..88a186c3dd78 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -74,7 +74,7 @@

  /* Context swap register */
  #define HASH_CSR_NB_SHA256_HMAC		54
-#define HASH_CSR_NB_SHA256		22
+#define HASH_CSR_NB_SHA256		38
  #define HASH_CSR_NB_SHA512_HMAC		103
  #define HASH_CSR_NB_SHA512		91
  #define HASH_CSR_NB_SHA3_HMAC		88
-- 
2.25.1



  reply	other threads:[~2023-07-12  7:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06  7:37 [PATCH 0/7] Support of HASH on STM32MP13 Thomas BOURGOIN
2023-07-06  7:37 ` [PATCH 1/7] dt-bindings: crypto: add new compatible for stm32-hash Thomas BOURGOIN
2023-07-06 15:50   ` Krzysztof Kozlowski
2023-07-06  7:37 ` [PATCH 2/7] crypto: stm32 - add new algorithms support Thomas BOURGOIN
2023-07-06 22:09   ` Linus Walleij
2023-07-12  7:58     ` Thomas BOURGOIN [this message]
2023-07-12 22:56       ` Linus Walleij
2023-07-13  7:59         ` Thomas BOURGOIN
2023-07-06  7:37 ` [PATCH 3/7] crypto: stm32 - remove bufcnt in stm32_hash_write_ctrl Thomas BOURGOIN
2023-07-06  7:37 ` [PATCH 4/7] crypto: stm32 - fix loop iterating through scatterlist for DMA Thomas BOURGOIN
2023-07-06  7:37 ` [PATCH 5/7] crypto: stm32 - check request size and scatterlist size when using DMA Thomas BOURGOIN
2023-07-06  7:37 ` [PATCH 6/7] crypto: stm32 - fix MDMAT condition Thomas BOURGOIN
2023-07-06 21:42   ` Linus Walleij
2023-07-06  7:37 ` [PATCH 7/7] crypto: stm32 - remove flag HASH_FLAGS_DMA_READY Thomas BOURGOIN

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=a584c152-329e-9c79-ec62-795485302a55@foss.st.com \
    --to=thomas.bourgoin@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=lionel.debieve@foss.st.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).