mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-07-10 14:47:25 +00:00
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
This commit is contained in:
parent
454da1fa6f
commit
57501ef056
|
@ -11,6 +11,8 @@ Bugfix
|
||||||
* Fix resource leak on windows platform, in mbedtls_x509_crt_parse_path.
|
* Fix resource leak on windows platform, in mbedtls_x509_crt_parse_path.
|
||||||
In case of failure, when an error occures, goto cleanup.
|
In case of failure, when an error occures, goto cleanup.
|
||||||
Found by redplait #590
|
Found by redplait #590
|
||||||
|
* Add MPI_CHK to check for error value of mpi_fill_random.
|
||||||
|
Backported from a report and fix suggestion by guidovranken in #740
|
||||||
|
|
||||||
= mbed TLS 1.3.20 branch released 2017-06-21
|
= mbed TLS 1.3.20 branch released 2017-06-21
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ int dhm_make_params( dhm_context *ctx, int x_size,
|
||||||
*/
|
*/
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
mpi_fill_random( &ctx->X, x_size, f_rng, p_rng );
|
MPI_CHK( mpi_fill_random( &ctx->X, x_size, f_rng, p_rng ) );
|
||||||
|
|
||||||
while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
|
while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
|
||||||
MPI_CHK( mpi_shift_r( &ctx->X, 1 ) );
|
MPI_CHK( mpi_shift_r( &ctx->X, 1 ) );
|
||||||
|
@ -249,7 +249,7 @@ int dhm_make_public( dhm_context *ctx, int x_size,
|
||||||
*/
|
*/
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
mpi_fill_random( &ctx->X, x_size, f_rng, p_rng );
|
MPI_CHK( mpi_fill_random( &ctx->X, x_size, f_rng, p_rng ) );
|
||||||
|
|
||||||
while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
|
while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
|
||||||
MPI_CHK( mpi_shift_r( &ctx->X, 1 ) );
|
MPI_CHK( mpi_shift_r( &ctx->X, 1 ) );
|
||||||
|
@ -322,7 +322,7 @@ static int dhm_update_blinding( dhm_context *ctx,
|
||||||
count = 0;
|
count = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
mpi_fill_random( &ctx->Vi, mpi_size( &ctx->P ), f_rng, p_rng );
|
MPI_CHK( mpi_fill_random( &ctx->Vi, mpi_size( &ctx->P ), f_rng, p_rng ) );
|
||||||
|
|
||||||
while( mpi_cmp_mpi( &ctx->Vi, &ctx->P ) >= 0 )
|
while( mpi_cmp_mpi( &ctx->Vi, &ctx->P ) >= 0 )
|
||||||
MPI_CHK( mpi_shift_r( &ctx->Vi, 1 ) );
|
MPI_CHK( mpi_shift_r( &ctx->Vi, 1 ) );
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ static int ecp_randomize_jac( const ecp_group *grp, ecp_point *pt,
|
||||||
/* Generate l such that 1 < l < p */
|
/* Generate l such that 1 < l < p */
|
||||||
do
|
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 )
|
while( mpi_cmp_mpi( &l, &grp->P ) >= 0 )
|
||||||
MPI_CHK( mpi_shift_r( &l, 1 ) );
|
MPI_CHK( mpi_shift_r( &l, 1 ) );
|
||||||
|
@ -1536,7 +1536,7 @@ static int ecp_randomize_mxz( const ecp_group *grp, ecp_point *P,
|
||||||
/* Generate l such that 1 < l < p */
|
/* Generate l such that 1 < l < p */
|
||||||
do
|
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 )
|
while( mpi_cmp_mpi( &l, &grp->P ) >= 0 )
|
||||||
MPI_CHK( mpi_shift_r( &l, 1 ) );
|
MPI_CHK( mpi_shift_r( &l, 1 ) );
|
||||||
|
|
Loading…
Reference in a new issue