summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/hcrypto/imath/iprime.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-08-26 19:35:52 +0200
committerStefan Metzmacher <metze@samba.org>2008-08-26 19:46:38 +0200
commit243321b4bbe273cf3a9105ca132caa2b53e2f263 (patch)
treec8588a032720412a9a510d4045d6ca6e5c961ee7 /source4/heimdal/lib/hcrypto/imath/iprime.c
parent455f5c043d1416136a16a0bb6e463d855a913409 (diff)
downloadsamba-243321b4bbe273cf3a9105ca132caa2b53e2f263.tar.gz
samba-243321b4bbe273cf3a9105ca132caa2b53e2f263.tar.bz2
samba-243321b4bbe273cf3a9105ca132caa2b53e2f263.zip
heimdal: import heimdal's trunk svn rev 23697 + lorikeet-heimdal patches
This is based on f56a3b1846c7d462542f2e9527f4d0ed8a34748d in my heimdal-wip repo. metze (This used to be commit 467a1f2163a63cdf1a4c83a69473db50e8794f53)
Diffstat (limited to 'source4/heimdal/lib/hcrypto/imath/iprime.c')
-rw-r--r--[-rwxr-xr-x]source4/heimdal/lib/hcrypto/imath/iprime.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source4/heimdal/lib/hcrypto/imath/iprime.c b/source4/heimdal/lib/hcrypto/imath/iprime.c
index 6313bab1b7..2bc9e7a6d1 100755..100644
--- a/source4/heimdal/lib/hcrypto/imath/iprime.c
+++ b/source4/heimdal/lib/hcrypto/imath/iprime.c
@@ -1,10 +1,10 @@
/*
Name: iprime.c
Purpose: Pseudoprimality testing routines
- Author: M. J. Fromberger <http://www.dartmouth.edu/~sting/>
- Info: $Id: iprime.c 19737 2007-01-05 21:01:48Z lha $
+ Author: M. J. Fromberger <http://spinning-yarns.org/michael/>
+ Info: $Id: iprime.c 635 2008-01-08 18:19:40Z sting $
- Copyright (C) 2002 Michael J. Fromberger, All Rights Reserved.
+ Copyright (C) 2002-2008 Michael J. Fromberger, All Rights Reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -47,7 +47,9 @@ static const int s_ptab[] = {
773, 787, 797, 809, 811, 821, 823, 827, 829, 839,
853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
- 991, 997, 1009, 1013, 1019, 1021, 1031, 1033,
+ 991, 997
+#ifdef IMATH_LARGE_PRIME_TABLE
+ , 1009, 1013, 1019, 1021, 1031, 1033,
1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091,
1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,
1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213,
@@ -110,10 +112,10 @@ static const int s_ptab[] = {
4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889,
4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951,
4957, 4967, 4969, 4973, 4987, 4993, 4999
+#endif
};
static const int s_ptab_size = sizeof(s_ptab)/sizeof(s_ptab[0]);
-
/* {{{ mp_int_is_prime(z) */
/* Test whether z is likely to be prime:
@@ -122,7 +124,8 @@ static const int s_ptab_size = sizeof(s_ptab)/sizeof(s_ptab[0]);
*/
mp_result mp_int_is_prime(mp_int z)
{
- int i, rem;
+ int i;
+ mp_small rem;
mp_result res;
/* First check for divisibility by small primes; this eliminates a