aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--include/net/ieee80211.h1
-rw-r--r--include/net/ieee80211_crypt.h10
-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
8 files changed, 38 insertions, 19 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 4a381a074fdd..4851756202c5 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -876,7 +876,6 @@ struct ieee80211_device {
876 /* WPA data */ 876 /* WPA data */
877 int wpa_enabled; 877 int wpa_enabled;
878 int drop_unencrypted; 878 int drop_unencrypted;
879 int tkip_countermeasures;
880 int privacy_invoked; 879 int privacy_invoked;
881 size_t wpa_ie_len; 880 size_t wpa_ie_len;
882 u8 *wpa_ie; 881 u8 *wpa_ie;
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index daf3b2c6b038..0c9d859d912e 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -25,13 +25,17 @@
25 25
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27 27
28enum {
29 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1<<0),
30};
31
28struct ieee80211_crypto_ops { 32struct ieee80211_crypto_ops {
29 const char *name; 33 const char *name;
30 34
31 /* init new crypto context (e.g., allocate private data space, 35 /* init new crypto context (e.g., allocate private data space,
32 * select IV, etc.); returns NULL on failure or pointer to allocated 36 * select IV, etc.); returns NULL on failure or pointer to allocated
33 * private data on success */ 37 * private data on success */
34 void *(*init) (struct ieee80211_device * ieee, int keyidx); 38 void *(*init) (int keyidx);
35 39
36 /* deinitialize crypto context and free allocated private data */ 40 /* deinitialize crypto context and free allocated private data */
37 void (*deinit) (void *priv); 41 void (*deinit) (void *priv);
@@ -60,6 +64,10 @@ struct ieee80211_crypto_ops {
60 * statistics */ 64 * statistics */
61 char *(*print_stats) (char *p, void *priv); 65 char *(*print_stats) (char *p, void *priv);
62 66
67 /* Crypto specific flag get/set for configuration settings */
68 unsigned long (*get_flags)(void *priv);
69 unsigned long (*set_flags)(unsigned long flags, void *priv);
70
63 /* maximum number of bytes added by encryption; encrypt buf is 71 /* maximum number of bytes added by encryption; encrypt buf is
64 * allocated with extra_prefix_len bytes, copy of in_buf, and 72 * allocated with extra_prefix_len bytes, copy of in_buf, and
65 * extra_postfix_len; encrypt need not use all this space, but 73 * extra_postfix_len; encrypt need not use all this space, but
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;