diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-10-07 06:04:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 18:05:59 -0400 |
commit | c6a1fa12d206882757264869f8e32d606b930e2a (patch) | |
tree | c69a7f8ebe43481a985acd7844d35a26bd9a61ce | |
parent | 36ff382d0065c9980c203c7cd3b3eb26251e9397 (diff) |
mac80211: minor code cleanups
Nothing very interesting, some checkpatch inspired stuff,
some other things.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/debugfs_sta.c | 6 | ||||
-rw-r--r-- | net/mac80211/main.c | 2 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 2 | ||||
-rw-r--r-- | net/mac80211/rc80211_pid.h | 2 | ||||
-rw-r--r-- | net/mac80211/rx.c | 24 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 4 | ||||
-rw-r--r-- | net/mac80211/wep.c | 26 | ||||
-rw-r--r-- | net/mac80211/wep.h | 2 | ||||
-rw-r--r-- | net/mac80211/wpa.c | 29 |
9 files changed, 45 insertions, 52 deletions
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 5824eb225f26..a2fbe0131312 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -137,7 +137,7 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, | |||
137 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); | 137 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); |
138 | for (i = 0; i < STA_TID_NUM; i++) | 138 | for (i = 0; i < STA_TID_NUM; i++) |
139 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", | 139 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", |
140 | sta->ampdu_mlme.tid_state_rx[i]? | 140 | sta->ampdu_mlme.tid_state_rx[i] ? |
141 | sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); | 141 | sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); |
142 | 142 | ||
143 | p += scnprintf(p, sizeof(buf)+buf-p, "\n TX :"); | 143 | p += scnprintf(p, sizeof(buf)+buf-p, "\n TX :"); |
@@ -148,13 +148,13 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, | |||
148 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); | 148 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); |
149 | for (i = 0; i < STA_TID_NUM; i++) | 149 | for (i = 0; i < STA_TID_NUM; i++) |
150 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", | 150 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", |
151 | sta->ampdu_mlme.tid_state_tx[i]? | 151 | sta->ampdu_mlme.tid_state_tx[i] ? |
152 | sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); | 152 | sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); |
153 | 153 | ||
154 | p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :"); | 154 | p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :"); |
155 | for (i = 0; i < STA_TID_NUM; i++) | 155 | for (i = 0; i < STA_TID_NUM; i++) |
156 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", | 156 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", |
157 | sta->ampdu_mlme.tid_state_tx[i]? | 157 | sta->ampdu_mlme.tid_state_tx[i] ? |
158 | sta->ampdu_mlme.tid_tx[i]->ssn : 0); | 158 | sta->ampdu_mlme.tid_tx[i]->ssn : 0); |
159 | 159 | ||
160 | p += scnprintf(p, sizeof(buf)+buf-p, "\n"); | 160 | p += scnprintf(p, sizeof(buf)+buf-p, "\n"); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index ae62ad40ad63..ff39d893a113 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -1013,7 +1013,7 @@ static int __init ieee80211_init(void) | |||
1013 | 1013 | ||
1014 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb)); | 1014 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb)); |
1015 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) + | 1015 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) + |
1016 | IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); | 1016 | IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); |
1017 | 1017 | ||
1018 | ret = rc80211_minstrel_init(); | 1018 | ret = rc80211_minstrel_init(); |
1019 | if (ret) | 1019 | if (ret) |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 8013277924f2..d3b6e1a648bd 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -473,7 +473,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
473 | size_t len, | 473 | size_t len, |
474 | struct ieee80211_rx_status *rx_status) | 474 | struct ieee80211_rx_status *rx_status) |
475 | { | 475 | { |
476 | struct ieee80211_local *local= sdata->local; | 476 | struct ieee80211_local *local = sdata->local; |
477 | struct ieee802_11_elems elems; | 477 | struct ieee802_11_elems elems; |
478 | struct ieee80211_channel *channel; | 478 | struct ieee80211_channel *channel; |
479 | u64 supp_rates = 0; | 479 | u64 supp_rates = 0; |
diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h index 01d64d53f3b9..ce099ea1d5d3 100644 --- a/net/mac80211/rc80211_pid.h +++ b/net/mac80211/rc80211_pid.h | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | /* Arithmetic right shift for positive and negative values for ISO C. */ | 50 | /* Arithmetic right shift for positive and negative values for ISO C. */ |
51 | #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \ | 51 | #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \ |
52 | (x) < 0 ? -((-(x)) >> (y)) : (x) >> (y) | 52 | ((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y)) |
53 | 53 | ||
54 | enum rc_pid_event_type { | 54 | enum rc_pid_event_type { |
55 | RC_PID_EVENT_TYPE_TX_STATUS, | 55 | RC_PID_EVENT_TYPE_TX_STATUS, |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 39aaf210e9f5..af6ce1064697 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include "tkip.h" | 26 | #include "tkip.h" |
27 | #include "wme.h" | 27 | #include "wme.h" |
28 | 28 | ||
29 | u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | 29 | static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, |
30 | struct tid_ampdu_rx *tid_agg_rx, | 30 | struct tid_ampdu_rx *tid_agg_rx, |
31 | struct sk_buff *skb, u16 mpdu_seq_num, | 31 | struct sk_buff *skb, |
32 | int bar_req); | 32 | u16 mpdu_seq_num, |
33 | int bar_req); | ||
33 | /* | 34 | /* |
34 | * monitor mode reception | 35 | * monitor mode reception |
35 | * | 36 | * |
@@ -1988,17 +1989,17 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
1988 | 1989 | ||
1989 | static inline int seq_less(u16 sq1, u16 sq2) | 1990 | static inline int seq_less(u16 sq1, u16 sq2) |
1990 | { | 1991 | { |
1991 | return (((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1)); | 1992 | return ((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1); |
1992 | } | 1993 | } |
1993 | 1994 | ||
1994 | static inline u16 seq_inc(u16 sq) | 1995 | static inline u16 seq_inc(u16 sq) |
1995 | { | 1996 | { |
1996 | return ((sq + 1) & SEQ_MASK); | 1997 | return (sq + 1) & SEQ_MASK; |
1997 | } | 1998 | } |
1998 | 1999 | ||
1999 | static inline u16 seq_sub(u16 sq1, u16 sq2) | 2000 | static inline u16 seq_sub(u16 sq1, u16 sq2) |
2000 | { | 2001 | { |
2001 | return ((sq1 - sq2) & SEQ_MASK); | 2002 | return (sq1 - sq2) & SEQ_MASK; |
2002 | } | 2003 | } |
2003 | 2004 | ||
2004 | 2005 | ||
@@ -2006,10 +2007,11 @@ static inline u16 seq_sub(u16 sq1, u16 sq2) | |||
2006 | * As it function blongs to Rx path it must be called with | 2007 | * As it function blongs to Rx path it must be called with |
2007 | * the proper rcu_read_lock protection for its flow. | 2008 | * the proper rcu_read_lock protection for its flow. |
2008 | */ | 2009 | */ |
2009 | u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | 2010 | static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, |
2010 | struct tid_ampdu_rx *tid_agg_rx, | 2011 | struct tid_ampdu_rx *tid_agg_rx, |
2011 | struct sk_buff *skb, u16 mpdu_seq_num, | 2012 | struct sk_buff *skb, |
2012 | int bar_req) | 2013 | u16 mpdu_seq_num, |
2014 | int bar_req) | ||
2013 | { | 2015 | { |
2014 | struct ieee80211_local *local = hw_to_local(hw); | 2016 | struct ieee80211_local *local = hw_to_local(hw); |
2015 | struct ieee80211_rx_status status; | 2017 | struct ieee80211_rx_status status; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index ca89a848c41e..b22110a4a75e 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -290,7 +290,7 @@ int sta_info_insert(struct sta_info *sta) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 || | 292 | if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 || |
293 | is_multicast_ether_addr(sta->sta.addr))) { | 293 | is_multicast_ether_addr(sta->sta.addr))) { |
294 | err = -EINVAL; | 294 | err = -EINVAL; |
295 | goto out_free; | 295 | goto out_free; |
296 | } | 296 | } |
@@ -821,7 +821,7 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | |||
821 | } | 821 | } |
822 | 822 | ||
823 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | 823 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, |
824 | const u8 *addr) | 824 | const u8 *addr) |
825 | { | 825 | { |
826 | struct sta_info *sta = sta_info_get(hw_to_local(hw), addr); | 826 | struct sta_info *sta = sta_info_get(hw_to_local(hw), addr); |
827 | 827 | ||
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index f0e2d3ecb5c4..7bbb98e846a3 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -49,17 +49,19 @@ void ieee80211_wep_free(struct ieee80211_local *local) | |||
49 | crypto_free_blkcipher(local->wep_rx_tfm); | 49 | crypto_free_blkcipher(local->wep_rx_tfm); |
50 | } | 50 | } |
51 | 51 | ||
52 | static inline int ieee80211_wep_weak_iv(u32 iv, int keylen) | 52 | static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen) |
53 | { | 53 | { |
54 | /* Fluhrer, Mantin, and Shamir have reported weaknesses in the | 54 | /* |
55 | * Fluhrer, Mantin, and Shamir have reported weaknesses in the | ||
55 | * key scheduling algorithm of RC4. At least IVs (KeyByte + 3, | 56 | * key scheduling algorithm of RC4. At least IVs (KeyByte + 3, |
56 | * 0xff, N) can be used to speedup attacks, so avoid using them. */ | 57 | * 0xff, N) can be used to speedup attacks, so avoid using them. |
58 | */ | ||
57 | if ((iv & 0xff00) == 0xff00) { | 59 | if ((iv & 0xff00) == 0xff00) { |
58 | u8 B = (iv >> 16) & 0xff; | 60 | u8 B = (iv >> 16) & 0xff; |
59 | if (B >= 3 && B < 3 + keylen) | 61 | if (B >= 3 && B < 3 + keylen) |
60 | return 1; | 62 | return true; |
61 | } | 63 | } |
62 | return 0; | 64 | return false; |
63 | } | 65 | } |
64 | 66 | ||
65 | 67 | ||
@@ -268,7 +270,7 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb, | |||
268 | } | 270 | } |
269 | 271 | ||
270 | 272 | ||
271 | u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) | 273 | bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) |
272 | { | 274 | { |
273 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 275 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
274 | unsigned int hdrlen; | 276 | unsigned int hdrlen; |
@@ -276,16 +278,13 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) | |||
276 | u32 iv; | 278 | u32 iv; |
277 | 279 | ||
278 | if (!ieee80211_has_protected(hdr->frame_control)) | 280 | if (!ieee80211_has_protected(hdr->frame_control)) |
279 | return NULL; | 281 | return false; |
280 | 282 | ||
281 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 283 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
282 | ivpos = skb->data + hdrlen; | 284 | ivpos = skb->data + hdrlen; |
283 | iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2]; | 285 | iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2]; |
284 | 286 | ||
285 | if (ieee80211_wep_weak_iv(iv, key->conf.keylen)) | 287 | return ieee80211_wep_weak_iv(iv, key->conf.keylen); |
286 | return ivpos; | ||
287 | |||
288 | return NULL; | ||
289 | } | 288 | } |
290 | 289 | ||
291 | ieee80211_rx_result | 290 | ieee80211_rx_result |
@@ -329,6 +328,8 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
329 | ieee80211_tx_result | 328 | ieee80211_tx_result |
330 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) | 329 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) |
331 | { | 330 | { |
331 | int i; | ||
332 | |||
332 | ieee80211_tx_set_protected(tx); | 333 | ieee80211_tx_set_protected(tx); |
333 | 334 | ||
334 | if (wep_encrypt_skb(tx, tx->skb) < 0) { | 335 | if (wep_encrypt_skb(tx, tx->skb) < 0) { |
@@ -337,9 +338,8 @@ ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) | |||
337 | } | 338 | } |
338 | 339 | ||
339 | if (tx->extra_frag) { | 340 | if (tx->extra_frag) { |
340 | int i; | ||
341 | for (i = 0; i < tx->num_extra_frag; i++) { | 341 | for (i = 0; i < tx->num_extra_frag; i++) { |
342 | if (wep_encrypt_skb(tx, tx->extra_frag[i]) < 0) { | 342 | if (wep_encrypt_skb(tx, tx->extra_frag[i])) { |
343 | I802_DEBUG_INC(tx->local-> | 343 | I802_DEBUG_INC(tx->local-> |
344 | tx_handlers_drop_wep); | 344 | tx_handlers_drop_wep); |
345 | return TX_DROP; | 345 | return TX_DROP; |
diff --git a/net/mac80211/wep.h b/net/mac80211/wep.h index e587172115b8..d3f0db48314e 100644 --- a/net/mac80211/wep.h +++ b/net/mac80211/wep.h | |||
@@ -26,7 +26,7 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, struct sk_buff *skb, | |||
26 | struct ieee80211_key *key); | 26 | struct ieee80211_key *key); |
27 | int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb, | 27 | int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb, |
28 | struct ieee80211_key *key); | 28 | struct ieee80211_key *key); |
29 | u8 *ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); | 29 | bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); |
30 | 30 | ||
31 | ieee80211_rx_result | 31 | ieee80211_rx_result |
32 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx); | 32 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx); |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 3a20b036ef4c..7aa63caf8d50 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -49,8 +49,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) | |||
49 | !(tx->flags & IEEE80211_TX_FRAGMENTED) && | 49 | !(tx->flags & IEEE80211_TX_FRAGMENTED) && |
50 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) && | 50 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) && |
51 | !wpa_test) { | 51 | !wpa_test) { |
52 | /* hwaccel - with no need for preallocated room for Michael MIC | 52 | /* hwaccel - with no need for preallocated room for MMIC */ |
53 | */ | ||
54 | return TX_CONTINUE; | 53 | return TX_CONTINUE; |
55 | } | 54 | } |
56 | 55 | ||
@@ -67,8 +66,6 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) | |||
67 | #else | 66 | #else |
68 | authenticator = 1; | 67 | authenticator = 1; |
69 | #endif | 68 | #endif |
70 | /* At this point we know we're using ALG_TKIP. To get the MIC key | ||
71 | * we now will rely on the offset from the ieee80211_key_conf::key */ | ||
72 | key_offset = authenticator ? | 69 | key_offset = authenticator ? |
73 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY : | 70 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY : |
74 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; | 71 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; |
@@ -91,9 +88,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
91 | struct sk_buff *skb = rx->skb; | 88 | struct sk_buff *skb = rx->skb; |
92 | int authenticator = 1, wpa_test = 0; | 89 | int authenticator = 1, wpa_test = 0; |
93 | 90 | ||
94 | /* | 91 | /* No way to verify the MIC if the hardware stripped it */ |
95 | * No way to verify the MIC if the hardware stripped it | ||
96 | */ | ||
97 | if (rx->status->flag & RX_FLAG_MMIC_STRIPPED) | 92 | if (rx->status->flag & RX_FLAG_MMIC_STRIPPED) |
98 | return RX_CONTINUE; | 93 | return RX_CONTINUE; |
99 | 94 | ||
@@ -115,8 +110,6 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
115 | #else | 110 | #else |
116 | authenticator = 1; | 111 | authenticator = 1; |
117 | #endif | 112 | #endif |
118 | /* At this point we know we're using ALG_TKIP. To get the MIC key | ||
119 | * we now will rely on the offset from the ieee80211_key_conf::key */ | ||
120 | key_offset = authenticator ? | 113 | key_offset = authenticator ? |
121 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY : | 114 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY : |
122 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY; | 115 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY; |
@@ -201,6 +194,7 @@ ieee80211_tx_result | |||
201 | ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) | 194 | ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) |
202 | { | 195 | { |
203 | struct sk_buff *skb = tx->skb; | 196 | struct sk_buff *skb = tx->skb; |
197 | int i; | ||
204 | 198 | ||
205 | ieee80211_tx_set_protected(tx); | 199 | ieee80211_tx_set_protected(tx); |
206 | 200 | ||
@@ -208,9 +202,8 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) | |||
208 | return TX_DROP; | 202 | return TX_DROP; |
209 | 203 | ||
210 | if (tx->extra_frag) { | 204 | if (tx->extra_frag) { |
211 | int i; | ||
212 | for (i = 0; i < tx->num_extra_frag; i++) { | 205 | for (i = 0; i < tx->num_extra_frag; i++) { |
213 | if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0) | 206 | if (tkip_encrypt_skb(tx, tx->extra_frag[i])) |
214 | return TX_DROP; | 207 | return TX_DROP; |
215 | } | 208 | } |
216 | } | 209 | } |
@@ -348,7 +341,7 @@ static inline void ccmp_pn2hdr(u8 *hdr, u8 *pn, int key_id) | |||
348 | } | 341 | } |
349 | 342 | ||
350 | 343 | ||
351 | static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr) | 344 | static inline void ccmp_hdr2pn(u8 *pn, u8 *hdr) |
352 | { | 345 | { |
353 | pn[0] = hdr[7]; | 346 | pn[0] = hdr[7]; |
354 | pn[1] = hdr[6]; | 347 | pn[1] = hdr[6]; |
@@ -356,7 +349,6 @@ static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr) | |||
356 | pn[3] = hdr[4]; | 349 | pn[3] = hdr[4]; |
357 | pn[4] = hdr[1]; | 350 | pn[4] = hdr[1]; |
358 | pn[5] = hdr[0]; | 351 | pn[5] = hdr[0]; |
359 | return (hdr[3] >> 6) & 0x03; | ||
360 | } | 352 | } |
361 | 353 | ||
362 | 354 | ||
@@ -371,7 +363,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
371 | 363 | ||
372 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && | 364 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && |
373 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { | 365 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { |
374 | /* hwaccel - with no need for preallocated room for CCMP " | 366 | /* hwaccel - with no need for preallocated room for CCMP |
375 | * header or MIC fields */ | 367 | * header or MIC fields */ |
376 | info->control.hw_key = &tx->key->conf; | 368 | info->control.hw_key = &tx->key->conf; |
377 | return 0; | 369 | return 0; |
@@ -424,6 +416,7 @@ ieee80211_tx_result | |||
424 | ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) | 416 | ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) |
425 | { | 417 | { |
426 | struct sk_buff *skb = tx->skb; | 418 | struct sk_buff *skb = tx->skb; |
419 | int i; | ||
427 | 420 | ||
428 | ieee80211_tx_set_protected(tx); | 421 | ieee80211_tx_set_protected(tx); |
429 | 422 | ||
@@ -431,9 +424,8 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) | |||
431 | return TX_DROP; | 424 | return TX_DROP; |
432 | 425 | ||
433 | if (tx->extra_frag) { | 426 | if (tx->extra_frag) { |
434 | int i; | ||
435 | for (i = 0; i < tx->num_extra_frag; i++) { | 427 | for (i = 0; i < tx->num_extra_frag; i++) { |
436 | if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0) | 428 | if (ccmp_encrypt_skb(tx, tx->extra_frag[i])) |
437 | return TX_DROP; | 429 | return TX_DROP; |
438 | } | 430 | } |
439 | } | 431 | } |
@@ -465,7 +457,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
465 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) | 457 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) |
466 | return RX_CONTINUE; | 458 | return RX_CONTINUE; |
467 | 459 | ||
468 | (void) ccmp_hdr2pn(pn, skb->data + hdrlen); | 460 | ccmp_hdr2pn(pn, skb->data + hdrlen); |
469 | 461 | ||
470 | if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) { | 462 | if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) { |
471 | key->u.ccmp.replays++; | 463 | key->u.ccmp.replays++; |
@@ -480,9 +472,8 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
480 | key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf, | 472 | key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf, |
481 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, | 473 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, |
482 | skb->data + skb->len - CCMP_MIC_LEN, | 474 | skb->data + skb->len - CCMP_MIC_LEN, |
483 | skb->data + hdrlen + CCMP_HDR_LEN)) { | 475 | skb->data + hdrlen + CCMP_HDR_LEN)) |
484 | return RX_DROP_UNUSABLE; | 476 | return RX_DROP_UNUSABLE; |
485 | } | ||
486 | } | 477 | } |
487 | 478 | ||
488 | memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN); | 479 | memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN); |