Align Montgomery init with development

The signature and naming of the Montgomrey initialisation function in
development and in the LTS was different. Align them for easier
readability and maintenance.

Signed-off-by: Janos Follath <janos.follath@arm.com>
diff --git a/library/bignum.c b/library/bignum.c
index 50da6b3..74f10af 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -1907,19 +1907,17 @@
 /*
  * Fast Montgomery initialization (thanks to Tom St Denis)
  */
-void mbedtls_mpi_montg_init(mbedtls_mpi_uint *mm, const mbedtls_mpi *N)
+mbedtls_mpi_uint mbedtls_mpi_montmul_init(const mbedtls_mpi_uint *N)
 {
-    mbedtls_mpi_uint x, m0 = N->p[0];
-    unsigned int i;
+    mbedtls_mpi_uint x = N[0];
 
-    x  = m0;
-    x += ((m0 + 2) & 4) << 1;
+    x += ((N[0] + 2) & 4) << 1;
 
-    for (i = biL; i >= 8; i /= 2) {
-        x *= (2 - (m0 * x));
+    for (unsigned int i = biL; i >= 8; i /= 2) {
+        x *= (2 - (N[0] * x));
     }
 
-    *mm = ~x + 1;
+    return ~x + 1;
 }
 
 void mbedtls_mpi_montmul(mbedtls_mpi *A,
@@ -2069,7 +2067,7 @@
     /*
      * Init temps and window size
      */
-    mbedtls_mpi_montg_init(&mm, N);
+    mm = mbedtls_mpi_montmul_init(N->p);
     mbedtls_mpi_init(&RR); mbedtls_mpi_init(&T);
     mbedtls_mpi_init(&Apos);
     mbedtls_mpi_init(&WW);
diff --git a/library/bignum_internal.h b/library/bignum_internal.h
index f14c294..5435ebb 100644
--- a/library/bignum_internal.h
+++ b/library/bignum_internal.h
@@ -30,14 +30,14 @@
 
 /**
  * \brief Calculate initialisation value for fast Montgomery modular
- *        multiplication.
+ *        multiplication
  *
- * \param[out] mm   The initialisation value for fast Montgomery modular
- *                  multiplication.
- * \param[in]  N    Little-endian presentation of the modulus. This must have
- *                  at least one limb.
+ * \param[in] N  Little-endian presentation of the modulus. This must have
+ *               at least one limb.
+ *
+ * \return       The initialisation value for fast Montgomery modular multiplication
  */
-void mbedtls_mpi_montg_init(mbedtls_mpi_uint *mm, const mbedtls_mpi *N);
+mbedtls_mpi_uint mbedtls_mpi_montmul_init(const mbedtls_mpi_uint *N);
 
 /** Montgomery multiplication: A = A * B * R^-1 mod N  (HAC 14.36)
  *
diff --git a/library/rsa.c b/library/rsa.c
index 23fe843..0a0c2e3 100644
--- a/library/rsa.c
+++ b/library/rsa.c
@@ -815,8 +815,7 @@
     const size_t nlimbs = N->n;
     const size_t tlimbs = 2 * (nlimbs + 1);
 
-    mbedtls_mpi_uint mm;
-    mbedtls_mpi_montg_init(&mm, N);
+    mbedtls_mpi_uint mm = mbedtls_mpi_montmul_init(N->p);
 
     mbedtls_mpi RR, M_T;