2019-11-08 09:04:01

by Pascal van Leeuwen

[permalink] [raw]
Subject: [PATCHv4] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin

Fixed 2 copy-paste mistakes in the commit mentioned below that caused
authenc w/ (3)DES to consistently fail on Macchiatobin (but strangely
work fine on x86+FPGA??).
Now fully tested on both platforms.

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

Signed-off-by: Pascal van Leeuwen <[email protected]>
---

changes since v1:
- added Fixes: tag

changes since v2:
- moved Fixes: tag down near other tags

changes since v3:
- moved changelog below the ---

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


2019-11-15 06:07:45

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCHv4] crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin

On Fri, Nov 08, 2019 at 10:00:21AM +0100, Pascal van Leeuwen wrote:
> Fixed 2 copy-paste mistakes in the commit mentioned below that caused
> authenc w/ (3)DES to consistently fail on Macchiatobin (but strangely
> work fine on x86+FPGA??).
> Now fully tested on both platforms.
>
> Fixes: 13a1bb93f7b1c9 ("crypto: inside-secure - Fixed warnings on
> inconsistent byte order handling")
>
> Signed-off-by: Pascal van Leeuwen <[email protected]>
> ---
>
> changes since v1:
> - added Fixes: tag
>
> changes since v2:
> - moved Fixes: tag down near other tags
>
> changes since v3:
> - moved changelog below the ---
>
> drivers/crypto/inside-secure/safexcel_cipher.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

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