diff options
| author | J08nY | 2017-03-25 19:06:49 +0100 |
|---|---|---|
| committer | J08nY | 2017-03-25 19:06:49 +0100 |
| commit | 7c01c2c0088b56def7ee2b7fe638b21fe1206981 (patch) | |
| tree | 824cd0790ff1629e72fd1b0b8470f486fddc7ba0 /src | |
| parent | 63da66f5a5ae9532430215ec854f7f7d238b96ec (diff) | |
| download | ecgen-7c01c2c0088b56def7ee2b7fe638b21fe1206981.tar.gz ecgen-7c01c2c0088b56def7ee2b7fe638b21fe1206981.tar.zst ecgen-7c01c2c0088b56def7ee2b7fe638b21fe1206981.zip | |
Added option to request no points on the curve
--points=none
Diffstat (limited to 'src')
| -rw-r--r-- | src/exhaustive/exhaustive.c | 3 | ||||
| -rw-r--r-- | src/io/cli.c | 4 | ||||
| -rw-r--r-- | src/io/cli.h | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/exhaustive/exhaustive.c b/src/exhaustive/exhaustive.c index 60b00a9..3b16349 100644 --- a/src/exhaustive/exhaustive.c +++ b/src/exhaustive/exhaustive.c @@ -75,6 +75,9 @@ void exhaustive_ginit(gen_t *generators, config_t *cfg) { case POINTS_PRIME: generators[OFFSET_POINTS] = &points_prime; break; + case POINTS_NONE: + generators[OFFSET_POINTS] = &gen_skip; + break; } } diff --git a/src/io/cli.c b/src/io/cli.c index 2ee6aee..d55f59c 100644 --- a/src/io/cli.c +++ b/src/io/cli.c @@ -45,7 +45,7 @@ struct argp_option options[] = { {"order", OPT_ORDER, "ORDER", 0, "Generate a curve with given order (using Complex Multiplication).", 2}, {"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}, - {"points", OPT_POINTS, "TYPE", 0, "Generate points of given type (random/prime).", 2}, + {"points", OPT_POINTS, "TYPE", 0, "Generate points of given type (random/prime/none).", 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}, @@ -138,6 +138,8 @@ error_t cli_parse(int key, char *arg, struct argp_state *state) { cfg->points.amount = (size_t)pts; } else if (strstr(arg, "prime")) { cfg->points.type = POINTS_PRIME; + } else if (strstr(arg, "none")) { + cfg->points.type = POINTS_NONE; } else { argp_failure(state, 1, 0, "Unknow point type"); } diff --git a/src/io/cli.h b/src/io/cli.h index c65f125..e45e939 100644 --- a/src/io/cli.h +++ b/src/io/cli.h @@ -18,7 +18,7 @@ extern struct argp_option options[]; enum field_e { FIELD_PRIME, FIELD_BINARY }; enum format_e { FORMAT_JSON, FORMAT_CSV }; -enum points_e { POINTS_PRIME, POINTS_RANDOM }; +enum points_e { POINTS_PRIME, POINTS_RANDOM, POINTS_NONE }; struct points_s { enum points_e type; size_t amount; |
