aboutsummaryrefslogtreecommitdiff
path: root/src/math/twists.c
diff options
context:
space:
mode:
authorJ08nY2018-01-18 18:37:44 +0100
committerJ08nY2018-01-18 18:40:06 +0100
commitcf074191532caef918fb9f502b37697094da317a (patch)
tree9826a5f436aba9fcbfbba8dfd5e615267213123f /src/math/twists.c
parentf940f80a2cb69ffcd1f0d608cbb1b0f06e0854d6 (diff)
downloadecgen-cf074191532caef918fb9f502b37697094da317a.tar.gz
ecgen-cf074191532caef918fb9f502b37697094da317a.tar.zst
ecgen-cf074191532caef918fb9f502b37697094da317a.zip
Diffstat (limited to 'src/math/twists.c')
-rw-r--r--src/math/twists.c12
1 files changed, 11 insertions, 1 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