Bignum Mod: improve residue_setup test
- Rename input variables to match their purpose. - Assert fields upon success Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
f55505d38b
commit
91f3abdfda
1 changed files with 9 additions and 3 deletions
|
@ -81,7 +81,7 @@ exit:
|
||||||
|
|
||||||
/* BEGIN MERGE SLOT 7 */
|
/* BEGIN MERGE SLOT 7 */
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE */
|
||||||
void mpi_residue_setup( char * input_X, char * input_Y, int ret )
|
void mpi_residue_setup( char * input_N, char * input_R, int ret )
|
||||||
{
|
{
|
||||||
mbedtls_mpi_uint *N = NULL;
|
mbedtls_mpi_uint *N = NULL;
|
||||||
mbedtls_mpi_uint *R = NULL;
|
mbedtls_mpi_uint *R = NULL;
|
||||||
|
@ -92,14 +92,20 @@ void mpi_residue_setup( char * input_X, char * input_Y, int ret )
|
||||||
mbedtls_mpi_mod_modulus_init( &m );
|
mbedtls_mpi_mod_modulus_init( &m );
|
||||||
|
|
||||||
/* Allocate the memory for intermediate data structures */
|
/* Allocate the memory for intermediate data structures */
|
||||||
TEST_EQUAL( 0, mbedtls_test_read_mpi_core( &N, &n_limbs, input_X ) );
|
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_Y ) );
|
TEST_EQUAL( 0, mbedtls_test_read_mpi_core( &R, &r_limbs, input_R ) );
|
||||||
|
|
||||||
TEST_EQUAL( 0, mbedtls_mpi_mod_modulus_setup( &m, N, n_limbs,
|
TEST_EQUAL( 0, mbedtls_mpi_mod_modulus_setup( &m, N, n_limbs,
|
||||||
MBEDTLS_MPI_MOD_REP_MONTGOMERY ) );
|
MBEDTLS_MPI_MOD_REP_MONTGOMERY ) );
|
||||||
|
|
||||||
TEST_EQUAL( ret, mbedtls_mpi_mod_residue_setup( &r, &m, R , r_limbs ) );
|
TEST_EQUAL( ret, mbedtls_mpi_mod_residue_setup( &r, &m, R , r_limbs ) );
|
||||||
|
|
||||||
|
if ( ret == 0 )
|
||||||
|
{
|
||||||
|
TEST_EQUAL( r.limbs, r_limbs );
|
||||||
|
TEST_ASSERT( r.p == R );
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_mpi_mod_modulus_free( &m );
|
mbedtls_mpi_mod_modulus_free( &m );
|
||||||
mbedtls_free( N );
|
mbedtls_free( N );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue