diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/smp.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 0980b86574bd..6207f32d1c6b 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -1216,6 +1216,25 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1216 | return 0; | 1216 | return 0; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | static u8 sc_check_confirm(struct smp_chan *smp) | ||
1220 | { | ||
1221 | struct l2cap_conn *conn = smp->conn; | ||
1222 | |||
1223 | BT_DBG(""); | ||
1224 | |||
1225 | /* Public Key exchange must happen before any other steps */ | ||
1226 | if (!test_bit(SMP_FLAG_REMOTE_PK, &smp->flags)) | ||
1227 | return SMP_UNSPECIFIED; | ||
1228 | |||
1229 | if (conn->hcon->out) { | ||
1230 | smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(smp->prnd), | ||
1231 | smp->prnd); | ||
1232 | SMP_ALLOW_CMD(smp, SMP_CMD_PAIRING_RANDOM); | ||
1233 | } | ||
1234 | |||
1235 | return 0; | ||
1236 | } | ||
1237 | |||
1219 | static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb) | 1238 | static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb) |
1220 | { | 1239 | { |
1221 | struct l2cap_chan *chan = conn->smp; | 1240 | struct l2cap_chan *chan = conn->smp; |
@@ -1229,6 +1248,9 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1229 | memcpy(smp->pcnf, skb->data, sizeof(smp->pcnf)); | 1248 | memcpy(smp->pcnf, skb->data, sizeof(smp->pcnf)); |
1230 | skb_pull(skb, sizeof(smp->pcnf)); | 1249 | skb_pull(skb, sizeof(smp->pcnf)); |
1231 | 1250 | ||
1251 | if (test_bit(SMP_FLAG_SC, &smp->flags)) | ||
1252 | return sc_check_confirm(smp); | ||
1253 | |||
1232 | if (conn->hcon->out) { | 1254 | if (conn->hcon->out) { |
1233 | smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(smp->prnd), | 1255 | smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(smp->prnd), |
1234 | smp->prnd); | 1256 | smp->prnd); |