aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wep.c
diff options
context:
space:
mode:
authorJanusz.Dziedzic@tieto.com <Janusz.Dziedzic@tieto.com>2012-05-09 01:11:20 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-16 12:46:37 -0400
commitee70108fa2a7688dc67bfedaeb0c8c46a221effb (patch)
tree69c9a607c144a79c72632c836eae3e2f5a884fd6 /net/mac80211/wep.c
parent40bbc21a2c2bc432735a085d572f3cb3732cf64c (diff)
mac80211: Add IV-room in the skb for TKIP and WEP
Add IV-room in skb also for TKIP and WEP. Extend patch: "mac80211: support adding IV-room in the skb for CCMP keys" Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wep.c')
-rw-r--r--net/mac80211/wep.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 7aa31bbfaa3b..e904401684da 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -92,6 +92,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
92 int keylen, int keyidx) 92 int keylen, int keyidx)
93{ 93{
94 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 94 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
95 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
95 unsigned int hdrlen; 96 unsigned int hdrlen;
96 u8 *newhdr; 97 u8 *newhdr;
97 98
@@ -104,6 +105,12 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
104 hdrlen = ieee80211_hdrlen(hdr->frame_control); 105 hdrlen = ieee80211_hdrlen(hdr->frame_control);
105 newhdr = skb_push(skb, WEP_IV_LEN); 106 newhdr = skb_push(skb, WEP_IV_LEN);
106 memmove(newhdr, newhdr + WEP_IV_LEN, hdrlen); 107 memmove(newhdr, newhdr + WEP_IV_LEN, hdrlen);
108
109 /* the HW only needs room for the IV, but not the actual IV */
110 if (info->control.hw_key &&
111 (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
112 return newhdr + hdrlen;
113
107 ieee80211_wep_get_iv(local, keylen, keyidx, newhdr + hdrlen); 114 ieee80211_wep_get_iv(local, keylen, keyidx, newhdr + hdrlen);
108 return newhdr + hdrlen; 115 return newhdr + hdrlen;
109} 116}
@@ -313,14 +320,15 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
313static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) 320static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
314{ 321{
315 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 322 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
323 struct ieee80211_key_conf *hw_key = info->control.hw_key;
316 324
317 if (!info->control.hw_key) { 325 if (!hw_key) {
318 if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, 326 if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
319 tx->key->conf.keylen, 327 tx->key->conf.keylen,
320 tx->key->conf.keyidx)) 328 tx->key->conf.keyidx))
321 return -1; 329 return -1;
322 } else if (info->control.hw_key->flags & 330 } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
323 IEEE80211_KEY_FLAG_GENERATE_IV) { 331 (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
324 if (!ieee80211_wep_add_iv(tx->local, skb, 332 if (!ieee80211_wep_add_iv(tx->local, skb,
325 tx->key->conf.keylen, 333 tx->key->conf.keylen,
326 tx->key->conf.keyidx)) 334 tx->key->conf.keyidx))