diff options
Diffstat (limited to 'src/io')
| -rw-r--r-- | src/io/cli.c | 52 | ||||
| -rw-r--r-- | src/io/input.c | 4 | ||||
| -rw-r--r-- | src/io/output.c | 4 |
3 files changed, 29 insertions, 31 deletions
diff --git a/src/io/cli.c b/src/io/cli.c index 12ceabd..011e6a7 100644 --- a/src/io/cli.c +++ b/src/io/cli.c @@ -6,8 +6,8 @@ #include <string.h> char doc[] = - "ecgen, tool for generating Elliptic curve domain parameters.\v(C) 2017 " - "Eastern Seaboard Phishing Authority"; + "ecgen, tool for generating Elliptic curve domain parameters.\v(C) 2017 " + "Eastern Seaboard Phishing Authority"; char args_doc[] = "bits"; enum opt_keys { @@ -28,20 +28,20 @@ enum opt_keys { // clang-format off struct argp_option options[] = { // Field specification - {"fp", OPT_FP, 0, 0, "Prime field."}, - {"f2m", OPT_F2M, 0, 0, "Binary field."}, + {"fp", OPT_FP, 0, 0, "Prime field."}, + {"f2m", OPT_F2M, 0, 0, "Binary field."}, // Curve specification - {"random", OPT_RANDOM, 0, 0, "Generate a random curve."}, - {"prime", OPT_PRIME, 0, 0, "Generate a curve with prime order."}, - {"seed", OPT_SEED, "SEED", OPTION_ARG_OPTIONAL, "Generate a curve from SEED (ANSI X9.62 verifiable procedure)."}, - {"invalid", OPT_INVALID, 0, 0, "Generate a set of invalid curves (for a given curve)."}, - {"order", OPT_ORDER, "ORDER", 0, "Generate a curve with given order (using Complex Multiplication)."}, - {"koblitz", OPT_KOBLITZ, 0, 0, "Generate a Koblitz curve."}, + {"exhaustive", OPT_RANDOM, 0, 0, "Generate a exhaustive curve."}, + {"prime", OPT_PRIME, 0, 0, "Generate a curve with prime order."}, + {"seed", OPT_SEED, "SEED", OPTION_ARG_OPTIONAL, "Generate a curve from SEED (ANSI X9.62 verifiable procedure)."}, + {"invalid", OPT_INVALID, 0, 0, "Generate a set of invalid curves (for a given curve)."}, + {"order", OPT_ORDER, "ORDER", 0, "Generate a curve with given order (using Complex Multiplication)."}, + {"koblitz", OPT_KOBLITZ, 0, 0, "Generate a Koblitz curve."}, // Other - {"data-dir", OPT_DATADIR, "DIR", 0, "PARI/GP data directory (containing seadata package)."}, - {"input", OPT_INPUT, "FILE", 0, "Input from file."}, - {"output", OPT_OUTPUT, "FILE", 0, "Output into file. Overwrites any existing file!"}, - {"append", OPT_APPEND, 0, 0, "Append to output file (don't overwrite)."}, + {"data-dir", OPT_DATADIR, "DIR", 0, "PARI/GP data directory (containing seadata package)."}, + {"input", OPT_INPUT, "FILE", 0, "Input from file."}, + {"output", OPT_OUTPUT, "FILE", 0, "Output into file. Overwrites any existing file!"}, + {"append", OPT_APPEND, 0, 0, "Append to output file (don't overwrite)."}, {0}}; // clang-format on @@ -85,8 +85,8 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) { // ANSI X9.62 specifies seed as at least 160 bits in length. if (strlen(arg) < 20) { argp_failure( - state, 1, 0, - "SEED must be at least 160 bits(20 characters)."); + state, 1, 0, + "SEED must be at least 160 bits(20 characters)."); } cfg->seed = arg; } @@ -111,22 +111,22 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) { // Only one field if (!cfg->prime_field && !cfg->binary_field) { argp_failure(state, 1, 0, - "Specify field type, prime or binary, with --fp / " - "--f2m(but not both)."); + "Specify field type, prime or binary, with --fp / " + "--f2m(but not both)."); } - // Invalid is not prime or seed or random by definition. + // Invalid is not prime or seed or exhaustive by definition. if (cfg->invalid && (cfg->prime || cfg->from_seed || cfg->random)) { - // not seed, not prime, not random + // not seed, not prime, not exhaustive argp_failure(state, 1, 0, - "Invalid curve generation can not generate curves " - "from seed, random or prime order."); + "Invalid curve generation can not generate curves " + "from seed, exhaustive or prime order."); } if (cfg->cm && (cfg->prime || cfg->from_seed || cfg->invalid)) { argp_failure(state, 1, 0, - "Fixed order curve generation can not generate " - "curves from seed, or invalid curves. Prime order " - "also doesn't make sense if the given one isn't " - "prime."); + "Fixed order curve generation can not generate " + "curves from seed, or invalid curves. Prime order " + "also doesn't make sense if the given one isn't " + "prime."); } break; case ARGP_KEY_NO_ARGS: diff --git a/src/io/input.c b/src/io/input.c index 3dcca00..7d6b614 100644 --- a/src/io/input.c +++ b/src/io/input.c @@ -2,8 +2,8 @@ * ecgen, tool for generating Elliptic curve domain parameters * Copyright (C) 2017 J08nY */ -#include <parson/parson.h> #include "input.h" +#include <parson/parson.h> FILE *in; @@ -75,7 +75,7 @@ GEN fread_string(FILE *stream, const char *prompt, int delim) { } GEN fread_param(param_t param, FILE *stream, const char *prompt, long bits, - int delim) { + int delim) { switch (param) { case PARAM_PRIME: return fread_prime(stream, prompt, bits, delim); diff --git a/src/io/output.c b/src/io/output.c index 86de015..141360e 100644 --- a/src/io/output.c +++ b/src/io/output.c @@ -47,9 +47,7 @@ void output_csv(FILE *out, const char *format, char delim, GEN vector) { free(string); } -char *output_sjson(GEN vector) { - parson -} +char *output_sjson(GEN vector) {} void output_json(FILE *out, GEN vector) {} |
