comparison libtommath/bn_mp_prime_rabin_miller_trials.c @ 1656:a36e545fb43d

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()
author Steffen Jaeckel <s@jaeckel.eu>
date Tue, 17 Sep 2019 16:11:09 +0200
parents f52919ffd3b1
children 1051e4eea25a
comparison
equal deleted inserted replaced
1655:f52919ffd3b1 1656:a36e545fb43d
27 { 512, 7 }, 27 { 512, 7 },
28 { 640, 6 }, 28 { 640, 6 },
29 { 768, 5 }, 29 { 768, 5 },
30 { 896, 4 }, 30 { 896, 4 },
31 { 1024, 4 }, 31 { 1024, 4 },
32 { 2048, 2 }, 32 { 2048, 2 } /* For bigger keysizes use always at least 2 Rounds */
33 { 4096, 1 },
34 }; 33 };
35 34
36 /* returns # of RM trials required for a given bit size and max. error of 2^(-96)*/ 35 /* returns # of RM trials required for a given bit size and max. error of 2^(-96)*/
37 int mp_prime_rabin_miller_trials(int size) 36 int mp_prime_rabin_miller_trials(int size)
38 { 37 {
43 return sizes[x].t; 42 return sizes[x].t;
44 } else if (sizes[x].k > size) { 43 } else if (sizes[x].k > size) {
45 return (x == 0) ? sizes[0].t : sizes[x - 1].t; 44 return (x == 0) ? sizes[0].t : sizes[x - 1].t;
46 } 45 }
47 } 46 }
48 return sizes[x-1].t + 1; 47 return sizes[x-1].t;
49 } 48 }
50 49
51 50
52 #endif 51 #endif
53 52