diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2011-07-07 17:59:41 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-07-08 16:37:18 -0400 |
commit | 02bc74556a3f1b26adf3feb372376c56ba990564 (patch) | |
tree | d374ba94cdd94b0df0dda641ddef6af3cc157a26 /net/bluetooth/smp.c | |
parent | e7e62c8592484f79469312fc694d2995918aa152 (diff) |
Bluetooth: Use the stored LTK for restabilishing security
Now that it's possible that the exchanged key is present in
the link key list, we may be able to estabilish security with
an already existing key, without need to perform any SMP
procedure.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 6df51017df21..5b7217919202 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -480,6 +480,17 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level) | |||
480 | 480 | ||
481 | if (hcon->link_mode & HCI_LM_MASTER) { | 481 | if (hcon->link_mode & HCI_LM_MASTER) { |
482 | struct smp_cmd_pairing cp; | 482 | struct smp_cmd_pairing cp; |
483 | struct link_key *key; | ||
484 | |||
485 | key = hci_find_link_key_type(hcon->hdev, conn->dst, | ||
486 | HCI_LK_SMP_LTK); | ||
487 | if (key) { | ||
488 | struct key_master_id *master = (void *) key->data; | ||
489 | |||
490 | hci_le_start_enc(hcon, master->ediv, master->rand, | ||
491 | key->val); | ||
492 | goto done; | ||
493 | } | ||
483 | 494 | ||
484 | build_pairing_cmd(conn, &cp, NULL, authreq); | 495 | build_pairing_cmd(conn, &cp, NULL, authreq); |
485 | conn->preq[0] = SMP_CMD_PAIRING_REQ; | 496 | conn->preq[0] = SMP_CMD_PAIRING_REQ; |
@@ -495,6 +506,7 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level) | |||
495 | smp_send_cmd(conn, SMP_CMD_SECURITY_REQ, sizeof(cp), &cp); | 506 | smp_send_cmd(conn, SMP_CMD_SECURITY_REQ, sizeof(cp), &cp); |
496 | } | 507 | } |
497 | 508 | ||
509 | done: | ||
498 | hcon->pending_sec_level = sec_level; | 510 | hcon->pending_sec_level = sec_level; |
499 | set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->pend); | 511 | set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->pend); |
500 | 512 | ||