rsa: Do not allow less than 512 bit RSA keys
authorSebastian Andrzej Siewior <sebastian@breakpoint.cc>
Wed, 18 Oct 2017 11:30:23 +0000 (13:30 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 11 Dec 2017 11:53:07 +0000 (12:53 +0100)
commitcac19d19e7d6f252ff9aea60d85e0c0fd71a117f
treec99c44c5a70e11d5662f4e187e1fa34bf67f923d
parenta8ea8018fa187e22fb4989450b550589e20f62c2
rsa: Do not allow less than 512 bit RSA keys

As per documentation, the RSA keys should not be smaller than 64bit (the
documentation mentions something about a quirk in the prime generation
algorithm). I am adding check into the code which used to be 16 for some
reason.
My primary motivation is to get rid of the last sentence in the
documentation which suggest that typical keys have 1024 bits (instead
updating it to the now default 2048).
I *assume* that keys less than the 2048 bits (say 512) are used for
education purposes.
The 512 bits as the minimum have been suggested by Bernd Edlinger.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4547)
crypto/rsa/rsa_gen.c
crypto/rsa/rsa_locl.h
crypto/rsa/rsa_pmeth.c
doc/man1/genrsa.pod
test/recipes/15-test_genrsa.t