aboutsummaryrefslogtreecommitdiff
path: root/src/math/twists.c
diff options
context:
space:
mode:
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