Extract MPI_CORE(add) from the prototype
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
diff --git a/library/bignum_core.c b/library/bignum_core.c
index 0083729..3f4e651 100644
--- a/library/bignum_core.c
+++ b/library/bignum_core.c
@@ -316,8 +316,6 @@
return( 0 );
}
-
-
void mbedtls_mpi_core_shift_r( mbedtls_mpi_uint *X, size_t limbs,
size_t count )
{
@@ -360,7 +358,21 @@
}
}
-
+mbedtls_mpi_uint MPI_CORE(add)( mbedtls_mpi_uint *d,
+ const mbedtls_mpi_uint *l,
+ const mbedtls_mpi_uint *r,
+ size_t n )
+{
+ mbedtls_mpi_uint c = 0, t;
+ for( size_t i = 0; i < n; i++ )
+ {
+ t = c;
+ t += l[i]; c = ( t < l[i] );
+ t += r[i]; c += ( t < r[i] );
+ d[i] = t;
+ }
+ return( c );
+}
mbedtls_mpi_uint mbedtls_mpi_core_add_if( mbedtls_mpi_uint *X,
const mbedtls_mpi_uint *A,