Skip to contentSkip to conversation

mac80211: tkip.c remove opencoded swab16 in tkip_S

PATCH In review [email protected] 1 participant 1 message Apr 18, 2008 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 2/7 mac80211: tkip.c remove opencoded swab16 in tkip_S

From: Harvey Harrison <[email protected]>

Opencode the Hi8/Lo8 and eliminate the temporary variable in tkip_S().

Cc Johannes Berg <[email protected]>
Cc John W. Linville <[email protected]>
Cc Joe Perches <[email protected]>
Cc Jiri Benc <[email protected]>

---

 net/mac80211/tkip.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
net/mac80211/tkip.c renamed from net/mac80211/tkip.c~mac80211-tkipc-remove-opencoded-swab16-in-tkip_s +1 -5
diff -puN net/mac80211/tkip.c~mac80211-tkipc-remove-opencoded-swab16-in-tkip_s net/mac80211/tkip.c
@@ -94,13 +94,9 @@ static inline u16 Lo16(u32 v)
 
 static inline 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)

_