aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2011-07-08 17:31:45 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-07-08 17:39:19 -0400
commit726b4ffcaa450d9593b9b6ac8605967ce9f3e506 (patch)
tree5d274067ab8946d081f01c9b160bff495aca857c /net/bluetooth/hci_core.c
parent5a0a8b49746771fba79866fb9185ffa051a6a183 (diff)
Bluetooth: Add support for storing the key size
In some cases it will be useful having the key size used for encrypting the link. For example, some profiles may restrict some operations depending on the key length. The key size is stored in the key that is passed to userspace using the pin_length field in the key structure. For now this field is only valid for LE controllers. 3.0+HS controllers define the Read Encryption Key Size command, this field is intended for storing the value returned by that command. 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_core.c')
-rw-r--r--net/bluetooth/hci_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4885914449f6..908fcd384ab4 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1149,7 +1149,7 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
1149} 1149}
1150 1150
1151int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, 1151int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr,
1152 __le16 ediv, u8 rand[8], u8 ltk[16]) 1152 u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16])
1153{ 1153{
1154 struct link_key *key, *old_key; 1154 struct link_key *key, *old_key;
1155 struct key_master_id *id; 1155 struct key_master_id *id;
@@ -1174,6 +1174,7 @@ int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr,
1174 bacpy(&key->bdaddr, bdaddr); 1174 bacpy(&key->bdaddr, bdaddr);
1175 memcpy(key->val, ltk, sizeof(key->val)); 1175 memcpy(key->val, ltk, sizeof(key->val));
1176 key->type = HCI_LK_SMP_LTK; 1176 key->type = HCI_LK_SMP_LTK;
1177 key->pin_len = key_size;
1177 1178
1178 id = (void *) &key->data; 1179 id = (void *) &key->data;
1179 id->ediv = ediv; 1180 id->ediv = ediv;