lib80211: Cosmetics - make room for MIC/CRC near the actual calculation
authorAndriy Tkachuk <andrit@ukr.net>
Tue, 2 Feb 2010 13:58:53 +0000 (15:58 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 2 Feb 2010 21:03:38 +0000 (16:03 -0500)
Signed-off-by: Andriy V. Tkachuk <andrit@ukr.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/lib80211_crypt_ccmp.c
net/wireless/lib80211_crypt_tkip.c

index 2301dc1edc4cda417335e0747f7505f748de7d8e..b7fa31d5fd13892a93c774de5ce3a2daa02af62d 100644 (file)
@@ -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];
 
index c36287399d7ea2155f53a535a1e0ad540e104be3..c6a3cae1f85e00dc41ef33532cc99fe767ef5ce6 100644 (file)
@@ -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;