summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ08nY2017-09-29 18:24:25 +0200
committerJ08nY2017-09-29 18:24:25 +0200
commit73ae939ffee2c0fc027d9ac5d07b479d8e967a8c (patch)
tree30c5f6bd04c5e77e9ac2ca7897bbc3d9b0e05a15
parent392b41421af7f54fae009dee0fdac5659a248256 (diff)
downloadecgen-73ae939ffee2c0fc027d9ac5d07b479d8e967a8c.tar.gz
ecgen-73ae939ffee2c0fc027d9ac5d07b479d8e967a8c.tar.zst
ecgen-73ae939ffee2c0fc027d9ac5d07b479d8e967a8c.zip
-rw-r--r--src/exhaustive/exhaustive.c11
-rw-r--r--src/gen/gens.c4
-rw-r--r--src/misc/types.h4
3 files changed, 15 insertions, 4 deletions
diff --git a/src/exhaustive/exhaustive.c b/src/exhaustive/exhaustive.c
index 2d52626..12ccd6e 100644
--- a/src/exhaustive/exhaustive.c
+++ b/src/exhaustive/exhaustive.c
@@ -123,7 +123,10 @@ static void exhaustive_ginit(gen_f *generators, const config_t *cfg) {
}
}
-static void exhaustive_cinit(check_t **validators, const config_t *cfg) {}
+static void exhaustive_cinit(check_t **validators, const config_t *cfg) {
+
+
+}
static void exhaustive_ainit(arg_t **argss, const config_t *cfg) {
if (cfg->anomalous) {
@@ -193,14 +196,16 @@ int exhaustive_gen_retry(curve_t *curve, const config_t *cfg,
while (state < end_offset) {
stack_tops[state] = avma;
- int diff = generators[state](curve, cfg, argss ? argss[state] : NULL);
+ arg_t *arg = argss ? argss[state] : NULL;
+
+ int diff = generators[state](curve, cfg, arg);
int new_state = state + diff;
if (new_state < start_offset) new_state = start_offset;
if (diff > 0 && validators && validators[state]) {
check_t *validator = validators[state];
for (size_t i = 0; i < validator->nchecks; ++i) {
- int new_diff = validator->checks[state](curve, cfg);
+ int new_diff = validator->checks[state](curve, cfg, arg);
if (new_diff <= 0) {
diff = new_diff;
break;
diff --git a/src/gen/gens.c b/src/gen/gens.c
index f5f9fcb..f5336df 100644
--- a/src/gen/gens.c
+++ b/src/gen/gens.c
@@ -37,6 +37,10 @@ GENERATOR(gens_gen_one) {
return gens_put(curve, generators, len);
}
+CHECK(gens_check_cofactor) {
+ return INT_MIN;
+}
+
UNROLL(gens_unroll) {
if (curve->generators) {
points_free_deep(&curve->generators, curve->ngens);
diff --git a/src/misc/types.h b/src/misc/types.h
index e80789f..958ab63 100644
--- a/src/misc/types.h
+++ b/src/misc/types.h
@@ -141,9 +141,11 @@ typedef UNROLL((*unroll_f));
* @brief A check function type.
* @param curve A curve_t being checked
* @param cfg An application config
+ * @param args Current optional generator argument
* @return state diff
*/
-#define CHECK(check_name) int check_name(curve_t *curve, const config_t *cfg)
+#define CHECK(check_name) \
+ GENERATOR(check_name)
typedef CHECK((*check_f));