Use modulus structure in mbedtls_mpi_mod_raw_add
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
diff --git a/library/bignum_mod_raw.c b/library/bignum_mod_raw.c
index 2460329..01f5a44 100644
--- a/library/bignum_mod_raw.c
+++ b/library/bignum_mod_raw.c
@@ -122,13 +122,12 @@
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
mbedtls_mpi_uint const *A,
mbedtls_mpi_uint const *B,
- const mbedtls_mpi_uint *N,
- size_t limbs )
+ const mbedtls_mpi_mod_modulus *N )
{
size_t carry, borrow = 0;
- carry = mbedtls_mpi_core_add( X, A, B, limbs );
- borrow = mbedtls_mpi_core_sub( X, X, N, limbs);
- (void) mbedtls_mpi_core_add_if( X, N, limbs, ( carry < borrow ) );
+ carry = mbedtls_mpi_core_add( X, A, B, N->limbs );
+ borrow = mbedtls_mpi_core_sub( X, X, N->p, N->limbs );
+ (void) mbedtls_mpi_core_add_if( X, N->p, N->limbs, ( carry < borrow ) );
}
/* END MERGE SLOT 5 */
diff --git a/library/bignum_mod_raw.h b/library/bignum_mod_raw.h
index 7b82c06..d652238 100644
--- a/library/bignum_mod_raw.h
+++ b/library/bignum_mod_raw.h
@@ -162,17 +162,17 @@
*
* \param[out] X The result of the modular addition.
* \param[in] A Little-endian presentation of the left operand. This
- * must be smaller than \p N.
+ * must be smaller than \p N, and have the same number of
+ * limbs.
* \param[in] B Little-endian presentation of the right operand. This
- * must be smaller than \p N.
- * \param[in] N Little-endian presentation of the modulus.
- * \param limbs Number of limbs of \p X, \p A, \p B and \p N.
+ * must be smaller than \p N, and have the same number of
+ * limbs.
+ * \param[in] N The address of the modulus.
*/
void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
mbedtls_mpi_uint const *A,
mbedtls_mpi_uint const *B,
- const mbedtls_mpi_uint *N,
- size_t limbs );
+ const mbedtls_mpi_mod_modulus *N );
/* END MERGE SLOT 5 */
/* BEGIN MERGE SLOT 6 */