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:
parent
0f231c70d3
commit
5b47ca7395
1 changed files with 9 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue