mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 08:16:33 +01:00
- Added POLARSSL_MPI_WINDOW_SIZE definition to allow easier time to memory trade-off
This commit is contained in:
parent
2e6d5328d5
commit
b6d5f08051
3 changed files with 17 additions and 1 deletions
|
|
@ -1377,7 +1377,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
|
|||
size_t i, j, nblimbs;
|
||||
size_t bufsize, nbits;
|
||||
t_uint ei, mm, state;
|
||||
mpi RR, T, W[64];
|
||||
mpi RR, T, W[ 2 << POLARSSL_MPI_WINDOW_SIZE ];
|
||||
|
||||
if( mpi_cmp_int( N, 0 ) < 0 || ( N->p[0] & 1 ) == 0 )
|
||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
|
@ -1394,6 +1394,9 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
|
|||
wsize = ( i > 671 ) ? 6 : ( i > 239 ) ? 5 :
|
||||
( i > 79 ) ? 4 : ( i > 23 ) ? 3 : 1;
|
||||
|
||||
if( wsize > POLARSSL_MPI_WINDOW_SIZE )
|
||||
wsize = POLARSSL_MPI_WINDOW_SIZE;
|
||||
|
||||
j = N->n + 1;
|
||||
MPI_CHK( mpi_grow( X, j ) );
|
||||
MPI_CHK( mpi_grow( &W[1], j ) );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue