Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libmbedtls: mbedtls_mpi_shrink(): fix possible unwanted truncation
If mbedtls_mpi_shrink() is passed a value for nblimbs that is smaller than the minimum number of limbs required to store the big number, the current implementation will unexpectedly truncate the number to the requested size. It should use the minimal size instead in order not to corrupt the bigum value. This issue was introduced in [1] probably as a result of a bad copy and paste from mbedtls_mpi_grow(). Fixes: [1] commit 98bd5fe ("libmbedtls: add mbedtls_mpi_init_mempool()") Reported-by: Zhenke Ma <zhenke.ma@armchina.com> Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
- Loading branch information