Skip to content

test(aes_ccm): fix incompatible-pointer-types warning in NIST vector test - #427

Open
StijnVM wants to merge 1 commit into
MicrochipTech:mainfrom
StijnVM:fix/aes-ccm-encrypt-finish-taglen-type
Open

test(aes_ccm): fix incompatible-pointer-types warning in NIST vector test#427
StijnVM wants to merge 1 commit into
MicrochipTech:mainfrom
StijnVM:fix/aes-ccm-encrypt-finish-taglen-type

Conversation

@StijnVM

@StijnVM StijnVM commented Aug 7, 2026

Copy link
Copy Markdown

atcab_aes_ccm_encrypt_finish() expects a uint8_t* for the tag size, but aes_ccm_nist_vector_test() was passing the address of a size_t taglen, producing:

atca_tests_aes_ccm.c:600:62: error: passing argument 3 of
'atcab_aes_ccm_encrypt_finish' from incompatible pointer type
[-Wincompatible-pointer-types]

Casting the size_t* to uint8_t* would only overwrite the low byte and leave the remaining bytes with stale content (and produce a wrong value on big-endian). Use a local uint8_t for the API call and write the result back into taglen so the subsequent
TEST_ASSERT_EQUAL_MEMORY(expected_tag, tag, taglen) sees the length returned by the API.

Checklist

…test

atcab_aes_ccm_encrypt_finish() expects a uint8_t* for the tag size, but
aes_ccm_nist_vector_test() was passing the address of a size_t `taglen`,
producing:

  atca_tests_aes_ccm.c:600:62: error: passing argument 3 of
  'atcab_aes_ccm_encrypt_finish' from incompatible pointer type
  [-Wincompatible-pointer-types]

Casting the size_t* to uint8_t* would only overwrite the low byte and
leave the remaining bytes with stale content (and produce a wrong value
on big-endian). Use a local uint8_t for the API call and write the
result back into `taglen` so the subsequent
TEST_ASSERT_EQUAL_MEMORY(expected_tag, tag, taglen) sees the length
returned by the API.

Signed-off-by: Stijn Van Mol <stijnvanmol@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant