For tests, rename TEST_CALLOC_OR_FAIL() to just TEST_CALLOC()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
diff --git a/tests/include/test/macros.h b/tests/include/test/macros.h
index 1bba436..83b2a07 100644
--- a/tests/include/test/macros.h
+++ b/tests/include/test/macros.h
@@ -143,7 +143,7 @@
* This expression may be evaluated multiple times.
*
*/
-#define TEST_CALLOC_OR_FAIL(pointer, length) \
+#define TEST_CALLOC(pointer, length) \
do { \
TEST_ASSERT((pointer) == NULL); \
if ((length) != 0) { \
@@ -154,11 +154,11 @@
} while (0)
/* For backwards compatibility */
-#define ASSERT_ALLOC(pointer, length) TEST_CALLOC_OR_FAIL(pointer, length)
+#define ASSERT_ALLOC(pointer, length) TEST_CALLOC(pointer, length)
/** Allocate memory dynamically. If the allocation fails, skip the test case.
*
- * This macro behaves like #TEST_CALLOC_OR_FAIL, except that if the allocation
+ * This macro behaves like #TEST_CALLOC, except that if the allocation
* fails, it marks the test as skipped rather than failed.
*/
#define TEST_CALLOC_OR_SKIP(pointer, length) \
diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c
index ff43780..7c70fa8 100644
--- a/tests/src/psa_exercise_key.c
+++ b/tests/src/psa_exercise_key.c
@@ -505,7 +505,7 @@
key_bits = psa_get_key_bits(&attributes);
public_key_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(private_key_type);
public_key_length = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_key_type, key_bits);
- TEST_CALLOC_OR_FAIL(public_key, public_key_length);
+ TEST_CALLOC(public_key, public_key_length);
PSA_ASSERT(psa_export_public_key(key, public_key, public_key_length,
&public_key_length));
@@ -547,7 +547,7 @@
key_bits = psa_get_key_bits(&attributes);
public_key_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(private_key_type);
public_key_length = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_key_type, key_bits);
- TEST_CALLOC_OR_FAIL(public_key, public_key_length);
+ TEST_CALLOC(public_key, public_key_length);
PSA_ASSERT(psa_export_public_key(key,
public_key, public_key_length,
&public_key_length));
@@ -807,7 +807,7 @@
exported_size = PSA_EXPORT_KEY_OUTPUT_SIZE(
psa_get_key_type(&attributes),
psa_get_key_bits(&attributes));
- TEST_CALLOC_OR_FAIL(exported, exported_size);
+ TEST_CALLOC(exported, exported_size);
if ((usage & PSA_KEY_USAGE_EXPORT) == 0 &&
!PSA_KEY_TYPE_IS_PUBLIC_KEY(psa_get_key_type(&attributes))) {
@@ -850,7 +850,7 @@
exported_size = PSA_EXPORT_KEY_OUTPUT_SIZE(
psa_get_key_type(&attributes),
psa_get_key_bits(&attributes));
- TEST_CALLOC_OR_FAIL(exported, exported_size);
+ TEST_CALLOC(exported, exported_size);
TEST_EQUAL(psa_export_public_key(key, exported,
exported_size, &exported_length),
@@ -863,7 +863,7 @@
psa_get_key_type(&attributes));
exported_size = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_type,
psa_get_key_bits(&attributes));
- TEST_CALLOC_OR_FAIL(exported, exported_size);
+ TEST_CALLOC(exported, exported_size);
PSA_ASSERT(psa_export_public_key(key,
exported, exported_size,
diff --git a/tests/src/test_helpers/ssl_helpers.c b/tests/src/test_helpers/ssl_helpers.c
index e346ca0..2fea014 100644
--- a/tests/src/test_helpers/ssl_helpers.c
+++ b/tests/src/test_helpers/ssl_helpers.c
@@ -566,9 +566,9 @@
}
cert = &(ep->cert);
- TEST_CALLOC_OR_FAIL(cert->ca_cert, 1);
- TEST_CALLOC_OR_FAIL(cert->cert, 1);
- TEST_CALLOC_OR_FAIL(cert->pkey, 1);
+ TEST_CALLOC(cert->ca_cert, 1);
+ TEST_CALLOC(cert->cert, 1);
+ TEST_CALLOC(cert->pkey, 1);
mbedtls_x509_crt_init(cert->ca_cert);
mbedtls_x509_crt_init(cert->cert);
diff --git a/tests/suites/test_suite_aes.function b/tests/suites/test_suite_aes.function
index 36859bd..ead883e 100644
--- a/tests/suites/test_suite_aes.function
+++ b/tests/suites/test_suite_aes.function
@@ -688,8 +688,8 @@
struct align1 *dec1 = NULL;
/* All peak alignment */
- TEST_CALLOC_OR_FAIL(enc0, 1);
- TEST_CALLOC_OR_FAIL(dec0, 1);
+ TEST_CALLOC(enc0, 1);
+ TEST_CALLOC(dec0, 1);
if (!test_ctx_alignment(key, &enc0->ctx, &dec0->ctx)) {
goto exit;
}
@@ -699,8 +699,8 @@
dec0 = NULL;
/* Enc aligned, dec not */
- TEST_CALLOC_OR_FAIL(enc0, 1);
- TEST_CALLOC_OR_FAIL(dec1, 1);
+ TEST_CALLOC(enc0, 1);
+ TEST_CALLOC(dec1, 1);
if (!test_ctx_alignment(key, &enc0->ctx, &dec1->ctx)) {
goto exit;
}
@@ -710,8 +710,8 @@
dec1 = NULL;
/* Dec aligned, enc not */
- TEST_CALLOC_OR_FAIL(enc1, 1);
- TEST_CALLOC_OR_FAIL(dec0, 1);
+ TEST_CALLOC(enc1, 1);
+ TEST_CALLOC(dec0, 1);
if (!test_ctx_alignment(key, &enc1->ctx, &dec0->ctx)) {
goto exit;
}
@@ -721,8 +721,8 @@
dec0 = NULL;
/* Both shifted */
- TEST_CALLOC_OR_FAIL(enc1, 1);
- TEST_CALLOC_OR_FAIL(dec1, 1);
+ TEST_CALLOC(enc1, 1);
+ TEST_CALLOC(dec1, 1);
if (!test_ctx_alignment(key, &enc1->ctx, &dec1->ctx)) {
goto exit;
}
diff --git a/tests/suites/test_suite_asn1parse.function b/tests/suites/test_suite_asn1parse.function
index 9cef8aa..77f268c 100644
--- a/tests/suites/test_suite_asn1parse.function
+++ b/tests/suites/test_suite_asn1parse.function
@@ -135,7 +135,7 @@
/* Allocate a new buffer of exactly the length to parse each time.
* This gives memory sanitizers a chance to catch buffer overreads. */
if (buffer_size == 0) {
- TEST_CALLOC_OR_FAIL(buf, 1);
+ TEST_CALLOC(buf, 1);
end = buf + 1;
p = end;
} else {
@@ -247,7 +247,7 @@
mbedtls_test_set_step(buffer_size);
/* Allocate a new buffer of exactly the length to parse each time.
* This gives memory sanitizers a chance to catch buffer overreads. */
- TEST_CALLOC_OR_FAIL(buf, buffer_size);
+ TEST_CALLOC(buf, buffer_size);
memcpy(buf, input->x, buffer_size);
p = buf;
ret = nested_parse(&p, buf + buffer_size);
@@ -506,7 +506,7 @@
mbedtls_mpi_init(&actual_mpi);
- TEST_CALLOC_OR_FAIL(buf, size);
+ TEST_CALLOC(buf, size);
buf[0] = 0x02; /* tag: INTEGER */
buf[1] = 0x84; /* 4-octet length */
buf[2] = (too_many_octets >> 24) & 0xff;
@@ -729,10 +729,10 @@
{ { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 };
if (with_oid) {
- TEST_CALLOC_OR_FAIL(head.oid.p, 1);
+ TEST_CALLOC(head.oid.p, 1);
}
if (with_val) {
- TEST_CALLOC_OR_FAIL(head.val.p, 1);
+ TEST_CALLOC(head.val.p, 1);
}
if (with_next) {
head.next = &next;
@@ -758,7 +758,7 @@
for (i = 0; i < length; i++) {
mbedtls_asn1_named_data *new = NULL;
- TEST_CALLOC_OR_FAIL(new, 1);
+ TEST_CALLOC(new, 1);
new->next = head;
head = new;
}
diff --git a/tests/suites/test_suite_asn1write.function b/tests/suites/test_suite_asn1write.function
index 6ddd285..583ddc9 100644
--- a/tests/suites/test_suite_asn1write.function
+++ b/tests/suites/test_suite_asn1write.function
@@ -17,7 +17,7 @@
mbedtls_test_set_step(data->size);
mbedtls_free(data->output);
data->output = NULL;
- TEST_CALLOC_OR_FAIL(data->output, data->size == 0 ? 1 : data->size);
+ TEST_CALLOC(data->output, data->size == 0 ? 1 : data->size);
data->end = data->output + data->size;
data->p = data->end;
data->start = data->end - data->size;
@@ -296,7 +296,7 @@
size_t len_complete = data_len + par_len;
unsigned char expected_params_tag;
size_t expected_params_len;
- TEST_CALLOC_OR_FAIL(buf_complete, len_complete);
+ TEST_CALLOC(buf_complete, len_complete);
unsigned char *end_complete = buf_complete + len_complete;
memcpy(buf_complete, data.p, data_len);
if (par_len == 0) {
@@ -404,7 +404,7 @@
TEST_ASSERT(bitstring->len >= byte_length);
#if defined(MBEDTLS_ASN1_PARSE_C)
- TEST_CALLOC_OR_FAIL(masked_bitstring, byte_length);
+ TEST_CALLOC(masked_bitstring, byte_length);
if (byte_length != 0) {
memcpy(masked_bitstring, bitstring->x, byte_length);
if (bits % 8 != 0) {
@@ -477,7 +477,7 @@
}
pointers[ARRAY_LENGTH(nd)] = NULL;
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
- TEST_CALLOC_OR_FAIL(nd[i].oid.p, oid[i]->len);
+ TEST_CALLOC(nd[i].oid.p, oid[i]->len);
memcpy(nd[i].oid.p, oid[i]->x, oid[i]->len);
nd[i].oid.len = oid[i]->len;
nd[i].next = pointers[i+1];
@@ -529,7 +529,7 @@
unsigned char *new_val = (unsigned char *) "new value";
if (old_len != 0) {
- TEST_CALLOC_OR_FAIL(nd.val.p, (size_t) old_len);
+ TEST_CALLOC(nd.val.p, (size_t) old_len);
old_val = nd.val.p;
nd.val.len = old_len;
memset(old_val, 'x', old_len);
diff --git a/tests/suites/test_suite_bignum.function b/tests/suites/test_suite_bignum.function
index db9c2e7..a65a489 100644
--- a/tests/suites/test_suite_bignum.function
+++ b/tests/suites/test_suite_bignum.function
@@ -1507,7 +1507,7 @@
full_stats = 0;
stats_len = n_bits;
}
- TEST_CALLOC_OR_FAIL(stats, stats_len);
+ TEST_CALLOC(stats, stats_len);
for (i = 0; i < (size_t) iterations; i++) {
mbedtls_test_set_step(i);
diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function
index bf7f421..fffc513 100644
--- a/tests/suites/test_suite_cipher.function
+++ b/tests/suites/test_suite_cipher.function
@@ -1229,7 +1229,7 @@
* (we need the tag appended to the ciphertext)
*/
cipher_plus_tag_len = cipher->len + tag->len;
- TEST_CALLOC_OR_FAIL(cipher_plus_tag, cipher_plus_tag_len);
+ TEST_CALLOC(cipher_plus_tag, cipher_plus_tag_len);
memcpy(cipher_plus_tag, cipher->x, cipher->len);
memcpy(cipher_plus_tag + cipher->len, tag->x, tag->len);
@@ -1247,7 +1247,7 @@
* Try decrypting to a buffer that's 1B too small
*/
if (decrypt_buf_len != 0) {
- TEST_CALLOC_OR_FAIL(decrypt_buf, decrypt_buf_len - 1);
+ TEST_CALLOC(decrypt_buf, decrypt_buf_len - 1);
outlen = 0;
ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
@@ -1262,7 +1262,7 @@
/*
* Authenticate and decrypt, and check result
*/
- TEST_CALLOC_OR_FAIL(decrypt_buf, decrypt_buf_len);
+ TEST_CALLOC(decrypt_buf, decrypt_buf_len);
outlen = 0;
ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
@@ -1306,7 +1306,7 @@
/*
* Try encrypting with an output buffer that's 1B too small
*/
- TEST_CALLOC_OR_FAIL(encrypt_buf, encrypt_buf_len - 1);
+ TEST_CALLOC(encrypt_buf, encrypt_buf_len - 1);
outlen = 0;
ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,
@@ -1320,7 +1320,7 @@
/*
* Encrypt and check the result
*/
- TEST_CALLOC_OR_FAIL(encrypt_buf, encrypt_buf_len);
+ TEST_CALLOC(encrypt_buf, encrypt_buf_len);
outlen = 0;
ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,
@@ -1374,7 +1374,7 @@
* Authenticate and decrypt, and check result
*/
- TEST_CALLOC_OR_FAIL(decrypt_buf, cipher->len);
+ TEST_CALLOC(decrypt_buf, cipher->len);
outlen = 0;
ret = mbedtls_cipher_auth_decrypt(&ctx, iv->x, iv->len, ad->x, ad->len,
tmp_cipher, cipher->len, decrypt_buf, &outlen,
@@ -1411,14 +1411,14 @@
/* prepare buffers for encryption */
#if defined(MBEDTLS_USE_PSA_CRYPTO)
if (use_psa) {
- TEST_CALLOC_OR_FAIL(cipher_plus_tag, cipher->len + tag->len);
+ TEST_CALLOC(cipher_plus_tag, cipher->len + tag->len);
tmp_cipher = cipher_plus_tag;
tmp_tag = cipher_plus_tag + cipher->len;
} else
#endif /* MBEDTLS_USE_PSA_CRYPTO */
{
- TEST_CALLOC_OR_FAIL(encrypt_buf, cipher->len);
- TEST_CALLOC_OR_FAIL(tag_buf, tag->len);
+ TEST_CALLOC(encrypt_buf, cipher->len);
+ TEST_CALLOC(tag_buf, tag->len);
tmp_cipher = encrypt_buf;
tmp_tag = tag_buf;
}
diff --git a/tests/suites/test_suite_constant_time.function b/tests/suites/test_suite_constant_time.function
index d67e46b..bbd8382 100644
--- a/tests/suites/test_suite_constant_time.function
+++ b/tests/suites/test_suite_constant_time.function
@@ -23,8 +23,8 @@
size_t src_len = offset_max + len;
size_t secret;
- TEST_CALLOC_OR_FAIL(dst, len);
- TEST_CALLOC_OR_FAIL(src, src_len);
+ TEST_CALLOC(dst, len);
+ TEST_CALLOC(src, src_len);
/* Fill src in a way that we can detect if we copied the right bytes */
mbedtls_test_rnd_std_rand(NULL, src, src_len);
diff --git a/tests/suites/test_suite_constant_time_hmac.function b/tests/suites/test_suite_constant_time_hmac.function
index 2ca1047..2cc5005 100644
--- a/tests/suites/test_suite_constant_time_hmac.function
+++ b/tests/suites/test_suite_constant_time_hmac.function
@@ -35,7 +35,7 @@
block_size = hash == MBEDTLS_MD_SHA384 ? 128 : 64;
/* Use allocated out buffer to catch overwrites */
- TEST_CALLOC_OR_FAIL(out, out_len);
+ TEST_CALLOC(out, out_len);
/* Set up contexts with the given hash and a dummy key */
TEST_EQUAL(0, mbedtls_md_setup(&ctx, md_info, 1));
@@ -54,7 +54,7 @@
mbedtls_test_set_step(max_in_len * 10000);
/* Use allocated in buffer to catch overreads */
- TEST_CALLOC_OR_FAIL(data, max_in_len);
+ TEST_CALLOC(data, max_in_len);
min_in_len = max_in_len > 255 ? max_in_len - 255 : 0;
for (in_len = min_in_len; in_len <= max_in_len; in_len++) {
diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function
index e12873b..39c9dde 100644
--- a/tests/suites/test_suite_ecp.function
+++ b/tests/suites/test_suite_ecp.function
@@ -1426,7 +1426,7 @@
rnd_info.fallback_f_rng = NULL;
rnd_info.fallback_p_rng = NULL;
- TEST_CALLOC_OR_FAIL(actual, expected->len);
+ TEST_CALLOC(actual, expected->len);
ret = mbedtls_ecp_gen_privkey_mx(bits, &d,
mbedtls_test_rnd_buffer_rand, &rnd_info);
diff --git a/tests/suites/test_suite_mps.function b/tests/suites/test_suite_mps.function
index c04a651..ecb7e31 100644
--- a/tests/suites/test_suite_mps.function
+++ b/tests/suites/test_suite_mps.function
@@ -844,15 +844,15 @@
mbedtls_mps_reader rd;
if (acc_size > 0) {
- TEST_CALLOC_OR_FAIL(acc, acc_size);
+ TEST_CALLOC(acc, acc_size);
}
/* This probably needs to be changed because we want
* our tests to be deterministic. */
// srand( time( NULL ) );
- TEST_CALLOC_OR_FAIL(outgoing, num_out_chunks * max_chunk_size);
- TEST_CALLOC_OR_FAIL(incoming, num_out_chunks * max_chunk_size);
+ TEST_CALLOC(outgoing, num_out_chunks * max_chunk_size);
+ TEST_CALLOC(incoming, num_out_chunks * max_chunk_size);
mbedtls_mps_reader_init(&rd, acc, acc_size);
@@ -884,7 +884,7 @@
}
tmp_size = (rand() % max_chunk_size) + 1;
- TEST_CALLOC_OR_FAIL(tmp, tmp_size);
+ TEST_CALLOC(tmp, tmp_size);
TEST_ASSERT(mbedtls_test_rnd_std_rand(NULL, tmp, tmp_size) == 0);
ret = mbedtls_mps_reader_feed(&rd, tmp, tmp_size);
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index 90647d5..c17037f 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -915,7 +915,7 @@
#endif
hash_len = mbedtls_md_get_size(mbedtls_md_info_from_type(md));
- TEST_CALLOC_OR_FAIL(hash, hash_len);
+ TEST_CALLOC(hash, hash_len);
mbedtls_pk_init(&pk);
USE_PSA_INIT();
diff --git a/tests/suites/test_suite_pkcs12.function b/tests/suites/test_suite_pkcs12.function
index c4df8ab..7bd6fc0 100644
--- a/tests/suites/test_suite_pkcs12.function
+++ b/tests/suites/test_suite_pkcs12.function
@@ -42,7 +42,7 @@
salt_len = salt_arg->len;
- TEST_CALLOC_OR_FAIL(output_data, key_size);
+ TEST_CALLOC(output_data, key_size);
int ret = mbedtls_pkcs12_derivation(output_data,
key_size,
diff --git a/tests/suites/test_suite_pkwrite.function b/tests/suites/test_suite_pkwrite.function
index 764c55c..88d0dd2 100644
--- a/tests/suites/test_suite_pkwrite.function
+++ b/tests/suites/test_suite_pkwrite.function
@@ -58,7 +58,7 @@
}
TEST_ASSERT(check_buf_len > 0);
- TEST_CALLOC_OR_FAIL(buf, check_buf_len);
+ TEST_CALLOC(buf, check_buf_len);
if (is_public_key) {
TEST_EQUAL(mbedtls_pk_parse_public_keyfile(&key, key_file), 0);
@@ -145,7 +145,7 @@
&pub_key_len), 0);
derived_key_len = pub_key_len;
- TEST_CALLOC_OR_FAIL(derived_key_raw, derived_key_len);
+ TEST_CALLOC(derived_key_raw, derived_key_len);
TEST_EQUAL(mbedtls_pk_write_pubkey_der(&priv_key, derived_key_raw,
derived_key_len), pub_key_len);
diff --git a/tests/suites/test_suite_platform_printf.function b/tests/suites/test_suite_platform_printf.function
index 14fa604..8739dc0 100644
--- a/tests/suites/test_suite_platform_printf.function
+++ b/tests/suites/test_suite_platform_printf.function
@@ -32,7 +32,7 @@
const size_t n = strlen(result);
/* Nominal case: buffer just large enough */
- TEST_CALLOC_OR_FAIL(output, n + 1);
+ TEST_CALLOC(output, n + 1);
TEST_EQUAL(n, mbedtls_snprintf(output, n + 1, format, x));
TEST_BUFFERS_EQUAL(result, n + 1, output, n + 1);
mbedtls_free(output);
@@ -53,11 +53,11 @@
const size_t n = sizeof(value) * 2;
/* We assume that long has no padding bits! */
- TEST_CALLOC_OR_FAIL(expected, n + 1);
+ TEST_CALLOC(expected, n + 1);
expected[0] = '7';
memset(expected + 1, 'f', sizeof(value) * 2 - 1);
- TEST_CALLOC_OR_FAIL(output, n + 1);
+ TEST_CALLOC(output, n + 1);
TEST_EQUAL(n, mbedtls_snprintf(output, n + 1, format, value));
TEST_BUFFERS_EQUAL(expected, n + 1, output, n + 1);
mbedtls_free(output);
@@ -77,7 +77,7 @@
const size_t n = strlen(result);
/* Nominal case: buffer just large enough */
- TEST_CALLOC_OR_FAIL(output, n + 1);
+ TEST_CALLOC(output, n + 1);
TEST_EQUAL(n, mbedtls_snprintf(output, n + 1, format, arg1, arg2));
TEST_BUFFERS_EQUAL(result, n + 1, output, n + 1);
mbedtls_free(output);
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index d2b3c71..16efd43 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -533,7 +533,7 @@
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
PSA_ASSERT(psa_crypto_init());
- TEST_CALLOC_OR_FAIL(buffer, buffer_size);
+ TEST_CALLOC(buffer, buffer_size);
TEST_ASSERT((ret = construct_fake_rsa_key(buffer, buffer_size, &p,
bits, keypair)) >= 0);
@@ -578,9 +578,9 @@
psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;
export_size = (ptrdiff_t) data->len + export_size_delta;
- TEST_CALLOC_OR_FAIL(exported, export_size);
+ TEST_CALLOC(exported, export_size);
if (!canonical_input) {
- TEST_CALLOC_OR_FAIL(reexported, export_size);
+ TEST_CALLOC(reexported, export_size);
}
PSA_ASSERT(psa_crypto_init());
@@ -687,7 +687,7 @@
PSA_ASSERT(psa_import_key(&attributes, data->x, data->len, &key));
/* Export the public key */
- TEST_CALLOC_OR_FAIL(exported, export_size);
+ TEST_CALLOC(exported, export_size);
status = psa_export_public_key(key,
exported, export_size,
&exported_length);
@@ -1081,7 +1081,7 @@
key_bits = psa_get_key_bits(&attributes);
buffer_length = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits,
exercise_alg);
- TEST_CALLOC_OR_FAIL(buffer, buffer_length);
+ TEST_CALLOC(buffer, buffer_length);
status = psa_asymmetric_encrypt(key, exercise_alg,
NULL, 0,
@@ -1446,7 +1446,7 @@
psa_get_key_enrollment_algorithm(&target_attributes));
if (expected_usage & PSA_KEY_USAGE_EXPORT) {
size_t length;
- TEST_CALLOC_OR_FAIL(export_buffer, material->len);
+ TEST_CALLOC(export_buffer, material->len);
PSA_ASSERT(psa_export_key(target_key, export_buffer,
material->len, &length));
TEST_BUFFERS_EQUAL(material->x, material->len,
@@ -1599,7 +1599,7 @@
psa_status_t expected_status = expected_status_arg;
psa_status_t status;
- TEST_CALLOC_OR_FAIL(output, output_size);
+ TEST_CALLOC(output, output_size);
PSA_ASSERT(psa_crypto_init());
@@ -2187,7 +2187,7 @@
PSA_ERROR_BUFFER_TOO_SMALL);
mbedtls_test_set_step(output_size);
- TEST_CALLOC_OR_FAIL(actual_mac, output_size);
+ TEST_CALLOC(actual_mac, output_size);
/* Calculate the MAC, one-shot case. */
TEST_EQUAL(psa_mac_compute(key, alg,
@@ -2283,7 +2283,7 @@
PSA_ERROR_INVALID_SIGNATURE);
/* Test a MAC that's too long, one-shot case. */
- TEST_CALLOC_OR_FAIL(perturbed_mac, expected_mac->len + 1);
+ TEST_CALLOC(perturbed_mac, expected_mac->len + 1);
memcpy(perturbed_mac, expected_mac->x, expected_mac->len);
TEST_EQUAL(psa_mac_verify(key, alg,
input->x, input->len,
@@ -2608,7 +2608,7 @@
output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg,
input->len);
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
&key));
@@ -2662,7 +2662,7 @@
&key));
output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg,
plaintext->len);
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
/* set_iv() is not allowed */
PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
@@ -2811,8 +2811,8 @@
output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
output2_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
- TEST_CALLOC_OR_FAIL(output1, output1_buffer_size);
- TEST_CALLOC_OR_FAIL(output2, output2_buffer_size);
+ TEST_CALLOC(output1, output1_buffer_size);
+ TEST_CALLOC(output2, output2_buffer_size);
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
&key));
@@ -2903,7 +2903,7 @@
output_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
TEST_LE_U(first_part_size, input->len);
PSA_ASSERT(psa_cipher_update(&operation, input->x, first_part_size,
@@ -3002,7 +3002,7 @@
output_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
TEST_LE_U(first_part_size, input->len);
PSA_ASSERT(psa_cipher_update(&operation,
@@ -3095,13 +3095,13 @@
/* Allocate input buffer and copy the iv and the plaintext */
input_buffer_size = ((size_t) input_arg->len + (size_t) iv->len);
if (input_buffer_size > 0) {
- TEST_CALLOC_OR_FAIL(input, input_buffer_size);
+ TEST_CALLOC(input, input_buffer_size);
memcpy(input, iv->x, iv->len);
memcpy(input + iv->len, input_arg->x, input_arg->len);
}
output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_buffer_size);
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
status = psa_cipher_decrypt(key, alg, input, input_buffer_size, output,
output_buffer_size, &output_length);
@@ -3142,13 +3142,13 @@
/* Allocate input buffer and copy the iv and the plaintext */
input_buffer_size = ((size_t) input_arg->len + (size_t) iv->len);
if (input_buffer_size > 0) {
- TEST_CALLOC_OR_FAIL(input, input_buffer_size);
+ TEST_CALLOC(input, input_buffer_size);
memcpy(input, iv->x, iv->len);
memcpy(input + iv->len, input_arg->x, input_arg->len);
}
output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_buffer_size);
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
&key));
@@ -3196,7 +3196,7 @@
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
&key));
output1_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
- TEST_CALLOC_OR_FAIL(output1, output1_size);
+ TEST_CALLOC(output1, output1_size);
PSA_ASSERT(psa_cipher_encrypt(key, alg, input->x, input->len,
output1, output1_size,
@@ -3207,7 +3207,7 @@
PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input->len));
output2_size = output1_length;
- TEST_CALLOC_OR_FAIL(output2, output2_size);
+ TEST_CALLOC(output2, output2_size);
PSA_ASSERT(psa_cipher_decrypt(key, alg, output1, output1_length,
output2, output2_size,
@@ -3273,7 +3273,7 @@
output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
TEST_LE_U(output1_buffer_size,
PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input->len));
- TEST_CALLOC_OR_FAIL(output1, output1_buffer_size);
+ TEST_CALLOC(output1, output1_buffer_size);
TEST_LE_U(first_part_size, input->len);
@@ -3316,7 +3316,7 @@
PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, output1_length));
TEST_LE_U(output2_buffer_size,
PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(output1_length));
- TEST_CALLOC_OR_FAIL(output2, output2_buffer_size);
+ TEST_CALLOC(output2, output2_buffer_size);
if (iv_length > 0) {
PSA_ASSERT(psa_cipher_set_iv(&operation2,
@@ -3412,7 +3412,7 @@
TEST_ASSERT(output_size <=
PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(input_data->len));
}
- TEST_CALLOC_OR_FAIL(output_data, output_size);
+ TEST_CALLOC(output_data, output_size);
status = psa_aead_encrypt(key, alg,
nonce->x, nonce->len,
@@ -3433,7 +3433,7 @@
TEST_EQUAL(status, expected_result);
if (PSA_SUCCESS == expected_result) {
- TEST_CALLOC_OR_FAIL(output_data2, output_length);
+ TEST_CALLOC(output_data2, output_length);
/* For all currently defined algorithms, PSA_AEAD_DECRYPT_OUTPUT_SIZE
* should be exact. */
@@ -3501,7 +3501,7 @@
PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_data->len));
TEST_ASSERT(output_size <=
PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(input_data->len));
- TEST_CALLOC_OR_FAIL(output_data, output_size);
+ TEST_CALLOC(output_data, output_size);
status = psa_aead_encrypt(key, alg,
nonce->x, nonce->len,
@@ -3571,7 +3571,7 @@
TEST_ASSERT(output_size <=
PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(input_data->len));
}
- TEST_CALLOC_OR_FAIL(output_data, output_size);
+ TEST_CALLOC(output_data, output_size);
status = psa_aead_decrypt(key, alg,
nonce->x, nonce->len,
@@ -3655,7 +3655,7 @@
key_bits, alg);
TEST_ASSERT(signature_size != 0);
TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
/* Perform the signature. */
PSA_ASSERT(psa_sign_hash(key, alg,
@@ -3705,7 +3705,7 @@
size_t signature_length = 0xdeadbeef;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
PSA_ASSERT(psa_crypto_init());
@@ -3775,7 +3775,7 @@
key_bits, alg);
TEST_ASSERT(signature_size != 0);
TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
/* Perform the signature. */
PSA_ASSERT(psa_sign_hash(key, alg,
@@ -3926,7 +3926,7 @@
signature_size = PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg);
TEST_ASSERT(signature_size != 0);
TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
PSA_ASSERT(psa_sign_message(key, alg,
input_data->x, input_data->len,
@@ -3964,7 +3964,7 @@
size_t signature_length = 0xdeadbeef;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
PSA_ASSERT(psa_crypto_init());
@@ -4024,7 +4024,7 @@
signature_size = PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg);
TEST_ASSERT(signature_size != 0);
TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
PSA_ASSERT(psa_sign_message(key, alg,
input_data->x, input_data->len,
@@ -4164,7 +4164,7 @@
output_size = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits, alg);
TEST_LE_U(output_size, PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(output, output_size);
+ TEST_CALLOC(output, output_size);
/* Encrypt the input */
actual_status = psa_asymmetric_encrypt(key, alg,
@@ -4246,13 +4246,13 @@
output_size = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits, alg);
TEST_LE_U(output_size, PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(output, output_size);
+ TEST_CALLOC(output, output_size);
output2_size = input_data->len;
TEST_LE_U(output2_size,
PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg));
TEST_LE_U(output2_size, PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(output2, output2_size);
+ TEST_CALLOC(output2, output2_size);
/* We test encryption by checking that encrypt-then-decrypt gives back
* the original plaintext because of the non-optional random
@@ -4320,7 +4320,7 @@
/* Determine the maximum ciphertext length */
output_size = PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg);
TEST_LE_U(output_size, PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(output, output_size);
+ TEST_CALLOC(output, output_size);
PSA_ASSERT(psa_asymmetric_decrypt(key, alg,
input_data->x, input_data->len,
@@ -4375,7 +4375,7 @@
psa_status_t expected_status = expected_status_arg;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
- TEST_CALLOC_OR_FAIL(output, output_size);
+ TEST_CALLOC(output, output_size);
PSA_ASSERT(psa_crypto_init());
@@ -4694,7 +4694,7 @@
expected_outputs[i] = NULL;
}
}
- TEST_CALLOC_OR_FAIL(output_buffer, output_buffer_size);
+ TEST_CALLOC(output_buffer, output_buffer_size);
PSA_ASSERT(psa_crypto_init());
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
@@ -4931,8 +4931,8 @@
psa_key_attributes_t derived_attributes = PSA_KEY_ATTRIBUTES_INIT;
size_t length;
- TEST_CALLOC_OR_FAIL(output_buffer, capacity);
- TEST_CALLOC_OR_FAIL(export_buffer, capacity);
+ TEST_CALLOC(output_buffer, capacity);
+ TEST_CALLOC(export_buffer, capacity);
PSA_ASSERT(psa_crypto_init());
psa_set_key_usage_flags(&base_attributes, PSA_KEY_USAGE_DERIVE);
@@ -5128,7 +5128,7 @@
PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE);
/* Good case with exact output size */
- TEST_CALLOC_OR_FAIL(output, expected_output->len);
+ TEST_CALLOC(output, expected_output->len);
PSA_ASSERT(psa_raw_key_agreement(alg, our_key,
peer_key_data->x, peer_key_data->len,
output, expected_output->len,
@@ -5140,7 +5140,7 @@
output_length = ~0;
/* Larger buffer */
- TEST_CALLOC_OR_FAIL(output, expected_output->len + 1);
+ TEST_CALLOC(output, expected_output->len + 1);
PSA_ASSERT(psa_raw_key_agreement(alg, our_key,
peer_key_data->x, peer_key_data->len,
output, expected_output->len + 1,
@@ -5152,7 +5152,7 @@
output_length = ~0;
/* Buffer too small */
- TEST_CALLOC_OR_FAIL(output, expected_output->len - 1);
+ TEST_CALLOC(output, expected_output->len - 1);
TEST_EQUAL(psa_raw_key_agreement(alg, our_key,
peer_key_data->x, peer_key_data->len,
output, expected_output->len - 1,
@@ -5241,7 +5241,7 @@
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
uint8_t *actual_output = NULL;
- TEST_CALLOC_OR_FAIL(actual_output, MAX(expected_output1->len,
+ TEST_CALLOC(actual_output, MAX(expected_output1->len,
expected_output2->len));
PSA_ASSERT(psa_crypto_init());
@@ -5297,8 +5297,8 @@
TEST_ASSERT(bytes_arg >= 0);
- TEST_CALLOC_OR_FAIL(output, bytes);
- TEST_CALLOC_OR_FAIL(changed, bytes);
+ TEST_CALLOC(output, bytes);
+ TEST_CALLOC(changed, bytes);
PSA_ASSERT(psa_crypto_init());
@@ -5416,8 +5416,8 @@
is_default_public_exponent = 1;
e_read_size = 0;
}
- TEST_CALLOC_OR_FAIL(e_read_buffer, e_read_size);
- TEST_CALLOC_OR_FAIL(exported, exported_size);
+ TEST_CALLOC(e_read_buffer, e_read_size);
+ TEST_CALLOC(exported, exported_size);
PSA_ASSERT(psa_crypto_init());
@@ -5519,8 +5519,8 @@
size_t second_exported_length;
if (usage_flags & PSA_KEY_USAGE_EXPORT) {
- TEST_CALLOC_OR_FAIL(first_export, export_size);
- TEST_CALLOC_OR_FAIL(second_export, export_size);
+ TEST_CALLOC(first_export, export_size);
+ TEST_CALLOC(second_export, export_size);
}
PSA_ASSERT(psa_crypto_init());
diff --git a/tests/suites/test_suite_psa_crypto_driver_wrappers.function b/tests/suites/test_suite_psa_crypto_driver_wrappers.function
index f7c5c33..5ae0461 100644
--- a/tests/suites/test_suite_psa_crypto_driver_wrappers.function
+++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.function
@@ -56,7 +56,7 @@
TEST_ASSERT(signature_size != 0);
TEST_ASSERT(signature_size <= PSA_SIGNATURE_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
actual_status = psa_sign_hash(key, alg,
data_input->x, data_input->len,
@@ -183,7 +183,7 @@
TEST_ASSERT(signature_size != 0);
TEST_ASSERT(signature_size <= PSA_SIGNATURE_MAX_SIZE);
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(signature, signature_size);
actual_status = psa_sign_message(key, alg,
data_input->x, data_input->len,
@@ -487,8 +487,8 @@
output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
output2_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
- TEST_CALLOC_OR_FAIL(output1, output1_buffer_size);
- TEST_CALLOC_OR_FAIL(output2, output2_buffer_size);
+ TEST_CALLOC(output1, output1_buffer_size);
+ TEST_CALLOC(output2, output2_buffer_size);
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
&key));
@@ -605,7 +605,7 @@
output_buffer_size = ((size_t) input->len +
PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type));
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
if (mock_output_arg) {
mbedtls_test_driver_cipher_hooks.forced_output = expected_output->x;
@@ -733,7 +733,7 @@
output_buffer_size = ((size_t) input->len +
PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type));
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
if (mock_output_arg) {
mbedtls_test_driver_cipher_hooks.forced_output = expected_output->x;
@@ -832,13 +832,13 @@
/* Allocate input buffer and copy the iv and the plaintext */
input_buffer_size = ((size_t) input_arg->len + (size_t) iv->len);
if (input_buffer_size > 0) {
- TEST_CALLOC_OR_FAIL(input, input_buffer_size);
+ TEST_CALLOC(input, input_buffer_size);
memcpy(input, iv->x, iv->len);
memcpy(input + iv->len, input_arg->x, input_arg->len);
}
output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_buffer_size);
- TEST_CALLOC_OR_FAIL(output, output_buffer_size);
+ TEST_CALLOC(output, output_buffer_size);
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
&key));
@@ -885,7 +885,7 @@
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
- TEST_CALLOC_OR_FAIL(output, input->len + 16);
+ TEST_CALLOC(output, input->len + 16);
output_buffer_size = input->len + 16;
PSA_ASSERT(psa_crypto_init());
@@ -1125,7 +1125,7 @@
PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_data->len));
TEST_ASSERT(output_size <=
PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(input_data->len));
- TEST_CALLOC_OR_FAIL(output_data, output_size);
+ TEST_CALLOC(output_data, output_size);
mbedtls_test_driver_aead_hooks.forced_status = forced_status;
status = psa_aead_encrypt(key, alg,
@@ -1187,7 +1187,7 @@
output_size = input_data->len - PSA_AEAD_TAG_LENGTH(key_type, key_bits,
alg);
- TEST_CALLOC_OR_FAIL(output_data, output_size);
+ TEST_CALLOC(output_data, output_size);
mbedtls_test_driver_aead_hooks.forced_status = forced_status;
status = psa_aead_decrypt(key, alg,
@@ -1250,7 +1250,7 @@
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
&key));
- TEST_CALLOC_OR_FAIL(actual_mac, mac_buffer_size);
+ TEST_CALLOC(actual_mac, mac_buffer_size);
mbedtls_test_driver_mac_hooks.forced_status = forced_status;
/*
@@ -1470,7 +1470,7 @@
psa_status_t actual_status;
PSA_ASSERT(psa_crypto_init());
- TEST_CALLOC_OR_FAIL(output_buffer, expected_output->len);
+ TEST_CALLOC(output_buffer, expected_output->len);
actual_status = psa_export_key(key, output_buffer, expected_output->len, &output_size);
@@ -1521,7 +1521,7 @@
psa_status_t actual_status;
PSA_ASSERT(psa_crypto_init());
- TEST_CALLOC_OR_FAIL(output_buffer, expected_output->len);
+ TEST_CALLOC(output_buffer, expected_output->len);
actual_status = psa_export_public_key(key, output_buffer, expected_output->len, &output_size);
@@ -1564,7 +1564,7 @@
mbedtls_test_driver_hash_hooks.forced_status = forced_status;
PSA_ASSERT(psa_crypto_init());
- TEST_CALLOC_OR_FAIL(output, PSA_HASH_LENGTH(alg));
+ TEST_CALLOC(output, PSA_HASH_LENGTH(alg));
TEST_EQUAL(psa_hash_compute(alg, input->x, input->len,
output, PSA_HASH_LENGTH(alg),
@@ -1597,7 +1597,7 @@
size_t output_length;
mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
- TEST_CALLOC_OR_FAIL(output, PSA_HASH_LENGTH(alg));
+ TEST_CALLOC(output, PSA_HASH_LENGTH(alg));
PSA_ASSERT(psa_crypto_init());
@@ -1642,7 +1642,7 @@
size_t output_length;
mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
- TEST_CALLOC_OR_FAIL(output, PSA_HASH_LENGTH(alg));
+ TEST_CALLOC(output, PSA_HASH_LENGTH(alg));
PSA_ASSERT(psa_crypto_init());
@@ -1697,7 +1697,7 @@
size_t output_length;
mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
- TEST_CALLOC_OR_FAIL(output, PSA_HASH_LENGTH(alg));
+ TEST_CALLOC(output, PSA_HASH_LENGTH(alg));
PSA_ASSERT(psa_crypto_init());
@@ -1751,7 +1751,7 @@
size_t output_length;
mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
- TEST_CALLOC_OR_FAIL(output, PSA_HASH_LENGTH(alg));
+ TEST_CALLOC(output, PSA_HASH_LENGTH(alg));
PSA_ASSERT(psa_crypto_init());
diff --git a/tests/suites/test_suite_psa_crypto_entropy.function b/tests/suites/test_suite_psa_crypto_entropy.function
index 6f65f8f..362b3da 100644
--- a/tests/suites/test_suite_psa_crypto_entropy.function
+++ b/tests/suites/test_suite_psa_crypto_entropy.function
@@ -114,8 +114,8 @@
size_t signature_size = PSA_SIGNATURE_MAX_SIZE;
size_t signature_length;
- TEST_CALLOC_OR_FAIL(input, input_size);
- TEST_CALLOC_OR_FAIL(signature, signature_size);
+ TEST_CALLOC(input, input_size);
+ TEST_CALLOC(signature, signature_size);
PSA_ASSERT(psa_crypto_init());
PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
@@ -163,7 +163,7 @@
} else {
seed_size = seed_length_b;
}
- TEST_CALLOC_OR_FAIL(seed, seed_size);
+ TEST_CALLOC(seed, seed_size);
/* fill seed with some data */
for (i = 0; i < seed_size; ++i) {
seed[i] = i;
diff --git a/tests/suites/test_suite_psa_crypto_init.function b/tests/suites/test_suite_psa_crypto_init.function
index 78f80a1..63767f0 100644
--- a/tests/suites/test_suite_psa_crypto_init.function
+++ b/tests/suites/test_suite_psa_crypto_init.function
@@ -289,7 +289,7 @@
uint8_t *seed = NULL;
size_t seed_size = seed_size_arg;
- TEST_CALLOC_OR_FAIL(seed, seed_size);
+ TEST_CALLOC(seed, seed_size);
TEST_ASSERT(mbedtls_nv_seed_write(seed, seed_size) >= 0);
custom_entropy_sources_mask = ENTROPY_SOURCE_NV_SEED;
diff --git a/tests/suites/test_suite_psa_crypto_persistent_key.function b/tests/suites/test_suite_psa_crypto_persistent_key.function
index 4b4b00d..f21875f 100644
--- a/tests/suites/test_suite_psa_crypto_persistent_key.function
+++ b/tests/suites/test_suite_psa_crypto_persistent_key.function
@@ -61,7 +61,7 @@
psa_set_key_algorithm(&attributes, key_alg);
psa_set_key_enrollment_algorithm(&attributes, key_alg2);
- TEST_CALLOC_OR_FAIL(file_data, file_data_length);
+ TEST_CALLOC(file_data, file_data_length);
psa_format_key_data_for_storage(key_data->x, key_data->len,
&attributes.core,
file_data);
@@ -127,7 +127,7 @@
size_t data_length = data_length_arg;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
- TEST_CALLOC_OR_FAIL(data, data_length);
+ TEST_CALLOC(data, data_length);
PSA_ASSERT(psa_crypto_init());
@@ -267,7 +267,7 @@
size_t exported_length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
- TEST_CALLOC_OR_FAIL(exported, export_size);
+ TEST_CALLOC(exported, export_size);
PSA_ASSERT(psa_crypto_init());
diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal.function b/tests/suites/test_suite_psa_crypto_se_driver_hal.function
index a897736..bb00c06 100644
--- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function
+++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function
@@ -601,7 +601,7 @@
int ok = 0;
PSA_ASSERT(psa_its_get_info(uid, &info));
- TEST_CALLOC_OR_FAIL(loaded, info.size);
+ TEST_CALLOC(loaded, info.size);
PSA_ASSERT(psa_its_get(uid, 0, info.size, loaded, NULL));
TEST_BUFFERS_EQUAL(expected_data, size, loaded, info.size);
ok = 1;
diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function
index 6868c88..5f65fb9 100644
--- a/tests/suites/test_suite_psa_crypto_slot_management.function
+++ b/tests/suites/test_suite_psa_crypto_slot_management.function
@@ -303,7 +303,7 @@
psa_get_key_type(&read_attributes));
TEST_EQUAL(psa_get_key_bits(&attributes),
psa_get_key_bits(&read_attributes));
- TEST_CALLOC_OR_FAIL(reexported, key_data->len);
+ TEST_CALLOC(reexported, key_data->len);
if (usage_flags & PSA_KEY_USAGE_EXPORT) {
PSA_ASSERT(psa_export_key(id, reexported, key_data->len,
&reexported_length));
@@ -575,7 +575,7 @@
psa_get_key_enrollment_algorithm(&target_attributes));
if (expected_usage & PSA_KEY_USAGE_EXPORT) {
size_t length;
- TEST_CALLOC_OR_FAIL(export_buffer, material->len);
+ TEST_CALLOC(export_buffer, material->len);
PSA_ASSERT(psa_export_key(returned_target_id, export_buffer,
material->len, &length));
TEST_BUFFERS_EQUAL(material->x, material->len,
@@ -689,7 +689,7 @@
psa_get_key_algorithm(&attributes2));
if (target_usage & PSA_KEY_USAGE_EXPORT) {
size_t length;
- TEST_CALLOC_OR_FAIL(export_buffer, target_material->len);
+ TEST_CALLOC(export_buffer, target_material->len);
PSA_ASSERT(psa_export_key(returned_target_id, export_buffer,
target_material->len, &length));
TEST_BUFFERS_EQUAL(target_material->x, target_material->len,
@@ -813,7 +813,7 @@
uint8_t exported[sizeof(size_t)];
size_t exported_length;
- TEST_CALLOC_OR_FAIL(keys, max_keys);
+ TEST_CALLOC(keys, max_keys);
PSA_ASSERT(psa_crypto_init());
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
@@ -942,7 +942,7 @@
TEST_ASSERT(MBEDTLS_PSA_KEY_SLOT_COUNT >= 1);
- TEST_CALLOC_OR_FAIL(keys, MBEDTLS_PSA_KEY_SLOT_COUNT);
+ TEST_CALLOC(keys, MBEDTLS_PSA_KEY_SLOT_COUNT);
PSA_ASSERT(psa_crypto_init());
psa_set_key_usage_flags(&attributes,
diff --git a/tests/suites/test_suite_psa_crypto_storage_format.function b/tests/suites/test_suite_psa_crypto_storage_format.function
index b68107c..9a03dd8 100644
--- a/tests/suites/test_suite_psa_crypto_storage_format.function
+++ b/tests/suites/test_suite_psa_crypto_storage_format.function
@@ -36,7 +36,7 @@
/* Check that the key is represented as expected. */
PSA_ASSERT(psa_its_get_info(uid, &storage_info));
TEST_EQUAL(storage_info.size, expected_representation->len);
- TEST_CALLOC_OR_FAIL(actual_representation, storage_info.size);
+ TEST_CALLOC(actual_representation, storage_info.size);
PSA_ASSERT(psa_its_get(uid, 0, storage_info.size,
actual_representation, &length));
TEST_BUFFERS_EQUAL(expected_representation->x, expected_representation->len,
@@ -268,7 +268,7 @@
TEST_EQUAL(psa_get_key_enrollment_algorithm(expected_attributes),
psa_get_key_enrollment_algorithm(&actual_attributes));
if (can_export(expected_attributes)) {
- TEST_CALLOC_OR_FAIL(exported_material, expected_material->len);
+ TEST_CALLOC(exported_material, expected_material->len);
PSA_ASSERT(psa_export_key(key_id,
exported_material, expected_material->len,
&length));
diff --git a/tests/suites/test_suite_psa_its.function b/tests/suites/test_suite_psa_its.function
index 5e86a0c..267b2e5 100644
--- a/tests/suites/test_suite_psa_its.function
+++ b/tests/suites/test_suite_psa_its.function
@@ -92,7 +92,7 @@
unsigned char *buffer = NULL;
size_t ret_len = 0;
- TEST_CALLOC_OR_FAIL(buffer, data->len);
+ TEST_CALLOC(buffer, data->len);
PSA_ASSERT(psa_its_set_wrap(uid, data->len, data->x, flags));
@@ -122,7 +122,7 @@
unsigned char *buffer = NULL;
size_t ret_len = 0;
- TEST_CALLOC_OR_FAIL(buffer, MAX(data1->len, data2->len));
+ TEST_CALLOC(buffer, MAX(data1->len, data2->len));
PSA_ASSERT(psa_its_set_wrap(uid, data1->len, data1->x, flags1));
PSA_ASSERT(psa_its_get_info(uid, &info));
@@ -214,7 +214,7 @@
size_t i;
size_t ret_len = 0;
- TEST_CALLOC_OR_FAIL(buffer, length + 16);
+ TEST_CALLOC(buffer, length + 16);
trailer = buffer + length;
memset(trailer, '-', 16);
diff --git a/tests/suites/test_suite_random.function b/tests/suites/test_suite_random.function
index f2da0ce..dfc4e85 100644
--- a/tests/suites/test_suite_random.function
+++ b/tests/suites/test_suite_random.function
@@ -163,7 +163,7 @@
unsigned char *output = NULL;
PSA_ASSERT(psa_crypto_init());
- TEST_CALLOC_OR_FAIL(output, n);
+ TEST_CALLOC(output, n);
TEST_EQUAL(0, mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE,
output, n));
diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function
index 1dc2313..302939f 100644
--- a/tests/suites/test_suite_ssl.function
+++ b/tests/suites/test_suite_ssl.function
@@ -147,7 +147,7 @@
if (input_len == 0) {
input_len = 1;
}
- TEST_CALLOC_OR_FAIL(input, input_len);
+ TEST_CALLOC(input, input_len);
output_len = 0;
for (j = 0; j < ROUNDS; j++) {
@@ -161,7 +161,7 @@
if (output_len == 0) {
output_len = 1;
}
- TEST_CALLOC_OR_FAIL(output, output_len);
+ TEST_CALLOC(output, output_len);
/* Fill up the buffer with structured data so that unwanted changes
* can be detected */
@@ -1516,8 +1516,8 @@
+ plaintext_len
+ t0.maclen
+ padlen + 1;
- TEST_CALLOC_OR_FAIL(buf, buflen);
- TEST_CALLOC_OR_FAIL(buf_save, buflen);
+ TEST_CALLOC(buf, buflen);
+ TEST_CALLOC(buf_save, buflen);
/* Prepare a dummy record header */
memset(rec.ctr, 0, sizeof(rec.ctr));