Bluetooth: Add new structures for supporting SM key distribution
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>
Thu, 7 Jul 2011 21:59:35 +0000 (18:59 -0300)
committerGustavo F. Padovan <padovan@profusion.mobi>
Fri, 8 Jul 2011 20:36:25 +0000 (17:36 -0300)
We need these changes because SMP keys may have more information
associated with them, for example, in the LTK case, it has an
encrypted diversifier (ediv) and a random number (rand).

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
include/net/bluetooth/hci.h
include/net/bluetooth/hci_core.h
include/net/bluetooth/mgmt.h

index 5004e36d0a66e16b52c743f975d847650d9ff656..be30aabe7b88b95825eab3e65dc606ae91d3ea83 100644 (file)
@@ -259,6 +259,10 @@ enum {
 #define HCI_LK_UNAUTH_COMBINATION      0x04
 #define HCI_LK_AUTH_COMBINATION                0x05
 #define HCI_LK_CHANGED_COMBINATION     0x06
+/* The spec doesn't define types for SMP keys */
+#define HCI_LK_SMP_LTK                 0x81
+#define HCI_LK_SMP_IRK                 0x82
+#define HCI_LK_SMP_CSRK                        0x83
 
 /* -----  HCI Commands ---- */
 #define HCI_OP_NOP                     0x0000
index bb57bcadf4842348fe1b082551d9031ffe08eeeb..0e1fd2b29b0ac421e28b9b8b0bb6196bf50d494c 100644 (file)
@@ -74,12 +74,28 @@ struct bt_uuid {
        u8 svc_hint;
 };
 
+struct key_master_id {
+       __le16 ediv;
+       u8 rand[8];
+} __packed;
+
+struct link_key_data {
+       bdaddr_t bdaddr;
+       u8 type;
+       u8 val[16];
+       u8 pin_len;
+       u8 dlen;
+       u8 data[0];
+} __packed;
+
 struct link_key {
        struct list_head list;
        bdaddr_t bdaddr;
        u8 type;
        u8 val[16];
        u8 pin_len;
+       u8 dlen;
+       u8 data[0];
 };
 
 struct oob_data {
index 45bea25d737f5bac5757d1ae6435c9054ba55114..5428fd32ccec228a4df03c6be87539bcb2985919 100644 (file)
@@ -101,6 +101,8 @@ struct mgmt_key_info {
        u8 type;
        u8 val[16];
        u8 pin_len;
+       u8 dlen;
+       u8 data[0];
 } __packed;
 
 #define MGMT_OP_LOAD_KEYS              0x000D