diff options
author | Gilles Peskine <Gilles.Peskine@arm.com> | 2020-01-20 21:17:43 +0100 |
---|---|---|
committer | Simon Butcher <simon.butcher@arm.com> | 2020-03-13 16:23:45 +0000 |
commit | 0660747057ac13e7f0be299a2dda24d3e2138977 (patch) | |
tree | 7e6a128fe5b2597b55953e03e94c58d6a5eef3e3 | |
parent | 51c2e06eb85bf18de30d327b25c0d58e74f5de3d (diff) | |
download | mbed-tls-0660747057ac13e7f0be299a2dda24d3e2138977.tar.gz |
Improve comments in mpi_shrink
-rw-r--r-- | library/bignum.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/bignum.c b/library/bignum.c index 0aee14924..36b04852b 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -157,9 +157,10 @@ int mbedtls_mpi_shrink( mbedtls_mpi *X, size_t nblimbs ) if( nblimbs > MBEDTLS_MPI_MAX_LIMBS ) return( MBEDTLS_ERR_MPI_ALLOC_FAILED ); - /* Actually resize up in this case */ + /* Actually resize up if there are currently fewer than nblimbs limbs. */ if( X->n <= nblimbs ) return( mbedtls_mpi_grow( X, nblimbs ) ); + /* Now X->n > nblimbs >= 0. */ for( i = X->n - 1; i > 0; i-- ) if( X->p[i] != 0 ) |