mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 02:25:40 +01:00
- Moved to prevent uninitialized exit var
This commit is contained in:
parent
4248823f43
commit
50546921ac
@ -1396,19 +1396,6 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
|
|||||||
if( mpi_cmp_int( E, 0 ) < 0 )
|
if( mpi_cmp_int( E, 0 ) < 0 )
|
||||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||||
|
|
||||||
/*
|
|
||||||
* Compensate for negative A (and correct at the end)
|
|
||||||
*/
|
|
||||||
neg = ( A->s == -1 );
|
|
||||||
|
|
||||||
mpi_init( &Apos );
|
|
||||||
if( neg )
|
|
||||||
{
|
|
||||||
MPI_CHK( mpi_copy( &Apos, A ) );
|
|
||||||
Apos.s = 1;
|
|
||||||
A = &Apos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init temps and window size
|
* Init temps and window size
|
||||||
*/
|
*/
|
||||||
@ -1429,6 +1416,19 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
|
|||||||
MPI_CHK( mpi_grow( &W[1], j ) );
|
MPI_CHK( mpi_grow( &W[1], j ) );
|
||||||
MPI_CHK( mpi_grow( &T, j * 2 ) );
|
MPI_CHK( mpi_grow( &T, j * 2 ) );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compensate for negative A (and correct at the end)
|
||||||
|
*/
|
||||||
|
neg = ( A->s == -1 );
|
||||||
|
|
||||||
|
mpi_init( &Apos );
|
||||||
|
if( neg )
|
||||||
|
{
|
||||||
|
MPI_CHK( mpi_copy( &Apos, A ) );
|
||||||
|
Apos.s = 1;
|
||||||
|
A = &Apos;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If 1st call, pre-compute R^2 mod N
|
* If 1st call, pre-compute R^2 mod N
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user