aboutsummaryrefslogtreecommitdiff
path: root/src/io/cli.c
diff options
context:
space:
mode:
authorJ08nY2017-05-23 19:47:10 +0200
committerJ08nY2017-05-23 19:47:10 +0200
commitca21d236ea409fa40f4bda693777054add7ef73f (patch)
tree2f48596d5a28c631be159bed5637e3350f187f4b /src/io/cli.c
parent3f9e42b055c305f05da3f57b2501600488d377a7 (diff)
downloadecgen-ca21d236ea409fa40f4bda693777054add7ef73f.tar.gz
ecgen-ca21d236ea409fa40f4bda693777054add7ef73f.tar.zst
ecgen-ca21d236ea409fa40f4bda693777054add7ef73f.zip
Diffstat (limited to 'src/io/cli.c')
-rw-r--r--src/io/cli.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/io/cli.c b/src/io/cli.c
index dadb65e..d4114c4 100644
--- a/src/io/cli.c
+++ b/src/io/cli.c
@@ -42,6 +42,7 @@ struct argp_option cli_options[] = {
{0, 0, 0, 0, "Field specification:", 1},
{"fp", OPT_FP, 0, 0, "Prime field.", 1},
{"f2m", OPT_F2M, 0, 0, "Binary field.", 1},
+
{0, 0, 0, 0, "Generation options:", 2},
{"random", OPT_RANDOM, 0, 0, "Generate a random curve (using Random approach).", 2},
{"prime", OPT_PRIME, 0, 0, "Generate a curve with prime order.", 2},
@@ -49,17 +50,19 @@ struct argp_option cli_options[] = {
{"koblitz", OPT_KOBLITZ, 0, 0, "Generate a Koblitz curve (a = 0).", 2},
{"unique", OPT_UNIQUE, 0, 0, "Generate a curve with only one generator.", 2},
{"anomalous", OPT_ANOMALOUS, 0, 0, "Generate an anomalous curve (of trace one, with field order equal to curve order).", 2},
- {"points", OPT_POINTS, "TYPE", 0, "Generate points of given type (random/prime/none).", 2},
+ {"points", OPT_POINTS, "TYPE", 0, "Generate points of given type (random/prime/all/none).", 2},
{"seed", OPT_SEED, "SEED", OPTION_ARG_OPTIONAL, "Generate a curve from SEED (ANSI X9.62 verifiable procedure). **NOT IMPLEMENTED**", 2},
{"invalid", OPT_INVALID, 0, 0, "Generate a set of invalid curves, for a given curve (using Invalid curve algorithm).", 2},
{"order", OPT_ORDER, "ORDER", 0, "Generate a curve with given order (using Complex Multiplication). **NOT IMPLEMENTED**", 2},
{"count", OPT_COUNT, "COUNT", 0, "Generate multiple curves.", 2},
+
{0, 0, 0, 0, "Input/Output options:", 3},
{"format", OPT_FORMAT, "FORMAT", 0, "Format to output in. One of [csv,json], default is json.", 3},
{"input", OPT_INPUT, "FILE", 0, "Input from file.", 3},
{"output", OPT_OUTPUT, "FILE", 0, "Output into file. Overwrites any existing file!", 3},
{"append", OPT_APPEND, 0, 0, "Append to output file (don't overwrite).", 3},
{"verbose", OPT_VERBOSE, "FILE", OPTION_ARG_OPTIONAL, "Verbose logging (to stdout or file).", 3},
+
{0, 0, 0, 0, "Other:", 4},
{"data-dir", OPT_DATADIR, "DIR", 0, "Set PARI/GP data directory (containing seadata package).", 4},
{"memory", OPT_MEMORY, "SIZE", 0, "Use PARI stack of SIZE (can have suffix k/m/g).", 4},
@@ -186,16 +189,18 @@ error_t cli_parse(int key, char *arg, struct argp_state *state) {
break;
case OPT_POINTS:
if (arg) {
+ long pts = strtol(arg, NULL, 10);
+ cfg->points.amount = (size_t)pts;
if (strstr(arg, "random")) {
- long pts = strtol(arg, NULL, 10);
cfg->points.type = POINTS_RANDOM;
- cfg->points.amount = (size_t)pts;
} else if (strstr(arg, "prime")) {
cfg->points.type = POINTS_PRIME;
+ } else if (strstr(arg, "all")) {
+ cfg->points.type = POINTS_ALL;
} else if (strstr(arg, "none")) {
cfg->points.type = POINTS_NONE;
} else {
- argp_failure(state, 1, 0, "Unknow point type");
+ argp_failure(state, 1, 0, "Unknown point type.");
}
} else {
argp_failure(state, 1, 0,