diff options
Diffstat (limited to 'net/mac80211/tkip.c')
-rw-r--r-- | net/mac80211/tkip.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index 8cdf053cb835..d74c91e23a7f 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -138,7 +138,7 @@ u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key, | |||
138 | *pos++ = iv1; | 138 | *pos++ = iv1; |
139 | *pos++ = iv2; | 139 | *pos++ = iv2; |
140 | *pos++ = (key->conf.keyidx << 6) | (1 << 5) /* Ext IV */; | 140 | *pos++ = (key->conf.keyidx << 6) | (1 << 5) /* Ext IV */; |
141 | put_unaligned_le32(key->u.tkip.iv32, pos); | 141 | put_unaligned_le32(key->u.tkip.tx.iv32, pos); |
142 | return pos + 4; | 142 | return pos + 4; |
143 | } | 143 | } |
144 | 144 | ||
@@ -146,16 +146,16 @@ static void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta, | |||
146 | u8 *rc4key) | 146 | u8 *rc4key) |
147 | { | 147 | { |
148 | /* Calculate per-packet key */ | 148 | /* Calculate per-packet key */ |
149 | if (key->u.tkip.iv16 == 0 || !key->u.tkip.tx_initialized) { | 149 | if (key->u.tkip.tx.iv16 == 0 || !key->u.tkip.tx.initialized) { |
150 | /* IV16 wrapped around - perform TKIP phase 1 */ | 150 | /* IV16 wrapped around - perform TKIP phase 1 */ |
151 | tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], | 151 | tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], |
152 | key->u.tkip.iv32, key->u.tkip.p1k); | 152 | key->u.tkip.tx.iv32, key->u.tkip.tx.p1k); |
153 | key->u.tkip.tx_initialized = 1; | 153 | key->u.tkip.tx.initialized = 1; |
154 | } | 154 | } |
155 | 155 | ||
156 | tkip_mixing_phase2(key->u.tkip.p1k, | 156 | tkip_mixing_phase2(key->u.tkip.tx.p1k, |
157 | &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], | 157 | &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], |
158 | key->u.tkip.iv16, rc4key); | 158 | key->u.tkip.tx.iv16, rc4key); |
159 | } | 159 | } |
160 | 160 | ||
161 | void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | 161 | void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, |
@@ -179,9 +179,9 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | |||
179 | printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n", | 179 | printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n", |
180 | iv16, iv32); | 180 | iv16, iv32); |
181 | 181 | ||
182 | if (iv32 != key->u.tkip.iv32) { | 182 | if (iv32 != key->u.tkip.tx.iv32) { |
183 | printk(KERN_DEBUG "skb: iv32 = 0x%08x key: iv32 = 0x%08x\n", | 183 | printk(KERN_DEBUG "skb: iv32 = 0x%08x key: iv32 = 0x%08x\n", |
184 | iv32, key->u.tkip.iv32); | 184 | iv32, key->u.tkip.tx.iv32); |
185 | printk(KERN_DEBUG "Wrap around of iv16 in the middle of a " | 185 | printk(KERN_DEBUG "Wrap around of iv16 in the middle of a " |
186 | "fragmented packet\n"); | 186 | "fragmented packet\n"); |
187 | } | 187 | } |
@@ -190,19 +190,19 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | |||
190 | /* Update the p1k only when the iv16 in the packet wraps around, this | 190 | /* Update the p1k only when the iv16 in the packet wraps around, this |
191 | * might occur after the wrap around of iv16 in the key in case of | 191 | * might occur after the wrap around of iv16 in the key in case of |
192 | * fragmented packets. */ | 192 | * fragmented packets. */ |
193 | if (iv16 == 0 || !key->u.tkip.tx_initialized) { | 193 | if (iv16 == 0 || !key->u.tkip.tx.initialized) { |
194 | /* IV16 wrapped around - perform TKIP phase 1 */ | 194 | /* IV16 wrapped around - perform TKIP phase 1 */ |
195 | tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], | 195 | tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], |
196 | iv32, key->u.tkip.p1k); | 196 | iv32, key->u.tkip.tx.p1k); |
197 | key->u.tkip.tx_initialized = 1; | 197 | key->u.tkip.tx.initialized = 1; |
198 | } | 198 | } |
199 | 199 | ||
200 | if (type == IEEE80211_TKIP_P1_KEY) { | 200 | if (type == IEEE80211_TKIP_P1_KEY) { |
201 | memcpy(outkey, key->u.tkip.p1k, sizeof(u16) * 5); | 201 | memcpy(outkey, key->u.tkip.tx.p1k, sizeof(u16) * 5); |
202 | return; | 202 | return; |
203 | } | 203 | } |
204 | 204 | ||
205 | tkip_mixing_phase2(key->u.tkip.p1k, | 205 | tkip_mixing_phase2(key->u.tkip.tx.p1k, |
206 | &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], iv16, outkey); | 206 | &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], iv16, outkey); |
207 | } | 207 | } |
208 | EXPORT_SYMBOL(ieee80211_get_tkip_key); | 208 | EXPORT_SYMBOL(ieee80211_get_tkip_key); |
@@ -263,33 +263,33 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
263 | if ((keyid >> 6) != key->conf.keyidx) | 263 | if ((keyid >> 6) != key->conf.keyidx) |
264 | return TKIP_DECRYPT_INVALID_KEYIDX; | 264 | return TKIP_DECRYPT_INVALID_KEYIDX; |
265 | 265 | ||
266 | if (key->u.tkip.rx_initialized[queue] && | 266 | if (key->u.tkip.rx[queue].initialized && |
267 | (iv32 < key->u.tkip.iv32_rx[queue] || | 267 | (iv32 < key->u.tkip.rx[queue].iv32 || |
268 | (iv32 == key->u.tkip.iv32_rx[queue] && | 268 | (iv32 == key->u.tkip.rx[queue].iv32 && |
269 | iv16 <= key->u.tkip.iv16_rx[queue]))) { | 269 | iv16 <= key->u.tkip.rx[queue].iv16))) { |
270 | #ifdef CONFIG_TKIP_DEBUG | 270 | #ifdef CONFIG_TKIP_DEBUG |
271 | DECLARE_MAC_BUF(mac); | 271 | DECLARE_MAC_BUF(mac); |
272 | printk(KERN_DEBUG "TKIP replay detected for RX frame from " | 272 | printk(KERN_DEBUG "TKIP replay detected for RX frame from " |
273 | "%s (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", | 273 | "%s (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", |
274 | print_mac(mac, ta), | 274 | print_mac(mac, ta), |
275 | iv32, iv16, key->u.tkip.iv32_rx[queue], | 275 | iv32, iv16, key->u.tkip.rx[queue].iv32, |
276 | key->u.tkip.iv16_rx[queue]); | 276 | key->u.tkip.rx[queue].iv16); |
277 | #endif /* CONFIG_TKIP_DEBUG */ | 277 | #endif /* CONFIG_TKIP_DEBUG */ |
278 | return TKIP_DECRYPT_REPLAY; | 278 | return TKIP_DECRYPT_REPLAY; |
279 | } | 279 | } |
280 | 280 | ||
281 | if (only_iv) { | 281 | if (only_iv) { |
282 | res = TKIP_DECRYPT_OK; | 282 | res = TKIP_DECRYPT_OK; |
283 | key->u.tkip.rx_initialized[queue] = 1; | 283 | key->u.tkip.rx[queue].initialized = 1; |
284 | goto done; | 284 | goto done; |
285 | } | 285 | } |
286 | 286 | ||
287 | if (!key->u.tkip.rx_initialized[queue] || | 287 | if (!key->u.tkip.rx[queue].initialized || |
288 | key->u.tkip.iv32_rx[queue] != iv32) { | 288 | key->u.tkip.rx[queue].iv32 != iv32) { |
289 | key->u.tkip.rx_initialized[queue] = 1; | 289 | key->u.tkip.rx[queue].initialized = 1; |
290 | /* IV16 wrapped around - perform TKIP phase 1 */ | 290 | /* IV16 wrapped around - perform TKIP phase 1 */ |
291 | tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], | 291 | tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], |
292 | iv32, key->u.tkip.p1k_rx[queue]); | 292 | iv32, key->u.tkip.rx[queue].p1k); |
293 | #ifdef CONFIG_TKIP_DEBUG | 293 | #ifdef CONFIG_TKIP_DEBUG |
294 | { | 294 | { |
295 | int i; | 295 | int i; |
@@ -303,7 +303,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
303 | printk("\n"); | 303 | printk("\n"); |
304 | printk(KERN_DEBUG "TKIP decrypt: P1K="); | 304 | printk(KERN_DEBUG "TKIP decrypt: P1K="); |
305 | for (i = 0; i < 5; i++) | 305 | for (i = 0; i < 5; i++) |
306 | printk("%04x ", key->u.tkip.p1k_rx[queue][i]); | 306 | printk("%04x ", key->u.tkip.rx[queue].p1k[i]); |
307 | printk("\n"); | 307 | printk("\n"); |
308 | } | 308 | } |
309 | #endif /* CONFIG_TKIP_DEBUG */ | 309 | #endif /* CONFIG_TKIP_DEBUG */ |
@@ -318,11 +318,11 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
318 | 318 | ||
319 | key->local->ops->update_tkip_key( | 319 | key->local->ops->update_tkip_key( |
320 | local_to_hw(key->local), &key->conf, | 320 | local_to_hw(key->local), &key->conf, |
321 | sta_addr, iv32, key->u.tkip.p1k_rx[queue]); | 321 | sta_addr, iv32, key->u.tkip.rx[queue].p1k); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | tkip_mixing_phase2(key->u.tkip.p1k_rx[queue], | 325 | tkip_mixing_phase2(key->u.tkip.rx[queue].p1k, |
326 | &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], | 326 | &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], |
327 | iv16, rc4key); | 327 | iv16, rc4key); |
328 | #ifdef CONFIG_TKIP_DEBUG | 328 | #ifdef CONFIG_TKIP_DEBUG |