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_gcm.function b/tests/suites/test_suite_gcm.function
index 5327431..ea72b87 100644
--- a/tests/suites/test_suite_gcm.function
+++ b/tests/suites/test_suite_gcm.function
@@ -33,7 +33,7 @@
/* Allocate a tight buffer for each update call. This way, if the function
* tries to write beyond the advertised required buffer size, this will
* count as an overflow for memory sanitizers and static checkers. */
- ASSERT_ALLOC(output, n1);
+ TEST_CALLOC_OR_FAIL(output, n1);
olen = 0xdeadbeef;
TEST_EQUAL(0, mbedtls_gcm_update(ctx, input->x, n1, output, n1, &olen));
TEST_EQUAL(n1, olen);
@@ -41,7 +41,7 @@
mbedtls_free(output);
output = NULL;
- ASSERT_ALLOC(output, n2);
+ TEST_CALLOC_OR_FAIL(output, n2);
olen = 0xdeadbeef;
TEST_EQUAL(0, mbedtls_gcm_update(ctx, input->x + n1, n2, output, n2, &olen));
TEST_EQUAL(n2, olen);
@@ -49,7 +49,7 @@
mbedtls_free(output);
output = NULL;
- ASSERT_ALLOC(output, tag->len);
+ TEST_CALLOC_OR_FAIL(output, tag->len);
TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen, output, tag->len));
TEST_EQUAL(0, olen);
TEST_BUFFERS_EQUAL(output, tag->len, tag->x, tag->len);
@@ -87,7 +87,7 @@
/* Allocate a tight buffer for each update call. This way, if the function
* tries to write beyond the advertised required buffer size, this will
* count as an overflow for memory sanitizers and static checkers. */
- ASSERT_ALLOC(output, input->len);
+ TEST_CALLOC_OR_FAIL(output, input->len);
olen = 0xdeadbeef;
TEST_EQUAL(0, mbedtls_gcm_update(ctx, input->x, input->len, output, input->len, &olen));
TEST_EQUAL(input->len, olen);
@@ -95,7 +95,7 @@
mbedtls_free(output);
output = NULL;
- ASSERT_ALLOC(output, tag->len);
+ TEST_CALLOC_OR_FAIL(output, tag->len);
TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen, output, tag->len));
TEST_EQUAL(0, olen);
TEST_BUFFERS_EQUAL(output, tag->len, tag->x, tag->len);
@@ -124,7 +124,7 @@
TEST_EQUAL(0, olen);
}
- ASSERT_ALLOC(output_tag, tag->len);
+ TEST_CALLOC_OR_FAIL(output_tag, tag->len);
TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen,
output_tag, tag->len));
TEST_EQUAL(0, olen);
@@ -144,7 +144,7 @@
TEST_EQUAL(0, mbedtls_gcm_starts(ctx, mode,
iv->x, iv->len));
- ASSERT_ALLOC(output, tag->len);
+ TEST_CALLOC_OR_FAIL(output, tag->len);
TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen, output, tag->len));
TEST_EQUAL(0, olen);
TEST_BUFFERS_EQUAL(output, tag->len, tag->x, tag->len);
@@ -448,7 +448,7 @@
TEST_EQUAL(mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8), 0);
TEST_EQUAL(0, mbedtls_gcm_starts(&ctx, mode, iv->x, iv->len));
- ASSERT_ALLOC(output, output_len);
+ TEST_CALLOC_OR_FAIL(output, output_len);
TEST_EQUAL(MBEDTLS_ERR_GCM_BUFFER_TOO_SMALL,
mbedtls_gcm_update(&ctx, input->x, input->len, output, output_len, &olen));