diff options
| author | J08nY | 2018-01-18 18:37:44 +0100 |
|---|---|---|
| committer | J08nY | 2018-01-18 18:40:06 +0100 |
| commit | cf074191532caef918fb9f502b37697094da317a (patch) | |
| tree | 9826a5f436aba9fcbfbba8dfd5e615267213123f /src/math | |
| parent | f940f80a2cb69ffcd1f0d608cbb1b0f06e0854d6 (diff) | |
| download | ecgen-cf074191532caef918fb9f502b37697094da317a.tar.gz ecgen-cf074191532caef918fb9f502b37697094da317a.tar.zst ecgen-cf074191532caef918fb9f502b37697094da317a.zip | |
Add curve twists to CLI and update options in README.
Diffstat (limited to 'src/math')
| -rw-r--r-- | src/math/twists.c | 12 | ||||
| -rw-r--r-- | src/math/twists.h | 8 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/math/twists.c b/src/math/twists.c index 78481f4..3f1296d 100644 --- a/src/math/twists.c +++ b/src/math/twists.c @@ -3,8 +3,10 @@ * Copyright (C) 2017-2018 J08nY */ #include "twists.h" +#include "gen/point.h" +#include "gen/seed.h" -void curve_twist_rand(curve_t *to, const curve_t *of) { +void twist_rand_to(curve_t *to, const curve_t *of) { to->field = gcopy(of->field); GEN v = elltwist(of->curve, NULL); to->curve = ellinit(v, to->field, -1); @@ -15,4 +17,12 @@ void curve_twist_rand(curve_t *to, const curve_t *of) { to->a = ell_get_a2(to->curve); to->b = ell_get_a6(to->curve); } +} + +void twist_rand(curve_t *what) { + twist_rand_to(what, what); + seed_free(&what->seed); + what->order = NULL; + points_free_deep(&what->points, what->npoints); + points_free_deep(&what->generators, what->ngens); }
\ No newline at end of file diff --git a/src/math/twists.h b/src/math/twists.h index 3249047..dcbdb31 100644 --- a/src/math/twists.h +++ b/src/math/twists.h @@ -12,6 +12,12 @@ * @param to The result of the twist. * @param of The curve to be twisted. */ -void curve_twist_rand(curve_t *to, const curve_t *of); +void twist_rand_to(curve_t *to, const curve_t *of); + +/** + * @brief + * @param what + */ +void twist_rand(curve_t *what); #endif // ECGEN_TWIST_H |
