Bluetooth: BR/EDR: Store new combination link key

Updates connection object keys using generated link key and mark the
key as legacy after successful pairing initiated by remote.

Change-Id: Idcd02ea12c45f6f19f6675a2d6161a8349dde170
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2015-12-28 16:44:01 +01:00 committed by Anas Nashif
commit 32a86ca351
2 changed files with 15 additions and 3 deletions

View file

@ -1523,9 +1523,20 @@ static void link_key_notify(struct net_buf *buf)
BT_DBG("%s, link type 0x%02x", bt_addr_str(&evt->bdaddr), evt->key_type);
/* TODO:
* classify link key based on conn internals and update keys storage
*/
if (!conn->keys) {
conn->keys = bt_keys_get_link_key(&evt->bdaddr);
}
if (!conn->keys) {
BT_ERR("Can't update keys for %s", bt_addr_str(&evt->bdaddr));
bt_conn_unref(conn);
return;
}
memcpy(conn->keys->link_key.val, evt->link_key, 16);
if (evt->key_type == BT_LK_COMBINATION) {
atomic_set_bit(&conn->keys->flags, BT_KEYS_BR_LEGACY);
}
bt_conn_unref(conn);
}

View file

@ -34,6 +34,7 @@ enum {
enum {
BT_KEYS_AUTHENTICATED,
BT_KEYS_BR_LEGACY,
};
struct bt_ltk {