openssl/crypto/dh
Jake Massimo af6ce3b46c Increase rounds of Miller-Rabin testing DH_check
DH_check is used to test the validity of Diffie-Hellman parameter sets (p, q, g). Among the tests performed are primality tests on p and q, for this BN_is_prime_ex is called with the rounds of Miller-Rabin set as default. This will therefore use the average case error estimates derived from the function BN_prime_checks_for_size based on the bit size of the number tested.

However, these bounds are only accurate on testing random input. Within this testing scenario, where we are checking the validity of a DH parameter set, we can not assert that these parameters are randomly generated. Thus we must treat them as if they are adversarial in nature and increase the rounds of Miller-Rabin performed.

Generally, each round of Miller-Rabin can declare a composite number prime with probability at most (1/4), thus 64 rounds is sufficient in thwarting known generation techniques (even in safe prime settings - see https://eprint.iacr.org/2019/032 for full analysis). The choice of 64 rounds is also consistent with SRP_NUMBER_ITERATIONS_FOR_PRIME 64 as used in srp_Verify_N_and_g in openssl/apps/s_client.c.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8593)

(cherry picked from commit 2500c093aa)
2019-03-27 15:03:55 +00:00
..
build.info DH named parameter support 2017-10-12 02:40:30 +01:00
dh192.pem
dh512.pem
dh1024.pem
dh2048.pem
dh4096.pem
dh_ameth.c Support public key and param check in EVP interface 2017-11-20 07:20:30 +01:00
dh_asn1.c
dh_check.c Increase rounds of Miller-Rabin testing DH_check 2019-03-27 15:03:55 +00:00
dh_depr.c
dh_err.c Set error code on alloc failures 2018-04-03 11:31:16 -04:00
dh_gen.c Added NULL check to BN_clear() & BN_CTX_end() 2019-03-19 07:28:39 +01:00
dh_kdf.c Use "" not <> on e_os.h include 2017-08-22 11:07:56 -04:00
dh_key.c Added NULL check to BN_clear() & BN_CTX_end() 2019-03-19 07:28:39 +01:00
dh_lib.c Harmonize the error handling codepath 2018-09-05 15:22:35 +03:00
dh_locl.h
dh_meth.c Update copyright year 2018-04-03 13:57:12 +01:00
dh_pmeth.c Update copyright year 2018-04-17 15:18:40 +02:00
dh_prn.c Remove parentheses of return. 2017-10-18 16:05:06 +01:00
dh_rfc5114.c
dh_rfc7919.c Fix memory leak in DH_get_nid() 2017-10-12 12:21:28 -05:00