X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/432c4e184d44704511a5991b80224a87cb1d4613..4739c68a6cb81cae53cd7df694ecd6176d6f11f8:/ec-test.c diff --git a/ec-test.c b/ec-test.c index 2f81015..e83e3ee 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.6 2004/04/08 01:36:15 mdw Exp $ * * Code for testing elliptic-curve stuff * @@ -27,20 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: ec-test.c,v $ - * Revision 1.3 2004/03/27 17:54:11 mdw - * Standard curves and curve checking. - * - * Revision 1.2 2004/03/27 00:04:46 mdw - * Implement efficient reduction for pleasant-looking primes. - * - * Revision 1.1 2004/03/23 15:19:32 mdw - * Test elliptic curves more thoroughly. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -110,8 +96,14 @@ static int ecCHECK(ec_curve *cc, const ec *p) 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 }; @@ -120,6 +112,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; @@ -158,7 +152,7 @@ static void ecvdump(dstr *d, FILE *fp) 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) {