Fix overly large allocations of MPIs
The second argument of ASSERT_ALLOC is a number of array elements, not a
number of bytes.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/tests/suites/test_suite_bignum_random.function b/tests/suites/test_suite_bignum_random.function
index 7a66073..c8bca6e 100644
--- a/tests/suites/test_suite_bignum_random.function
+++ b/tests/suites/test_suite_bignum_random.function
@@ -82,9 +82,9 @@
TEST_EQUAL( 0, mbedtls_test_read_mpi_core( &upper_bound, &limbs,
bound_bytes ) );
- ASSERT_ALLOC( lower_bound, limbs * ciL );
+ ASSERT_ALLOC( lower_bound, limbs );
lower_bound[0] = min;
- ASSERT_ALLOC( result, limbs * ciL );
+ ASSERT_ALLOC( result, limbs );
TEST_EQUAL( expected_ret,
mbedtls_mpi_core_random( result, min, upper_bound, limbs,
@@ -121,7 +121,7 @@
TEST_EQUAL( 0, mbedtls_test_read_mpi( &max_legacy, max_hex ) );
size_t limbs = max_legacy.n;
- ASSERT_ALLOC( R_core, limbs * ciL );
+ ASSERT_ALLOC( R_core, limbs );
/* Call the legacy function and the core function with the same random
* stream. */
@@ -180,7 +180,7 @@
TEST_EQUAL( 0, mbedtls_test_read_mpi_core( &upper_bound, &limbs,
bound_hex ) );
- ASSERT_ALLOC( result, limbs * ciL );
+ ASSERT_ALLOC( result, limbs );
n_bits = mbedtls_mpi_core_bitlen( upper_bound, limbs );
/* Consider a bound "small" if it's less than 2^5. This value is chosen