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