From b59b73e2bc82a0b970f388245de4bb9fd2e086b9 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Wed, 17 May 2023 15:17:12 +0100 Subject: [PATCH] Use new CT interface in mbedtls_mpi_core_add_if Signed-off-by: Dave Rodgman --- library/bignum_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/bignum_core.c b/library/bignum_core.c index 7a77f0720..308f5c76f 100644 --- a/library/bignum_core.c +++ b/library/bignum_core.c @@ -458,11 +458,10 @@ mbedtls_mpi_uint mbedtls_mpi_core_add_if(mbedtls_mpi_uint *X, { 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;