Bluetooth: Read encryption key size for BR/EDR connections
[firefly-linux-kernel-4.4.55.git] / net / bluetooth / hci_conn.c
index ee5e59839b0294a6db0ea95f9f3eda4db0e4c503..2c48bf0b5afbd00d4b0308e8bb74a92fc9b72a7a 100644 (file)
@@ -276,7 +276,7 @@ u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
 }
 
 void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
-                     __u8 ltk[16])
+                     __u8 ltk[16], __u8 key_size)
 {
        struct hci_dev *hdev = conn->hdev;
        struct hci_cp_le_start_enc cp;
@@ -288,7 +288,7 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
        cp.handle = cpu_to_le16(conn->handle);
        cp.rand = rand;
        cp.ediv = ediv;
-       memcpy(cp.ltk, ltk, sizeof(cp.ltk));
+       memcpy(cp.ltk, ltk, key_size);
 
        hci_send_cmd(hdev, HCI_OP_LE_START_ENC, sizeof(cp), &cp);
 }