summaryrefslogtreecommitdiffhomepage
path: root/libtommath/bn_mp_prime_rabin_miller_trials.c
diff options
context:
space:
mode:
authorSteffen Jaeckel <s@jaeckel.eu>2019-09-17 16:11:09 +0200
committerMatt Johnston <matt@ucc.asn.au>2019-09-17 22:11:09 +0800
commitc71258625db4091b26b87b242f72405c7afc3fb7 (patch)
tree4d3dac2bfeab5e4f03f0a197de748ab965a0dad0 /libtommath/bn_mp_prime_rabin_miller_trials.c
parent615ed4e46a52b6bfe0bfc581b8c2fbcc6cc488d1 (diff)
Prime-related bugfixes (#81)
* Merge pull request #180 from czurnieden/isprimeerror Fixed bug in mp_prime_isprime (cherry picked from commit f3ff7064f3301a2fc11b84d389fd67769862d437) * do 2 MR rounds for numbers >=2048bits * back-port modified mp_prime_next_prime()
Diffstat (limited to 'libtommath/bn_mp_prime_rabin_miller_trials.c')
-rw-r--r--libtommath/bn_mp_prime_rabin_miller_trials.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c
index 4c4051e..d92c20f 100644
--- a/libtommath/bn_mp_prime_rabin_miller_trials.c
+++ b/libtommath/bn_mp_prime_rabin_miller_trials.c
@@ -29,8 +29,7 @@ static const struct {
{ 768, 5 },
{ 896, 4 },
{ 1024, 4 },
- { 2048, 2 },
- { 4096, 1 },
+ { 2048, 2 } /* For bigger keysizes use always at least 2 Rounds */
};
/* returns # of RM trials required for a given bit size and max. error of 2^(-96)*/
@@ -45,7 +44,7 @@ int mp_prime_rabin_miller_trials(int size)
return (x == 0) ? sizes[0].t : sizes[x - 1].t;
}
}
- return sizes[x-1].t + 1;
+ return sizes[x-1].t;
}