summaryrefslogtreecommitdiff
path: root/src/gen/curve.c
diff options
context:
space:
mode:
authorJ08nY2018-01-18 18:37:44 +0100
committerJ08nY2018-01-18 18:40:06 +0100
commitcf074191532caef918fb9f502b37697094da317a (patch)
tree9826a5f436aba9fcbfbba8dfd5e615267213123f /src/gen/curve.c
parentf940f80a2cb69ffcd1f0d608cbb1b0f06e0854d6 (diff)
downloadecgen-cf074191532caef918fb9f502b37697094da317a.tar.gz
ecgen-cf074191532caef918fb9f502b37697094da317a.tar.zst
ecgen-cf074191532caef918fb9f502b37697094da317a.zip
Diffstat (limited to 'src/gen/curve.c')
-rw-r--r--src/gen/curve.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gen/curve.c b/src/gen/curve.c
index 4996c28..f89044a 100644
--- a/src/gen/curve.c
+++ b/src/gen/curve.c
@@ -3,6 +3,7 @@
* Copyright (C) 2017-2018 J08nY
*/
#include "curve.h"
+#include "math/twists.h"
#include "point.h"
#include "seed.h"
#include "util/memory.h"
@@ -116,6 +117,16 @@ GENERATOR(curve_gen_any) {
}
}
+GENERATOR(curve_gen_any_twist) {
+ int result = curve_gen_any(curve, args, state);
+ if (result != 1) {
+ return result;
+ } else {
+ twist_rand(curve);
+ return 1;
+ }
+}
+
CHECK(curve_check_nonzero) {
if (gequal0(ell_get_disc(curve->curve))) {
return -3;