Backport 1.3: Check rc of mbedtls_mpi_fill_random
Add MPI_CHK to check for error value of mpi_fill_random.
Backport from Report and fix suggestion by guidovranken in #740
diff --git a/library/ecp.c b/library/ecp.c
index 796452b..79066dc 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -1151,7 +1151,7 @@
/* Generate l such that 1 < l < p */
do
{
- mpi_fill_random( &l, p_size, f_rng, p_rng );
+ MPI_CHK( mpi_fill_random( &l, p_size, f_rng, p_rng ) );
while( mpi_cmp_mpi( &l, &grp->P ) >= 0 )
MPI_CHK( mpi_shift_r( &l, 1 ) );
@@ -1536,7 +1536,7 @@
/* Generate l such that 1 < l < p */
do
{
- mpi_fill_random( &l, p_size, f_rng, p_rng );
+ MPI_CHK( mpi_fill_random( &l, p_size, f_rng, p_rng ) );
while( mpi_cmp_mpi( &l, &grp->P ) >= 0 )
MPI_CHK( mpi_shift_r( &l, 1 ) );