linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tkip: remove unused function, other cleanups
@ 2008-03-08  3:17 Harvey Harrison
  2008-03-08  6:52 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Harvey Harrison @ 2008-03-08  3:17 UTC (permalink / raw)
  To: Jiri Benc; +Cc: Johannes Berg, linux-wireless

tkip_S had an opencoded bswab16
make static void ieee80211_tkip_gen_rc4key static
remove the unused ieee80211_tkip_gen_phase1key

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 net/mac80211/tkip.c |   22 ++++------------------
 net/mac80211/tkip.h |    4 ----
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index 3abe194..d08a6d8 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -10,8 +10,8 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/netdevice.h>
-
 #include <net/mac80211.h>
+
 #include "ieee80211_key.h"
 #include "tkip.h"
 #include "wep.h"
@@ -98,15 +98,11 @@ static inline u16 RotR1(u16 v)
 }
 

-static inline u16 tkip_S(u16 val)
+static u16 tkip_S(u16 val)
 {
-	u16 a = tkip_sbox[Hi8(val)];
-
-	return tkip_sbox[Lo8(val)] ^ Hi8(a) ^ (Lo8(a) << 8);
+	return tkip_sbox[val & 0xff] ^ __swab16(tkip_sbox[val >> 8]);
 }
 
-
-
 /* P1K := Phase1(TA, TK, TSC)
  * TA = transmitter address (48 bits)
  * TK = dot11DefaultKeyValue or dot11KeyMappingValue (128 bits)
@@ -190,15 +186,7 @@ u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
 	return pos;
 }
 
-
-void ieee80211_tkip_gen_phase1key(struct ieee80211_key *key, u8 *ta,
-				  u16 *phase1key)
-{
-	tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY],
-			   key->u.tkip.iv32, phase1key);
-}
-
-void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
+static void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
 			       u8 *rc4key)
 {
 	/* Calculate per-packet key */
@@ -345,5 +333,3 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
 
 	return res;
 }
-
-
diff --git a/net/mac80211/tkip.h b/net/mac80211/tkip.h
index 73d8ef2..944d5fa 100644
--- a/net/mac80211/tkip.h
+++ b/net/mac80211/tkip.h
@@ -15,10 +15,6 @@
 
 u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
 			   u8 iv0, u8 iv1, u8 iv2);
-void ieee80211_tkip_gen_phase1key(struct ieee80211_key *key, u8 *ta,
-				  u16 *phase1key);
-void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
-			       u8 *rc4key);
 void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
 				 struct ieee80211_key *key,
 				 u8 *pos, size_t payload_len, u8 *ta);
-- 
1.5.4.GIT



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

* Re: [PATCH 1/2] tkip: remove unused function, other cleanups
  2008-03-08  3:17 [PATCH 1/2] tkip: remove unused function, other cleanups Harvey Harrison
@ 2008-03-08  6:52 ` Johannes Berg
  2008-03-10  0:03   ` Harvey Harrison
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2008-03-08  6:52 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Jiri Benc, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]


> -static inline u16 tkip_S(u16 val)
> +static u16 tkip_S(u16 val)
>  {
> -	u16 a = tkip_sbox[Hi8(val)];
> -
> -	return tkip_sbox[Lo8(val)] ^ Hi8(a) ^ (Lo8(a) << 8);
> +	return tkip_sbox[val & 0xff] ^ __swab16(tkip_sbox[val >> 8]);

What's wrong with using the non-underscored versions? This is pure
kernel code...

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [PATCH 1/2] tkip: remove unused function, other cleanups
  2008-03-08  6:52 ` Johannes Berg
@ 2008-03-10  0:03   ` Harvey Harrison
  0 siblings, 0 replies; 3+ messages in thread
From: Harvey Harrison @ 2008-03-10  0:03 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Jiri Benc, linux-wireless

On Sat, 2008-03-08 at 07:52 +0100, Johannes Berg wrote:
> > -static inline u16 tkip_S(u16 val)
> > +static u16 tkip_S(u16 val)
> >  {
> > -	u16 a = tkip_sbox[Hi8(val)];
> > -
> > -	return tkip_sbox[Lo8(val)] ^ Hi8(a) ^ (Lo8(a) << 8);
> > +	return tkip_sbox[val & 0xff] ^ __swab16(tkip_sbox[val >> 8]);
> 
> What's wrong with using the non-underscored versions? This is pure
> kernel code...

That was a thinko on my part, I resent this in a 5-patch series shortly
thereafter without the underscores (the alignment problems you noted in
2/2 still remain).

Thanks for the comments.

Harvey


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

end of thread, other threads:[~2008-03-10  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-08  3:17 [PATCH 1/2] tkip: remove unused function, other cleanups Harvey Harrison
2008-03-08  6:52 ` Johannes Berg
2008-03-10  0:03   ` 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).