stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "crypto: arm/aes-ce - fix for big endian" has been added to the 4.9-stable tree
@ 2017-01-09 15:26 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-01-09 15:26 UTC (permalink / raw)
  To: ard.biesheuvel, gregkh, herbert; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    crypto: arm/aes-ce - fix for big endian

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     crypto-arm-aes-ce-fix-for-big-endian.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 58010fa6f71c9577922b22e46014b95a4ec80fa0 Mon Sep 17 00:00:00 2001
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Tue, 11 Oct 2016 19:15:20 +0100
Subject: crypto: arm/aes-ce - fix for big endian

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 58010fa6f71c9577922b22e46014b95a4ec80fa0 upstream.

The AES key schedule generation is mostly endian agnostic, with the
exception of the rotation and the incorporation of the round constant
at the start of each round. So implement a big endian specific version
of that part to make the whole routine big endian compatible.

Fixes: 86464859cc77 ("crypto: arm - AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/crypto/aes-ce-glue.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/arch/arm/crypto/aes-ce-glue.c
+++ b/arch/arm/crypto/aes-ce-glue.c
@@ -88,8 +88,13 @@ static int ce_aes_expandkey(struct crypt
 		u32 *rki = ctx->key_enc + (i * kwords);
 		u32 *rko = rki + kwords;
 
+#ifndef CONFIG_CPU_BIG_ENDIAN
 		rko[0] = ror32(ce_aes_sub(rki[kwords - 1]), 8);
 		rko[0] = rko[0] ^ rki[0] ^ rcon[i];
+#else
+		rko[0] = rol32(ce_aes_sub(rki[kwords - 1]), 8);
+		rko[0] = rko[0] ^ rki[0] ^ (rcon[i] << 24);
+#endif
 		rko[1] = rko[0] ^ rki[1];
 		rko[2] = rko[1] ^ rki[2];
 		rko[3] = rko[2] ^ rki[3];


Patches currently in stable-queue which might be from ard.biesheuvel@linaro.org are

queue-4.9/crypto-arm64-aes-neon-fix-for-big-endian.patch
queue-4.9/crypto-arm64-ghash-ce-fix-for-big-endian.patch
queue-4.9/crypto-arm64-aes-ce-fix-for-big-endian.patch
queue-4.9/crypto-arm64-aes-xts-ce-fix-for-big-endian.patch
queue-4.9/efi-efivar_ssdt_load-don-t-return-success-on-allocation-failure.patch
queue-4.9/crypto-arm-aes-ce-fix-for-big-endian.patch
queue-4.9/crypto-arm64-aes-ccm-ce-fix-for-big-endian.patch
queue-4.9/crypto-arm64-sha2-ce-fix-for-big-endian.patch
queue-4.9/crypto-arm64-sha1-ce-fix-for-big-endian.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-09 15:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-09 15:26 Patch "crypto: arm/aes-ce - fix for big endian" has been added to the 4.9-stable tree gregkh

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).