Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: rsa - allow keys >= 2048 bits in FIPS mode

With a public notification, NIST now allows the use of RSA keys with a
modulus >= 2048 bits. The new rule allows any modulus size >= 2048 bits
provided that either 2048 or 3072 bits are supported at least so that
the entire RSA implementation can be CAVS tested.

This patch fixes the inability to boot the kernel in FIPS mode, because
certs/x509.genkey defines a 4096 bit RSA key per default. This key causes
the RSA signature verification to fail in FIPS mode without the patch
below.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Stephan Mueller and committed by
Herbert Xu
e09287df 59df87c3

+2 -2
+2 -2
crypto/rsa_helper.c
··· 35 35 n_sz--; 36 36 } 37 37 38 - /* In FIPS mode only allow key size 2K & 3K */ 39 - if (n_sz != 256 && n_sz != 384) { 38 + /* In FIPS mode only allow key size 2K and higher */ 39 + if (n_sz < 256) { 40 40 pr_err("RSA: key size not allowed in FIPS mode\n"); 41 41 return -EINVAL; 42 42 }