From 7725a63c240b1db6026147ddc6b819b91ee43101 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Tue, 20 Apr 2021 18:54:59 +0100 Subject: [PATCH] Fix unchecked return in bignum Signed-off-by: Paul Elliott --- ChangeLog.d/fix_bignum_unchecked_return.txt | 2 ++ library/bignum.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 ChangeLog.d/fix_bignum_unchecked_return.txt diff --git a/ChangeLog.d/fix_bignum_unchecked_return.txt b/ChangeLog.d/fix_bignum_unchecked_return.txt new file mode 100644 index 000000000..1c32da888 --- /dev/null +++ b/ChangeLog.d/fix_bignum_unchecked_return.txt @@ -0,0 +1,2 @@ +Bugfix + * Fix unchecked return in bignum module. diff --git a/library/bignum.c b/library/bignum.c index bfca43d90..225e36c07 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -1666,8 +1666,7 @@ int mbedtls_mpi_mul_int( mbedtls_mpi *X, const mbedtls_mpi *A, mbedtls_mpi_uint * calculating the result is trivial in those cases. */ if( b == 0 || n == 0 ) { - mbedtls_mpi_lset( X, 0 ); - return( 0 ); + return mbedtls_mpi_lset( X, 0 ); } /* Calculate A*b as A + A*(b-1) to take advantage of mpi_mul_hlp */