From 67c9247ed9930a9822b0df339e212d9b6d6f12b5 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Fri, 2 Sep 2022 13:28:59 +0100 Subject: [PATCH] Move the T++ in mbedtls_mpi_core_montmul() to within the loop body Signed-off-by: Tom Cosgrove --- library/bignum_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/bignum_core.c b/library/bignum_core.c index cfcf91a83..13fc074a6 100644 --- a/library/bignum_core.c +++ b/library/bignum_core.c @@ -411,7 +411,7 @@ void mbedtls_mpi_core_montmul( mbedtls_mpi_uint *X, { memset( T, 0, ( 2 * AN_limbs + 1 ) * ciL ); - for( size_t i = 0; i < AN_limbs; i++, T++ ) + for( size_t i = 0; i < AN_limbs; i++ ) { /* T = (T + u0*B + u1*N) / 2^biL */ mbedtls_mpi_uint u0 = A[i]; @@ -419,6 +419,8 @@ void mbedtls_mpi_core_montmul( mbedtls_mpi_uint *X, (void) mbedtls_mpi_core_mla( T, AN_limbs + 2, B, B_limbs, u0 ); (void) mbedtls_mpi_core_mla( T, AN_limbs + 2, N, AN_limbs, u1 ); + + T++; } /*