Skip to content

Commit

Permalink
Bluetooth: Move SMP crypto functions to a workqueue
Browse files Browse the repository at this point in the history
The function crypto_blkcipher_setkey() called by smp_e()
can sleep, so all the crypto work has to be moved to
hci_dev workqueue.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Vinicius Costa Gomes authored and Gustavo F. Padovan committed Sep 21, 2011
1 parent 1c1def0 commit 8aab475
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 103 deletions.
9 changes: 8 additions & 1 deletion include/net/bluetooth/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,25 @@ struct smp_cmd_security_req {
#define SMP_MAX_ENC_KEY_SIZE 16

struct smp_chan {
struct l2cap_conn *conn;
u8 preq[7]; /* SMP Pairing Request */
u8 prsp[7]; /* SMP Pairing Response */
u8 prnd[16]; /* SMP Pairing Random */
u8 prnd[16]; /* SMP Pairing Random (local) */
u8 rrnd[16]; /* SMP Pairing Random (remote) */
u8 pcnf[16]; /* SMP Pairing Confirm */
u8 tk[16]; /* SMP Temporary Key */
u8 smp_key_size;
struct crypto_blkcipher *tfm;
struct work_struct confirm;
struct work_struct random;

};

/* SMP Commands */
int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level);
int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);

void smp_chan_destroy(struct l2cap_conn *conn);

#endif /* __SMP_H */
2 changes: 1 addition & 1 deletion net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)

if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) {
del_timer(&conn->security_timer);
hci_conn_put(hcon);
smp_chan_destroy(conn);
}

hcon->l2cap_data = NULL;
Expand Down
Loading

0 comments on commit 8aab475

Please sign in to comment.