Merge remote-tracking branch 'origin/development' into update-restricted-2023-08-30

This commit is contained in:
Dave Rodgman 2023-08-30 11:22:00 +01:00
commit 730bbee226
315 changed files with 16246 additions and 9989 deletions

View file

@ -586,7 +586,7 @@ void dec_empty_buf(int cipher,
iv_len = 12;
}
ASSERT_ALLOC(iv, iv_len);
TEST_CALLOC(iv, iv_len);
memset(iv, 0, iv_len);
TEST_ASSERT(sizeof(key) * 8 >= mbedtls_cipher_info_get_key_bitlen(cipher_info));
@ -908,7 +908,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(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);
@ -926,7 +926,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(decrypt_buf, decrypt_buf_len - 1);
outlen = 0;
ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
@ -941,7 +941,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(decrypt_buf, decrypt_buf_len);
outlen = 0;
ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
@ -953,7 +953,7 @@ void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
TEST_ASSERT(buffer_is_all_zero(decrypt_buf, decrypt_buf_len));
} else {
TEST_ASSERT(ret == 0);
ASSERT_COMPARE(decrypt_buf, outlen, clear->x, clear->len);
TEST_MEMORY_COMPARE(decrypt_buf, outlen, clear->x, clear->len);
}
mbedtls_free(decrypt_buf);
@ -984,7 +984,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(encrypt_buf, encrypt_buf_len - 1);
outlen = 0;
ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,
@ -998,7 +998,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(encrypt_buf, encrypt_buf_len);
outlen = 0;
ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,