linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: ccree: fix xts-aes-ccree blocksize
@ 2022-02-09  7:06 Corentin Labbe
  2022-02-17 19:36 ` Gilad Ben-Yossef
  0 siblings, 1 reply; 3+ messages in thread
From: Corentin Labbe @ 2022-02-09  7:06 UTC (permalink / raw)
  To: davem, gilad, herbert; +Cc: linux-crypto, linux-kernel, Corentin Labbe

loading ccree on next-20220207 with CRYPTO_MANAGER_EXTRA_TESTS show a warning:
alg: skcipher: blocksize for xts-aes-ccree (1) doesn't match generic impl (16)
alg: self-tests for xts-aes-ccree (xts(aes)) failed (rc=-22)

After setting the correct blocksize, selftests pass.

Fixes: 67caef08a71f ("crypto: ccree - enable CTS support in AES-XTS")
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/crypto/ccree/cc_cipher.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
index 78833491f534..d955fe15cf40 100644
--- a/drivers/crypto/ccree/cc_cipher.c
+++ b/drivers/crypto/ccree/cc_cipher.c
@@ -1010,7 +1010,7 @@ static const struct cc_alg_template skcipher_algs[] = {
 	{
 		.name = "xts(paes)",
 		.driver_name = "xts-paes-ccree",
-		.blocksize = 1,
+		.blocksize = XTS_BLOCK_SIZE,
 		.template_skcipher = {
 			.setkey = cc_cipher_sethkey,
 			.encrypt = cc_cipher_encrypt,
@@ -1140,7 +1140,7 @@ static const struct cc_alg_template skcipher_algs[] = {
 		 */
 		.name = "xts(aes)",
 		.driver_name = "xts-aes-ccree",
-		.blocksize = 1,
+		.blocksize = XTS_BLOCK_SIZE,
 		.template_skcipher = {
 			.setkey = cc_cipher_setkey,
 			.encrypt = cc_cipher_encrypt,
-- 
2.34.1


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

* Re: [PATCH] crypto: ccree: fix xts-aes-ccree blocksize
  2022-02-09  7:06 [PATCH] crypto: ccree: fix xts-aes-ccree blocksize Corentin Labbe
@ 2022-02-17 19:36 ` Gilad Ben-Yossef
  2022-02-18  3:55   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Gilad Ben-Yossef @ 2022-02-17 19:36 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: David Miller, Herbert Xu, Linux Crypto Mailing List,
	Linux kernel mailing list

Hi Again,

Thank you for taking the time to look into this!

However, this is an old topic that has been discussed before and the
answer really is that the selftests are wrong. They are looking at the
wrong thing. Yes, I know...

See the discussion here:
https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg40576.html

I also also point out this is actually documented in the code:

+               /* See
https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg40576.html
+                * for the reason why this differs from the generic
+                * implementation.
+                */

Thanks again!
Gilad


On Wed, Feb 9, 2022 at 9:06 AM Corentin Labbe <clabbe@baylibre.com> wrote:
>
> loading ccree on next-20220207 with CRYPTO_MANAGER_EXTRA_TESTS show a warning:
> alg: skcipher: blocksize for xts-aes-ccree (1) doesn't match generic impl (16)
> alg: self-tests for xts-aes-ccree (xts(aes)) failed (rc=-22)
>
> After setting the correct blocksize, selftests pass.
>
> Fixes: 67caef08a71f ("crypto: ccree - enable CTS support in AES-XTS")
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  drivers/crypto/ccree/cc_cipher.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
> index 78833491f534..d955fe15cf40 100644
> --- a/drivers/crypto/ccree/cc_cipher.c
> +++ b/drivers/crypto/ccree/cc_cipher.c
> @@ -1010,7 +1010,7 @@ static const struct cc_alg_template skcipher_algs[] = {
>         {
>                 .name = "xts(paes)",
>                 .driver_name = "xts-paes-ccree",
> -               .blocksize = 1,
> +               .blocksize = XTS_BLOCK_SIZE,
>                 .template_skcipher = {
>                         .setkey = cc_cipher_sethkey,
>                         .encrypt = cc_cipher_encrypt,
> @@ -1140,7 +1140,7 @@ static const struct cc_alg_template skcipher_algs[] = {
>                  */
>                 .name = "xts(aes)",
>                 .driver_name = "xts-aes-ccree",
> -               .blocksize = 1,
> +               .blocksize = XTS_BLOCK_SIZE,
>                 .template_skcipher = {
>                         .setkey = cc_cipher_setkey,
>                         .encrypt = cc_cipher_encrypt,
> --
> 2.34.1
>


-- 
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

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

* Re: [PATCH] crypto: ccree: fix xts-aes-ccree blocksize
  2022-02-17 19:36 ` Gilad Ben-Yossef
@ 2022-02-18  3:55   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2022-02-18  3:55 UTC (permalink / raw)
  To: Gilad Ben-Yossef
  Cc: Corentin Labbe, David Miller, Linux Crypto Mailing List,
	Linux kernel mailing list

On Thu, Feb 17, 2022 at 09:36:41PM +0200, Gilad Ben-Yossef wrote:
> Hi Again,
> 
> Thank you for taking the time to look into this!
> 
> However, this is an old topic that has been discussed before and the
> answer really is that the selftests are wrong. They are looking at the
> wrong thing. Yes, I know...
> 
> See the discussion here:
> https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg40576.html
> 
> I also also point out this is actually documented in the code:
> 
> +               /* See
> https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg40576.html
> +                * for the reason why this differs from the generic
> +                * implementation.
> +                */

Indeed.  We should instead change the generic algorithm as well
as the other drivers that implement XTS.

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] 3+ messages in thread

end of thread, other threads:[~2022-02-18  3:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09  7:06 [PATCH] crypto: ccree: fix xts-aes-ccree blocksize Corentin Labbe
2022-02-17 19:36 ` Gilad Ben-Yossef
2022-02-18  3:55   ` 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).