Skip to content

Commit

Permalink
Bluetooth: Mesh: AES-CCM: Fix output MIC with additional data
Browse files Browse the repository at this point in the history
General MIC fix for AAD lengths up to 14 bytes.
This case doesn't concern the mesh stack because it uses 16 bytes.

Signed-off-by: Reham Tarek <reham.tarek@si-vision.com>
  • Loading branch information
RehamTarekAhmed authored and jhedberg committed Apr 17, 2019
1 parent 321fec4 commit a1d69fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/bluetooth/host/mesh/crypto.c
Expand Up @@ -267,7 +267,7 @@ static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13],
} }
} }


for (i = 0; i < aad_len; i++, j++) { for (; i < aad_len; i++, j++) {
pmsg[i] = Xn[i] ^ aad[j]; pmsg[i] = Xn[i] ^ aad[j];
} }


Expand Down Expand Up @@ -431,7 +431,7 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
} }
} }


for (i = 0; i < aad_len; i++, j++) { for (; i < aad_len; i++, j++) {
pmsg[i] = Xn[i] ^ aad[j]; pmsg[i] = Xn[i] ^ aad[j];
} }


Expand Down

0 comments on commit a1d69fb

Please sign in to comment.