- Make A only smaller if it is larger than |X| - 1

This commit is contained in:
Paul Bakker 2011-01-05 15:53:06 +00:00
parent ccba9bc42d
commit b94081bfc1

View file

@ -1746,8 +1746,11 @@ int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng )
for( j = 0; j < A.n * ciL; j++ )
*p++ = (unsigned char) f_rng( p_rng );
j = mpi_msb( &A ) - mpi_msb( &W );
MPI_CHK( mpi_shift_r( &A, j + 1 ) );
if( mpi_cmp_mpi( &A, &W ) >= 0 )
{
j = mpi_msb( &A ) - mpi_msb( &W );
MPI_CHK( mpi_shift_r( &A, j + 1 ) );
}
A.p[0] |= 3;
/*