projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't use @va_arg@ as an argument to @STORE32@!
[u/mdw/catacomb]
/
pgen-gcd.c
diff --git
a/pgen-gcd.c
b/pgen-gcd.c
index
cd23c37
..
35b770a
100644
(file)
--- a/
pgen-gcd.c
+++ b/
pgen-gcd.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: pgen-gcd.c,v 1.
1 2000/06/17 11:51:53
mdw Exp $
+ * $Id: pgen-gcd.c,v 1.
2 2000/07/01 11:09:20
mdw Exp $
*
* Prime search stepper ensuring a low GCD for %$(p - 1)/2$%
*
*
* Prime search stepper ensuring a low GCD for %$(p - 1)/2$%
*
@@
-30,6
+30,10
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: pgen-gcd.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: pgen-gcd.c,v $
+ * Revision 1.2 2000/07/01 11:09:20 mdw
+ * (pgen_gcd): Bug fix -- check the GCDs of the right things when deciding
+ * whether to abort.
+ *
* Revision 1.1 2000/06/17 11:51:53 mdw
* Filter which imposes additional restrictions on GCD of %$(p - 1)/2$%
* with a given integer.
* Revision 1.1 2000/06/17 11:51:53 mdw
* Filter which imposes additional restrictions on GCD of %$(p - 1)/2$%
* with a given integer.
@@
-52,16
+56,24
@@
int pgen_gcdstep(int rq, pgen_event *ev, void *p)
/* --- Set everything up --- *
*
/* --- Set everything up --- *
*
- * Call things off if @q@ and @jq@ have common factors.
+ * Call things off if @p@ and @jp@ have common factors, or if @q@, @r@
+ * and @jq@ have common factors greater than @max@.
*/
case PGEN_BEGIN: {
mp *p = ev->m;
*/
case PGEN_BEGIN: {
mp *p = ev->m;
+ mp_gcd(&g->g, 0, 0, p, g->jp.m);
+ if (MP_CMP(g->g, >, MP_ONE))
+ return (PGEN_ABORT);
g->q = mp_lsr(MP_NEW, p, 1);
g->jq = mp_lsr(MP_NEW, g->jp.m, 1);
mp_gcd(&g->g, 0, 0, g->q, g->jq);
g->q = mp_lsr(MP_NEW, p, 1);
g->jq = mp_lsr(MP_NEW, g->jp.m, 1);
mp_gcd(&g->g, 0, 0, g->q, g->jq);
- if (MP_CMP(g->g, >, MP_ONE))
+ mp_gcd(&g->g, 0, 0, g->g, g->r);
+ if (MP_CMP(g->g, >, g->max)) {
+ mp_drop(g->q);
+ mp_drop(g->jq);
return (PGEN_ABORT);
return (PGEN_ABORT);
+ }
rc = pfilt_create(&g->p, p);
mp_drop(p);
} break;
rc = pfilt_create(&g->p, p);
mp_drop(p);
} break;