From 36ac7bc8a9c856bcdff6eecdaca128ccc5430a1e Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Fri, 28 Aug 2015 12:41:50 -0400 Subject: [PATCH] GH367 follow-up, for more clarity MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rich Salz Reviewed-by: Emilia Käsper --- crypto/dsa/dsa_gen.c | 8 ++++---- doc/crypto/DSA_generate_parameters.pod | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c index a4fae17667..97110ef90b 100644 --- a/crypto/dsa/dsa_gen.c +++ b/crypto/dsa/dsa_gen.c @@ -136,7 +136,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, if (seed_len < (size_t)qsize) return 0; if (seed_len > (size_t)qsize) { - /* Don't overflow seed local variable. */ + /* Only consume as much seed as is expected. */ seed_len = qsize; } memcpy(seed, seed_in, seed_len); @@ -163,13 +163,13 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, for (;;) { for (;;) { /* find q */ - int seed_is_random = seed_in == NULL; + int use_random_seed = (seed_in == NULL); /* step 1 */ if (!BN_GENCB_call(cb, 0, m++)) goto err; - if (seed_is_random) { + if (use_random_seed) { if (RAND_bytes(seed, qsize) <= 0) goto err; } else { @@ -201,7 +201,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, /* step 4 */ r = BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx, - seed_is_random, cb); + use_random_seed, cb); if (r > 0) break; if (r != 0) diff --git a/doc/crypto/DSA_generate_parameters.pod b/doc/crypto/DSA_generate_parameters.pod index 92c89a07eb..ae13023d42 100644 --- a/doc/crypto/DSA_generate_parameters.pod +++ b/doc/crypto/DSA_generate_parameters.pod @@ -25,7 +25,7 @@ for use in the DSA and stores the result in B. B is the length of the prime p to be generated. For lengths under 2048 bits, the length of q is 160 bits; for lengths -at least 2048, it is set to 256 bits. +greater than or equal to 2048 bits, the length of q is set to 256 bits. If B is NULL, the primes will be generated at random. If B is less than the length of q, an error is returned. -- 2.25.1