aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wep.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/wep.c')
-rw-r--r--net/mac80211/wep.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 0b19e89fcf6a..e785fe1f78ed 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -63,8 +63,8 @@ static inline int ieee80211_wep_weak_iv(u32 iv, int keylen)
63} 63}
64 64
65 65
66void ieee80211_wep_get_iv(struct ieee80211_local *local, 66static void ieee80211_wep_get_iv(struct ieee80211_local *local,
67 struct ieee80211_key *key, u8 *iv) 67 struct ieee80211_key *key, u8 *iv)
68{ 68{
69 local->wep_iv++; 69 local->wep_iv++;
70 if (ieee80211_wep_weak_iv(local->wep_iv, key->conf.keylen)) 70 if (ieee80211_wep_weak_iv(local->wep_iv, key->conf.keylen))
@@ -109,9 +109,9 @@ u8 * ieee80211_wep_add_iv(struct ieee80211_local *local,
109} 109}
110 110
111 111
112void ieee80211_wep_remove_iv(struct ieee80211_local *local, 112static void ieee80211_wep_remove_iv(struct ieee80211_local *local,
113 struct sk_buff *skb, 113 struct sk_buff *skb,
114 struct ieee80211_key *key) 114 struct ieee80211_key *key)
115{ 115{
116 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 116 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
117 u16 fc; 117 u16 fc;
@@ -326,3 +326,27 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
326 326
327 return NULL; 327 return NULL;
328} 328}
329
330ieee80211_txrx_result
331ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx)
332{
333 if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
334 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
335 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH))
336 return TXRX_CONTINUE;
337
338 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) {
339 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
340 if (net_ratelimit())
341 printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
342 "failed\n", rx->dev->name);
343 return TXRX_DROP;
344 }
345 } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) {
346 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
347 /* remove ICV */
348 skb_trim(rx->skb, rx->skb->len - 4);
349 }
350
351 return TXRX_CONTINUE;
352}