blob: 0458744fc754a018ca9ede900d0ddcf663979a71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* TomsFastMath, a fast ISO C bignum library.
*
* This project is public domain and free for all purposes.
*
* Love Hornquist Astrand <lha@h5l.org>
*/
#include <tommath.h>
int mp_find_prime(mp_int *a)
{
int res;
if (mp_iseven(a))
mp_add_d(a, 1, a);
do {
if ((res = mp_isprime(a)) == MP_NO) {
mp_add_d(a, 2, a);
continue;
}
} while (res != MP_YES);
return res;
}
|