diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ecgen.c | 51 | ||||
| -rw-r--r-- | src/io/cli.c | 15 |
2 files changed, 15 insertions, 51 deletions
diff --git a/src/ecgen.c b/src/ecgen.c index 069d6e0..238311b 100644 --- a/src/ecgen.c +++ b/src/ecgen.c @@ -20,7 +20,7 @@ /** * @file ecgen.c * @author J08nY <johny@neuromancer.sk> - * @version 0.7.6 + * @version 0.7.7 * @copyright GPL v2.0 */ #include <pari/pari.h> @@ -38,11 +38,11 @@ #endif const char *argp_program_version = - "ecgen 0.7.6" GIT_VERSION + "ecgen 0.7.7" GIT_VERSION "\n" "Compiled with: " PARIVERSION "\n\n" - "Copyright (C) 2017-2018,2021 J08nY\n" + "Copyright (C) 2017-2018,2021,2024 J08nY\n" "License GPLv2: GNU GPL version 2 (or later) " "<http://gnu.org/licenses/gpl.html>\n" "This is free software: you are free to change and redistribute it.\n" @@ -106,51 +106,6 @@ int quit(int status) { /** * @mainpage - * - * Three fundamentally different Elliptic curve generation approaches can be - * taken. - * - * [Baier] - - * https://www.cdc.informatik.tu-darmstadt.de/reports/reports/harald_baier.diss.pdf - * - * [Baier, Buchmann] - - * https://www.ipa.go.jp/security/enc/CRYPTREC/fy15/doc/1030_Buchmann.evaluation.pdf - * - * - Complex Multiplication: - * - Capable of generating a curve of a given (prime) order. - * - Generates a subset of all Elliptic Curves over a given field. - * - Used with the -n / --order option - * - * - [Broker, Stevenhagen] - https://arxiv.org/abs/0712.2022 - * - [Savas, Schmidt, Koc] - - * http://people.oregonstate.edu/~schmidtt/ourPapers/SavasKoc/ches01curve.pdf - * - * - Invalid curve generation: - * - Generates *invalid* curves for a given curve. - * - These curves have the same field, and *A* parameter in the short - * Weierstrass equation. - * - Multiplication using some(most?) scalar multiplication algorithm - * proceeds the same way - * multiplication on the input curve would. - * - * - [Antipa, Brown, Menezes, Struik, Vanstone] - - * https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf - * - [Biehl, Mayer, Muller] - - * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.107.3920&rep=rep1&type=pdf - * - [Jager, Schwenk, Somorovksy] - - * http://euklid.org/pdf/ECC_Invalid_Curve.pdf - * - * - Exhaustive/Random approach: - * - Generates field and equation parameters: - * - randomly - * - using ANSI X9.62 verifiably random method(from seed) - * - given input - * , until a curve with requested properties appears. - * - Can generate curves repeatedly until one satisfies requested - * properties: - * - -p / --prime generates curves until a prime order curve is found. - * - -K / --koblitz generates a curve with fixed A = 0 parameter. - * */ int main(int argc, char *argv[]) { memset(cfg, 0, sizeof(config_t)); 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 " |
