From: Pascal van Leeuwen Date: Fri, 8 Nov 2019 09:00:21 +0000 (+0100) Subject: crypto: inside-secure - Fixed authenc w/ (3)DES fails on Macchiatobin X-Git-Tag: baikal/mips/sdk5.9~14900^2~101 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=c9147b8c46bcd9a570d38aee997e252e24cf1320;p=kernel.git 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: de4bd640af5b17 ("crypto: inside-secure - Fixed warnings...") Signed-off-by: Pascal van Leeuwen Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-secure/safexcel_cipher.c index 98f9fc60c268e..c02995694b41a 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);