* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* Use: Parses an elliptic curve description, which has the form
*
* * a field description
- * * an optional `/'
+ * * an optional `;'
* * `prime', `primeproj', `bin', or `binproj'
* * an optional `:'
* * the %$a$% parameter
field *f;
if ((f = field_parse(qd)) == 0) goto fail;
- qd_delim(qd, '/');
+ qd_delim(qd, ';');
switch (qd_enum(qd, "prime,primeproj,bin,binproj")) {
case 0:
if (F_TYPE(f) != FTY_PRIME) {
return (0);
}
-/* --- @getinfo@ --- *
+/* --- @ec_infofromdata@ --- *
*
* Arguments: @ec_info *ei@ = where to write the information
* @ecdata *ed@ = raw data
* curves.
*/
-static void getinfo(ec_info *ei, ecdata *ed)
+void ec_infofromdata(ec_info *ei, ecdata *ed)
{
field *f;
* curve, or it has the form
*
* * elliptic curve description
- * * optional `/'
+ * * optional `;'
* * common point
* * optional `:'
* * group order
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) {
+ ec_infofromdata(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 (!ec_ptparse(qd, &g)) goto fail;
qd_delim(qd, ':'); if ((r = qd_getmp(qd)) == 0) goto fail;
qd_delim(qd, '*'); if ((h = qd_getmp(qd)) == 0) goto fail;
ei->c = c; ei->g = g; ei->r = r; ei->h = h;
}
}
} else {
- fputs("checking standard curves...\n", stdout);
+ fputs("checking standard curves:", stdout);
+ fflush(stdout);
for (ee = ectab; ee->name; ee++) {
ec_info ei;
- printf(" %s: ", ee->name);
- fflush(stdout);
- getinfo(&ei, ee->data);
+ ec_infofromdata(&ei, ee->data);
e = ec_checkinfo(&ei, gr);
ec_freeinfo(&ei);
if (e) {
- printf("fails: %s\n", e);
+ printf(" [%s fails: %s]", ee->name, e);
ok = 0;
} else
- fputs("ok\n", stdout);
+ printf(" %s", ee->name);
fflush(stdout);
}
- if (ok)
- fputs("all ok\n", stdout);
+ fputs(ok ? " ok\n" : " failed\n", stdout);
}
gr->ops->destroy(gr);
return (!ok);