aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-03-19 08:14:53 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-03-19 16:55:06 -0400
commit01ad34d267475ac3387d7ab803a2225b392dae91 (patch)
tree45d12bac249e36219b6c533dae85e78090208aad /net
parent5ed884d765a240593c721711eb9e6d24ceba5e8b (diff)
Bluetooth: Fix SMP user passkey notification mgmt event
When performing SMP pairing with MITM protection one side needs to enter the passkey while the other side displays to the user what needs to be entered. Nowhere in the SMP specification does it say that the displaying side needs to any kind of confirmation of the passkey, even though a code comment in smp.c implies this. This patch removes the misleading comment and converts the code to use the passkey notification mgmt event instead of the passkey confirmation mgmt event. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/smp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index ed1c9547ba6e..2a7ee7f6cd8b 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -407,13 +407,14 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
407 method = REQ_PASSKEY; 407 method = REQ_PASSKEY;
408 } 408 }
409 409
410 /* Generate random passkey. Not valid until confirmed. */ 410 /* Generate random passkey. */
411 if (method == CFM_PASSKEY) { 411 if (method == CFM_PASSKEY) {
412 memset(smp->tk, 0, sizeof(smp->tk)); 412 memset(smp->tk, 0, sizeof(smp->tk));
413 get_random_bytes(&passkey, sizeof(passkey)); 413 get_random_bytes(&passkey, sizeof(passkey));
414 passkey %= 1000000; 414 passkey %= 1000000;
415 put_unaligned_le32(passkey, smp->tk); 415 put_unaligned_le32(passkey, smp->tk);
416 BT_DBG("PassKey: %d", passkey); 416 BT_DBG("PassKey: %d", passkey);
417 set_bit(SMP_FLAG_TK_VALID, &smp->smp_flags);
417 } 418 }
418 419
419 hci_dev_lock(hcon->hdev); 420 hci_dev_lock(hcon->hdev);
@@ -422,7 +423,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
422 ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst, 423 ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst,
423 hcon->type, hcon->dst_type); 424 hcon->type, hcon->dst_type);
424 else 425 else
425 ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, 426 ret = mgmt_user_passkey_notify(hcon->hdev, &hcon->dst,
426 hcon->type, hcon->dst_type, 427 hcon->type, hcon->dst_type,
427 cpu_to_le32(passkey), 0); 428 cpu_to_le32(passkey), 0);
428 429