GH367: use random data if seed too short.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
This commit is contained in:
Ismo Puustinen 2015-09-18 16:07:23 -04:00 committed by Rich Salz
parent 21b538d616
commit 6f997dc365
2 changed files with 2 additions and 2 deletions

View File

@ -203,7 +203,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
if (!BN_GENCB_call(cb, 0, m++)) if (!BN_GENCB_call(cb, 0, m++))
goto err; goto err;
if (!seed_len) { if (!seed_len || !seed_in) {
if (RAND_pseudo_bytes(seed, qsize) < 0) if (RAND_pseudo_bytes(seed, qsize) < 0)
goto err; goto err;
seed_is_random = 1; seed_is_random = 1;

View File

@ -29,7 +29,7 @@ maximum of 1024 bits.
If B<seed> is B<NULL> or B<seed_len> E<lt> 20, the primes will be If B<seed> is B<NULL> or B<seed_len> E<lt> 20, the primes will be
generated at random. Otherwise, the seed is used to generate generated at random. Otherwise, the seed is used to generate
them. If the given seed does not yield a prime q, a new random them. If the given seed does not yield a prime q, a new random
seed is chosen and placed at B<seed>. seed is chosen.
DSA_generate_parameters_ex() places the iteration count in DSA_generate_parameters_ex() places the iteration count in
*B<counter_ret> and a counter used for finding a generator in *B<counter_ret> and a counter used for finding a generator in