diff options
| author | J08nY | 2024-11-29 21:59:47 +0100 |
|---|---|---|
| committer | J08nY | 2024-11-29 21:59:47 +0100 |
| commit | e1af97551fde2efbd847e872fbcde9380e24fe42 (patch) | |
| tree | b026cea6786f68cafd67eab1dfc4c5b1929fdd19 /src/io/cli.c | |
| parent | 1f0abf9091f7c7b2a2d660ea481a3e46e02c40ec (diff) | |
| download | ecgen-e1af97551fde2efbd847e872fbcde9380e24fe42.tar.gz ecgen-e1af97551fde2efbd847e872fbcde9380e24fe42.tar.zst ecgen-e1af97551fde2efbd847e872fbcde9380e24fe42.zip | |
Diffstat (limited to 'src/io/cli.c')
| -rw-r--r-- | src/io/cli.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/io/cli.c b/src/io/cli.c index fec3283..d6bb9e0 100644 --- a/src/io/cli.c +++ b/src/io/cli.c @@ -158,7 +158,9 @@ static void cli_end(struct argp_state *state) { } // Only one of prime, cofactor, smooth if (cfg->prime + cfg->smooth + cfg->cofactor > 1) { - argp_failure(state, 1, 0, "Can only choose one of prime-order, cofactor value or smoothness bound."); + argp_failure(state, 1, 0, + "Can only choose one of prime-order, cofactor value or " + "smoothness bound."); } // Only one gen method switch (cfg->method) { @@ -171,13 +173,15 @@ static void cli_end(struct argp_state *state) { case METHOD_SUPERSINGULAR: break; default: - printf("%u\n", cfg->method); argp_failure(state, 1, 0, "Only one generation method can be specified."); break; } - if (cfg->method == METHOD_SEED && (cfg->seed_algo == SEED_BRAINPOOL || cfg->seed_algo == SEED_BRAINPOOL_RFC) && + // Many methods are prime field only + if (cfg->method == METHOD_SEED && + (cfg->seed_algo == SEED_BRAINPOOL || + cfg->seed_algo == SEED_BRAINPOOL_RFC) && cfg->field == FIELD_BINARY) { argp_failure(state, 1, 0, "Brainpool algorithm only creates prime field curves."); @@ -191,6 +195,11 @@ static void cli_end(struct argp_state *state) { argp_failure(state, 1, 0, "Complex multiplication only creates prime field curves."); } + if (cfg->method == METHOD_ANOMALOUS && cfg->field == FIELD_BINARY) { + argp_failure(state, 1, 0, + "Can only generate anomalous curves over prime fields " + "currently."); + } if (cfg->method == METHOD_SUPERSINGULAR && cfg->field == FIELD_BINARY) { argp_failure(state, 1, 0, "Can only generate supersingular curves over prime fields " |
