Improve comments in mpi_shrink

This commit is contained in:
Gilles Peskine 2020-01-20 21:17:43 +01:00
parent 2aeab87cf7
commit 6a26967382

View File

@ -151,9 +151,10 @@ int mbedtls_mpi_shrink( mbedtls_mpi *X, size_t nblimbs )
mbedtls_mpi_uint *p; mbedtls_mpi_uint *p;
size_t i; size_t i;
/* Actually resize up in this case */ /* Actually resize up if there are currently fewer than nblimbs limbs. */
if( X->n <= nblimbs ) if( X->n <= nblimbs )
return( mbedtls_mpi_grow( X, nblimbs ) ); return( mbedtls_mpi_grow( X, nblimbs ) );
/* Now X->n > nblimbs >= 0. */
for( i = X->n - 1; i > 0; i-- ) for( i = X->n - 1; i > 0; i-- )
if( X->p[i] != 0 ) if( X->p[i] != 0 )