diff options
Diffstat (limited to 'net/mac80211/tkip.c')
-rw-r--r-- | net/mac80211/tkip.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index e710243d82e2..995f7af3d25e 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -164,10 +164,10 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | |||
164 | iv16 = data[2] | (data[0] << 8); | 164 | iv16 = data[2] | (data[0] << 8); |
165 | iv32 = get_unaligned_le32(&data[4]); | 165 | iv32 = get_unaligned_le32(&data[4]); |
166 | 166 | ||
167 | tk = &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY]; | 167 | tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; |
168 | ctx = &key->u.tkip.tx; | 168 | ctx = &key->u.tkip.tx; |
169 | 169 | ||
170 | #ifdef CONFIG_TKIP_DEBUG | 170 | #ifdef CONFIG_MAC80211_TKIP_DEBUG |
171 | printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n", | 171 | printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n", |
172 | iv16, iv32); | 172 | iv16, iv32); |
173 | 173 | ||
@@ -177,7 +177,7 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | |||
177 | printk(KERN_DEBUG "Wrap around of iv16 in the middle of a " | 177 | printk(KERN_DEBUG "Wrap around of iv16 in the middle of a " |
178 | "fragmented packet\n"); | 178 | "fragmented packet\n"); |
179 | } | 179 | } |
180 | #endif /* CONFIG_TKIP_DEBUG */ | 180 | #endif |
181 | 181 | ||
182 | /* Update the p1k only when the iv16 in the packet wraps around, this | 182 | /* Update the p1k only when the iv16 in the packet wraps around, this |
183 | * might occur after the wrap around of iv16 in the key in case of | 183 | * might occur after the wrap around of iv16 in the key in case of |
@@ -205,7 +205,7 @@ void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm, | |||
205 | { | 205 | { |
206 | u8 rc4key[16]; | 206 | u8 rc4key[16]; |
207 | struct tkip_ctx *ctx = &key->u.tkip.tx; | 207 | struct tkip_ctx *ctx = &key->u.tkip.tx; |
208 | const u8 *tk = &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY]; | 208 | const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; |
209 | 209 | ||
210 | /* Calculate per-packet key */ | 210 | /* Calculate per-packet key */ |
211 | if (ctx->iv16 == 0 || !ctx->initialized) | 211 | if (ctx->iv16 == 0 || !ctx->initialized) |
@@ -231,7 +231,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
231 | u32 iv16; | 231 | u32 iv16; |
232 | u8 rc4key[16], keyid, *pos = payload; | 232 | u8 rc4key[16], keyid, *pos = payload; |
233 | int res; | 233 | int res; |
234 | const u8 *tk = &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY]; | 234 | const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; |
235 | 235 | ||
236 | if (payload_len < 12) | 236 | if (payload_len < 12) |
237 | return -1; | 237 | return -1; |
@@ -240,7 +240,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
240 | keyid = pos[3]; | 240 | keyid = pos[3]; |
241 | iv32 = get_unaligned_le32(pos + 4); | 241 | iv32 = get_unaligned_le32(pos + 4); |
242 | pos += 8; | 242 | pos += 8; |
243 | #ifdef CONFIG_TKIP_DEBUG | 243 | #ifdef CONFIG_MAC80211_TKIP_DEBUG |
244 | { | 244 | { |
245 | int i; | 245 | int i; |
246 | printk(KERN_DEBUG "TKIP decrypt: data(len=%zd)", payload_len); | 246 | printk(KERN_DEBUG "TKIP decrypt: data(len=%zd)", payload_len); |
@@ -250,7 +250,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
250 | printk(KERN_DEBUG "TKIP decrypt: iv16=%04x iv32=%08x\n", | 250 | printk(KERN_DEBUG "TKIP decrypt: iv16=%04x iv32=%08x\n", |
251 | iv16, iv32); | 251 | iv16, iv32); |
252 | } | 252 | } |
253 | #endif /* CONFIG_TKIP_DEBUG */ | 253 | #endif |
254 | 254 | ||
255 | if (!(keyid & (1 << 5))) | 255 | if (!(keyid & (1 << 5))) |
256 | return TKIP_DECRYPT_NO_EXT_IV; | 256 | return TKIP_DECRYPT_NO_EXT_IV; |
@@ -262,14 +262,14 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
262 | (iv32 < key->u.tkip.rx[queue].iv32 || | 262 | (iv32 < key->u.tkip.rx[queue].iv32 || |
263 | (iv32 == key->u.tkip.rx[queue].iv32 && | 263 | (iv32 == key->u.tkip.rx[queue].iv32 && |
264 | iv16 <= key->u.tkip.rx[queue].iv16))) { | 264 | iv16 <= key->u.tkip.rx[queue].iv16))) { |
265 | #ifdef CONFIG_TKIP_DEBUG | 265 | #ifdef CONFIG_MAC80211_TKIP_DEBUG |
266 | DECLARE_MAC_BUF(mac); | 266 | DECLARE_MAC_BUF(mac); |
267 | printk(KERN_DEBUG "TKIP replay detected for RX frame from " | 267 | printk(KERN_DEBUG "TKIP replay detected for RX frame from " |
268 | "%s (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", | 268 | "%s (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", |
269 | print_mac(mac, ta), | 269 | print_mac(mac, ta), |
270 | iv32, iv16, key->u.tkip.rx[queue].iv32, | 270 | iv32, iv16, key->u.tkip.rx[queue].iv32, |
271 | key->u.tkip.rx[queue].iv16); | 271 | key->u.tkip.rx[queue].iv16); |
272 | #endif /* CONFIG_TKIP_DEBUG */ | 272 | #endif |
273 | return TKIP_DECRYPT_REPLAY; | 273 | return TKIP_DECRYPT_REPLAY; |
274 | } | 274 | } |
275 | 275 | ||
@@ -283,23 +283,23 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
283 | key->u.tkip.rx[queue].iv32 != iv32) { | 283 | key->u.tkip.rx[queue].iv32 != iv32) { |
284 | /* IV16 wrapped around - perform TKIP phase 1 */ | 284 | /* IV16 wrapped around - perform TKIP phase 1 */ |
285 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); | 285 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); |
286 | #ifdef CONFIG_TKIP_DEBUG | 286 | #ifdef CONFIG_MAC80211_TKIP_DEBUG |
287 | { | 287 | { |
288 | int i; | 288 | int i; |
289 | u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY; | ||
289 | DECLARE_MAC_BUF(mac); | 290 | DECLARE_MAC_BUF(mac); |
290 | printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%s" | 291 | printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%s" |
291 | " TK=", print_mac(mac, ta)); | 292 | " TK=", print_mac(mac, ta)); |
292 | for (i = 0; i < 16; i++) | 293 | for (i = 0; i < 16; i++) |
293 | printk("%02x ", | 294 | printk("%02x ", |
294 | key->conf.key[ | 295 | key->conf.key[key_offset + i]); |
295 | ALG_TKIP_TEMP_ENCR_KEY + i]); | ||
296 | printk("\n"); | 296 | printk("\n"); |
297 | printk(KERN_DEBUG "TKIP decrypt: P1K="); | 297 | printk(KERN_DEBUG "TKIP decrypt: P1K="); |
298 | for (i = 0; i < 5; i++) | 298 | for (i = 0; i < 5; i++) |
299 | printk("%04x ", key->u.tkip.rx[queue].p1k[i]); | 299 | printk("%04x ", key->u.tkip.rx[queue].p1k[i]); |
300 | printk("\n"); | 300 | printk("\n"); |
301 | } | 301 | } |
302 | #endif /* CONFIG_TKIP_DEBUG */ | 302 | #endif |
303 | if (key->local->ops->update_tkip_key && | 303 | if (key->local->ops->update_tkip_key && |
304 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { | 304 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { |
305 | u8 bcast[ETH_ALEN] = | 305 | u8 bcast[ETH_ALEN] = |
@@ -316,7 +316,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
316 | } | 316 | } |
317 | 317 | ||
318 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); | 318 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); |
319 | #ifdef CONFIG_TKIP_DEBUG | 319 | #ifdef CONFIG_MAC80211_TKIP_DEBUG |
320 | { | 320 | { |
321 | int i; | 321 | int i; |
322 | printk(KERN_DEBUG "TKIP decrypt: Phase2 rc4key="); | 322 | printk(KERN_DEBUG "TKIP decrypt: Phase2 rc4key="); |
@@ -324,7 +324,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
324 | printk("%02x ", rc4key[i]); | 324 | printk("%02x ", rc4key[i]); |
325 | printk("\n"); | 325 | printk("\n"); |
326 | } | 326 | } |
327 | #endif /* CONFIG_TKIP_DEBUG */ | 327 | #endif |
328 | 328 | ||
329 | res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); | 329 | res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); |
330 | done: | 330 | done: |