提交 cb92205b 编写于 作者: J Jakub Pawlowski 提交者: Marcel Holtmann

Bluetooth: fix MGMT_EV_NEW_LONG_TERM_KEY event

This patch fixes how MGMT_EV_NEW_LONG_TERM_KEY event is build. Right now
val vield is filled with only 1 byte, instead of whole value. This bug
was introduced in
commit 1fc62c52 ("Bluetooth: Fix exposing full value of shortened LTKs")

Before that patch, if you paired with device using bluetoothd using simple
pairing, and then restarted bluetoothd, you would be able to re-connect,
but device would fail to establish encryption and would terminate
connection. After this patch connecting after bluetoothd restart works
fine.
Signed-off-by: NJakub Pawlowski <jpawlowski@google.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 2475b225
...@@ -7820,7 +7820,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent) ...@@ -7820,7 +7820,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent)
/* Make sure we copy only the significant bytes based on the /* Make sure we copy only the significant bytes based on the
* encryption key size, and set the rest of the value to zeroes. * encryption key size, and set the rest of the value to zeroes.
*/ */
memcpy(ev.key.val, key->val, sizeof(key->enc_size)); memcpy(ev.key.val, key->val, key->enc_size);
memset(ev.key.val + key->enc_size, 0, memset(ev.key.val + key->enc_size, 0,
sizeof(ev.key.val) - key->enc_size); sizeof(ev.key.val) - key->enc_size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册