Bignum Mod: remove unused parameter in io_neg test
The value was overwritten and the length wasn't used either. This latter could have lead to a buffer overflow as well. Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
566c91db27
commit
339b439906
2 changed files with 10 additions and 9 deletions
|
@ -57,19 +57,19 @@ Test mbedtls_mpi_residue_setup #8 r > m
|
|||
mpi_residue_setup:"fe":"ff":-4
|
||||
|
||||
Test mbedtls_mpi_mod_io_neg #1 input_r < modulo m
|
||||
mpi_mod_io_neg:"fe":"01":"fd":0
|
||||
mpi_mod_io_neg:"fe":"fd":0
|
||||
|
||||
Test mbedtls_mpi_mod_io_neg #2 input_r == modulo m
|
||||
mpi_mod_io_neg:"fe":"01":"fe":MBEDTLS_ERR_MPI_BAD_INPUT_DATA
|
||||
mpi_mod_io_neg:"fe":"fe":MBEDTLS_ERR_MPI_BAD_INPUT_DATA
|
||||
|
||||
Test mbedtls_mpi_mod_io_neg #3 input_r > modulo m
|
||||
mpi_mod_io_neg:"fe":"01":"ff":MBEDTLS_ERR_MPI_BAD_INPUT_DATA
|
||||
mpi_mod_io_neg:"fe":"ff":MBEDTLS_ERR_MPI_BAD_INPUT_DATA
|
||||
|
||||
Test mbedtls_mpi_mod_io_neg #4 input_r too large to fit
|
||||
mpi_mod_io_neg:"fe":"01":"ffffffffffffffffff":MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
|
||||
mpi_mod_io_neg:"fe":"ffffffffffffffffff":MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
|
||||
|
||||
Test mbedtls_mpi_mod_io_neg #5 Sucesfull read / output buffer too small
|
||||
mpi_mod_io_neg:"7ffffffffffffffffffffffffffffff1":"7ffffffffffffffffffffffffffffff0":"ffff":0
|
||||
mpi_mod_io_neg:"7ffffffffffffffffffffffffffffff1":"ffff":0
|
||||
|
||||
Test mbedtls_mpi_mod_io #1 N: "11" A: "119".
|
||||
mpi_mod_io:"000000000000000b":"0000000000000000":MBEDTLS_MPI_MOD_EXT_REP_BE
|
||||
|
|
|
@ -114,11 +114,10 @@ exit:
|
|||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mpi_mod_io_neg( char * input_N, char * input_R, data_t * buf, int ret )
|
||||
void mpi_mod_io_neg( char * input_N, data_t * buf, int ret )
|
||||
{
|
||||
mbedtls_mpi_uint *N = NULL;
|
||||
mbedtls_mpi_uint *R = NULL;
|
||||
size_t n_limbs, r_limbs;
|
||||
|
||||
mbedtls_mpi_mod_modulus m;
|
||||
mbedtls_mpi_mod_residue r;
|
||||
|
@ -127,8 +126,10 @@ void mpi_mod_io_neg( char * input_N, char * input_R, data_t * buf, int ret )
|
|||
|
||||
mbedtls_mpi_mod_modulus_init( &m );
|
||||
|
||||
size_t n_limbs;
|
||||
TEST_EQUAL( 0, mbedtls_test_read_mpi_core( &N, &n_limbs, input_N ) );
|
||||
TEST_EQUAL( 0, mbedtls_test_read_mpi_core( &R, &r_limbs, input_R ) );
|
||||
size_t r_limbs = n_limbs;
|
||||
ASSERT_ALLOC( R, r_limbs );
|
||||
|
||||
/* modulo->p == NULL || residue->p == NULL ( m has not been set-up ) */
|
||||
TEST_EQUAL( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
|
||||
|
@ -139,7 +140,7 @@ void mpi_mod_io_neg( char * input_N, char * input_R, data_t * buf, int ret )
|
|||
|
||||
TEST_EQUAL( 0, mbedtls_mpi_mod_modulus_setup( &m, N, n_limbs,
|
||||
MBEDTLS_MPI_MOD_REP_MONTGOMERY ) );
|
||||
TEST_EQUAL( 0, mbedtls_mpi_mod_residue_setup( &r, &m, R , n_limbs ) );
|
||||
TEST_EQUAL( 0, mbedtls_mpi_mod_residue_setup( &r, &m, R , r_limbs ) );
|
||||
|
||||
/* modulo->p == NULL || residue->p == NULL ( m has been set-up ) */
|
||||
TEST_EQUAL( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
|
||||
|
|
Loading…
Reference in a new issue