tests/tinycrypt: Fix wrong sizeof argument in test_ccm_mode

This commit fixes the wrong sizeof argument error reported by
Coverity.

Coverity-CID: 152032

Change-Id: I2ee3089b4b840f4a1b8ba0303e92a3311c07ffeb
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
Flavio Santes 2016-11-16 16:43:32 -06:00 committed by Anas Nashif
commit 5b47ca7395

View file

@ -410,7 +410,7 @@ uint32_t test_vector_8(void)
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
};
uint8_t *data = NULL;
uint8_t data[] = {};
struct tc_ccm_mode_struct c;
struct tc_aes_key_sched_struct sched;
@ -426,14 +426,17 @@ uint32_t test_vector_8(void)
goto exitTest1;
}
if (tc_ccm_generation_encryption(ciphertext, hdr, sizeof(hdr), data, 0, &c) == 0) {
result = tc_ccm_generation_encryption(ciphertext, hdr, sizeof(hdr),
data, sizeof(data), &c);
if (result == 0) {
TC_ERROR("ccm_encrypt failed in %s.\n", __func__);
result = TC_FAIL;
goto exitTest1;
}
if (tc_ccm_decryption_verification(decrypted, hdr, sizeof(hdr),
ciphertext, mlen, &c) == 0) {
result = tc_ccm_decryption_verification(decrypted, hdr, sizeof(hdr),
ciphertext, mlen, &c);
if (result == 0) {
TC_ERROR("ccm_decrypt failed in %s.\n", __func__);
show_str("\t\tExpected", data, sizeof(data));
show_str("\t\tComputed", decrypted, sizeof(decrypted));
@ -441,6 +444,8 @@ uint32_t test_vector_8(void)
goto exitTest1;
}
result = TC_PASS;
exitTest1:
TC_END_RESULT(result);
return result;