X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/1ba83484ee5bb486da9aa958576de4bc29ef0c1d..34e4f738bcba58e6d8c4cabbb0b3232a65b42a9d:/ec-test.c diff --git a/ec-test.c b/ec-test.c index 2f81015..1307e32 100644 --- a/ec-test.c +++ b/ec-test.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: ec-test.c,v 1.3 2004/03/27 17:54:11 mdw Exp $ + * $Id: ec-test.c,v 1.4 2004/04/01 12:50:09 mdw Exp $ * * Code for testing elliptic-curve stuff * @@ -30,6 +30,13 @@ /*----- Revision history --------------------------------------------------* * * $Log: ec-test.c,v $ + * 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. * @@ -110,8 +117,14 @@ static int ecCHECK(ec_curve *cc, const ec *p) return (EC_CHECK(c->real, p)); } +static int ecSAMEP(ec_curve *cc, ec_curve *dd) +{ + ecctx *c = (ecctx *)cc, *d = (ecctx *)dd; + return (ec_samep(c->real, d->real)); +} + static ec_ops ecops = { - ecDESTROY, ecIN, ecOUT, ecFIX, + ecDESTROY, ecSAMEP, ecIN, ecOUT, ecFIX, ecFIND, ecNEG, ecADD, ecSUB, ecDBL, ecCHECK }; @@ -120,6 +133,8 @@ static ec_curve *ec_cutout(ec_curve *real, const char *name) 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;