Fix or improve some comments (and whitespace)
diff --git a/library/ecdh.c b/library/ecdh.c
index a118de5..8336912 100644
--- a/library/ecdh.c
+++ b/library/ecdh.c
@@ -200,7 +200,7 @@
 #endif
 
     if( ( ret = ecdh_gen_public_restartable( &ctx->grp, &ctx->d, &ctx->Q,
-                    f_rng, p_rng, rs_ctx ) ) != 0 )
+                                             f_rng, p_rng, rs_ctx ) ) != 0 )
         return( ret );
 
     if( ( ret = mbedtls_ecp_tls_write_group( &ctx->grp, &grp_len, buf, blen ) )
@@ -211,7 +211,7 @@
     blen -= grp_len;
 
     if( ( ret = mbedtls_ecp_tls_write_point( &ctx->grp, &ctx->Q, ctx->point_format,
-                                     &pt_len, buf, blen ) ) != 0 )
+                                             &pt_len, buf, blen ) ) != 0 )
         return( ret );
 
     *olen = grp_len + pt_len;
diff --git a/library/ecp.c b/library/ecp.c
index b2ee523..94b42b9 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -1428,7 +1428,7 @@
  *
  * - For the sake of compactness, only the seven low-order bits of x[i]
  *   are used to represent its absolute value (K_i in the paper), and the msb
- *   of x[i] encodes the the sign (s_i in the paper): it is set if and only if
+ *   of x[i] encodes the sign (s_i in the paper): it is set if and only if
  *   if s_i == -1;
  *
  * Calling conventions:
@@ -1480,10 +1480,10 @@
  *
  * Note: Even comb values (those where P would be omitted from the
  *       sum defining T[i] above) are not needed in our adaption
- *       the the comb method. See ecp_comb_recode_core().
+ *       the comb method. See ecp_comb_recode_core().
  *
  * This function currently works in four steps:
- * (1) [dbl]      Computation of intermediate T[i] for 2-powers values of i
+ * (1) [dbl]      Computation of intermediate T[i] for 2-power values of i
  * (2) [norm_dbl] Normalization of coordinates of these T[i]
  * (3) [add]      Computation of all T[i]
  * (4) [norm_add] Normalization of all T[i]
@@ -1513,10 +1513,6 @@
     const unsigned char T_size = 1U << ( w - 1 );
     mbedtls_ecp_point *cur, *TT[COMB_MAX_PRE - 1];
 
-#if !defined(MBEDTLS_ECP_RESTARTABLE)
-    (void) rs_ctx;
-#endif
-
 #if defined(MBEDTLS_ECP_RESTARTABLE)
     if( rs_ctx != NULL && rs_ctx->rsm != NULL )
     {
@@ -1529,12 +1525,10 @@
         if( rs_ctx->rsm->state == ecp_rsm_pre_norm_add )
             goto norm_add;
     }
+#else
+    (void) rs_ctx;
 #endif
 
-    /*
-     * Set T[0] = P and
-     * T[2^{l-1}] = 2^{dl} P for l = 1 .. w-1 (this is not the final value)
-     */
 #if defined(MBEDTLS_ECP_RESTARTABLE)
     if( rs_ctx != NULL && rs_ctx->rsm != NULL )
     {
@@ -1546,7 +1540,10 @@
 
 dbl:
 #endif
-
+    /*
+     * Set T[0] = P and
+     * T[2^{l-1}] = 2^{dl} P for l = 1 .. w-1 (this is not the final value)
+     */
     MBEDTLS_MPI_CHK( mbedtls_ecp_copy( &T[0], P ) );
 
 #if defined(MBEDTLS_ECP_RESTARTABLE)
@@ -1569,17 +1566,16 @@
         MBEDTLS_MPI_CHK( ecp_double_jac( grp, cur, cur ) );
     }
 
-    /*
-     * Normalize current elements in T. As T has holes,
-     * use an auxiliary array of pointers to elements in T.
-     */
 #if defined(MBEDTLS_ECP_RESTARTABLE)
     if( rs_ctx != NULL && rs_ctx->rsm != NULL )
         rs_ctx->rsm->state = ecp_rsm_pre_norm_dbl;
 
 norm_dbl:
 #endif
