diff options
author | Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> | 2011-04-28 06:07:59 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-28 14:19:43 -0400 |
commit | a770bb5aea84ee2509d4775f9959665f96da3b9d (patch) | |
tree | 7d7785c39b55ec1e036f2ccadf5e0c34a98c96b7 | |
parent | 58797bf77234154a84827186bda316a1205bde05 (diff) |
Bluetooth: Add secure flag for mgmt_pin_code_req
Extend the mgmt_pin_code_request interface to require secure
pin code (16 digit) for authentication.
This is a kernel part of the secure pin code requirement notification
to user space agent.
Code styling fix by Johan Hedberg.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 2 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 12 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 3 |
4 files changed, 14 insertions, 4 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 2da2eb9f53ac..2995e2e63512 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -777,7 +777,7 @@ int mgmt_connected(u16 index, bdaddr_t *bdaddr); | |||
777 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); | 777 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); |
778 | int mgmt_disconnect_failed(u16 index); | 778 | int mgmt_disconnect_failed(u16 index); |
779 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); | 779 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); |
780 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr); | 780 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure); |
781 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | 781 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); |
782 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | 782 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); |
783 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value); | 783 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value); |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 743440615349..0e7de636035d 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -253,6 +253,7 @@ struct mgmt_ev_connect_failed { | |||
253 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E | 253 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E |
254 | struct mgmt_ev_pin_code_request { | 254 | struct mgmt_ev_pin_code_request { |
255 | bdaddr_t bdaddr; | 255 | bdaddr_t bdaddr; |
256 | __u8 secure; | ||
256 | } __packed; | 257 | } __packed; |
257 | 258 | ||
258 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F | 259 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 9d50e90993ca..577d638600df 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -2022,8 +2022,16 @@ static inline void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff | |||
2022 | hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, | 2022 | hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, |
2023 | sizeof(ev->bdaddr), &ev->bdaddr); | 2023 | sizeof(ev->bdaddr), &ev->bdaddr); |
2024 | 2024 | ||
2025 | if (test_bit(HCI_MGMT, &hdev->flags)) | 2025 | if (test_bit(HCI_MGMT, &hdev->flags)) { |
2026 | mgmt_pin_code_request(hdev->id, &ev->bdaddr); | 2026 | u8 secure; |
2027 | |||
2028 | if (conn->pending_sec_level == BT_SECURITY_HIGH) | ||
2029 | secure = 1; | ||
2030 | else | ||
2031 | secure = 0; | ||
2032 | |||
2033 | mgmt_pin_code_request(hdev->id, &ev->bdaddr, secure); | ||
2034 | } | ||
2027 | 2035 | ||
2028 | hci_dev_unlock(hdev); | 2036 | hci_dev_unlock(hdev); |
2029 | } | 2037 | } |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 4542396fc856..a7b4937d761c 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1942,11 +1942,12 @@ int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status) | |||
1942 | return mgmt_event(MGMT_EV_CONNECT_FAILED, index, &ev, sizeof(ev), NULL); | 1942 | return mgmt_event(MGMT_EV_CONNECT_FAILED, index, &ev, sizeof(ev), NULL); |
1943 | } | 1943 | } |
1944 | 1944 | ||
1945 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr) | 1945 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure) |
1946 | { | 1946 | { |
1947 | struct mgmt_ev_pin_code_request ev; | 1947 | struct mgmt_ev_pin_code_request ev; |
1948 | 1948 | ||
1949 | bacpy(&ev.bdaddr, bdaddr); | 1949 | bacpy(&ev.bdaddr, bdaddr); |
1950 | ev.secure = secure; | ||
1950 | 1951 | ||
1951 | return mgmt_event(MGMT_EV_PIN_CODE_REQUEST, index, &ev, sizeof(ev), | 1952 | return mgmt_event(MGMT_EV_PIN_CODE_REQUEST, index, &ev, sizeof(ev), |
1952 | NULL); | 1953 | NULL); |