Skip to contentSkip to conversation

Patch "s390/crypto: Extend key length check for AES-XTS in fips mode." has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Nov 6, 2017

Subsystems (4)
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

s390/crypto: Extend key length check for AES-XTS in fips mode.

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:
s390-crypto-extend-key-length-check-for-aes-xts-in-fips-mode.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 foo@baz Mon Nov 6 10:07:36 CET 2017

From: Harald Freudenberger <[email protected]>
Date: Sat, 7 Oct 2017 22:36:57 +0000
Subject: s390/crypto: Extend key length check for AES-XTS in fips mode.

From: Harald Freudenberger <[email protected]>

[ Upstream commit a4f2779ecf2f42b0997fedef6fd20a931c40a3e3 ]

In fips mode only xts keys with 128 bit or 125 bit are allowed. This fix extends the xts_aes_set_key function to check for these valid key lengths in fips mode.

---
 arch/s390/crypto/aes_s390.c |    7 +++++++
 1 file changed, 7 insertions(+)
arch/s390/crypto/aes_s390.c +7 -0
@@ -28,6 +28,7 @@
 #include <linux/cpufeature.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <linux/fips.h>
 #include <crypto/xts.h>
 #include <asm/cpacf.h>
 
@@ -501,6 +502,12 @@ static int xts_aes_set_key(struct crypto
 	if (err)
 		return err;
 
+	/* In fips mode only 128 bit or 256 bit keys are valid */
+	if (fips_enabled && key_len != 32 && key_len != 64) {
+		tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
+		return -EINVAL;
+	}
+
 	/* Pick the correct function code based on the key length */
 	fc = (key_len == 32) ? CPACF_KM_XTS_128 :
 	     (key_len == 64) ? CPACF_KM_XTS_256 : 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/s390-crypto-extend-key-length-check-for-aes-xts-in-fips-mode.patch queue-4.9/s390-prng-adjust-generation-of-entropy-to-produce-real-256-bits.patch