GH367: use random data if seed too short.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 6f997dc36504d67d1339ceb6bce4ecba673d8568)
This commit is contained in:
Ismo Puustinen 2015-09-18 16:07:23 -04:00 committed by Rich Salz
parent b0c8e38e33
commit 72ac982306
2 changed files with 2 additions and 2 deletions

View File

@ -201,7 +201,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

@ -23,7 +23,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() places the iteration count in DSA_generate_parameters() 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