aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_crypt_tkip.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2007-10-03 20:59:30 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:42 -0400
commit0795af5729b18218767fab27c44b1384f72dc9ad (patch)
tree67c16df84aa6ec219340b8ea1b5cfb0e8150a216 /net/ieee80211/ieee80211_crypt_tkip.c
parent95ea36275f3c9a1d3d04c217b4b576c657c4e70e (diff)
[NET]: Introduce and use print_mac() and DECLARE_MAC_BUF()
This is nicer than the MAC_FMT stuff. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee80211/ieee80211_crypt_tkip.c')
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index 5a48d8e0aec1..6cc54eeca3ed 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -359,14 +359,15 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
359 u8 rc4key[16], *pos, *icv; 359 u8 rc4key[16], *pos, *icv;
360 u32 crc; 360 u32 crc;
361 struct scatterlist sg; 361 struct scatterlist sg;
362 DECLARE_MAC_BUF(mac);
362 363
363 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { 364 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
364 if (net_ratelimit()) { 365 if (net_ratelimit()) {
365 struct ieee80211_hdr_4addr *hdr = 366 struct ieee80211_hdr_4addr *hdr =
366 (struct ieee80211_hdr_4addr *)skb->data; 367 (struct ieee80211_hdr_4addr *)skb->data;
367 printk(KERN_DEBUG ": TKIP countermeasures: dropped " 368 printk(KERN_DEBUG ": TKIP countermeasures: dropped "
368 "TX packet to " MAC_FMT "\n", 369 "TX packet to %s\n",
369 MAC_ARG(hdr->addr1)); 370 print_mac(mac, hdr->addr1));
370 } 371 }
371 return -1; 372 return -1;
372 } 373 }
@@ -421,14 +422,15 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
421 u32 crc; 422 u32 crc;
422 struct scatterlist sg; 423 struct scatterlist sg;
423 int plen; 424 int plen;
425 DECLARE_MAC_BUF(mac);
424 426
425 hdr = (struct ieee80211_hdr_4addr *)skb->data; 427 hdr = (struct ieee80211_hdr_4addr *)skb->data;
426 428
427 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { 429 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
428 if (net_ratelimit()) { 430 if (net_ratelimit()) {
429 printk(KERN_DEBUG ": TKIP countermeasures: dropped " 431 printk(KERN_DEBUG ": TKIP countermeasures: dropped "
430 "received packet from " MAC_FMT "\n", 432 "received packet from %s\n",
431 MAC_ARG(hdr->addr2)); 433 print_mac(mac, hdr->addr2));
432 } 434 }
433 return -1; 435 return -1;
434 } 436 }
@@ -441,7 +443,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
441 if (!(keyidx & (1 << 5))) { 443 if (!(keyidx & (1 << 5))) {
442 if (net_ratelimit()) { 444 if (net_ratelimit()) {
443 printk(KERN_DEBUG "TKIP: received packet without ExtIV" 445 printk(KERN_DEBUG "TKIP: received packet without ExtIV"
444 " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2)); 446 " flag from %s\n", print_mac(mac, hdr->addr2));
445 } 447 }
446 return -2; 448 return -2;
447 } 449 }
@@ -453,9 +455,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
453 } 455 }
454 if (!tkey->key_set) { 456 if (!tkey->key_set) {
455 if (net_ratelimit()) { 457 if (net_ratelimit()) {
456 printk(KERN_DEBUG "TKIP: received packet from " MAC_FMT 458 printk(KERN_DEBUG "TKIP: received packet from %s"
457 " with keyid=%d that does not have a configured" 459 " with keyid=%d that does not have a configured"
458 " key\n", MAC_ARG(hdr->addr2), keyidx); 460 " key\n", print_mac(mac, hdr->addr2), keyidx);
459 } 461 }
460 return -3; 462 return -3;
461 } 463 }
@@ -465,9 +467,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
465 467
466 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { 468 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) {
467 if (net_ratelimit()) { 469 if (net_ratelimit()) {
468 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=" MAC_FMT 470 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s"
469 " previous TSC %08x%04x received TSC " 471 " previous TSC %08x%04x received TSC "
470 "%08x%04x\n", MAC_ARG(hdr->addr2), 472 "%08x%04x\n", print_mac(mac, hdr->addr2),
471 tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); 473 tkey->rx_iv32, tkey->rx_iv16, iv32, iv16);
472 } 474 }
473 tkey->dot11RSNAStatsTKIPReplays++; 475 tkey->dot11RSNAStatsTKIPReplays++;
@@ -489,8 +491,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
489 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { 491 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
490 if (net_ratelimit()) { 492 if (net_ratelimit()) {
491 printk(KERN_DEBUG ": TKIP: failed to decrypt " 493 printk(KERN_DEBUG ": TKIP: failed to decrypt "
492 "received packet from " MAC_FMT "\n", 494 "received packet from %s\n",
493 MAC_ARG(hdr->addr2)); 495 print_mac(mac, hdr->addr2));
494 } 496 }
495 return -7; 497 return -7;
496 } 498 }
@@ -508,7 +510,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
508 } 510 }
509 if (net_ratelimit()) { 511 if (net_ratelimit()) {
510 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA=" 512 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA="
511 MAC_FMT "\n", MAC_ARG(hdr->addr2)); 513 "%s\n", print_mac(mac, hdr->addr2));
512 } 514 }
513 tkey->dot11RSNAStatsTKIPICVErrors++; 515 tkey->dot11RSNAStatsTKIPICVErrors++;
514 return -5; 516 return -5;
@@ -639,6 +641,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
639{ 641{
640 struct ieee80211_tkip_data *tkey = priv; 642 struct ieee80211_tkip_data *tkey = priv;
641 u8 mic[8]; 643 u8 mic[8];
644 DECLARE_MAC_BUF(mac);
642 645
643 if (!tkey->key_set) 646 if (!tkey->key_set)
644 return -1; 647 return -1;
@@ -651,8 +654,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
651 struct ieee80211_hdr_4addr *hdr; 654 struct ieee80211_hdr_4addr *hdr;
652 hdr = (struct ieee80211_hdr_4addr *)skb->data; 655 hdr = (struct ieee80211_hdr_4addr *)skb->data;
653 printk(KERN_DEBUG "%s: Michael MIC verification failed for " 656 printk(KERN_DEBUG "%s: Michael MIC verification failed for "
654 "MSDU from " MAC_FMT " keyidx=%d\n", 657 "MSDU from %s keyidx=%d\n",
655 skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), 658 skb->dev ? skb->dev->name : "N/A", print_mac(mac, hdr->addr2),
656 keyidx); 659 keyidx);
657 if (skb->dev) 660 if (skb->dev)
658 ieee80211_michael_mic_failure(skb->dev, hdr, keyidx); 661 ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);