netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Kimdon <david.kimdon@devicescape.com>
To: netdev@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>, Jiri Benc <jbenc@suse.cz>
Subject: [patch] d80211: fix WEP on big endian cpus
Date: Sun, 10 Sep 2006 10:36:49 -0700	[thread overview]
Message-ID: <20060910173649.GA6324@devicescape.com> (raw)

[-- 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;

--

             reply	other threads:[~2006-09-10 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-10 17:36 David Kimdon [this message]
2006-09-10 18:11 ` [patch] d80211: fix WEP on big endian cpus Michael Buesch
2006-09-10 21:47 ` Michael Wu
2006-09-21 19:28   ` Jiri Benc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060910173649.GA6324@devicescape.com \
    --to=david.kimdon@devicescape.com \
    --cc=jbenc@suse.cz \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).