-
+    /*
+     * Normalize current elements in T. As T has holes,
+     * use an auxiliary array of pointers to elements in T.
+     */
     j = 0;
     for( i = 1; i < T_size; i <<= 1 )
         TT[j++] = T + i;
@@ -1588,17 +1584,16 @@
 
     MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, j ) );
 
-    /*
-     * Compute the remaining ones using the minimal number of additions
-     * Be careful to update T[2^l] only after using it!
-     */
 #if defined(MBEDTLS_ECP_RESTARTABLE)
     if( rs_ctx != NULL && rs_ctx->rsm != NULL )
         rs_ctx->rsm->state = ecp_rsm_pre_add;
 
 add:
 #endif
-
+    /*
+     * Compute the remaining ones using the minimal number of additions
+     * Be careful to update T[2^l] only after using it!
+     */
     MBEDTLS_ECP_BUDGET( ( T_size - 1 ) * MBEDTLS_ECP_OPS_ADD );
 
     for( i = 1; i < T_size; i <<= 1 )
@@ -1608,18 +1603,17 @@
             MBEDTLS_MPI_CHK( ecp_add_mixed( grp, &T[i + j], &T[j], &T[i] ) );
     }
 
-    /*
-     * Normalize final elements in T. Even though there are no holes now,
-     * we still need the auxiliary array for homogeneity with last time.
-     * Also, skip T[0] which is already normalised, being a copy of P.
-     */
 #if defined(MBEDTLS_ECP_RESTARTABLE)
     if( rs_ctx != NULL && rs_ctx->rsm != NULL )
         rs_ctx->rsm->state = ecp_rsm_pre_norm_add;
 
 norm_add:
 #endif
-
+    /*
+     * Normalize final elements in T. Even though there are no holes now,
+     * we still need the auxiliary array for homogeneity with last time.
+     * Also, skip T[0] which is already normalised, being a copy of P.
+     */
     for( j = 0; j + 1 < T_size; j++ )
         TT[j] = T + j + 1;
 
@@ -1965,7 +1959,7 @@
         if( p_eq_g )
         {
             /* almost transfer ownership of T to the group, but keep a copy of
-             * the pointer to use for caling the next function more easily */
+             * the pointer to use for calling the next function more easily */
             grp->T = T;
             grp->T_size = T_size;
         }
diff --git a/library/pk.c b/library/pk.c
index ba8950e..ce8dbb5 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -204,7 +204,7 @@
  * Helper to set up a restart context if needed
  */
 static int pk_restart_setup( mbedtls_pk_restart_ctx *ctx,
-                               const mbedtls_pk_info_t *info )
+                             const mbedtls_pk_info_t *info )
 {
     /* Don't do anything if already set up or invalid */
     if( ctx == NULL || ctx->pk_info != NULL )
diff --git a/library/pk_wrap.c b/library/pk_wrap.c
index cb08eba..87806be 100644
--- a/library/pk_wrap.c
+++ b/library/pk_wrap.c
@@ -337,7 +337,7 @@
     if( rs == NULL )
         return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
 
-    /* set up our own sub-context if needed */
+    /* set up our own sub-context if needed (that is, on first run) */
     if( rs->ecdsa_ctx.grp.pbits == 0 )
         MBEDTLS_MPI_CHK( mbedtls_ecdsa_from_keypair( &rs->ecdsa_ctx, ctx ) );
 
@@ -362,7 +362,7 @@
     if( rs == NULL )
         return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
 
-    /* set up our own sub-context if needed */
+    /* set up our own sub-context if needed (that is, on first run) */
     if( rs->ecdsa_ctx.grp.pbits == 0 )
         MBEDTLS_MPI_CHK( mbedtls_ecdsa_from_keypair( &rs->ecdsa_ctx, ctx ) );
 
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 5d9c623..5f9b74f 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -2727,7 +2727,6 @@
         return;
 
     mbedtls_pk_restart_free( &ctx->pk );
-
     mbedtls_x509_crt_restart_init( ctx );
 }
 #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */