Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256412
b: refs/heads/master
c: e7e62c8
h: refs/heads/master
v: v3
  • Loading branch information
Vinicius Costa Gomes authored and Gustavo F. Padovan committed Jul 8, 2011
1 parent a23ef88 commit f0e85b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 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: 16b908396fbf1be49d417ffdb4a8b41c8c8cb670
refs/heads/master: e7e62c8592484f79469312fc694d2995918aa152
23 changes: 15 additions & 8 deletions trunk/net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,29 +390,36 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
}

if (conn->hcon->out) {
u8 stk[16], rand[8];
__le16 ediv;
u8 rand[8];

memset(rand, 0, sizeof(rand));
ediv = 0;

smp_s1(tfm, conn->tk, random, conn->prnd, key);
swap128(key, hcon->ltk);
swap128(key, stk);

memset(hcon->ltk + conn->smp_key_size, 0,
memset(stk + conn->smp_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - conn->smp_key_size);

hci_le_start_enc(hcon, ediv, rand, stk);
} else {
u8 stk[16], r[16], rand[8];
__le16 ediv;

memset(rand, 0, sizeof(rand));
ediv = 0;
hci_le_start_enc(hcon, ediv, rand, hcon->ltk);
} else {
u8 r[16];

swap128(conn->prnd, r);
smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(r), r);

smp_s1(tfm, conn->tk, conn->prnd, random, key);
swap128(key, hcon->ltk);
swap128(key, stk);

memset(hcon->ltk + conn->smp_key_size, 0,
memset(stk + conn->smp_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - conn->smp_key_size);

hci_add_ltk(conn->hcon->hdev, 0, conn->dst, ediv, rand, stk);
}

return 0;
Expand Down

0 comments on commit f0e85b3

Please sign in to comment.