All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin
@ 2019-11-08  7:46 Pascal van Leeuwen
  2019-11-08  8:38 ` Antoine Tenart
  0 siblings, 1 reply; 4+ messages in thread
From: Pascal van Leeuwen @ 2019-11-08  7:46 UTC (permalink / raw)
  To: linux-crypto; +Cc: antoine.tenart, herbert, davem, Pascal van Leeuwen

Fixed 2 copy-paste mistakes made during commit 13a1bb93f7b1c9 ("crypto:
inside-secure - Fixed warnings on inconsistent byte order handling")
that caused authenc w/ (3)DES to consistently fail on Macchiatobin (but
strangely work fine on x86+FPGA??).
Now fully tested on both platforms.

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
---
 drivers/crypto/inside-secure/safexcel_cipher.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-secure/safexcel_cipher.c
index 98f9fc6..c029956 100644
--- a/drivers/crypto/inside-secure/safexcel_cipher.c
+++ b/drivers/crypto/inside-secure/safexcel_cipher.c
@@ -405,7 +405,8 @@ static int safexcel_aead_setkey(struct crypto_aead *ctfm, const u8 *key,
 
 	if (priv->flags & EIP197_TRC_CACHE && ctx->base.ctxr_dma) {
 		for (i = 0; i < keys.enckeylen / sizeof(u32); i++) {
-			if (le32_to_cpu(ctx->key[i]) != aes.key_enc[i]) {
+			if (le32_to_cpu(ctx->key[i]) !=
+			    ((u32 *)keys.enckey)[i]) {
 				ctx->base.needs_inv = true;
 				break;
 			}
@@ -459,7 +460,7 @@ static int safexcel_aead_setkey(struct crypto_aead *ctfm, const u8 *key,
 
 	/* Now copy the keys into the context */
 	for (i = 0; i < keys.enckeylen / sizeof(u32); i++)
-		ctx->key[i] = cpu_to_le32(aes.key_enc[i]);
+		ctx->key[i] = cpu_to_le32(((u32 *)keys.enckey)[i]);
 	ctx->key_len = keys.enckeylen;
 
 	memcpy(ctx->ipad, &istate.state, ctx->state_sz);
-- 
1.8.3.1


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

* Re: [PATCH] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin
  2019-11-08  7:46 [PATCH] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin Pascal van Leeuwen
@ 2019-11-08  8:38 ` Antoine Tenart
  2019-11-08  8:40   ` Pascal Van Leeuwen
  0 siblings, 1 reply; 4+ messages in thread
From: Antoine Tenart @ 2019-11-08  8:38 UTC (permalink / raw)
  To: Pascal van Leeuwen
  Cc: linux-crypto, antoine.tenart, herbert, davem, Pascal van Leeuwen

Hi Pascal,

On Fri, Nov 08, 2019 at 08:46:05AM +0100, Pascal van Leeuwen wrote:
> Fixed 2 copy-paste mistakes made during commit 13a1bb93f7b1c9 ("crypto:
> inside-secure - Fixed warnings on inconsistent byte order handling")
> that caused authenc w/ (3)DES to consistently fail on Macchiatobin (but
> strangely work fine on x86+FPGA??).
> Now fully tested on both platforms.

Can you add a Fixes: tag?

Thanks!
Antoine

> Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
> ---
>  drivers/crypto/inside-secure/safexcel_cipher.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-secure/safexcel_cipher.c
> index 98f9fc6..c029956 100644
> --- a/drivers/crypto/inside-secure/safexcel_cipher.c
> +++ b/drivers/crypto/inside-secure/safexcel_cipher.c
> @@ -405,7 +405,8 @@ static int safexcel_aead_setkey(struct crypto_aead *ctfm, const u8 *key,
>  
>  	if (priv->flags & EIP197_TRC_CACHE && ctx->base.ctxr_dma) {
>  		for (i = 0; i < keys.enckeylen / sizeof(u32); i++) {
> -			if (le32_to_cpu(ctx->key[i]) != aes.key_enc[i]) {
> +			if (le32_to_cpu(ctx->key[i]) !=
> +			    ((u32 *)keys.enckey)[i]) {
>  				ctx->base.needs_inv = true;
>  				break;
>  			}
> @@ -459,7 +460,7 @@ static int safexcel_aead_setkey(struct crypto_aead *ctfm, const u8 *key,
>  
>  	/* Now copy the keys into the context */
>  	for (i = 0; i < keys.enckeylen / sizeof(u32); i++)
> -		ctx->key[i] = cpu_to_le32(aes.key_enc[i]);
> +		ctx->key[i] = cpu_to_le32(((u32 *)keys.enckey)[i]);
>  	ctx->key_len = keys.enckeylen;
>  
>  	memcpy(ctx->ipad, &istate.state, ctx->state_sz);
> -- 
> 1.8.3.1
> 

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* RE: [PATCH] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin
  2019-11-08  8:38 ` Antoine Tenart
