Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256400
b: refs/heads/master
c: 2e65c9d
h: refs/heads/master
v: v3
  • Loading branch information
Andre Guedes authored and Gustavo F. Padovan committed Jul 6, 2011
1 parent 3f23c25 commit f17948a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 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: eead27da60df80a112d1ac3ea482226e9794c26b
refs/heads/master: 2e65c9d2c5206eb24439f2dd2daa2f6702df358e
15 changes: 1 addition & 14 deletions trunk/net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ static void hci_tx_task(unsigned long arg);

static DEFINE_RWLOCK(hci_task_lock);

static int enable_smp;

/* HCI device list */
LIST_HEAD(hci_dev_list);
DEFINE_RWLOCK(hci_dev_list_lock);
Expand Down Expand Up @@ -1368,14 +1366,6 @@ int hci_add_adv_entry(struct hci_dev *hdev,
return 0;
}

static struct crypto_blkcipher *alloc_cypher(void)
{
if (enable_smp)
return crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);

return ERR_PTR(-ENOTSUPP);
}

/* Register HCI device */
int hci_register_dev(struct hci_dev *hdev)
{
Expand Down Expand Up @@ -1460,7 +1450,7 @@ int hci_register_dev(struct hci_dev *hdev)
if (!hdev->workqueue)
goto nomem;

hdev->tfm = alloc_cypher();
hdev->tfm = crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(hdev->tfm))
BT_INFO("Failed to load transform for ecb(aes): %ld",
PTR_ERR(hdev->tfm));
Expand Down Expand Up @@ -2352,6 +2342,3 @@ static void hci_cmd_task(unsigned long arg)
}
}
}

module_param(enable_smp, bool, 0644);
MODULE_PARM_DESC(enable_smp, "Enable SMP support (LE only)");
9 changes: 9 additions & 0 deletions trunk/net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)

BT_DBG("conn %p hcon %p level 0x%2.2x", conn, hcon, sec_level);

if (!lmp_host_le_capable(hcon->hdev))
return 1;

if (IS_ERR(hcon->hdev->tfm))
return 1;

Expand Down Expand Up @@ -477,6 +480,12 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
__u8 reason;
int err = 0;

if (!lmp_host_le_capable(conn->hcon->hdev)) {
err = -ENOTSUPP;
reason = SMP_PAIRING_NOTSUPP;
goto done;
}

if (IS_ERR(conn->hcon->hdev->tfm)) {
err = PTR_ERR(conn->hcon->hdev->tfm);
reason = SMP_PAIRING_NOTSUPP;
Expand Down

0 comments on commit f17948a

Please sign in to comment.