aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wpa.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-02-03 11:34:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-03 16:45:29 -0500
commit747d753df7fea1d2d29c5c33623f6d2e5d0ed2d6 (patch)
tree1c3df8dcc49a1557635b90672471e5ec61483328 /net/mac80211/wpa.c
parent942a84901b71f8ac1edb80c4b9db08441536a440 (diff)
mac80211: Remove obsolete TKIP flexibility
The TKIP implementation was originally prepared to be a bit more flexible in the way Michael MIC TX/RX keys are configured. However, we are now taking care of the TX/RX MIC key swapping in user space, so this code will not be needed. Similarly, there were some remaining WPA testing code that won't be used in their current form. Remove the unneeded extra complexity. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Reviewed-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.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index bee230d8fd11..cd5e730873a8 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -26,13 +26,12 @@
26ieee80211_tx_result 26ieee80211_tx_result
27ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) 27ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
28{ 28{
29 u8 *data, *key, *mic, key_offset; 29 u8 *data, *key, *mic;
30 size_t data_len; 30 size_t data_len;
31 unsigned int hdrlen; 31 unsigned int hdrlen;
32 struct ieee80211_hdr *hdr; 32 struct ieee80211_hdr *hdr;
33 struct sk_buff *skb = tx->skb; 33 struct sk_buff *skb = tx->skb;
34 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 34 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
35 int authenticator;
36 int tail; 35 int tail;
37 36
38 hdr = (struct ieee80211_hdr *)skb->data; 37 hdr = (struct ieee80211_hdr *)skb->data;
@@ -62,15 +61,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
62 skb_headroom(skb) < TKIP_IV_LEN)) 61 skb_headroom(skb) < TKIP_IV_LEN))
63 return TX_DROP; 62 return TX_DROP;
64 63
65#if 0 64 key = &tx->key->conf.key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY];
66 authenticator = fc & IEEE80211_FCTL_FROMDS; /* FIX */
67#else
68 authenticator = 1;
69#endif
70 key_offset = authenticator ?
71 NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY :
72 NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY;
73 key = &tx->key->conf.key[key_offset];
74 mic = skb_put(skb, MICHAEL_MIC_LEN); 65 mic = skb_put(skb, MICHAEL_MIC_LEN);
75 michael_mic(key, hdr, data, data_len, mic); 66 michael_mic(key, hdr, data, data_len, mic);
76 67
@@ -81,14 +72,13 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
81ieee80211_rx_result 72ieee80211_rx_result
82ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) 73ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
83{ 74{
84 u8 *data, *key = NULL, key_offset; 75 u8 *data, *key = NULL;
85 size_t data_len; 76 size_t data_len;
86 unsigned int hdrlen; 77 unsigned int hdrlen;
87 u8 mic[MICHAEL_MIC_LEN]; 78 u8 mic[MICHAEL_MIC_LEN];
88 struct sk_buff *skb = rx->skb; 79 struct sk_buff *skb = rx->skb;
89 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 80 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
90 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 81 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
91 int authenticator = 1, wpa_test = 0;
92 82
93 /* No way to verify the MIC if the hardware stripped it */ 83 /* No way to verify the MIC if the hardware stripped it */
94 if (status->flag & RX_FLAG_MMIC_STRIPPED) 84 if (status->flag & RX_FLAG_MMIC_STRIPPED)
@@ -106,17 +96,9 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
106 data = skb->data + hdrlen; 96 data = skb->data + hdrlen;
107 data_len = skb->len - hdrlen - MICHAEL_MIC_LEN; 97 data_len = skb->len - hdrlen - MICHAEL_MIC_LEN;
108 98
109#if 0 99 key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY];
110 authenticator = fc & IEEE80211_FCTL_TODS; /* FIX */
111#else
112 authenticator = 1;
113#endif
114 key_offset = authenticator ?
115 NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY :
116 NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY;
117 key = &rx->key->conf.key[key_offset];
118 michael_mic(key, hdr, data, data_len, mic); 100 michael_mic(key, hdr, data, data_len, mic);
119 if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) { 101 if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0) {
120 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) 102 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
121 return RX_DROP_UNUSABLE; 103 return RX_DROP_UNUSABLE;
122 104
@@ -208,7 +190,7 @@ ieee80211_rx_result
208ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) 190ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
209{ 191{
210 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 192 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
211 int hdrlen, res, hwaccel = 0, wpa_test = 0; 193 int hdrlen, res, hwaccel = 0;
212 struct ieee80211_key *key = rx->key; 194 struct ieee80211_key *key = rx->key;
213 struct sk_buff *skb = rx->skb; 195 struct sk_buff *skb = rx->skb;
214 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 196 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
@@ -235,7 +217,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
235 hdr->addr1, hwaccel, rx->queue, 217 hdr->addr1, hwaccel, rx->queue,
236 &rx->tkip_iv32, 218 &rx->tkip_iv32,
237 &rx->tkip_iv16); 219 &rx->tkip_iv16);
238 if (res != TKIP_DECRYPT_OK || wpa_test) 220 if (res != TKIP_DECRYPT_OK)
239 return RX_DROP_UNUSABLE; 221 return RX_DROP_UNUSABLE;
240 222
241 /* Trim ICV */ 223 /* Trim ICV */