Skip to contentSkip to conversation

Patch "crypto: arm/aes-ce - fix for big endian" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 9, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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 <[email protected]> know about it.

Quoted 1 line

From 58010fa6f71c9577922b22e46014b95a4ec80fa0 Mon Sep 17 00:00:00 2001

From: Ard Biesheuvel <[email protected]>
Date: Tue, 11 Oct 2016 19:15:20 +0100
Subject: crypto: arm/aes-ce - fix for big endian

From: Ard Biesheuvel <[email protected]>

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")
---
 arch/arm/crypto/aes-ce-glue.c |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/crypto/aes-ce-glue.c +5 -0
@@ -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 [email protected] 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