Bluetooth: Mesh: AES-CCM: Fix output MIC with additional data

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>
This commit is contained in:
Reham Tarek 2018-11-11 22:29:18 +02:00 committed by Johan Hedberg
commit a1d69fb725

View file

@ -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];
}
@ -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];
}