aboutsummaryrefslogtreecommitdiff
path: root/src/exhaustive/brainpool.c
diff options
context:
space:
mode:
authorJ08nY2017-12-17 20:16:16 +0100
committerJ08nY2017-12-17 22:55:45 +0100
commit878bd3fb19c5f876c6852ca5274186850b3c189f (patch)
tree172c60b0cd9190ff539e57e2d506598663bc604d /src/exhaustive/brainpool.c
parent04237935d3577eed75efaf0e2fec69e1cdad35e4 (diff)
downloadecgen-feature/brainpool-algo.tar.gz
ecgen-feature/brainpool-algo.tar.zst
ecgen-feature/brainpool-algo.zip
Diffstat (limited to 'src/exhaustive/brainpool.c')
-rw-r--r--src/exhaustive/brainpool.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/exhaustive/brainpool.c b/src/exhaustive/brainpool.c
index c45d0d5..fdabd6f 100644
--- a/src/exhaustive/brainpool.c
+++ b/src/exhaustive/brainpool.c
@@ -109,7 +109,11 @@ GENERATOR(brainpool_gen_field) {
GEN c = bits_to_i(p_bits);
bits_free(&p_bits);
GEN p = c;
+ pari_sp bbtop = avma;
do {
+ if (p != c) {//yes, check ptr identity here
+ avma = bbtop;
+ }
p = nextprime(addii(p, gen_1));
} while (mod4(p) != 3);
@@ -127,7 +131,7 @@ GENERATOR(brainpool_gen_field) {
continue;
}
- curve->field = p;
+ curve->field = gcopy(p);
gerepileall(btop, 1, &curve->field);
break;
} while (true);
@@ -156,6 +160,7 @@ GENERATOR(brainpool_gen_equation) {
avma = btop;
continue;
}
+
GEN z;
z = Fp_sqrtn(Fp_muls(am, -3, curve->field), stoi(4), curve->field,
NULL);