diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /net/mac80211/tkip.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'net/mac80211/tkip.c')
-rw-r--r-- | net/mac80211/tkip.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index 57e14d59e12..f49d00a4c7f 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/bitops.h> | 10 | #include <linux/bitops.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
13 | #include <linux/export.h> | ||
14 | #include <asm/unaligned.h> | 13 | #include <asm/unaligned.h> |
15 | 14 | ||
16 | #include <net/mac80211.h> | 15 | #include <net/mac80211.h> |
@@ -260,6 +259,17 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
260 | keyid = pos[3]; | 259 | keyid = pos[3]; |
261 | iv32 = get_unaligned_le32(pos + 4); | 260 | iv32 = get_unaligned_le32(pos + 4); |
262 | pos += 8; | 261 | pos += 8; |
262 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
263 | { | ||
264 | int i; | ||
265 | printk(KERN_DEBUG "TKIP decrypt: data(len=%zd)", payload_len); | ||
266 | for (i = 0; i < payload_len; i++) | ||
267 | printk(" %02x", payload[i]); | ||
268 | printk("\n"); | ||
269 | printk(KERN_DEBUG "TKIP decrypt: iv16=%04x iv32=%08x\n", | ||
270 | iv16, iv32); | ||
271 | } | ||
272 | #endif | ||
263 | 273 | ||
264 | if (!(keyid & (1 << 5))) | 274 | if (!(keyid & (1 << 5))) |
265 | return TKIP_DECRYPT_NO_EXT_IV; | 275 | return TKIP_DECRYPT_NO_EXT_IV; |
@@ -270,8 +280,16 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
270 | if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT && | 280 | if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT && |
271 | (iv32 < key->u.tkip.rx[queue].iv32 || | 281 | (iv32 < key->u.tkip.rx[queue].iv32 || |
272 | (iv32 == key->u.tkip.rx[queue].iv32 && | 282 | (iv32 == key->u.tkip.rx[queue].iv32 && |
273 | iv16 <= key->u.tkip.rx[queue].iv16))) | 283 | iv16 <= key->u.tkip.rx[queue].iv16))) { |
284 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
285 | printk(KERN_DEBUG "TKIP replay detected for RX frame from " | ||
286 | "%pM (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", | ||
287 | ta, | ||
288 | iv32, iv16, key->u.tkip.rx[queue].iv32, | ||
289 | key->u.tkip.rx[queue].iv16); | ||
290 | #endif | ||
274 | return TKIP_DECRYPT_REPLAY; | 291 | return TKIP_DECRYPT_REPLAY; |
292 | } | ||
275 | 293 | ||
276 | if (only_iv) { | 294 | if (only_iv) { |
277 | res = TKIP_DECRYPT_OK; | 295 | res = TKIP_DECRYPT_OK; |
@@ -283,6 +301,22 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
283 | key->u.tkip.rx[queue].iv32 != iv32) { | 301 | key->u.tkip.rx[queue].iv32 != iv32) { |
284 | /* IV16 wrapped around - perform TKIP phase 1 */ | 302 | /* IV16 wrapped around - perform TKIP phase 1 */ |
285 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); | 303 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); |
304 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
305 | { | ||
306 | int i; | ||
307 | u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY; | ||
308 | printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%pM" | ||
309 | " TK=", ta); | ||
310 | for (i = 0; i < 16; i++) | ||
311 | printk("%02x ", | ||
312 | key->conf.key[key_offset + i]); | ||
313 | printk("\n"); | ||
314 | printk(KERN_DEBUG "TKIP decrypt: P1K="); | ||
315 | for (i = 0; i < 5; i++) | ||
316 | printk("%04x ", key->u.tkip.rx[queue].p1k[i]); | ||
317 | printk("\n"); | ||
318 | } | ||
319 | #endif | ||
286 | } | 320 | } |
287 | if (key->local->ops->update_tkip_key && | 321 | if (key->local->ops->update_tkip_key && |
288 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && | 322 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && |
@@ -298,6 +332,15 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, | |||
298 | } | 332 | } |
299 | 333 | ||
300 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); | 334 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); |
335 | #ifdef CONFIG_MAC80211_TKIP_DEBUG | ||
336 | { | ||
337 | int i; | ||
338 | printk(KERN_DEBUG "TKIP decrypt: Phase2 rc4key="); | ||
339 | for (i = 0; i < 16; i++) | ||
340 | printk("%02x ", rc4key[i]); | ||
341 | printk("\n"); | ||
342 | } | ||
343 | #endif | ||
301 | 344 | ||
302 | res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); | 345 | res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); |
303 | done: | 346 | done: |