Skip to content
This repository was archived by the owner on Mar 5, 2024. It is now read-only.

Commit 0ab3473

Browse files
author
Constanza Heath
committed
Fixed sanity check bug where (plen <= alen) in ccm_mode is incorrect. Plen and alen are independent. Bug caused decryptions to incorrectly fail.
Signed-off-by: Constanza Heath <[email protected]>
1 parent b3946f5 commit 0ab3473

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/source/ccm_mode.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,9 @@ int32_t tc_ccm_generation_encryption(uint8_t *out, const uint8_t *associated_dat
195195
int32_t tc_ccm_decryption_verification(uint8_t *out, const uint8_t *associated_data,
196196
uint32_t alen, const uint8_t *payload,
197197
uint32_t plen, TCCcmMode_t c)
198-
{
199-
198+
{
200199
/* input sanity check: */
201-
if ((plen <= alen) ||
202-
(out == (uint8_t *) 0) ||
200+
if ((out == (uint8_t *) 0) ||
203201
(c == (TCCcmMode_t) 0) ||
204202
((plen > 0) && (payload == (uint8_t *) 0)) ||
205203
((alen > 0) && (associated_data == (uint8_t *) 0)) ||

0 commit comments

Comments
 (0)