For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
diff --git a/tests/suites/test_suite_bignum_random.function b/tests/suites/test_suite_bignum_random.function
index c7d277f..534fdb8 100644
--- a/tests/suites/test_suite_bignum_random.function
+++ b/tests/suites/test_suite_bignum_random.function
@@ -124,9 +124,9 @@
TEST_EQUAL(0, mbedtls_test_read_mpi_core(&upper_bound, &limbs,
bound_bytes));
- ASSERT_ALLOC(lower_bound, limbs);
+ TEST_CALLOC_OR_FAIL(lower_bound, limbs);
lower_bound[0] = min;
- ASSERT_ALLOC(result, limbs);
+ TEST_CALLOC_OR_FAIL(result, limbs);
TEST_EQUAL(expected_ret,
mbedtls_mpi_core_random(result, min, upper_bound, limbs,
@@ -159,7 +159,7 @@
TEST_EQUAL(0, mbedtls_test_read_mpi(&max_legacy, max_hex));
size_t limbs = max_legacy.n;
- ASSERT_ALLOC(R_core, limbs);
+ TEST_CALLOC_OR_FAIL(R_core, limbs);
/* Call the legacy function and the core function with the same random
* stream. */
@@ -209,9 +209,9 @@
mbedtls_mpi_mod_modulus_init(&N);
TEST_EQUAL(mbedtls_test_read_mpi_modulus(&N, max_hex, rep), 0);
- ASSERT_ALLOC(R_core, N.limbs);
- ASSERT_ALLOC(R_mod_raw, N.limbs);
- ASSERT_ALLOC(R_mod_digits, N.limbs);
+ TEST_CALLOC_OR_FAIL(R_core, N.limbs);
+ TEST_CALLOC_OR_FAIL(R_mod_raw, N.limbs);
+ TEST_CALLOC_OR_FAIL(R_mod_digits, N.limbs);
TEST_EQUAL(mbedtls_mpi_mod_residue_setup(&R_mod, &N,
R_mod_digits, N.limbs),
0);
@@ -287,7 +287,7 @@
TEST_EQUAL(0, mbedtls_test_read_mpi_core(&upper_bound, &limbs,
bound_hex));
- ASSERT_ALLOC(result, limbs);
+ TEST_CALLOC_OR_FAIL(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
@@ -302,7 +302,7 @@
full_stats = 0;
stats_len = n_bits;
}
- ASSERT_ALLOC(stats, stats_len);
+ TEST_CALLOC_OR_FAIL(stats, stats_len);
for (i = 0; i < (size_t) iterations; i++) {
mbedtls_test_set_step(i);
@@ -340,7 +340,7 @@
}
} else {
bound_bytes.len = limbs * sizeof(mbedtls_mpi_uint);
- ASSERT_ALLOC(bound_bytes.x, bound_bytes.len);
+ TEST_CALLOC_OR_FAIL(bound_bytes.x, bound_bytes.len);
mbedtls_mpi_core_write_be(upper_bound, limbs,
bound_bytes.x, bound_bytes.len);
int statistically_safe_all_the_way =
@@ -416,7 +416,7 @@
MBEDTLS_MPI_MOD_REP_OPT_RED),
0);
size_t result_limbs = N.limbs + result_limbs_delta;
- ASSERT_ALLOC(result_digits, result_limbs);
+ TEST_CALLOC_OR_FAIL(result_digits, result_limbs);
/* Build a reside that might not match the modulus, to test that
* the library function rejects that as expected. */
mbedtls_mpi_mod_residue result = { result_digits, result_limbs };