From e1af97551fde2efbd847e872fbcde9380e24fe42 Mon Sep 17 00:00:00 2001 From: J08nY Date: Fri, 29 Nov 2024 21:59:47 +0100 Subject: Silence criterion build. --- Doxyfile | 2 +- src/ecgen.c | 51 +++------------------------------------------------ src/io/cli.c | 15 ++++++++++++--- test/CMakeLists.txt | 2 +- test/criterion.sh | 4 ++-- 5 files changed, 19 insertions(+), 55 deletions(-) diff --git a/Doxyfile b/Doxyfile index 5cf4b12..8fa8e6a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "ecgen" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.7.6 +PROJECT_NUMBER = 0.7.7 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a 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 - * @version 0.7.6 + * @version 0.7.7 * @copyright GPL v2.0 */ #include @@ -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) " "\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 " diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index deab05a..8120e7e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.10) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/criterion/include) -find_library(criterion NAMES criterion PATHS ${CMAKE_CURRENT_SOURCE_DIR}/lib/criterion/build) +find_library(criterion NAMES criterion PATHS ${CMAKE_CURRENT_SOURCE_DIR}/lib/criterion/build/src) file(GLOB TEST_SRC "src/math/*.c" "src/obj/*.c" "src/gen/*.c" "src/cm/*.c" "src/invalid/*.c" "src/io/*.c" "src/exhaustive/*.c" "src/util/*.c") file(GLOB TESTING_SRC "src/test/*.c") diff --git a/test/criterion.sh b/test/criterion.sh index 5ad0756..00e5db2 100755 --- a/test/criterion.sh +++ b/test/criterion.sh @@ -6,5 +6,5 @@ if [ ! -f "lib/criterion/meson.build" ]; then fi cd lib/criterion -meson setup build -meson compile -C build +meson setup build > /dev/null +meson compile -C build > /dev/null -- cgit v1.2.3-70-g09d2