1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

bignum_mod: Adjusted input checking for mbedtls_mpi_mod_residue_setup()

This patch adjusts the logic of the size checking of the method,
and refactors the tests. Documentation has also been updated.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis
2022-11-24 09:09:47 +00:00
committed by Janos Follath
parent a17ad48e2d
commit aed832ac16
4 changed files with 39 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ int mbedtls_mpi_mod_residue_setup( mbedtls_mpi_mod_residue *r,
mbedtls_mpi_uint *p,
size_t p_limbs )
{
if( p_limbs > m->limbs || !mbedtls_mpi_core_lt_ct( p, m->p, m->limbs ) )
if( p_limbs > m->limbs || !mbedtls_mpi_core_lt_ct( p, m->p, p_limbs ) )
return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
r->limbs = m->limbs;