diff options
| author | J08nY | 2017-10-14 13:25:47 +0200 |
|---|---|---|
| committer | J08nY | 2017-10-14 13:25:47 +0200 |
| commit | 80514f24dae8352f39f9a9e49c0d9afbd8edd432 (patch) | |
| tree | 77735babce3681a792bf5e05fea5b672091026fc /src/math | |
| parent | 5a24bec70aa2614e847e866be514341dce10ff19 (diff) | |
| download | ecgen-80514f24dae8352f39f9a9e49c0d9afbd8edd432.tar.gz ecgen-80514f24dae8352f39f9a9e49c0d9afbd8edd432.tar.zst ecgen-80514f24dae8352f39f9a9e49c0d9afbd8edd432.zip | |
Make config_t *cfg a global variable.
The config is setup from parsing CLI options and then doesn't
change for the whole duration of running ecgen, so it makes sense
to make it a global variable.
Diffstat (limited to 'src/math')
| -rw-r--r-- | src/math/subgroups.c | 6 | ||||
| -rw-r--r-- | src/math/subgroups.h | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/math/subgroups.c b/src/math/subgroups.c index 45523ad..aac58f0 100644 --- a/src/math/subgroups.c +++ b/src/math/subgroups.c @@ -125,7 +125,7 @@ static GEN subgroups_2n(const curve_t *curve, size_t min_bits) { return subgroups_2n_gens(curve, min_bits); } -GEN subgroups_prime(const curve_t *curve, const config_t *cfg) { +GEN subgroups_prime(const curve_t *curve) { if (cfg->prime || isprime(curve->order)) { return gtovec(curve->order); } @@ -133,7 +133,7 @@ GEN subgroups_prime(const curve_t *curve, const config_t *cfg) { return subgroups_factors(curve->order); } -GEN subgroups_nonprime(const curve_t *curve, const config_t *cfg) { +GEN subgroups_nonprime(const curve_t *curve) { if (cfg->prime || isprime(curve->order)) { return NULL; } @@ -141,7 +141,7 @@ GEN subgroups_nonprime(const curve_t *curve, const config_t *cfg) { return subgroups_2n(curve, 1); } -GEN subgroups_all(const curve_t *curve, const config_t *cfg) { +GEN subgroups_all(const curve_t *curve) { if (cfg->prime || isprime(curve->order)) { return gtovec(curve->order); } diff --git a/src/math/subgroups.h b/src/math/subgroups.h index 1c11d4c..6cca10f 100644 --- a/src/math/subgroups.h +++ b/src/math/subgroups.h @@ -14,25 +14,22 @@ /** * @brief Enumerates prime subgroup orders of a given curve. * @param curve - * @param cfg * @return */ -GEN subgroups_prime(const curve_t *curve, const config_t *cfg); +GEN subgroups_prime(const curve_t *curve); /** * @brief Enumerates nonprime subgroup orders of a given curve. * @param curve - * @param cfg * @return */ -GEN subgroups_nonprime(const curve_t *curve, const config_t *cfg); +GEN subgroups_nonprime(const curve_t *curve); /** * @brief Enumerates all subgroup orders of a given curve. * @param curve - * @param cfg * @return */ -GEN subgroups_all(const curve_t *curve, const config_t *cfg); +GEN subgroups_all(const curve_t *curve); #endif // ECGEN_SUBGROUPS_H |
