mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
tests/sys_crypto: exclude some test for 8 and 16 bit arch
The tests doesn't work when length_encoding is above the maximum uint16 value. Also add a set that checks the right error code is returned with too small length_encoding.
This commit is contained in:
parent
77801d18e2
commit
2d9612b116
@ -1009,6 +1009,9 @@ static void test_crypto_modes_ccm_check_len(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Using length_encoding above UINT16_MAX doesn't work on 8/16 bit
|
||||
architectures, SIZE_MAX is equal to UINT16_MAX there */
|
||||
#if SIZE_MAX > UINT16_MAX
|
||||
/* Just 1 to big to fit */
|
||||
ret = _test_ccm_len(cipher_encrypt_ccm, 2, NULL, 1 << 16, 0);
|
||||
TEST_ASSERT_EQUAL_INT(CCM_ERR_INVALID_LENGTH_ENCODING, ret);
|
||||
@ -1020,6 +1023,11 @@ static void test_crypto_modes_ccm_check_len(void)
|
||||
TEST_ASSERT_EQUAL_INT(CCM_ERR_INVALID_LENGTH_ENCODING, ret);
|
||||
ret = _test_ccm_len(cipher_decrypt_ccm, 2, NULL, 1 << 16, 65535);
|
||||
TEST_ASSERT_EQUAL_INT(CCM_ERR_INVALID_LENGTH_ENCODING, ret);
|
||||
#endif
|
||||
|
||||
/* Invalid length when length_encoding < 2 */
|
||||
ret = _test_ccm_len(cipher_encrypt_ccm, 1, NULL, 8, 0);
|
||||
TEST_ASSERT_EQUAL_INT(CCM_ERR_INVALID_LENGTH_ENCODING, ret);
|
||||
|
||||
/* Valid length that were wrongly checked */
|
||||
/* Check should work with len_encoding >= 4, test with 8 */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user