Skip to content

Commit 2cab877

Browse files
nth-eyecfriedt
authored andcommitted
Bluetooth: host: Fix MIC generation in Bluetooth CCM encryption
bt_ccm_encrypt only works when encrypting in place. To fix this ccm_auth() inside bt_ccm_encrypt() must take plaintext instead of enc_data, to not rely on assumption that plain and cypher data are the same memory. Signed-off-by: Ilya Makarov <[email protected]> Fixes: #40069
1 parent 08bb61e commit 2cab877

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/bluetooth/host/aes_ccm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ int bt_ccm_encrypt(const uint8_t key[16], uint8_t nonce[13],
223223
return -EINVAL;
224224
}
225225

226-
ccm_auth(key, nonce, enc_data, len, aad, aad_len, mic, mic_size);
226+
ccm_auth(key, nonce, plaintext, len, aad, aad_len, mic, mic_size);
227227

228228
ccm_crypt(key, nonce, plaintext, enc_data, len);
229229

0 commit comments

Comments
 (0)