netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] d80211: fix WEP on big endian cpus
@ 2006-09-10 17:36 David Kimdon
  2006-09-10 18:11 ` Michael Buesch
  2006-09-10 21:47 ` Michael Wu
  0 siblings, 2 replies; 4+ messages in thread
From: David Kimdon @ 2006-09-10 17:36 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc

[-- Attachment #1: wep-big-endian.patch --]
[-- Type: text/plain, Size: 970 bytes --]

The ICV is transmitted on the network as a 4 byte little endian
quantity.  WEP encryption needs to swap the bytes before transmission
and decryption needs to swap bytes before ICV verification.


Index: wireless-dev/net/d80211/wep.c
===================================================================
--- wireless-dev.orig/net/d80211/wep.c	2006-09-10 14:50:52.073583400 +0000
+++ wireless-dev/net/d80211/wep.c	2006-09-10 14:51:10.146835848 +0000
@@ -121,9 +121,11 @@
 {
 	struct scatterlist sg;
 	u32 *icv;
+	u32 crc;
 
 	icv = (u32 *)(data + data_len);
-	*icv = ~crc32_le(~0, data, data_len);
+	crc = ~crc32_le(~0, data, data_len);
+	*icv = cpu_to_le32(crc);
 
 	crypto_cipher_setkey(tfm, rc4key, klen);
 	sg.page = virt_to_page(data);
@@ -196,6 +198,7 @@
 	crypto_cipher_decrypt(tfm, &sg, &sg, sg.length);
 
 	crc = ~crc32_le(~0, data, data_len);
+	crc = cpu_to_le32(crc);
 	if (memcmp(&crc, data + data_len, WEP_ICV_LEN) != 0)
 		/* ICV mismatch */
 		return -1;

--

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

end of thread, other threads:[~2006-09-21 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-10 17:36 [patch] d80211: fix WEP on big endian cpus David Kimdon
2006-09-10 18:11 ` Michael Buesch
2006-09-10 21:47 ` Michael Wu
2006-09-21 19:28   ` Jiri Benc

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).