Bluetooth: Move SMP LTK notification after key distribution

This patch moves the SMP Long Term Key notification over mgmt from the
hci_add_ltk function to smp.c when both sides have completed their key
distribution. This way we are also able to update the identity address
into the mgmt_new_ltk event.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Johan Hedberg
2014-02-19 14:57:47 +02:00
committed by Marcel Holtmann
parent 23d0e128e3
commit 35d702719d
4 changed files with 31 additions and 20 deletions
+2 -9
View File
@@ -2762,9 +2762,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
}
struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 addr_type, u8 type, int new_key,
u8 authenticated, u8 tk[16], u8 enc_size,
__le16 ediv, u8 rand[8])
u8 addr_type, u8 type, u8 authenticated,
u8 tk[16], u8 enc_size, __le16 ediv, u8 rand[8])
{
struct smp_ltk *key, *old_key;
bool master = ltk_type_master(type);
@@ -2788,12 +2787,6 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
key->type = type;
memcpy(key->rand, rand, sizeof(key->rand));
if (!new_key)
return key;
if (type == HCI_SMP_LTK || type == HCI_SMP_LTK_SLAVE)
mgmt_new_ltk(hdev, key);
return key;
}