aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/smp.c
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2011-08-25 19:02:27 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-09-21 11:59:15 -0400
commit0fb4eb6f630a22bf4c2f358ef2db91f28a3d18d4 (patch)
tree5d8346ca6f6c321ff7a4ea0b6914fb289006bf63 /net/bluetooth/smp.c
parent5e762444b0d3e56bbd66f5092434c4a1ba698313 (diff)
Bluetooth: Fix sending wrong authentication requirements
Until we support any pairing method (Passkey Entry, OOB) that gives MITM protection we shouldn't send that we have MITM protection. 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.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 03489e5815ef..7e558465133f 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -187,18 +187,6 @@ static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data)
187 msecs_to_jiffies(SMP_TIMEOUT)); 187 msecs_to_jiffies(SMP_TIMEOUT));
188} 188}
189 189
190static __u8 seclevel_to_authreq(__u8 level)
191{
192 switch (level) {
193 case BT_SECURITY_HIGH:
194 /* Right now we don't support bonding */
195 return SMP_AUTH_MITM;
196
197 default:
198 return SMP_AUTH_NONE;
199 }
200}
201
202static void build_pairing_cmd(struct l2cap_conn *conn, 190static void build_pairing_cmd(struct l2cap_conn *conn,
203 struct smp_cmd_pairing *req, 191 struct smp_cmd_pairing *req,
204 struct smp_cmd_pairing *rsp, 192 struct smp_cmd_pairing *rsp,
@@ -542,7 +530,6 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
542{ 530{
543 struct hci_conn *hcon = conn->hcon; 531 struct hci_conn *hcon = conn->hcon;
544 struct smp_chan *smp = conn->smp_chan; 532 struct smp_chan *smp = conn->smp_chan;
545 __u8 authreq;
546 533
547 BT_DBG("conn %p hcon %p level 0x%2.2x", conn, hcon, sec_level); 534 BT_DBG("conn %p hcon %p level 0x%2.2x", conn, hcon, sec_level);
548 535
@@ -580,19 +567,17 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
580 567
581 smp = smp_chan_create(conn); 568 smp = smp_chan_create(conn);
582 569
583 authreq = seclevel_to_authreq(sec_level);
584
585 if (hcon->link_mode & HCI_LM_MASTER) { 570 if (hcon->link_mode & HCI_LM_MASTER) {
586 struct smp_cmd_pairing cp; 571 struct smp_cmd_pairing cp;
587 572
588 build_pairing_cmd(conn, &cp, NULL, authreq); 573 build_pairing_cmd(conn, &cp, NULL, SMP_AUTH_NONE);
589 smp->preq[0] = SMP_CMD_PAIRING_REQ; 574 smp->preq[0] = SMP_CMD_PAIRING_REQ;
590 memcpy(&smp->preq[1], &cp, sizeof(cp)); 575 memcpy(&smp->preq[1], &cp, sizeof(cp));
591 576
592 smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp); 577 smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp);
593 } else { 578 } else {
594 struct smp_cmd_security_req cp; 579 struct smp_cmd_security_req cp;
595 cp.auth_req = authreq; 580 cp.auth_req = SMP_AUTH_NONE;
596 smp_send_cmd(conn, SMP_CMD_SECURITY_REQ, sizeof(cp), &cp); 581 smp_send_cmd(conn, SMP_CMD_SECURITY_REQ, sizeof(cp), &cp);
597 } 582 }
598 583