linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: Remove unused key xoring
@ 2009-03-02 13:07 Jouni Malinen
  2009-03-02 15:20 ` Bob Copeland
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jouni Malinen @ 2009-03-02 13:07 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

This is not used anywhere in ath9k and is just making the code more
confusing.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

---
 drivers/net/wireless/ath9k/hw.c   |   15 ++++++---------
 drivers/net/wireless/ath9k/hw.h   |    2 +-
 drivers/net/wireless/ath9k/main.c |    2 +-
 drivers/net/wireless/ath9k/phy.h  |    2 --
 4 files changed, 8 insertions(+), 13 deletions(-)

--- wireless-testing.orig/drivers/net/wireless/ath9k/hw.c	2009-03-02 14:23:07.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/hw.c	2009-03-02 14:23:09.000000000 +0200
@@ -2415,14 +2415,11 @@ bool ath9k_hw_keysetmac(struct ath_hw *a
 
 bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
 				 const struct ath9k_keyval *k,
-				 const u8 *mac, int xorKey)
+				 const u8 *mac)
 {
 	const struct ath9k_hw_capabilities *pCap = &ah->caps;
 	u32 key0, key1, key2, key3, key4;
 	u32 keyType;
-	u32 xorMask = xorKey ?
-		(ATH9K_KEY_XOR << 24 | ATH9K_KEY_XOR << 16 | ATH9K_KEY_XOR << 8
-		 | ATH9K_KEY_XOR) : 0;
 
 	if (entry >= pCap->keycache_size) {
 		DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
@@ -2474,11 +2471,11 @@ bool ath9k_hw_set_keycache_entry(struct 
 		return false;
 	}
 
-	key0 = get_unaligned_le32(k->kv_val + 0) ^ xorMask;
-	key1 = (get_unaligned_le16(k->kv_val + 4) ^ xorMask) & 0xffff;
-	key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask;
-	key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff;
-	key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask;
+	key0 = get_unaligned_le32(k->kv_val + 0);
+	key1 = get_unaligned_le16(k->kv_val + 4);
+	key2 = get_unaligned_le32(k->kv_val + 6);
+	key3 = get_unaligned_le16(k->kv_val + 10) & 0xffff;
+	key4 = get_unaligned_le32(k->kv_val + 12);
 	if (k->kv_len <= LEN_WEP104)
 		key4 &= 0xff;
 
--- wireless-testing.orig/drivers/net/wireless/ath9k/hw.h	2009-03-02 14:23:03.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/hw.h	2009-03-02 14:23:09.000000000 +0200
@@ -584,7 +584,7 @@ bool ath9k_hw_keyreset(struct ath_hw *ah
 bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac);
 bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
 				 const struct ath9k_keyval *k,
-				 const u8 *mac, int xorKey);
+				 const u8 *mac);
 bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry);
 
 /* GPIO / RFKILL / Antennae */
--- wireless-testing.orig/drivers/net/wireless/ath9k/main.c	2009-03-02 14:23:03.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/main.c	2009-03-02 14:23:09.000000000 +0200
@@ -642,7 +642,7 @@ static int ath_keyset(struct ath_softc *
 	bool status;
 
 	status = ath9k_hw_set_keycache_entry(sc->sc_ah,
-		keyix, hk, mac, false);
+		keyix, hk, mac);
 
 	return status != false;
 }
--- wireless-testing.orig/drivers/net/wireless/ath9k/phy.h	2009-03-02 14:23:03.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/phy.h	2009-03-02 14:23:09.000000000 +0200
@@ -559,8 +559,6 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,
 		}							\
 	} while (0)
 
-#define ATH9K_KEY_XOR                 0xaa
-
 #define ATH9K_IS_MIC_ENABLED(ah)					\
 	((ah)->sta_id1_defaults & AR_STA_ID1_CRPT_MIC_ENABLE)
 

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath9k: Remove unused key xoring
  2009-03-02 13:07 [PATCH] ath9k: Remove unused key xoring Jouni Malinen
@ 2009-03-02 15:20 ` Bob Copeland
  2009-03-02 15:58   ` Jouni Malinen
  2009-03-02 16:15 ` [PATCH v2] " Jouni Malinen
  2009-03-03  0:57 ` [PATCH] " Harvey Harrison
  2 siblings, 1 reply; 5+ messages in thread
From: Bob Copeland @ 2009-03-02 15:20 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

> - =A0 =A0 =A0 key0 =3D get_unaligned_le32(k->kv_val + 0) ^ xorMask;
> - =A0 =A0 =A0 key1 =3D (get_unaligned_le16(k->kv_val + 4) ^ xorMask) =
& 0xffff;
> - =A0 =A0 =A0 key2 =3D get_unaligned_le32(k->kv_val + 6) ^ xorMask;
> - =A0 =A0 =A0 key3 =3D (get_unaligned_le16(k->kv_val + 10) ^ xorMask)=
 & 0xffff;
> - =A0 =A0 =A0 key4 =3D get_unaligned_le32(k->kv_val + 12) ^ xorMask;
> + =A0 =A0 =A0 key0 =3D get_unaligned_le32(k->kv_val + 0);
> + =A0 =A0 =A0 key1 =3D get_unaligned_le16(k->kv_val + 4);
> + =A0 =A0 =A0 key2 =3D get_unaligned_le32(k->kv_val + 6);
> + =A0 =A0 =A0 key3 =3D get_unaligned_le16(k->kv_val + 10) & 0xffff;
> + =A0 =A0 =A0 key4 =3D get_unaligned_le32(k->kv_val + 12);

key1 lost the mask but key3 kept it?

--=20
Bob Copeland %% www.bobcopeland.com
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath9k: Remove unused key xoring
  2009-03-02 15:20 ` Bob Copeland
