aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-05-20 02:45:47 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-05-20 11:44:11 -0400
commit4bc58f51e156227d139668199ffe5df2ccb2f3c2 (patch)
tree50369b94e3cd3d4b4707eea168447f5bca6d681b
parentf4e2dd53d5d876aaf33ec9c4d3dd0286a5bf89c5 (diff)
Bluetooth: Make SMP context private to smp.c
There are no users of the smp_chan struct outside of smp.c so move it away from smp.h. The addition of the l2cap.h include to hci_core.c, hci_conn.c and mgmt.c is something that should have been there already previously to avoid warnings of undeclared struct l2cap_conn, but the compiler warning was apparently shadowed away by the mention of l2cap_conn in the struct smp_chan definition. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--net/bluetooth/hci_conn.c1
-rw-r--r--net/bluetooth/hci_core.c1
-rw-r--r--net/bluetooth/mgmt.c1
-rw-r--r--net/bluetooth/smp.c29
-rw-r--r--net/bluetooth/smp.h29
5 files changed, 32 insertions, 29 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index a987e7def025..1bb8900086dd 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -28,6 +28,7 @@
28 28
29#include <net/bluetooth/bluetooth.h> 29#include <net/bluetooth/bluetooth.h>
30#include <net/bluetooth/hci_core.h> 30#include <net/bluetooth/hci_core.h>
31#include <net/bluetooth/l2cap.h>
31 32
32#include "smp.h" 33#include "smp.h"
33#include "a2mp.h" 34#include "a2mp.h"
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 313bd1c164d6..0a43cce9a914 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -34,6 +34,7 @@
34 34
35#include <net/bluetooth/bluetooth.h> 35#include <net/bluetooth/bluetooth.h>
36#include <net/bluetooth/hci_core.h> 36#include <net/bluetooth/hci_core.h>
37#include <net/bluetooth/l2cap.h>
37 38
38#include "smp.h" 39#include "smp.h"
39 40
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 370cd42f488b..f8ca69dd1984 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -29,6 +29,7 @@
29 29
30#include <net/bluetooth/bluetooth.h> 30#include <net/bluetooth/bluetooth.h>
31#include <net/bluetooth/hci_core.h> 31#include <net/bluetooth/hci_core.h>
32#include <net/bluetooth/l2cap.h>
32#include <net/bluetooth/mgmt.h> 33#include <net/bluetooth/mgmt.h>
33 34
34#include "smp.h" 35#include "smp.h"
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index b5b926399e76..df91ed28084f 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -35,6 +35,35 @@
35 35
36#define AUTH_REQ_MASK 0x07 36#define AUTH_REQ_MASK 0x07
37 37
38#define SMP_FLAG_TK_VALID 1
39#define SMP_FLAG_CFM_PENDING 2
40#define SMP_FLAG_MITM_AUTH 3
41#define SMP_FLAG_COMPLETE 4
42#define SMP_FLAG_INITIATOR 5
43
44struct smp_chan {
45 struct l2cap_conn *conn;
46 u8 preq[7]; /* SMP Pairing Request */
47 u8 prsp[7]; /* SMP Pairing Response */
48 u8 prnd[16]; /* SMP Pairing Random (local) */
49 u8 rrnd[16]; /* SMP Pairing Random (remote) */
50 u8 pcnf[16]; /* SMP Pairing Confirm */
51 u8 tk[16]; /* SMP Temporary Key */
52 u8 enc_key_size;
53 u8 remote_key_dist;
54 bdaddr_t id_addr;
55 u8 id_addr_type;
56 u8 irk[16];
57 struct smp_csrk *csrk;
58 struct smp_csrk *slave_csrk;
59 struct smp_ltk *ltk;
60 struct smp_ltk *slave_ltk;
61 struct smp_irk *remote_irk;
62 unsigned long smp_flags;
63 struct work_struct confirm;
64 struct work_struct random;
65};
66
38static inline void swap128(const u8 src[16], u8 dst[16]) 67static inline void swap128(const u8 src[16], u8 dst[16])
39{ 68{
40 int i; 69 int i;
diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h
index afd16231db13..5a8dc36460a1 100644
--- a/net/bluetooth/smp.h
+++ b/net/bluetooth/smp.h
@@ -116,35 +116,6 @@ struct smp_cmd_security_req {
116#define SMP_MIN_ENC_KEY_SIZE 7 116#define SMP_MIN_ENC_KEY_SIZE 7
117#define SMP_MAX_ENC_KEY_SIZE 16 117#define SMP_MAX_ENC_KEY_SIZE 16
118 118
119#define SMP_FLAG_TK_VALID 1
120#define SMP_FLAG_CFM_PENDING 2
121#define SMP_FLAG_MITM_AUTH 3
122#define SMP_FLAG_COMPLETE 4
123#define SMP_FLAG_INITIATOR 5
124
125struct smp_chan {
126 struct l2cap_conn *conn;
127 u8 preq[7]; /* SMP Pairing Request */
128 u8 prsp[7]; /* SMP Pairing Response */
129 u8 prnd[16]; /* SMP Pairing Random (local) */
130 u8 rrnd[16]; /* SMP Pairing Random (remote) */
131 u8 pcnf[16]; /* SMP Pairing Confirm */
132 u8 tk[16]; /* SMP Temporary Key */
133 u8 enc_key_size;
134 u8 remote_key_dist;
135 bdaddr_t id_addr;
136 u8 id_addr_type;
137 u8 irk[16];
138 struct smp_csrk *csrk;
139 struct smp_csrk *slave_csrk;
140 struct smp_ltk *ltk;
141 struct smp_ltk *slave_ltk;
142 struct smp_irk *remote_irk;
143 unsigned long smp_flags;
144 struct work_struct confirm;
145 struct work_struct random;
146};
147
148/* SMP Commands */ 119/* SMP Commands */
149bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level); 120bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level);
150int smp_conn_security(struct hci_conn *hcon, __u8 sec_level); 121int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);