/* -*-c-*-
*
- * $Id: ec-info.c,v 1.2 2004/04/01 12:50:09 mdw Exp $
+ * $Id: ec-info.c,v 1.5 2004/04/08 01:36:15 mdw Exp $
*
* Elliptic curve information management
*
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: ec-info.c,v $
- * Revision 1.2 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.1 2004/03/27 17:54:11 mdw
- * Standard curves and curve checking.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include "ec.h"
default:
goto fail;
}
+ if (!c) {
+ qd->e = "bad curve parameters";
+ goto fail;
+ }
if (a) MP_DROP(a);
if (b) MP_DROP(b);
return (c);
f = field_binpoly(&ed->p);
ei->c = ec_binproj(f, &ed->a, &ed->b);
break;
+ case FTAG_BINNORM:
+ f = field_binnorm(&ed->p, &ed->beta);
+ ei->c = ec_binproj(f, &ed->a, &ed->b);
+ break;
default:
abort();
}
+ assert(f); assert(ei->c);
EC_CREATE(&ei->g); ei->g.x = &ed->gx; ei->g.y = &ed->gy; ei->g.z = 0;
ei->r = &ed->r; ei->h = &ed->h;
}
const ecentry *ee;
mp *r = MP_NEW, *h = MP_NEW;
- for (ee = ectab; ee->name; ee++) {
- if (qd_enum(qd, ee->name) >= 0) {
- getinfo(ei, ee->data);
- goto found;
- }
- }
+ for (ee = ectab; ee->name; ee++)
+ if (qd_enum(qd, ee->name) >= 0) { getinfo(ei, ee->data); goto found; }
+
if ((c = ec_curveparse(qd)) == 0) goto fail;
qd_delim(qd, '/'); if (!ec_ptparse(qd, &g)) goto fail;
qd_delim(qd, ':'); if ((r = qd_getmp(qd)) == 0) goto fail;