@ 2009-03-02 15:58   ` Jouni Malinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jouni Malinen @ 2009-03-02 15:58 UTC (permalink / raw)
  To: Bob Copeland; +Cc: Jouni Malinen, John W. Linville, linux-wireless

On Mon, Mar 02, 2009 at 10:20:07AM -0500, Bob Copeland wrote:
> > - =C2=A0 =C2=A0 =C2=A0 key1 =3D (get_unaligned_le16(k->kv_val + 4) =
^ xorMask) & 0xffff;
> > - =C2=A0 =C2=A0 =C2=A0 key3 =3D (get_unaligned_le16(k->kv_val + 10)=
 ^ xorMask) & 0xffff;

> > + =C2=A0 =C2=A0 =C2=A0 key1 =3D get_unaligned_le16(k->kv_val + 4);
> > + =C2=A0 =C2=A0 =C2=A0 key3 =3D get_unaligned_le16(k->kv_val + 10) =
& 0xffff;

> key1 lost the mask but key3 kept it?

Heh.. Interesting editing bug that probably happened when I cleaned up
some of my pending patches. I don't think the '& 0xffff' part is really
needed here in either case.
=20
--=20
Jouni Malinen                                            PGP id EFC895F=
A
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] ath9k: Remove unused key xoring
  2009-03-02 13:07 [PATCH] ath9k: Remove unused key xoring Jouni Malinen
  2009-03-02 15:20 ` Bob Copeland
@ 2009-03-02 16:15 ` Jouni Malinen
  2009-03-03  0:57 ` [PATCH] " Harvey Harrison
  2 siblings, 0 replies; 5+ messages in thread
From: Jouni Malinen @ 2009-03-02 16:15 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

This is not used anywhere in ath9k and is just making the code more
confusing.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

---
 drivers/net/wireless/ath9k/hw.c   |   15 ++++++---------
 drivers/net/wireless/ath9k/hw.h   |    2 +-
 drivers/net/wireless/ath9k/main.c |    2 +-
 drivers/net/wireless/ath9k/phy.h  |    2 --
 4 files changed, 8 insertions(+), 13 deletions(-)

v2: Remove unneeded &0xffff from key3 = get_unaligned_le16()

--- wireless-testing.orig/drivers/net/wireless/ath9k/hw.c	2009-03-02 14:23:07.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/hw.c	2009-03-02 14:23:09.000000000 +0200
@@ -2415,14 +2415,11 @@ bool ath9k_hw_keysetmac(struct ath_hw *a
 
 bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
 				 const struct ath9k_keyval *k,
-				 const u8 *mac, int xorKey)
+				 const u8 *mac)
 {
 	const struct ath9k_hw_capabilities *pCap = &ah->caps;
 	u32 key0, key1, key2, key3, key4;
 	u32 keyType;
-	u32 xorMask = xorKey ?
-		(ATH9K_KEY_XOR << 24 | ATH9K_KEY_XOR << 16 | ATH9K_KEY_XOR << 8
-		 | ATH9K_KEY_XOR) : 0;
 
 	if (entry >= pCap->keycache_size) {
 		DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
@@ -2474,11 +2471,11 @@ bool ath9k_hw_set_keycache_entry(struct 
 		return false;
 	}
 
-	key0 = get_unaligned_le32(k->kv_val + 0) ^ xorMask;
-	key1 = (get_unaligned_le16(k->kv_val + 4) ^ xorMask) & 0xffff;
-	key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask;
-	key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff;
-	key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask;
+	key0 = get_unaligned_le32(k->kv_val + 0);
+	key1 = get_unaligned_le16(k->kv_val + 4);
+	key2 = get_unaligned_le32(k->kv_val + 6);
+	key3 = get_unaligned_le16(k->kv_val + 10);
+	key4 = get_unaligned_le32(k->kv_val + 12);
 	if (k->kv_len <= LEN_WEP104)
 		key4 &= 0xff;
 
--- wireless-testing.orig/drivers/net/wireless/ath9k/hw.h	2009-03-02 14:23:03.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/hw.h	2009-03-02 14:23:09.000000000 +0200
@@ -584,7 +584,7 @@ bool ath9k_hw_keyreset(struct ath_hw *ah
 bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac);
 bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
 				 const struct ath9k_keyval *k,
-				 const u8 *mac, int xorKey);
+				 const u8 *mac);
 bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry);
 
 /* GPIO / RFKILL / Antennae */
