Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256411
b: refs/heads/master
c: 16b9083
h: refs/heads/master
i:
  256409: 8c64b9f
  256407: 79da047
v: v3
  • Loading branch information
Vinicius Costa Gomes authored and Gustavo F. Padovan committed Jul 8, 2011
1 parent 893f70d commit a23ef88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54790f73a3ec87c181e4d6e5eb6963de3d50ebd7
refs/heads/master: 16b908396fbf1be49d417ffdb4a8b41c8c8cb670
20 changes: 14 additions & 6 deletions trunk/net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,23 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)

static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
{
BT_DBG("conn %p", conn);
/* FIXME: store the ltk */
struct smp_cmd_encrypt_info *rp = (void *) skb->data;

skb_pull(skb, sizeof(*rp));

memcpy(conn->tk, rp->ltk, sizeof(conn->tk));

return 0;
}

static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
{
struct smp_cmd_pairing *paircmd = (void *) &conn->prsp[1];
u8 keydist = paircmd->init_key_dist;
struct smp_cmd_master_ident *rp = (void *) skb->data;

skb_pull(skb, sizeof(*rp));

BT_DBG("keydist 0x%x", keydist);
/* FIXME: store ediv and rand */
hci_add_ltk(conn->hcon->hdev, 1, conn->src, rp->ediv,
rp->rand, conn->tk);

smp_distribute_keys(conn, 1);

Expand Down Expand Up @@ -632,6 +637,9 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)

smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc);

hci_add_ltk(conn->hcon->hdev, 1, conn->dst, ediv,
ident.rand, enc.ltk);

ident.ediv = cpu_to_le16(ediv);

smp_send_cmd(conn, SMP_CMD_MASTER_IDENT, sizeof(ident), &ident);
Expand Down

0 comments on commit a23ef88

Please sign in to comment.