@ 2019-11-08  8:40   ` Pascal Van Leeuwen
  2019-11-08  8:51     ` Antoine Tenart
  0 siblings, 1 reply; 4+ messages in thread
From: Pascal Van Leeuwen @ 2019-11-08  8:40 UTC (permalink / raw)
  To: Antoine Tenart, Pascal van Leeuwen; +Cc: linux-crypto, herbert, davem

> -----Original Message-----
> From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On Behalf Of
> Antoine Tenart
> Sent: Friday, November 8, 2019 9:38 AM
> To: Pascal van Leeuwen <pascalvanl@gmail.com>
> Cc: linux-crypto@vger.kernel.org; antoine.tenart@bootlin.com; herbert@gondor.apana.org.au;
> davem@davemloft.net; Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> Subject: Re: [PATCH] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin
> 
> Hi Pascal,
> 
> On Fri, Nov 08, 2019 at 08:46:05AM +0100, Pascal van Leeuwen wrote:
> > Fixed 2 copy-paste mistakes made during commit 13a1bb93f7b1c9 ("crypto:
> > inside-secure - Fixed warnings on inconsistent byte order handling")
> > that caused authenc w/ (3)DES to consistently fail on Macchiatobin (but
> > strangely work fine on x86+FPGA??).
> > Now fully tested on both platforms.
> 
> Can you add a Fixes: tag?
> 
Sure I can :-) If I know what I should put in such a Fixes: tag?
(I'm off Googling now, but a response here might be faster :-)

> Thanks!
> Antoine
> 
> > Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
> > ---
> >  drivers/crypto/inside-secure/safexcel_cipher.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-
> secure/safexcel_cipher.c
> > index 98f9fc6..c029956 100644
> > --- a/drivers/crypto/inside-secure/safexcel_cipher.c
> > +++ b/drivers/crypto/inside-secure/safexcel_cipher.c
> > @@ -405,7 +405,8 @@ static int safexcel_aead_setkey(struct crypto_aead *ctfm, const u8
> *key,
> >
> >  	if (priv->flags & EIP197_TRC_CACHE && ctx->base.ctxr_dma) {
> >  		for (i = 0; i < keys.enckeylen / sizeof(u32); i++) {
> > -			if (le32_to_cpu(ctx->key[i]) != aes.key_enc[i]) {
> > +			if (le32_to_cpu(ctx->key[i]) !=
> > +			    ((u32 *)keys.enckey)[i]) {
> >  				ctx->base.needs_inv = true;
> >  				break;
> >  			}
> > @@ -459,7 +460,7 @@ static int safexcel_aead_setkey(struct crypto_aead *ctfm, const u8
> *key,
> >
> >  	/* Now copy the keys into the context */
> >  	for (i = 0; i < keys.enckeylen / sizeof(u32); i++)
> > -		ctx->key[i] = cpu_to_le32(aes.key_enc[i]);
> > +		ctx->key[i] = cpu_to_le32(((u32 *)keys.enckey)[i]);
> >  	ctx->key_len = keys.enckeylen;
> >
> >  	memcpy(ctx->ipad, &istate.state, ctx->state_sz);
> > --
> > 1.8.3.1
> >
> 
> --
> Antoine Ténart, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com


Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com


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

* Re: [PATCH] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin
  2019-11-08  8:40   ` Pascal Van Leeuwen
@ 2019-11-08  8:51     ` Antoine Tenart
  0 siblings, 0 replies; 4+ messages in thread
From: Antoine Tenart @ 2019-11-08  8:51 UTC (permalink / raw)
  To: Pascal Van Leeuwen
  Cc: Antoine Tenart, Pascal van Leeuwen, linux-crypto, herbert, davem

On Fri, Nov 08, 2019 at 08:40:29AM +0000, Pascal Van Leeuwen wrote:
> > On Fri, Nov 08, 2019 at 08:46:05AM +0100, Pascal van Leeuwen wrote:
> > > Fixed 2 copy-paste mistakes made during commit 13a1bb93f7b1c9 ("crypto:
> > > inside-secure - Fixed warnings on inconsistent byte order handling")
> > > that caused authenc w/ (3)DES to consistently fail on Macchiatobin (but
> > > strangely work fine on x86+FPGA??).
> > > Now fully tested on both platforms.
> > 
> > Can you add a Fixes: tag?
> > 
> Sure I can :-) If I know what I should put in such a Fixes: tag?
> (I'm off Googling now, but a response here might be faster :-)

:)

Fixes: 13a1bb93f7b1c9 ("crypto: inside-secure - Fixed warnings on inconsistent byte order handling")

Thanks,
Antoine

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2019-11-08  8:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08  7:46 [PATCH] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin Pascal van Leeuwen
2019-11-08  8:38 ` Antoine Tenart
2019-11-08  8:40   ` Pascal Van Leeuwen
2019-11-08  8:51     ` Antoine Tenart

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.