Test little endian core I/O with odd limbs
Signed-off-by: Janos Follath <janos.follath@arm.com>
diff --git a/tests/suites/test_suite_mpi.function b/tests/suites/test_suite_mpi.function
index cd901d1..aaceb3a 100644
--- a/tests/suites/test_suite_mpi.function
+++ b/tests/suites/test_suite_mpi.function
@@ -294,7 +294,7 @@
/* END_CASE */
/* BEGIN_CASE */
-void mbedtls_mpi_core_io_le( data_t *input, int nb_int, int nx_64_int, int iret,
+void mbedtls_mpi_core_io_le( data_t *input, int nb_int, int nx_32_int, int iret,
int oret )
{
#define BMAX 1024
@@ -311,12 +311,12 @@
nb = nb_int;
TEST_ASSERT( nb <= BMAX );
- TEST_ASSERT( 0 <= nx_64_int );
- nx = nx_64_int;
- /* nx_64_int is the number of 64 bit limbs, if we have 32 bit limbs we need
- * to double the number of limbs to have the same size. */
- if( sizeof( mbedtls_mpi_uint ) == 4 )
- nx *= 2;
+ TEST_ASSERT( 0 <= nx_32_int );
+ nx = nx_32_int;
+ /* nx_32_int is the number of 32 bit limbs, if we have 64 bit limbs we need
+ * to halve the number of limbs to have the same size. */
+ if( sizeof( mbedtls_mpi_uint ) == 8 )
+ nx = nx / 2 + nx % 2;
TEST_ASSERT( nx <= XMAX );
ret = mbedtls_mpi_core_read_le( X, nx, input->x, input->len );