Change E closer to where it's used
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/library/bignum_core.c b/library/bignum_core.c
index 957f190..a6aa5a8 100644
--- a/library/bignum_core.c
+++ b/library/bignum_core.c
@@ -616,7 +616,6 @@
mbedtls_mpi_uint one = 1, mm;
mm = mbedtls_mpi_core_montmul_init( N ); /* Compute Montgomery constant */
- E += E_limbs; /* Skip to end of exponent buffer */
wsize = exp_mod_get_window_size( E_limbs * biL );
welem = ( (size_t) 1 ) << wsize;
@@ -664,6 +663,9 @@
/* X = 1 (in Montgomery presentation) initially */
memcpy( X, Wtable, AN_limbs * ciL );
+ /* Start from the end of exponent buffer */
+ E += E_limbs;
+
size_t limb_bits_remaining = 0;
mbedtls_mpi_uint cur_limb, window = 0;
size_t window_bits = 0;