aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/key.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-08-28 17:01:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:51 -0400
commit8f20fc24986a083228823d9b68adca20714b254e (patch)
treeb5d7638b913649c7a181d6703ccd72e35ca06de9 /net/mac80211/key.c
parent13262ffd4902805acad2618c12b41fcaa6c50791 (diff)
[MAC80211]: embed key conf in key, fix driver interface
This patch embeds the struct ieee80211_key_conf into struct ieee80211_key and thus avoids allocations and having data present twice. This required some more changes: 1) The removal of the IEEE80211_KEY_DEFAULT_TX_KEY key flag. This flag isn't used by drivers nor should it be since we have a set_key_idx() callback. Maybe that callback needs to be extended to include the key conf, but only a driver that requires it will tell. 2) The removal of the IEEE80211_KEY_DEFAULT_WEP_ONLY key flag. This flag is global, so it shouldn't be passed in the key conf structure. Pass it to the function instead. Also, this patch removes the AID parameter to the set_key() callback because it is currently unused and the hardware currently cannot know about the AID anyway. I suspect this was used with some hardware that actually selected the AID itself, but that functionality was removed. Additionally, I've removed the ALG_NULL key algorithm since we have ALG_NONE. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Michael Wu <flamingice@sourmilk.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r--net/mac80211/key.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index b67558c24639..92d994f090b6 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -13,32 +13,6 @@
13#include "debugfs_key.h" 13#include "debugfs_key.h"
14#include "aes_ccm.h" 14#include "aes_ccm.h"
15 15
16struct ieee80211_key_conf *
17ieee80211_key_data2conf(struct ieee80211_local *local,
18 const struct ieee80211_key *data)
19{
20 struct ieee80211_key_conf *conf;
21
22 conf = kmalloc(sizeof(*conf) + data->keylen, GFP_ATOMIC);
23 if (!conf)
24 return NULL;
25
26 conf->hw_key_idx = data->hw_key_idx;
27 conf->alg = data->alg;
28 conf->keylen = data->keylen;
29 conf->flags = 0;
30 if (data->force_sw_encrypt)
31 conf->flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
32 conf->keyidx = data->keyidx;
33 if (data->default_tx_key)
34 conf->flags |= IEEE80211_KEY_DEFAULT_TX_KEY;
35 if (local->default_wep_only)
36 conf->flags |= IEEE80211_KEY_DEFAULT_WEP_ONLY;
37 memcpy(conf->key, data->key, data->keylen);
38
39 return conf;
40}
41
42struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata, 16struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
43 int idx, size_t key_len, gfp_t flags) 17 int idx, size_t key_len, gfp_t flags)
44{ 18{
@@ -56,7 +30,7 @@ static void ieee80211_key_release(struct kref *kref)
56 struct ieee80211_key *key; 30 struct ieee80211_key *key;
57 31
58 key = container_of(kref, struct ieee80211_key, kref); 32 key = container_of(kref, struct ieee80211_key, kref);
59 if (key->alg == ALG_CCMP) 33 if (key->conf.alg == ALG_CCMP)
60 ieee80211_aes_key_free(key->u.ccmp.tfm); 34 ieee80211_aes_key_free(key->u.ccmp.tfm);
61 ieee80211_debugfs_key_remove(key); 35 ieee80211_debugfs_key_remove(key);
62 kfree(key); 36 kfree(key);