aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211
diff options
context:
space:
mode:
authorJames Ketrenos <jketreno@linux.intel.com>2005-09-22 06:34:15 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-22 15:40:59 -0400
commit6eb6edf04acd09e3cea09456913e8da59323b89e (patch)
tree7cf648aba7823b1b7cc9419f682a2dca60cc2e82 /net/ieee80211
parente5658d3e8a347f4393a9403b0cec8d43fa6214b1 (diff)
[PATCH] ieee80211: in-tree driver updates to sync with latest ieee80211 series
Changed crypto method from requiring a struct ieee80211_device reference to the init handler. Instead we now have a get/set flags method for each crypto component. Setting of TKIP countermeasures can now be done via set_flags(IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) Signed-off-by: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'net/ieee80211')
-rw-r--r--net/ieee80211/ieee80211_crypt.c3
-rw-r--r--net/ieee80211/ieee80211_crypt_ccmp.c2
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c34
-rw-r--r--net/ieee80211/ieee80211_crypt_wep.c2
-rw-r--r--net/ieee80211/ieee80211_module.c1
-rw-r--r--net/ieee80211/ieee80211_wx.c4
6 files changed, 29 insertions, 17 deletions
diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c
index e26bcc918032..f3b6aa3be638 100644
--- a/net/ieee80211/ieee80211_crypt.c
+++ b/net/ieee80211/ieee80211_crypt.c
@@ -202,8 +202,7 @@ struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name)
202 return NULL; 202 return NULL;
203} 203}
204 204
205static void *ieee80211_crypt_null_init(struct ieee80211_device *ieee, 205static void *ieee80211_crypt_null_init(int keyidx)
206 int keyidx)
207{ 206{
208 return (void *)1; 207 return (void *)1;
209} 208}
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c
index 081d8575dbb1..05a853c13012 100644
--- a/net/ieee80211/ieee80211_crypt_ccmp.c
+++ b/net/ieee80211/ieee80211_crypt_ccmp.c
@@ -74,7 +74,7 @@ static void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
74 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); 74 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
75} 75}
76 76
77static void *ieee80211_ccmp_init(struct ieee80211_device *ieee, int key_idx) 77static void *ieee80211_ccmp_init(int key_idx)
78{ 78{
79 struct ieee80211_ccmp_data *priv; 79 struct ieee80211_ccmp_data *priv;
80 80
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index e0733050ae71..2e34f29b7956 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -60,10 +60,24 @@ struct ieee80211_tkip_data {
60 /* scratch buffers for virt_to_page() (crypto API) */ 60 /* scratch buffers for virt_to_page() (crypto API) */
61 u8 rx_hdr[16], tx_hdr[16]; 61 u8 rx_hdr[16], tx_hdr[16];
62 62
63 struct ieee80211_device *ieee; 63 unsigned long flags;
64}; 64};
65 65
66static void *ieee80211_tkip_init(struct ieee80211_device *ieee, int key_idx) 66static unsigned long ieee80211_tkip_set_flags(unsigned long flags, void *priv)
67{
68 struct ieee80211_tkip_data *_priv = priv;
69 unsigned long old_flags = _priv->flags;
70 _priv->flags = flags;
71 return old_flags;
72}
73
74static unsigned long ieee80211_tkip_get_flags(void *priv)
75{
76 struct ieee80211_tkip_data *_priv = priv;
77 return _priv->flags;
78}
79
80static void *ieee80211_tkip_init(int key_idx)
67{ 81{
68 struct ieee80211_tkip_data *priv; 82 struct ieee80211_tkip_data *priv;
69 83
@@ -72,8 +86,6 @@ static void *ieee80211_tkip_init(struct ieee80211_device *ieee, int key_idx)
72 goto fail; 86 goto fail;
73 memset(priv, 0, sizeof(*priv)); 87 memset(priv, 0, sizeof(*priv));
74 88
75 priv->ieee = ieee;
76
77 priv->key_idx = key_idx; 89 priv->key_idx = key_idx;
78 90
79 priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0); 91 priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
@@ -315,13 +327,13 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
315 u8 *pos; 327 u8 *pos;
316 struct scatterlist sg; 328 struct scatterlist sg;
317 329
318 if (tkey->ieee->tkip_countermeasures) { 330 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
319 if (net_ratelimit()) { 331 if (net_ratelimit()) {
320 struct ieee80211_hdr_4addr *hdr = 332 struct ieee80211_hdr_4addr *hdr =
321 (struct ieee80211_hdr_4addr *)skb->data; 333 (struct ieee80211_hdr_4addr *)skb->data;
322 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 334 printk(KERN_DEBUG "TKIP countermeasures: dropped "
323 "TX packet to " MAC_FMT "\n", 335 "TX packet to " MAC_FMT "\n",
324 tkey->ieee->dev->name, MAC_ARG(hdr->addr1)); 336 MAC_ARG(hdr->addr1));
325 } 337 }
326 return -1; 338 return -1;
327 } 339 }
@@ -366,11 +378,11 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
366 378
367 hdr = (struct ieee80211_hdr_4addr *)skb->data; 379 hdr = (struct ieee80211_hdr_4addr *)skb->data;
368 380
369 if (tkey->ieee->tkip_countermeasures) { 381 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
370 if (net_ratelimit()) { 382 if (net_ratelimit()) {
371 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 383 printk(KERN_DEBUG "TKIP countermeasures: dropped "
372 "received packet from " MAC_FMT "\n", 384 "received packet from " MAC_FMT "\n",
373 tkey->ieee->dev->name, MAC_ARG(hdr->addr2)); 385 MAC_ARG(hdr->addr2));
374 } 386 }
375 return -1; 387 return -1;
376 } 388 }
@@ -694,6 +706,8 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
694 .extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */ 706 .extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */
695 .extra_mpdu_postfix_len = 4, /* ICV */ 707 .extra_mpdu_postfix_len = 4, /* ICV */
696 .extra_msdu_postfix_len = 8, /* MIC */ 708 .extra_msdu_postfix_len = 8, /* MIC */
709 .get_flags = ieee80211_tkip_get_flags,
710 .set_flags = ieee80211_tkip_set_flags,
697 .owner = THIS_MODULE, 711 .owner = THIS_MODULE,
698}; 712};
699 713
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c
index 2aaeac1e02d7..7c08ed2f2628 100644
--- a/net/ieee80211/ieee80211_crypt_wep.c
+++ b/net/ieee80211/ieee80211_crypt_wep.c
@@ -37,7 +37,7 @@ struct prism2_wep_data {
37 struct crypto_tfm *tfm; 37 struct crypto_tfm *tfm;
38}; 38};
39 39
40static void *prism2_wep_init(struct ieee80211_device *ieee, int keyidx) 40static void *prism2_wep_init(int keyidx)
41{ 41{
42 struct prism2_wep_data *priv; 42 struct prism2_wep_data *priv;
43 43
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
index 319312564167..5714692e82b4 100644
--- a/net/ieee80211/ieee80211_module.c
+++ b/net/ieee80211/ieee80211_module.c
@@ -155,7 +155,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
155 spin_lock_init(&ieee->lock); 155 spin_lock_init(&ieee->lock);
156 156
157 ieee->wpa_enabled = 0; 157 ieee->wpa_enabled = 0;
158 ieee->tkip_countermeasures = 0;
159 ieee->drop_unencrypted = 0; 158 ieee->drop_unencrypted = 0;
160 ieee->privacy_invoked = 0; 159 ieee->privacy_invoked = 0;
161 160
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 3dd2bbae0c24..ee7a70a13250 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -355,7 +355,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
355 } 355 }
356 356
357 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 357 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
358 new_crypt->priv = new_crypt->ops->init(ieee, key); 358 new_crypt->priv = new_crypt->ops->init(key);
359 359
360 if (!new_crypt->ops || !new_crypt->priv) { 360 if (!new_crypt->ops || !new_crypt->priv) {
361 kfree(new_crypt); 361 kfree(new_crypt);
@@ -598,7 +598,7 @@ int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
598 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 598 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
599 new_crypt->ops = ops; 599 new_crypt->ops = ops;
600 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 600 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
601 new_crypt->priv = new_crypt->ops->init(ieee, idx); 601 new_crypt->priv = new_crypt->ops->init(idx);
602 if (new_crypt->priv == NULL) { 602 if (new_crypt->priv == NULL) {
603 kfree(new_crypt); 603 kfree(new_crypt);
604 ret = -EINVAL; 604 ret = -EINVAL;