aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-12-19 14:24:30 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-19 15:24:06 -0500
commit9cf7f247bd0cd21e475c71a4e018bb612ef02aab (patch)
tree12cb70971c349f1abfa81ea5d80e708c9e02ef4f /drivers/net/wireless
parentb929ecf7965c2dab7e373f390ac5fc563011484d (diff)
b43: Add key memory dumping
This adds an option to dump all crypto related memory to the kernel log. Obviously, it should not be enabled on productive systems. ;) Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/b43/debugfs.c1
-rw-r--r--drivers/net/wireless/b43/debugfs.h1
-rw-r--r--drivers/net/wireless/b43/main.c53
3 files changed, 53 insertions, 2 deletions
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index 06a01da80160..e04fc91f569e 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -731,6 +731,7 @@ static void b43_add_dynamic_debug(struct b43_wldev *dev)
731 add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0); 731 add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0);
732 add_dyn_dbg("debug_lo", B43_DBG_LO, 0); 732 add_dyn_dbg("debug_lo", B43_DBG_LO, 0);
733 add_dyn_dbg("debug_firmware", B43_DBG_FIRMWARE, 0); 733 add_dyn_dbg("debug_firmware", B43_DBG_FIRMWARE, 0);
734 add_dyn_dbg("debug_keys", B43_DBG_KEYS, 0);
734 735
735#undef add_dyn_dbg 736#undef add_dyn_dbg
736} 737}
diff --git a/drivers/net/wireless/b43/debugfs.h b/drivers/net/wireless/b43/debugfs.h
index 22ffd02ba554..7886cbe2d1d1 100644
--- a/drivers/net/wireless/b43/debugfs.h
+++ b/drivers/net/wireless/b43/debugfs.h
@@ -12,6 +12,7 @@ enum b43_dyndbg { /* Dynamic debugging features */
12 B43_DBG_PWORK_STOP, 12 B43_DBG_PWORK_STOP,
13 B43_DBG_LO, 13 B43_DBG_LO,
14 B43_DBG_FIRMWARE, 14 B43_DBG_FIRMWARE,
15 B43_DBG_KEYS,
15 __B43_NR_DYNDBG, 16 __B43_NR_DYNDBG,
16}; 17};
17 18
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 07dc9886d968..7b31a327b24a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -992,6 +992,52 @@ static void b43_clear_keys(struct b43_wldev *dev)
992 b43_key_clear(dev, i); 992 b43_key_clear(dev, i);
993} 993}
994 994
995static void b43_dump_keymemory(struct b43_wldev *dev)
996{
997 unsigned int i, index, offset;
998 DECLARE_MAC_BUF(macbuf);
999 u8 mac[ETH_ALEN];
1000 u16 algo;
1001 u32 rcmta0;
1002 u16 rcmta1;
1003 u64 hf;
1004 struct b43_key *key;
1005
1006 if (!b43_debug(dev, B43_DBG_KEYS))
1007 return;
1008
1009 hf = b43_hf_read(dev);
1010 b43dbg(dev->wl, "Hardware key memory dump: USEDEFKEYS=%u\n",
1011 !!(hf & B43_HF_USEDEFKEYS));
1012 for (index = 0; index < dev->max_nr_keys; index++) {
1013 key = &(dev->key[index]);
1014 printk(KERN_DEBUG "Key slot %02u: %s",
1015 index, (key->keyconf == NULL) ? " " : "*");
1016 offset = dev->ktp + (index * B43_SEC_KEYSIZE);
1017 for (i = 0; i < B43_SEC_KEYSIZE; i += 2) {
1018 u16 tmp = b43_shm_read16(dev, B43_SHM_SHARED, offset + i);
1019 printk("%02X%02X", (tmp & 0xFF), ((tmp >> 8) & 0xFF));
1020 }
1021
1022 algo = b43_shm_read16(dev, B43_SHM_SHARED,
1023 B43_SHM_SH_KEYIDXBLOCK + (index * 2));
1024 printk(" Algo: %04X/%02X", algo, key->algorithm);
1025
1026 if (index >= 4) {
1027 rcmta0 = b43_shm_read32(dev, B43_SHM_RCMTA,
1028 ((index - 4) * 2) + 0);
1029 rcmta1 = b43_shm_read16(dev, B43_SHM_RCMTA,
1030 ((index - 4) * 2) + 1);
1031 *((__le32 *)(&mac[0])) = cpu_to_le32(rcmta0);
1032 *((__le16 *)(&mac[4])) = cpu_to_le16(rcmta1);
1033 printk(" MAC: %s",
1034 print_mac(macbuf, mac));
1035 } else
1036 printk(" DEFAULT KEY");
1037 printk("\n");
1038 }
1039}
1040
995void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags) 1041void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
996{ 1042{
997 u32 macctl; 1043 u32 macctl;
@@ -3565,15 +3611,18 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3565 default: 3611 default:
3566 B43_WARN_ON(1); 3612 B43_WARN_ON(1);
3567 } 3613 }
3614
3568out_unlock: 3615out_unlock:
3569 spin_unlock_irqrestore(&wl->irq_lock, flags);
3570 mutex_unlock(&wl->mutex);
3571 if (!err) { 3616 if (!err) {
3572 b43dbg(wl, "%s hardware based encryption for keyidx: %d, " 3617 b43dbg(wl, "%s hardware based encryption for keyidx: %d, "
3573 "mac: %pM\n", 3618 "mac: %pM\n",
3574 cmd == SET_KEY ? "Using" : "Disabling", key->keyidx, 3619 cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
3575 addr); 3620 addr);
3621 b43_dump_keymemory(dev);
3576 } 3622 }
3623 spin_unlock_irqrestore(&wl->irq_lock, flags);
3624 mutex_unlock(&wl->mutex);
3625
3577 return err; 3626 return err;
3578} 3627}
3579 3628