Fix potential memory leak in EC multiplication
Signed-off-by: Jonas <jonas.lejeune4420@gmail.com>
This commit is contained in:
parent
5435451a1a
commit
6692a064e3
1 changed files with 8 additions and 2 deletions
|
@ -1544,7 +1544,10 @@ static int ecp_randomize_jac( const mbedtls_ecp_group *grp, mbedtls_ecp_point *p
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &l, 1 ) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &l, 1 ) );
|
||||||
|
|
||||||
if( count++ > 10 )
|
if( count++ > 10 )
|
||||||
return( MBEDTLS_ERR_ECP_RANDOM_FAILED );
|
{
|
||||||
|
ret = MBEDTLS_ERR_ECP_RANDOM_FAILED;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while( mbedtls_mpi_cmp_int( &l, 1 ) <= 0 );
|
while( mbedtls_mpi_cmp_int( &l, 1 ) <= 0 );
|
||||||
|
|
||||||
|
@ -2278,7 +2281,10 @@ static int ecp_randomize_mxz( const mbedtls_ecp_group *grp, mbedtls_ecp_point *P
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &l, 1 ) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &l, 1 ) );
|
||||||
|
|
||||||
if( count++ > 10 )
|
if( count++ > 10 )
|
||||||
return( MBEDTLS_ERR_ECP_RANDOM_FAILED );
|
{
|
||||||
|
ret = MBEDTLS_ERR_ECP_RANDOM_FAILED;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while( mbedtls_mpi_cmp_int( &l, 1 ) <= 0 );
|
while( mbedtls_mpi_cmp_int( &l, 1 ) <= 0 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue