select add libtommath

This commit is contained in:
Love Hornquist Astrand
2010-07-18 13:04:03 -07:00
parent 5240043542
commit 6c0c936595
10 changed files with 865 additions and 2 deletions

View File

@@ -0,0 +1,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;
}