summaryrefslogtreecommitdiff
path: root/bignum-random.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2013-01-31 21:04:06 +0100
committerNiels Möller <nisse@lysator.liu.se>2013-01-31 21:04:06 +0100
commit5172adc35ef2eae3d9c7bfd61485794cd6893295 (patch)
tree425709c9459bc9594461af994c2070e5e374de22 /bignum-random.c
parenta6671dc550514c152da3e77895341623c52a6d31 (diff)
downloadnettle-5172adc35ef2eae3d9c7bfd61485794cd6893295.tar.gz
nettle_mpz_random: Increased number of extra bits to 64, following FIPS 186-3.
Diffstat (limited to 'bignum-random.c')
-rw-r--r--bignum-random.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bignum-random.c b/bignum-random.c
index ab8c4f14..f305f040 100644
--- a/bignum-random.c
+++ b/bignum-random.c
@@ -75,11 +75,12 @@ nettle_mpz_random(mpz_t x,
*/
/* Add a few bits extra, to decrease the bias from the final modulo
- * operation. */
+ * operation. NIST FIPS 186-3 specifies 64 extra bits, for use with
+ * DSA. */
nettle_mpz_random_size(x,
ctx, random,
- mpz_sizeinbase(n, 2) + 16);
+ mpz_sizeinbase(n, 2) + 64);
mpz_fdiv_r(x, x, n);
}