diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2011-06-09 17:50:47 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-06-13 14:48:25 -0400 |
commit | a7a595f675f1b33dc73167147321dba5c4395acc (patch) | |
tree | ee17d1ba777fd18ec7b666a356b00c131cb5f0f2 /net/bluetooth/hci_conn.c | |
parent | 7d24ddcc1140d2f796436e476c8d69469610588b (diff) |
Bluetooth: Add support for LE Start Encryption
This adds support for starting SMP Phase 2 Encryption, when the initial
SMP negotiation is successful. This adds the LE Start Encryption and LE
Long Term Key Request commands and related events.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 37f5a174f072..18193831bbf1 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -204,6 +204,55 @@ void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | |||
204 | } | 204 | } |
205 | EXPORT_SYMBOL(hci_le_conn_update); | 205 | EXPORT_SYMBOL(hci_le_conn_update); |
206 | 206 | ||
207 | void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], | ||
208 | __u8 ltk[16]) | ||
209 | { | ||
210 | struct hci_dev *hdev = conn->hdev; | ||
211 | struct hci_cp_le_start_enc cp; | ||
212 | |||
213 | BT_DBG("%p", conn); | ||
214 | |||
215 | memset(&cp, 0, sizeof(cp)); | ||
216 | |||
217 | cp.handle = cpu_to_le16(conn->handle); | ||
218 | memcpy(cp.ltk, ltk, sizeof(cp.ltk)); | ||
219 | cp.ediv = ediv; | ||
220 | memcpy(cp.rand, rand, sizeof(rand)); | ||
221 | |||
222 | hci_send_cmd(hdev, HCI_OP_LE_START_ENC, sizeof(cp), &cp); | ||
223 | } | ||
224 | EXPORT_SYMBOL(hci_le_start_enc); | ||
225 | |||
226 | void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]) | ||
227 | { | ||
228 | struct hci_dev *hdev = conn->hdev; | ||
229 | struct hci_cp_le_ltk_reply cp; | ||
230 | |||
231 | BT_DBG("%p", conn); | ||
232 | |||
233 | memset(&cp, 0, sizeof(cp)); | ||
234 | |||
235 | cp.handle = cpu_to_le16(conn->handle); | ||
236 | memcpy(cp.ltk, ltk, sizeof(ltk)); | ||
237 | |||
238 | hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); | ||
239 | } | ||
240 | EXPORT_SYMBOL(hci_le_ltk_reply); | ||
241 | |||
242 | void hci_le_ltk_neg_reply(struct hci_conn *conn) | ||
243 | { | ||
244 | struct hci_dev *hdev = conn->hdev; | ||
245 | struct hci_cp_le_ltk_neg_reply cp; | ||
246 | |||
247 | BT_DBG("%p", conn); | ||
248 | |||
249 | memset(&cp, 0, sizeof(cp)); | ||
250 | |||
251 | cp.handle = cpu_to_le16(conn->handle); | ||
252 | |||
253 | hci_send_cmd(hdev, HCI_OP_LE_LTK_NEG_REPLY, sizeof(cp), &cp); | ||
254 | } | ||
255 | |||
207 | /* Device _must_ be locked */ | 256 | /* Device _must_ be locked */ |
208 | void hci_sco_setup(struct hci_conn *conn, __u8 status) | 257 | void hci_sco_setup(struct hci_conn *conn, __u8 status) |
209 | { | 258 | { |