diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-12-18 20:03:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:59:48 -0500 |
commit | 41ade00f21a72d30911c6351a93823a491fffa39 (patch) | |
tree | d7e4e29c0d757414a5bad9089b1509fd5352ed8f /include | |
parent | a1464ab61e66c96f9cffea335755de850fe8bdbd (diff) |
cfg80211/nl80211: introduce key handling
This introduces key handling to cfg80211/nl80211. Default
and group keys can be added, changed and removed; sequence
counters for each key can be retrieved.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nl80211.h | 34 | ||||
-rw-r--r-- | include/net/cfg80211.h | 44 |
2 files changed, 78 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 538ee1dd3d0a..8dc807d9c29a 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -37,6 +37,16 @@ | |||
37 | * userspace to request deletion of a virtual interface, then requires | 37 | * userspace to request deletion of a virtual interface, then requires |
38 | * attribute %NL80211_ATTR_IFINDEX. | 38 | * attribute %NL80211_ATTR_IFINDEX. |
39 | * | 39 | * |
40 | * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified | ||
41 | * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. | ||
42 | * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT or | ||
43 | * %NL80211_ATTR_KEY_THRESHOLD. | ||
44 | * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, | ||
45 | * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER | ||
46 | * attributes. | ||
47 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX | ||
48 | * or %NL80211_ATTR_MAC. | ||
49 | * | ||
40 | * @NL80211_CMD_MAX: highest used command number | 50 | * @NL80211_CMD_MAX: highest used command number |
41 | * @__NL80211_CMD_AFTER_LAST: internal use | 51 | * @__NL80211_CMD_AFTER_LAST: internal use |
42 | */ | 52 | */ |
@@ -54,6 +64,11 @@ enum nl80211_commands { | |||
54 | NL80211_CMD_NEW_INTERFACE, | 64 | NL80211_CMD_NEW_INTERFACE, |
55 | NL80211_CMD_DEL_INTERFACE, | 65 | NL80211_CMD_DEL_INTERFACE, |
56 | 66 | ||
67 | NL80211_CMD_GET_KEY, | ||
68 | NL80211_CMD_SET_KEY, | ||
69 | NL80211_CMD_NEW_KEY, | ||
70 | NL80211_CMD_DEL_KEY, | ||
71 | |||
57 | /* add commands here */ | 72 | /* add commands here */ |
58 | 73 | ||
59 | /* used to define NL80211_CMD_MAX below */ | 74 | /* used to define NL80211_CMD_MAX below */ |
@@ -75,6 +90,17 @@ enum nl80211_commands { | |||
75 | * @NL80211_ATTR_IFNAME: network interface name | 90 | * @NL80211_ATTR_IFNAME: network interface name |
76 | * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype | 91 | * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype |
77 | * | 92 | * |
93 | * @NL80211_ATTR_MAC: MAC address (various uses) | ||
94 | * | ||
95 | * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of | ||
96 | * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC | ||
97 | * keys | ||
98 | * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3) | ||
99 | * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 | ||
100 | * section 7.3.2.25.1, e.g. 0x000FAC04) | ||
101 | * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and | ||
102 | * CCMP keys, each six bytes in little endian | ||
103 | * | ||
78 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 104 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
79 | * @__NL80211_ATTR_AFTER_LAST: internal use | 105 | * @__NL80211_ATTR_AFTER_LAST: internal use |
80 | */ | 106 | */ |
@@ -89,6 +115,14 @@ enum nl80211_attrs { | |||
89 | NL80211_ATTR_IFNAME, | 115 | NL80211_ATTR_IFNAME, |
90 | NL80211_ATTR_IFTYPE, | 116 | NL80211_ATTR_IFTYPE, |
91 | 117 | ||
118 | NL80211_ATTR_MAC, | ||
119 | |||
120 | NL80211_ATTR_KEY_DATA, | ||
121 | NL80211_ATTR_KEY_IDX, | ||
122 | NL80211_ATTR_KEY_CIPHER, | ||
123 | NL80211_ATTR_KEY_SEQ, | ||
124 | NL80211_ATTR_KEY_DEFAULT, | ||
125 | |||
92 | /* add attributes here, update the policy in nl80211.c */ | 126 | /* add attributes here, update the policy in nl80211.c */ |
93 | 127 | ||
94 | __NL80211_ATTR_AFTER_LAST, | 128 | __NL80211_ATTR_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d30960e1755c..3db7dfa53b6f 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -49,6 +49,26 @@ extern int ieee80211_radiotap_iterator_next( | |||
49 | struct ieee80211_radiotap_iterator *iterator); | 49 | struct ieee80211_radiotap_iterator *iterator); |
50 | 50 | ||
51 | 51 | ||
52 | /** | ||
53 | * struct key_params - key information | ||
54 | * | ||
55 | * Information about a key | ||
56 | * | ||
57 | * @key: key material | ||
58 | * @key_len: length of key material | ||
59 | * @cipher: cipher suite selector | ||
60 | * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used | ||
61 | * with the get_key() callback, must be in little endian, | ||
62 | * length given by @seq_len. | ||
63 | */ | ||
64 | struct key_params { | ||
65 | u8 *key; | ||
66 | u8 *seq; | ||
67 | int key_len; | ||
68 | int seq_len; | ||
69 | u32 cipher; | ||
70 | }; | ||
71 | |||
52 | /* from net/wireless.h */ | 72 | /* from net/wireless.h */ |
53 | struct wiphy; | 73 | struct wiphy; |
54 | 74 | ||
@@ -71,6 +91,18 @@ struct wiphy; | |||
71 | * | 91 | * |
72 | * @change_virtual_intf: change type of virtual interface | 92 | * @change_virtual_intf: change type of virtual interface |
73 | * | 93 | * |
94 | * @add_key: add a key with the given parameters. @mac_addr will be %NULL | ||
95 | * when adding a group key. | ||
96 | * | ||
97 | * @get_key: get information about the key with the given parameters. | ||
98 | * @mac_addr will be %NULL when requesting information for a group | ||
99 | * key. All pointers given to the @callback function need not be valid | ||
100 | * after it returns. | ||
101 | * | ||
102 | * @del_key: remove a key given the @mac_addr (%NULL for a group key) | ||
103 | * and @key_index | ||
104 | * | ||
105 | * @set_default_key: set the default key on an interface | ||
74 | */ | 106 | */ |
75 | struct cfg80211_ops { | 107 | struct cfg80211_ops { |
76 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | 108 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, |
@@ -78,6 +110,18 @@ struct cfg80211_ops { | |||
78 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); | 110 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); |
79 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, | 111 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, |
80 | enum nl80211_iftype type); | 112 | enum nl80211_iftype type); |
113 | |||
114 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
115 | u8 key_index, u8 *mac_addr, | ||
116 | struct key_params *params); | ||
117 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
118 | u8 key_index, u8 *mac_addr, void *cookie, | ||
119 | void (*callback)(void *cookie, struct key_params*)); | ||
120 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
121 | u8 key_index, u8 *mac_addr); | ||
122 | int (*set_default_key)(struct wiphy *wiphy, | ||
123 | struct net_device *netdev, | ||
124 | u8 key_index); | ||
81 | }; | 125 | }; |
82 | 126 | ||
83 | #endif /* __NET_CFG80211_H */ | 127 | #endif /* __NET_CFG80211_H */ |