Move the declaration of variables to their scope of usage

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
diff --git a/library/bignum_core.c b/library/bignum_core.c
index 9cc05b9..3e19ff4 100644
--- a/library/bignum_core.c
+++ b/library/bignum_core.c
@@ -164,8 +164,7 @@
                               const unsigned char *buf,
                               size_t buflen )
 {
-    size_t i;
-    size_t const limbs = CHARS_TO_LIMBS( buflen );
+    const size_t limbs = CHARS_TO_LIMBS( buflen );
 
     if( nx < limbs )
         return( MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL );
@@ -174,7 +173,7 @@
     {
         memset( X, 0, nx * ciL );
 
-        for( i = 0; i < buflen; i++ )
+        for( size_t i = 0; i < buflen; i++ )
             X[i / ciL] |= ((mbedtls_mpi_uint) buf[i]) << ((i % ciL) << 3);
     }
 
@@ -186,9 +185,7 @@
                               const unsigned char *buf,
                               size_t buflen )
 {
-    size_t const limbs = CHARS_TO_LIMBS( buflen );
-    size_t overhead;
-    unsigned char *Xp;
+    const size_t limbs = CHARS_TO_LIMBS( buflen );
 
     if( nx < limbs )
         return( MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL );
@@ -197,13 +194,13 @@
     {
         memset( X, 0, nx * ciL );
 
-        overhead = ( nx * ciL ) - buflen;
+        const size_t overhead = ( nx * ciL ) - buflen;
 
         /* Avoid calling `memcpy` with NULL source or destination argument,
          * even if buflen is 0. */
         if( buf != NULL )
         {
-            Xp = (unsigned char*) X;
+            unsigned char *Xp = (unsigned char *) X;
             memcpy( Xp + overhead, buf, buflen );
 
             mbedtls_mpi_core_bigendian_to_host( X, nx );
diff --git a/library/constant_time.c b/library/constant_time.c
index d2649ce..d108b13 100644
--- a/library/constant_time.c
+++ b/library/constant_time.c
@@ -748,14 +748,13 @@
                                  const mbedtls_mpi_uint *Y,
                                  size_t len )
 {
-    size_t i;
     unsigned ret, cond, done;
 
     /* The value of any of these variables is either 0 or 1 for the rest of
      * their scope. */
     ret = cond = done = 0;
 
-    for( i = len; i > 0; i-- )
+    for( size_t i = len; i > 0; i-- )
     {
         /*
          * If Y[i - 1] < X[i - 1] then X < Y is false and the result must