linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andriy Tkachuk <andrit@ukr.net>
To: linux-wireless@vger.kernel.org
Cc: Jouni Malinen <j@w1.fi>, "John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH] lib80211: Cosmetics - make room for MIC/CRC near the actual calculation
Date: Tue, 02 Feb 2010 15:58:53 +0200	[thread overview]
Message-ID: <4B682F9D.4060004@ukr.net> (raw)


Signed-off-by: Andriy V. Tkachuk <andrit@ukr.net>

---
 net/wireless/lib80211_crypt_ccmp.c |    2 +-
 net/wireless/lib80211_crypt_tkip.c |   15 +++++++--------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/net/wireless/lib80211_crypt_ccmp.c
b/net/wireless/lib80211_crypt_ccmp.c
index 2301dc1..b7fa31d 100644
--- a/net/wireless/lib80211_crypt_ccmp.c
+++ b/net/wireless/lib80211_crypt_ccmp.c
@@ -237,7 +237,6 @@ static int lib80211_ccmp_encrypt(struct sk_buff
*skb, int hdr_len, void *priv)
 		return -1;

 	pos = skb->data + hdr_len + CCMP_HDR_LEN;
-	mic = skb_put(skb, CCMP_MIC_LEN);
 	hdr = (struct ieee80211_hdr *)skb->data;
 	ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);

@@ -257,6 +256,7 @@ static int lib80211_ccmp_encrypt(struct sk_buff
*skb, int hdr_len, void *priv)
 		pos += len;
 	}

+	mic = skb_put(skb, CCMP_MIC_LEN);
 	for (i = 0; i < CCMP_MIC_LEN; i++)
 		mic[i] = b[i] ^ s0[i];

diff --git a/net/wireless/lib80211_crypt_tkip.c
b/net/wireless/lib80211_crypt_tkip.c
index c362873..7d9254c 100644
--- a/net/wireless/lib80211_crypt_tkip.c
+++ b/net/wireless/lib80211_crypt_tkip.c
@@ -384,9 +384,8 @@ static int lib80211_tkip_encrypt(struct sk_buff
*skb, int hdr_len, void *priv)
 	if ((lib80211_tkip_hdr(skb, hdr_len, rc4key, 16, priv)) < 0)
 		return -1;

-	icv = skb_put(skb, 4);
-
 	crc = ~crc32_le(~0, pos, len);
+	icv = skb_put(skb, 4);
 	icv[0] = crc;
 	icv[1] = crc >> 8;
 	icv[2] = crc >> 16;

                 reply	other threads:[~2010-02-02 13:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4B682F9D.4060004@ukr.net \
    --to=andrit@ukr.net \
    --cc=j@w1.fi \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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).