From 76b8866222b9abd5f25a795ff719914e852e14ab Mon Sep 17 00:00:00 2001 From: J08nY Date: Sat, 3 Feb 2018 23:33:27 +0100 Subject: Fix memory leak in brainpool and brainpool_rfc methods. --- src/exhaustive/brainpool.c | 10 +++++----- src/exhaustive/brainpool_rfc.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/exhaustive/brainpool.c b/src/exhaustive/brainpool.c index af8fd63..30558eb 100644 --- a/src/exhaustive/brainpool.c +++ b/src/exhaustive/brainpool.c @@ -169,7 +169,7 @@ GENERATOR(brainpool_gen_equation) { avma = btop; continue; } - seed->brainpool.seed_a = bits_copy(seed->seed); + //seed->brainpool.seed_a = bits_copy(seed->seed); brainpool_update_seed(seed->seed); @@ -179,11 +179,11 @@ GENERATOR(brainpool_gen_equation) { bits_free(&b_bits); if (!Fp_issquare(b, curve->field)) { brainpool_update_seed(seed->seed); - bits_free(&seed->brainpool.seed_a); + //bits_free(&seed->brainpool.seed_a); avma = btop; continue; } - seed->brainpool.seed_b = bits_copy(seed->seed); + //seed->brainpool.seed_b = bits_copy(seed->seed); GEN mod_a = gmodulo(a, curve->field); GEN mod_b = gmodulo(b, curve->field); @@ -191,8 +191,8 @@ GENERATOR(brainpool_gen_equation) { if (gequal0(gmulsg(-16, gadd(gmulsg(4, gpowgs(mod_a, 3)), gmulsg(27, gsqr(mod_b)))))) { brainpool_update_seed(seed->seed); - bits_free(&seed->brainpool.seed_a); - bits_free(&seed->brainpool.seed_b); + //bits_free(&seed->brainpool.seed_a); + //bits_free(&seed->brainpool.seed_b); avma = btop; continue; } diff --git a/src/exhaustive/brainpool_rfc.c b/src/exhaustive/brainpool_rfc.c index 0c045d5..0c0eed6 100644 --- a/src/exhaustive/brainpool_rfc.c +++ b/src/exhaustive/brainpool_rfc.c @@ -57,7 +57,7 @@ GENERATOR(brainpool_rfc_gen_equation) { avma = btop; continue; } - seed->brainpool.seed_a = bits_copy(seed->seed); + //seed->brainpool.seed_a = bits_copy(seed->seed); GEN b = NULL; pari_sp bbtop = avma; @@ -72,7 +72,7 @@ GENERATOR(brainpool_rfc_gen_equation) { bits_free(&b_bits); } while (Fp_issquare(b, curve->field)); - seed->brainpool.seed_b = bits_copy(seed->seed); + //seed->brainpool.seed_b = bits_copy(seed->seed); GEN mod_a = gmodulo(a, curve->field); GEN mod_b = gmodulo(b, curve->field); @@ -80,8 +80,8 @@ GENERATOR(brainpool_rfc_gen_equation) { if (gequal0(gmulsg(-16, gadd(gmulsg(4, gpowgs(mod_a, 3)), gmulsg(27, gsqr(mod_b)))))) { brainpool_update_seed(seed->seed); - bits_free(&seed->brainpool.seed_a); - bits_free(&seed->brainpool.seed_b); + //bits_free(&seed->brainpool.seed_a); + //bits_free(&seed->brainpool.seed_b); avma = btop; continue; } -- cgit v1.2.3-70-g09d2