Use new CT interface in mbedtls_mpi_core_add_if
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/library/bignum_core.c b/library/bignum_core.c
index 7a77f07..308f5c7 100644
--- a/library/bignum_core.c
+++ b/library/bignum_core.c
@@ -458,11 +458,10 @@
{
mbedtls_mpi_uint c = 0;
- /* all-bits 0 if cond is 0, all-bits 1 if cond is non-0 */
- const mbedtls_mpi_uint mask = mbedtls_ct_mpi_uint_mask(cond);
+ mbedtls_ct_condition_t do_add = mbedtls_ct_bool(cond);
for (size_t i = 0; i < limbs; i++) {
- mbedtls_mpi_uint add = mask & A[i];
+ mbedtls_mpi_uint add = mbedtls_ct_mpi_uint_if0(do_add, A[i]);
mbedtls_mpi_uint t = c + X[i];
c = (t < X[i]);
t += add;