From 7f762319ad5a604e817c8ff8956211ac664f9e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 21 Nov 2013 10:47:41 +0100 Subject: [PATCH] Use mpi_shrink() in ecp_precompute() --- library/ecp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/ecp.c b/library/ecp.c index d7a4567ea..1ab1c52a1 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -1354,11 +1354,17 @@ static int ecp_precompute_comb( const ecp_group *grp, ecp_normalize_many( grp, TT, k ); /* - * Post-precessing: reclaim some memory by not storing Z (always 1) + * Post-precessing: reclaim some memory by + * - not storing Z (always 1) + * - shrinking other coordinates + * However keep the same number of limbs as P, which will be useful in + * ecp_select_comb() */ for( i = 0; i < ( 1U << (w-1) ); i++ ) { mpi_free( &T[i].Z ); + mpi_shrink( &T[i].X, grp->P.n ); + mpi_shrink( &T[i].Y, grp->P.n ); } cleanup: