mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
- Corrected is_prime() results for 0, 1 and 2 (found by code coverage tests)
This commit is contained in:
parent
ce40a6d21d
commit
48eab260e9
2 changed files with 7 additions and 1 deletions
|
|
@ -1683,7 +1683,11 @@ int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng )
|
|||
mpi W, R, T, A, RR;
|
||||
unsigned char *p;
|
||||
|
||||
if( mpi_cmp_int( X, 0 ) == 0 )
|
||||
if( mpi_cmp_int( X, 0 ) == 0 ||
|
||||
mpi_cmp_int( X, 1 ) == 0 )
|
||||
return( POLARSSL_ERR_MPI_NOT_ACCEPTABLE );
|
||||
|
||||
if( mpi_cmp_int( X, 2 ) == 0 )
|
||||
return( 0 );
|
||||
|
||||
mpi_init( &W, &R, &T, &A, &RR, NULL );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue