mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-09 15:45:37 +00:00
Added MPI_CHK around unguarded mpi calls
This commit is contained in:
parent
3cb407107d
commit
1dc45f15a6
|
@ -1456,8 +1456,11 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
|
||||||
* W[1] = A * R^2 * R^-1 mod N = A * R mod N
|
* W[1] = A * R^2 * R^-1 mod N = A * R mod N
|
||||||
*/
|
*/
|
||||||
if( mpi_cmp_mpi( A, N ) >= 0 )
|
if( mpi_cmp_mpi( A, N ) >= 0 )
|
||||||
mpi_mod_mpi( &W[1], A, N );
|
{
|
||||||
else mpi_copy( &W[1], A );
|
MPI_CHK( mpi_mod_mpi( &W[1], A, N ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MPI_CHK( mpi_copy( &W[1], A ) );
|
||||||
|
|
||||||
mpi_montmul( &W[1], &RR, N, mm, &T );
|
mpi_montmul( &W[1], &RR, N, mm, &T );
|
||||||
|
|
||||||
|
@ -1577,7 +1580,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
|
||||||
if( neg )
|
if( neg )
|
||||||
{
|
{
|
||||||
X->s = -1;
|
X->s = -1;
|
||||||
mpi_add_mpi( X, N, X );
|
MPI_CHK( mpi_add_mpi( X, N, X ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
Loading…
Reference in a new issue