From 93f41dbdfdb047a87872a772881405aefcf6828e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 5 Dec 2013 10:48:42 +0100 Subject: [PATCH] Fix possible issue in corner-case for ecp_mul_mx() --- library/ecp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/ecp.c b/library/ecp.c index 0cb61f41c..02f1b61d7 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -1540,6 +1540,9 @@ static int ecp_mul_mxz( ecp_group *grp, ecp_point *R, MPI_CHK( mpi_lset( &R->Z, 0 ) ); mpi_free( &R->Y ); + /* RP.X might be sligtly larger than P, so reduce it */ + MOD_ADD( RP.X ); + /* Randomize coordinates of the starting point */ if( f_rng != NULL ) MPI_CHK( ecp_randomize_mxz( grp, &RP, f_rng, p_rng ) );