Skip to content

Backport 3.6: Use a null pointer for empty data #10257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: mbedtls-3.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/suites/test_suite_aes.function
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void aes_encrypt_xts(char *hex_key_string, char *hex_data_unit_string,
dst = mbedtls_test_unhexify_alloc(hex_dst_string, &dst_len);
TEST_ASSERT(src_len == dst_len);

output = mbedtls_test_zero_alloc(dst_len);
TEST_CALLOC(output, dst_len);

TEST_ASSERT(mbedtls_aes_xts_setkey_enc(&ctx, key, key_len * 8) == 0);
TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_ENCRYPT, src_len,
Expand Down Expand Up @@ -350,7 +350,7 @@ void aes_decrypt_xts(char *hex_key_string, char *hex_data_unit_string,
dst = mbedtls_test_unhexify_alloc(hex_dst_string, &dst_len);
TEST_ASSERT(src_len == dst_len);

output = mbedtls_test_zero_alloc(dst_len);
TEST_CALLOC(output, dst_len);

TEST_ASSERT(mbedtls_aes_xts_setkey_dec(&ctx, key, key_len * 8) == 0);
TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_DECRYPT, src_len,
Expand Down
4 changes: 2 additions & 2 deletions tests/suites/test_suite_base64.function
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void base64_encode_hex(data_t *src, char *dst, int dst_buf_size,
unsigned char *res = NULL;
size_t len;

res = mbedtls_test_zero_alloc(dst_buf_size);
TEST_CALLOC(res, dst_buf_size);

TEST_CF_SECRET(src->x, src->len);
TEST_ASSERT(mbedtls_base64_encode(res, dst_buf_size, &len, src->x, src->len) == result);
Expand All @@ -136,7 +136,7 @@ void base64_decode_hex(char *src, data_t *dst, int dst_buf_size,
unsigned char *res = NULL;
size_t len;

res = mbedtls_test_zero_alloc(dst_buf_size);
TEST_CALLOC(res, dst_buf_size);

TEST_ASSERT(mbedtls_base64_decode(res, dst_buf_size, &len, (unsigned char *) src,
strlen(src)) == result);
Expand Down