aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wpa.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-09-26 09:19:41 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:14 -0400
commit6a22a59d487e7fe509b457b72497593e402911c0 (patch)
treea4bfd02cdea7e1cec690101bc119b515f3dc445c /net/mac80211/wpa.c
parent4f0d18e26f8bc4c6507b69aa0080d0fae807c990 (diff)
[PATCH] mac80211: consolidate encryption
Currently we run through all crypto handlers for each transmitted frame although we already know which one will be used. This changes the code to invoke only the needed handler. It also moves the wep code into wep.c. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wpa.c')
-rw-r--r--net/mac80211/wpa.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 108fe3e81e24..a07fd7484cdf 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -239,17 +239,16 @@ static int tkip_encrypt_skb(struct ieee80211_txrx_data *tx,
239 239
240 240
241ieee80211_txrx_result 241ieee80211_txrx_result
242ieee80211_tx_h_tkip_encrypt(struct ieee80211_txrx_data *tx) 242ieee80211_crypto_tkip_encrypt(struct ieee80211_txrx_data *tx)
243{ 243{
244 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 244 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
245 u16 fc; 245 u16 fc;
246 struct ieee80211_key *key = tx->key;
247 struct sk_buff *skb = tx->skb; 246 struct sk_buff *skb = tx->skb;
248 int wpa_test = 0, test = 0; 247 int wpa_test = 0, test = 0;
249 248
250 fc = le16_to_cpu(hdr->frame_control); 249 fc = le16_to_cpu(hdr->frame_control);
251 250
252 if (!key || key->conf.alg != ALG_TKIP || !WLAN_FC_DATA_PRESENT(fc)) 251 if (!WLAN_FC_DATA_PRESENT(fc))
253 return TXRX_CONTINUE; 252 return TXRX_CONTINUE;
254 253
255 tx->u.tx.control->icv_len = TKIP_ICV_LEN; 254 tx->u.tx.control->icv_len = TKIP_ICV_LEN;
@@ -491,17 +490,16 @@ static int ccmp_encrypt_skb(struct ieee80211_txrx_data *tx,
491 490
492 491
493ieee80211_txrx_result 492ieee80211_txrx_result
494ieee80211_tx_h_ccmp_encrypt(struct ieee80211_txrx_data *tx) 493ieee80211_crypto_ccmp_encrypt(struct ieee80211_txrx_data *tx)
495{ 494{
496 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 495 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
497 struct ieee80211_key *key = tx->key;
498 u16 fc; 496 u16 fc;
499 struct sk_buff *skb = tx->skb; 497 struct sk_buff *skb = tx->skb;
500 int test = 0; 498 int test = 0;
501 499
502 fc = le16_to_cpu(hdr->frame_control); 500 fc = le16_to_cpu(hdr->frame_control);
503 501
504 if (!key || key->conf.alg != ALG_CCMP || !WLAN_FC_DATA_PRESENT(fc)) 502 if (!WLAN_FC_DATA_PRESENT(fc))
505 return TXRX_CONTINUE; 503 return TXRX_CONTINUE;
506 504
507 tx->u.tx.control->icv_len = CCMP_MIC_LEN; 505 tx->u.tx.control->icv_len = CCMP_MIC_LEN;