From 1a277d9ad69eb75d8934d356838680116daf3ff6 Mon Sep 17 00:00:00 2001 From: Werner Lewis Date: Tue, 8 Nov 2022 15:55:17 +0000 Subject: [PATCH] Replace comparison with XOR Signed-off-by: Werner Lewis --- library/bignum_mod_raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/bignum_mod_raw.c b/library/bignum_mod_raw.c index 94dcf7724..8889f5541 100644 --- a/library/bignum_mod_raw.c +++ b/library/bignum_mod_raw.c @@ -127,7 +127,7 @@ void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X, mbedtls_mpi_uint 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 ) ); + (void) mbedtls_mpi_core_add_if( X, N->p, N->limbs, (unsigned char) ( carry ^ borrow ) ); } /* END MERGE SLOT 5 */