Skip to content

Commit e2f563e

Browse files
Improve comments in mpi_shrink
1 parent db42062 commit e2f563e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/bignum.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ int mbedtls_mpi_shrink( mbedtls_mpi *X, size_t nblimbs )
158158
if( nblimbs > MBEDTLS_MPI_MAX_LIMBS )
159159
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
160160

161-
/* Actually resize up in this case */
161+
/* Actually resize up if there are currently fewer than nblimbs limbs. */
162162
if( X->n <= nblimbs )
163163
return( mbedtls_mpi_grow( X, nblimbs ) );
164+
/* Now X->n > nblimbs >= 0. */
164165

165166
for( i = X->n - 1; i > 0; i-- )
166167
if( X->p[i] != 0 )

0 commit comments

Comments
 (0)