diff options
| author | J08nY | 2025-03-20 16:22:28 +0100 |
|---|---|---|
| committer | J08nY | 2025-03-20 16:22:47 +0100 |
| commit | efa899bab078ef57d55ffbde9343d1320a9b08a0 (patch) | |
| tree | 0938d637fc389175c346e7e41057f71eb43638d6 /src/cm/cm_any.h | |
| parent | ce6f2ddbb6c1cd718f3e093e71eddb7ab4a69f07 (diff) | |
| download | ecgen-efa899bab078ef57d55ffbde9343d1320a9b08a0.tar.gz ecgen-efa899bab078ef57d55ffbde9343d1320a9b08a0.tar.zst ecgen-efa899bab078ef57d55ffbde9343d1320a9b08a0.zip | |
Fix discriminant iteration in CM with composite order.
The prime impl is still broken. The family gen is as well.
Diffstat (limited to 'src/cm/cm_any.h')
| -rw-r--r-- | src/cm/cm_any.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/cm/cm_any.h b/src/cm/cm_any.h index a49fd7f..c5407cb 100644 --- a/src/cm/cm_any.h +++ b/src/cm/cm_any.h @@ -12,22 +12,53 @@ typedef struct { GEN d; } cm_any_qdisc_t; +typedef struct { + GEN roots; + long used; + long total; +} cm_any_roots_t; + +/** + * + * @param d + * @param p + * @param roots + */ +void cm_update_roots(GEN d, GEN p, cm_any_roots_t *roots); + +/** + * + * @param d + * @param p + * @return + */ +cm_any_roots_t *cm_make_roots(GEN d, GEN p); + +void cm_free_roots(cm_any_roots_t *roots); + /** * @brief Construct an elliptic curve given its order, CM discriminant and field * order. * @param order * @param d * @param p + * @param roots * @param ord_prime * @return */ -GEN cm_construct_curve(GEN order, GEN d, GEN p, bool ord_prime); +GEN cm_construct_curve(GEN order, GEN d, GEN p, cm_any_roots_t *roots, + bool ord_prime); /** * @brief Construct an elliptic curve given a factor of its order, CM * discriminant and field order. + * + * @param r + * @param d + * @param p + * @param roots */ -GEN cm_construct_curve_subgroup(GEN r, GEN d, GEN p); +GEN cm_construct_curve_subgroup(GEN r, GEN d, GEN p, cm_any_roots_t *roots); /** * @brief @@ -47,4 +78,9 @@ GENERATOR(cm_gen_curve_any); */ GENERATOR(cm_gen_order); +/** + * @brief Deinitialize. + */ +void cm_any_quit(); + #endif // ECGEN_CM_ANY_H |
