tests/ccm: check output buffer size
Add static test to verify output buffer is big enough for testing.
This commit is contained in:
parent
a83a1a80e5
commit
30202f9de7
@ -100,6 +100,9 @@ static void test_encrypt_op(uint8_t* key, uint8_t key_len,
|
|||||||
int len, err, cmp;
|
int len, err, cmp;
|
||||||
size_t len_encoding = nonce_and_len_encoding_size - nonce_len;
|
size_t len_encoding = nonce_and_len_encoding_size - nonce_len;
|
||||||
|
|
||||||
|
TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len,
|
||||||
|
"Output buffer too small");
|
||||||
|
|
||||||
err = cipher_init(&cipher, CIPHER_AES_128, key, key_len);
|
err = cipher_init(&cipher, CIPHER_AES_128, key, key_len);
|
||||||
TEST_ASSERT_EQUAL_INT(1, err);
|
TEST_ASSERT_EQUAL_INT(1, err);
|
||||||
|
|
||||||
@ -126,6 +129,9 @@ static void test_decrypt_op(uint8_t* key, uint8_t key_len,
|
|||||||
int len, err, cmp;
|
int len, err, cmp;
|
||||||
size_t len_encoding = nonce_and_len_encoding_size - nonce_len;
|
size_t len_encoding = nonce_and_len_encoding_size - nonce_len;
|
||||||
|
|
||||||
|
TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len,
|
||||||
|
"Output buffer too small");
|
||||||
|
|
||||||
err = cipher_init(&cipher, CIPHER_AES_128, key, key_len);
|
err = cipher_init(&cipher, CIPHER_AES_128, key, key_len);
|
||||||
TEST_ASSERT_EQUAL_INT(1, err);
|
TEST_ASSERT_EQUAL_INT(1, err);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user