Abort modular inversion when modulus is one.
The modular inversion function hangs when provided with the modulus
1. This commit refuses this modulus with a BAD_INPUT error code. It
also adds a test for this case.
diff --git a/library/bignum.c b/library/bignum.c
index 211cb2a..9d12a86 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -1891,7 +1891,7 @@
int ret;
mpi G, TA, TU, U1, U2, TB, TV, V1, V2;
- if( mpi_cmp_int( N, 0 ) <= 0 )
+ if( mpi_cmp_int( N, 1 ) <= 0 )
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
mpi_init( &TA ); mpi_init( &TU ); mpi_init( &U1 ); mpi_init( &U2 );