aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_crypt_tkip.c
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/ieee80211_crypt_tkip.c
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/ieee80211_crypt_tkip.c')
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c34
1 files changed, 24 insertions, 10 deletions
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