Bluetooth: Remove HCI prefix from SMP LTK defines
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 16 Jun 2014 16:25:16 +0000 (19:25 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:42 +0000 (17:42 +0200)
The LTK type has really nothing to do with HCI so it makes more sense to
have these in smp.h than hci.h. This patch moves the defines to smp.h
and removes the HCI_ prefix in the same go.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci.h
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c
net/bluetooth/mgmt.c
net/bluetooth/smp.c
net/bluetooth/smp.h

index 98f7520d2f57e53005f647f426f687c7c27aa366..6ec5b3bd1f673246ccdbfac4a2f822c1a45f080d 100644 (file)
@@ -347,10 +347,6 @@ enum {
 #define HCI_LK_CHANGED_COMBINATION     0x06
 #define HCI_LK_UNAUTH_COMBINATION_P256 0x07
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
-/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
-#define HCI_SMP_STK                    0x80
-#define HCI_SMP_LTK                    0x82
-#define HCI_SMP_LTK_SLAVE              0x83
 
 /* Long Term Key types */
 #define HCI_LTK_UNAUTH                 0x00
index 9e0368b02a1165f499cb0a2106175e1da6a8c022..6001b9293905ef9679822ca422ecf2c94ac9dbf1 100644 (file)
@@ -2974,7 +2974,7 @@ static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn,
 
 static bool ltk_type_master(u8 type)
 {
-       if (type == HCI_SMP_STK || type == HCI_SMP_LTK)
+       if (type == SMP_STK || type == SMP_LTK)
                return true;
 
        return false;
index 8dde40430b5fe7e0b37736f84e001c701c4cc0de..15a0a65bf4471c522eab188385dd9a74356d737c 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "a2mp.h"
 #include "amp.h"
+#include "smp.h"
 
 /* Handle HCI Event packets */
 
@@ -4241,7 +4242,7 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
         * distribute the keys. Later, security can be re-established
         * using a distributed LTK.
         */
-       if (ltk->type == HCI_SMP_STK) {
+       if (ltk->type == SMP_STK) {
                list_del(&ltk->list);
                kfree(ltk);
        }
index af8e0a6243b7520617156f79d7d430ce12ef4be9..99eb845865ef751cf01da3cf95d83a66f935cfb6 100644 (file)
@@ -4550,9 +4550,9 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
                        addr_type = ADDR_LE_DEV_RANDOM;
 
                if (key->master)
-                       type = HCI_SMP_LTK;
+                       type = SMP_LTK;
                else
-                       type = HCI_SMP_LTK_SLAVE;
+                       type = SMP_LTK_SLAVE;
 
                switch (key->type) {
                case MGMT_LTK_UNAUTHENTICATED:
@@ -5279,7 +5279,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent)
        ev.key.ediv = key->ediv;
        ev.key.rand = key->rand;
 
-       if (key->type == HCI_SMP_LTK)
+       if (key->type == SMP_LTK)
                ev.key.master = 1;
 
        memcpy(ev.key.val, key->val, sizeof(key->val));
index b9cac1deb19fcc0dcf01fefced71dc0ef70134b8..78b9573f4a73f04ffc407b0fb13ae32b2be686ec 100644 (file)
@@ -573,8 +573,7 @@ static u8 smp_random(struct smp_chan *smp)
                 * STK never needs to be stored).
                 */
                hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
-                           HCI_SMP_STK, auth, stk, smp->enc_key_size,
-                           ediv, rand);
+                           SMP_STK, auth, stk, smp->enc_key_size, ediv, rand);
        }
 
        return 0;
@@ -1027,7 +1026,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
 
        hci_dev_lock(hdev);
        authenticated = (hcon->sec_level == BT_SECURITY_HIGH);
-       ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, HCI_SMP_LTK,
+       ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, SMP_LTK,
                          authenticated, smp->tk, smp->enc_key_size,
                          rp->ediv, rp->rand);
        smp->ltk = ltk;
@@ -1343,7 +1342,7 @@ int smp_distribute_keys(struct l2cap_conn *conn)
 
                authenticated = hcon->sec_level == BT_SECURITY_HIGH;
                ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type,
-                                 HCI_SMP_LTK_SLAVE, authenticated, enc.ltk,
+                                 SMP_LTK_SLAVE, authenticated, enc.ltk,
                                  smp->enc_key_size, ediv, rand);
                smp->slave_ltk = ltk;
 
index 5a8dc36460a1b7e3a61b08d18407708673a7d1a5..796f4f45f92f67e43e32d75bfb015b5175f2aba0 100644 (file)
@@ -116,6 +116,13 @@ struct smp_cmd_security_req {
 #define SMP_MIN_ENC_KEY_SIZE           7
 #define SMP_MAX_ENC_KEY_SIZE           16
 
+/* LTK types used in internal storage (struct smp_ltk) */
+enum {
+       SMP_STK,
+       SMP_LTK,
+       SMP_LTK_SLAVE,
+};
+
 /* SMP Commands */
 bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level);
 int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
This page took 0.036362 seconds and 5 git commands to generate.