summaryrefslogtreecommitdiff
path: root/thirdparty/mbedtls/library/bignum.c
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-03-05 16:12:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-03-05 16:12:50 +0100
commite435bed84708edb0c14fb94529fba7665966324f (patch)
treec4fa986295390d9362c9cfcf438a7dd803b44ecb /thirdparty/mbedtls/library/bignum.c
parentbd553d072b65fe5359ab76e64566ff316d35c62e (diff)
mbedtls: Update to upstream version 2.16.5
Fixes https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2020-02 Drop patch to disable VIA padlock since we no longer use libwebsockets, so there's no conflict anymore.
Diffstat (limited to 'thirdparty/mbedtls/library/bignum.c')
-rw-r--r--thirdparty/mbedtls/library/bignum.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/thirdparty/mbedtls/library/bignum.c b/thirdparty/mbedtls/library/bignum.c
index 6713bcbf6f..87ccf42fad 100644
--- a/thirdparty/mbedtls/library/bignum.c
+++ b/thirdparty/mbedtls/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 ) );
+ /* After this point, then X->n > nblimbs and in particular X->n > 0. */
for( i = X->n - 1; i > 0; i-- )
if( X->p[i] != 0 )
@@ -198,7 +199,7 @@ int mbedtls_mpi_copy( mbedtls_mpi *X, const mbedtls_mpi *Y )
if( X == Y )
return( 0 );
- if( Y->p == NULL )
+ if( Y->n == 0 )
{
mbedtls_mpi_free( X );
return( 0 );