/* -*-c-*-
*
- * $Id: ec-test.c,v 1.3 2004/03/27 17:54:11 mdw Exp $
+ * $Id: ec-test.c,v 1.5 2004/04/02 01:03:49 mdw Exp $
*
* Code for testing elliptic-curve stuff
*
/*----- Revision history --------------------------------------------------*
*
* $Log: ec-test.c,v $
+ * Revision 1.5 2004/04/02 01:03:49 mdw
+ * Miscellaneous constification.
+ *
+ * Revision 1.4 2004/04/01 12:50:09 mdw
+ * Add cyclic group abstraction, with test code. Separate off exponentation
+ * functions for better static linking. Fix a buttload of bugs on the way.
+ * Generally ensure that negative exponents do inversion correctly. Add
+ * table of standard prime-field subgroups. (Binary field subgroups are
+ * currently unimplemented but easy to add if anyone ever finds a good one.)
+ *
* Revision 1.3 2004/03/27 17:54:11 mdw
* Standard curves and curve checking.
*
return (EC_CHECK(c->real, p));
}
-static ec_ops ecops = {
- ecDESTROY, ecIN, ecOUT, ecFIX,
+static int ecSAMEP(ec_curve *cc, ec_curve *dd)
+{
+ ecctx *c = (ecctx *)cc, *d = (ecctx *)dd;
+ return (ec_samep(c->real, d->real));
+}
+
+static const ec_ops ecops = {
+ ecDESTROY, ecSAMEP, ecIN, ecOUT, ecFIX,
ecFIND, ecNEG, ecADD, ecSUB, ecDBL, ecCHECK
};
ecctx *c = CREATE(ecctx);
c->c.f = real->f;
c->c.ops = &ecops;
+ c->c.a = real->a;
+ c->c.b = real->b;
c->magic = MAGIC;
c->name = xstrdup(name);
c->real = real;
fprintf(fp, "%s", ec_name(v));
}
-test_type type_ecurve = { ecvcvt, ecvdump };
+const test_type type_ecurve = { ecvcvt, ecvdump };
static void eccvt(const char *p, dstr *d)
{