mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 11:25:42 +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
@ -24,6 +24,8 @@ Changes
|
||||
parity bits, to prevent mistakes in copying data. (Closes ticket #33)
|
||||
* Loads of minimal changes to better support WINCE as a build target
|
||||
(Credits go to Marco Lizza)
|
||||
* Added POLARSSL_MPI_WINDOW_SIZE definition to allow easier time to memory
|
||||
trade-off
|
||||
|
||||
Bugfix
|
||||
* Fixed faulty HMAC-MD2 implementation. Found by dibac. (Closes
|
||||
|
@ -45,6 +45,17 @@
|
||||
*/
|
||||
#define POLARSSL_MPI_MAX_LIMBS 10000
|
||||
|
||||
/*
|
||||
* Maximum window size used for modular exponentiation. Default: 6
|
||||
* Minimum value: 1. Maximum value: 6.
|
||||
*
|
||||
* Result is an array of ( 2 << POLARSSL_MPI_WINDOW_SIZE ) MPIs used
|
||||
* for the sliding window calculation. (So 64 by default)
|
||||
*
|
||||
* Reduction in size, reduces speed.
|
||||
*/
|
||||
#define POLARSSL_MPI_WINDOW_SIZE 6 /**< Maximum windows size used. */
|
||||
|
||||
/*
|
||||
* Define the base integer type, architecture-wise
|
||||
*/
|
||||
|
@ -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…
Reference in New Issue
Block a user