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