diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-06-08 11:31:13 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-06-08 20:00:40 -0400 |
commit | 1c2e004183178e1947882cd2e74f37826f45230e (patch) | |
tree | a0a5e7ed54d89392bb77ae7175a9c63bbfc7b9f1 /net | |
parent | 4dab786482d706a2a41cd16cf174671d640a9870 (diff) |
Bluetooth: Add support for encryption key refresh
With LE/SMP the completion of a security level elavation from medium to
high is indicated by a HCI Encryption Key Refresh Complete event. The
necessary behavior upon receiving this event is a mix of what's done for
auth_complete and encryption_change, which is also where most of the
event handling code has been copied from.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_event.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 4eefb7f65cf6..94ad124a4ea3 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -3043,6 +3043,50 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct | |||
3043 | hci_dev_unlock(hdev); | 3043 | hci_dev_unlock(hdev); |
3044 | } | 3044 | } |
3045 | 3045 | ||
3046 | static void hci_key_refresh_complete_evt(struct hci_dev *hdev, | ||
3047 | struct sk_buff *skb) | ||
3048 | { | ||
3049 | struct hci_ev_key_refresh_complete *ev = (void *) skb->data; | ||
3050 | struct hci_conn *conn; | ||
3051 | |||
3052 | BT_DBG("%s status %u handle %u", hdev->name, ev->status, | ||
3053 | __le16_to_cpu(ev->handle)); | ||
3054 | |||
3055 | hci_dev_lock(hdev); | ||
3056 | |||
3057 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); | ||
3058 | if (!conn) | ||
3059 | goto unlock; | ||
3060 | |||
3061 | if (!ev->status) | ||
3062 | conn->sec_level = conn->pending_sec_level; | ||
3063 | |||
3064 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | ||
3065 | |||
3066 | if (ev->status && conn->state == BT_CONNECTED) { | ||
3067 | hci_acl_disconn(conn, HCI_ERROR_AUTH_FAILURE); | ||
3068 | hci_conn_put(conn); | ||
3069 | goto unlock; | ||
3070 | } | ||
3071 | |||
3072 | if (conn->state == BT_CONFIG) { | ||
3073 | if (!ev->status) | ||
3074 | conn->state = BT_CONNECTED; | ||
3075 | |||
3076 | hci_proto_connect_cfm(conn, ev->status); | ||
3077 | hci_conn_put(conn); | ||
3078 | } else { | ||
3079 | hci_auth_cfm(conn, ev->status); | ||
3080 | |||
3081 | hci_conn_hold(conn); | ||
3082 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; | ||
3083 | hci_conn_put(conn); | ||
3084 | } | ||
3085 | |||
3086 | unlock: | ||
3087 | hci_dev_unlock(hdev); | ||
3088 | } | ||
3089 | |||
3046 | static inline u8 hci_get_auth_req(struct hci_conn *conn) | 3090 | static inline u8 hci_get_auth_req(struct hci_conn *conn) |
3047 | { | 3091 | { |
3048 | /* If remote requests dedicated bonding follow that lead */ | 3092 | /* If remote requests dedicated bonding follow that lead */ |
@@ -3559,6 +3603,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
3559 | hci_extended_inquiry_result_evt(hdev, skb); | 3603 | hci_extended_inquiry_result_evt(hdev, skb); |
3560 | break; | 3604 | break; |
3561 | 3605 | ||
3606 | case HCI_EV_KEY_REFRESH_COMPLETE: | ||
3607 | hci_key_refresh_complete_evt(hdev, skb); | ||
3608 | break; | ||
3609 | |||
3562 | case HCI_EV_IO_CAPA_REQUEST: | 3610 | case HCI_EV_IO_CAPA_REQUEST: |
3563 | hci_io_capa_request_evt(hdev, skb); | 3611 | hci_io_capa_request_evt(hdev, skb); |
3564 | break; | 3612 | break; |