1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove
2023-07-20 16:48:18 +01:00
parent 65cd8519f7
commit f9ffd11e7a
40 changed files with 347 additions and 347 deletions

View File

@@ -583,7 +583,7 @@ void dec_empty_buf(int cipher,
iv_len = 12;
}
ASSERT_ALLOC(iv, iv_len);
TEST_CALLOC_OR_FAIL(iv, iv_len);
memset(iv, 0, iv_len);
TEST_ASSERT(sizeof(key) * 8 >= mbedtls_cipher_info_get_key_bitlen(cipher_info));
@@ -905,7 +905,7 @@ void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
* (we need the tag appended to the ciphertext)
*/
cipher_plus_tag_len = cipher->len + tag->len;
ASSERT_ALLOC(cipher_plus_tag, cipher_plus_tag_len);
TEST_CALLOC_OR_FAIL(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);
@@ -923,7 +923,7 @@ void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
* Try decrypting to a buffer that's 1B too small
*/
if (decrypt_buf_len != 0) {
ASSERT_ALLOC(decrypt_buf, decrypt_buf_len - 1);
TEST_CALLOC_OR_FAIL(decrypt_buf, decrypt_buf_len - 1);
outlen = 0;
ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
@@ -938,7 +938,7 @@ void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
/*
* Authenticate and decrypt, and check result
*/
ASSERT_ALLOC(decrypt_buf, decrypt_buf_len);
TEST_CALLOC_OR_FAIL(decrypt_buf, decrypt_buf_len);
outlen = 0;
ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
@@ -981,7 +981,7 @@ void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
/*
* Try encrypting with an output buffer that's 1B too small
*/
ASSERT_ALLOC(encrypt_buf, encrypt_buf_len - 1);
TEST_CALLOC_OR_FAIL(encrypt_buf, encrypt_buf_len - 1);
outlen = 0;
ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,
@@ -995,7 +995,7 @@ void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
/*
* Encrypt and check the result
*/
ASSERT_ALLOC(encrypt_buf, encrypt_buf_len);
TEST_CALLOC_OR_FAIL(encrypt_buf, encrypt_buf_len);
outlen = 0;
ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,