Skip to contentSkip to conversation

RFC: ath: Fix WEP hardware encryption

PATCH Vasanthakumar Thiagarajan 1 participant 1 message Jan 24, 2011 3 messages not in the archive

lore
Share & tools
lore
#3 lore raw
In reply to a message not in the archive

Adding linux-wireless in CC

Quoted 74 lines · Bruno Randolf
Quoted 7 lines · On Saturday 22 January 2011 00:10:23 Vasanthakumar Thiagarajan wrote:
Quoted 3 lines · Bruno Randolf

I need this to enable HW encryption for WEP.
Otherwise we fall back to software decryption - i only checked the decryption case.

Encryption/Decryption is done in hw by default. In which case are you seeing it done in sw?.

Sorry i was not very verbose in my description yesterday.

I'm seeing the problem when i have an AP configured with WEP.

The reason is that the index returned by the "reserve_keycache_entry" function (sorry i dont have the code here right now) is >= 4 (hw_key_index) while the key index in the packet header is 0-3. This is ok for transmit but received packets are not decrypted and therefore mac80211 has to decrypt it in SW - this can be easily seen by adding some debug prints in mac80211/wep.c. I have noticed it by watching the system CPU load under high traffic.

bruno

Quoted 14 lines
Quoted 14 lines

Any comments?

bruno
---

 drivers/net/wireless/ath/key.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/net/wireless/ath/key.c index 5d465e5..5748dae 100644

drivers/net/wireless/ath/key.c +0 -0
@@ -465,6 +465,16 @@ int ath_key_config(struct ath_common *common,
 
Quoted 7 lines

drivers/net/wireless/ath/key.c int ath_key_config(struct ath_common *common, · line 472

Quoted 7 lines
drivers/net/wireless/ath/key.c +4 -0
 	hk.kv_len = key->keylen;
 	memcpy(hk.kv_val, key->key, key->keylen);
 
+	/* set WEP keys directly to index */
+	if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
+	     key->cipher == WLAN_CIPHER_SUITE_WEP104) && key->keyidx < 4) {
+		ret = ath_hw_set_keycache_entry(common, key->keyidx, &hk, 

NULL);

Quoted 30 lines
Quoted 30 lines
drivers/net/wireless/ath/key.c +6 -0
+		if (!ret)
+			return -EIO;
+		set_bit(key->keyidx, common->keymap);
+		return key->keyidx;
+	}
+
 
 	if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
drivers/net/wireless/ath/key.c +1 -3
 		switch (vif->type) {
 
 		case NL80211_IFTYPE_AP:
@@ -541,10 +551,8 @@ EXPORT_SYMBOL(ath_key_config);
 
 void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf
 *key) {
 
 	ath_hw_keyreset(common, key->hw_key_idx);
 
-	if (key->hw_key_idx < IEEE80211_WEP_NKID)
-		return;
-
 
 	clear_bit(key->hw_key_idx, common->keymap);
 
+
 
 	if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
 
 		return;