--- wireless-testing.orig/drivers/net/wireless/ath9k/main.c	2009-03-02 14:23:03.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/main.c	2009-03-02 14:23:09.000000000 +0200
@@ -642,7 +642,7 @@ static int ath_keyset(struct ath_softc *
 	bool status;
 
 	status = ath9k_hw_set_keycache_entry(sc->sc_ah,
-		keyix, hk, mac, false);
+		keyix, hk, mac);
 
 	return status != false;
 }
--- wireless-testing.orig/drivers/net/wireless/ath9k/phy.h	2009-03-02 14:23:03.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/phy.h	2009-03-02 14:23:09.000000000 +0200
@@ -559,8 +559,6 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,
 		}							\
 	} while (0)
 
-#define ATH9K_KEY_XOR                 0xaa
-
 #define ATH9K_IS_MIC_ENABLED(ah)					\
 	((ah)->sta_id1_defaults & AR_STA_ID1_CRPT_MIC_ENABLE)
 
-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath9k: Remove unused key xoring
  2009-03-02 13:07 [PATCH] ath9k: Remove unused key xoring Jouni Malinen
  2009-03-02 15:20 ` Bob Copeland
  2009-03-02 16:15 ` [PATCH v2] " Jouni Malinen
@ 2009-03-03  0:57 ` Harvey Harrison
  2 siblings, 0 replies; 5+ messages in thread
From: Harvey Harrison @ 2009-03-03  0:57 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

On Mon, 2009-03-02 at 15:07 +0200, Jouni Malinen wrote:
> This is not used anywhere in ath9k and is just making the code more
> confusing.
> 
> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
> 
> ---
>  drivers/net/wireless/ath9k/hw.c   |   15 ++++++---------
>  drivers/net/wireless/ath9k/hw.h   |    2 +-
>  drivers/net/wireless/ath9k/main.c |    2 +-
>  drivers/net/wireless/ath9k/phy.h  |    2 --
>  4 files changed, 8 insertions(+), 13 deletions(-)
> 
> --- wireless-testing.orig/drivers/net/wireless/ath9k/hw.c	2009-03-02 14:23:07.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/ath9k/hw.c	2009-03-02 14:23:09.000000000 +0200
> @@ -2415,14 +2415,11 @@ bool ath9k_hw_keysetmac(struct ath_hw *a
>  
>  bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
>  				 const struct ath9k_keyval *k,
> -				 const u8 *mac, int xorKey)
> +				 const u8 *mac)
>  {
>  	const struct ath9k_hw_capabilities *pCap = &ah->caps;
>  	u32 key0, key1, key2, key3, key4;
>  	u32 keyType;
> -	u32 xorMask = xorKey ?
> -		(ATH9K_KEY_XOR << 24 | ATH9K_KEY_XOR << 16 | ATH9K_KEY_XOR << 8
> -		 | ATH9K_KEY_XOR) : 0;
>  
>  	if (entry >= pCap->keycache_size) {
>  		DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
> @@ -2474,11 +2471,11 @@ bool ath9k_hw_set_keycache_entry(struct 
>  		return false;
>  	}
>  
> -	key0 = get_unaligned_le32(k->kv_val + 0) ^ xorMask;
> -	key1 = (get_unaligned_le16(k->kv_val + 4) ^ xorMask) & 0xffff;
> -	key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask;
> -	key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff;
> -	key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask;
> +	key0 = get_unaligned_le32(k->kv_val + 0);
> +	key1 = get_unaligned_le16(k->kv_val + 4);
> +	key2 = get_unaligned_le32(k->kv_val + 6);
> +	key3 = get_unaligned_le16(k->kv_val + 10) & 0xffff;
> +	key4 = get_unaligned_le32(k->kv_val + 12);

No longer need the 0xffff here

Harvey


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-03  0:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-02 13:07 [PATCH] ath9k: Remove unused key xoring Jouni Malinen
2009-03-02 15:20 ` Bob Copeland
2009-03-02 15:58   ` Jouni Malinen
2009-03-02 16:15 ` [PATCH v2] " Jouni Malinen
2009-03-03  0:57 ` [PATCH] " Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).