Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e09287df authored by Stephan Mueller's avatar Stephan Mueller Committed by Herbert Xu
Browse files

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: default avatarStephan Mueller <smueller@chronox.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 59df87c3
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -35,8 +35,8 @@ int rsa_get_n(void *context, size_t hdrlen, unsigned char tag,
			n_sz--;
			n_sz--;
		}
		}


		/* In FIPS mode only allow key size 2K & 3K */
		/* In FIPS mode only allow key size 2K and higher */
		if (n_sz != 256 && n_sz != 384) {
		if (n_sz < 256) {
			pr_err("RSA: key size not allowed in FIPS mode\n");
			pr_err("RSA: key size not allowed in FIPS mode\n");
			return -EINVAL;
			return -EINVAL;
		}
		}