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/include/polarssl/bignum.h b/include/polarssl/bignum.h
index 2db29d5..dc54af8 100644
--- a/include/polarssl/bignum.h
+++ b/include/polarssl/bignum.h
@@ -691,6 +691,8 @@
*
* \return 0 if successful,
* POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed
+ * POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is <= 1,
+ * POLARSSL_ERR_MPI_NOT_ACCEPTABLE if A has no inverse mod N.
*/
int mpi_gcd( mpi *G, const mpi *A, const mpi *B );