projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove vestiges of @primorial@.
[u/mdw/catacomb]
/
dsa-gen.c
diff --git
a/dsa-gen.c
b/dsa-gen.c
index
3943dd5
..
1e7fdc7
100644
(file)
--- a/
dsa-gen.c
+++ b/
dsa-gen.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: dsa-gen.c,v 1.
6 2000/07/29 10:00:14
mdw Exp $
+ * $Id: dsa-gen.c,v 1.
8 2000/10/08 12:12:47
mdw Exp $
*
* Generate DSA shared parameters
*
*
* Generate DSA shared parameters
*
@@
-30,6
+30,13
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: dsa-gen.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: dsa-gen.c,v $
+ * Revision 1.8 2000/10/08 12:12:47 mdw
+ * Use @MP_EQ@ instead of @MP_CMP@. Remove vestages of @primorial@.
+ *
+ * Revision 1.7 2000/08/15 21:45:05 mdw
+ * Use the new trial division equipment in pfilt. This gives a 10%
+ * performance improvement in dsa-gen.t.
+ *
* Revision 1.6 2000/07/29 10:00:14 mdw
* Rename `dsa_seed' to `dsa_gen' for consistency with other parameter-
* generation interfaces.
* Revision 1.6 2000/07/29 10:00:14 mdw
* Rename `dsa_seed' to `dsa_gen' for consistency with other parameter-
* generation interfaces.
@@
-63,7
+70,6
@@
#include "mprand.h"
#include "pgen.h"
#include "prim.h"
#include "mprand.h"
#include "pgen.h"
#include "prim.h"
-#include "primorial.h"
#include "sha.h"
/*----- The DSA stepper ---------------------------------------------------*/
#include "sha.h"
/*----- The DSA stepper ---------------------------------------------------*/
@@
-100,15
+106,7
@@
static int next(pgen_event *ev, dsa_stepctx *d)
/* --- Do the trial division --- */
/* --- Do the trial division --- */
- {
- mp *g = MP_NEW;
- mp_gcd(&g, 0, 0, m, primorial);
- if (MP_CMP(g, ==, MP_ONE) || MP_CMP(g, ==, m))
- rc = PGEN_TRY;
- else
- rc = PGEN_FAIL;
- mp_drop(g);
- }
+ rc = pfilt_smallfactor(m);
/* --- Return the result --- */
/* --- Return the result --- */
@@
-123,7
+121,6
@@
int dsa_step(int rq, pgen_event *ev, void *p)
switch (rq) {
case PGEN_BEGIN:
switch (rq) {
case PGEN_BEGIN:
- primorial_setup();
case PGEN_TRY:
return (next(ev, d));
case PGEN_DONE:
case PGEN_TRY:
return (next(ev, d));
case PGEN_DONE:
@@
-244,8
+241,8
@@
static int verify(dstr *v)
int rc;
rc = dsa_gen(&dp, 160, l, 1, v[0].buf, v[0].len, pgen_evspin, 0);
int rc;
rc = dsa_gen(&dp, 160, l, 1, v[0].buf, v[0].len, pgen_evspin, 0);
- if (rc ||
MP_CMP(q, !=
, dp.q) ||
-
MP_CMP(p, !=, dp.p) || MP_CMP(g, !=
, dp.g)) {
+ if (rc ||
!MP_EQ(q
, dp.q) ||
+
!MP_EQ(p, dp.p) || !MP_EQ(g
, dp.g)) {
fputs("\n*** gen failed", stderr);
fputs("\nseed = ", stderr); type_hex.dump(&v[0], stderr);
fprintf(stderr, "\nl = %u", l);
fputs("\n*** gen failed", stderr);
fputs("\nseed = ", stderr); type_hex.dump(&v[0], stderr);
fprintf(stderr, "\nl = %u", l);
@@
-265,7
+262,7
@@
static int verify(dstr *v)
if (!rc) {
mp_drop(dp.q); mp_drop(dp.p); mp_drop(dp.g);
}
if (!rc) {
mp_drop(dp.q); mp_drop(dp.p); mp_drop(dp.g);
}
- assert(mparena_count(MPARENA_GLOBAL) ==
1); /* Primorial! */
+ assert(mparena_count(MPARENA_GLOBAL) ==
0);
return (ok);
}
return (ok);
}