[NET]: Removing duplicit #includes
[linux-2.6-block.git] / net / ieee80211 / ieee80211_crypt_tkip.c
index 6cc54eeca3edf54b11f76f6d23ca7b43d2adeec5..58b22619ab15c160ad072cbd65edbc7931ba7b98 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/random.h>
+#include <linux/scatterlist.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/mm.h>
@@ -24,7 +25,6 @@
 #include <net/ieee80211.h>
 
 #include <linux/crypto.h>
-#include <asm/scatterlist.h>
 #include <linux/crc32.h>
 
 MODULE_AUTHOR("Jouni Malinen");
@@ -390,9 +390,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
        icv[3] = crc >> 24;
 
        crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
-       sg.page = virt_to_page(pos);
-       sg.offset = offset_in_page(pos);
-       sg.length = len + 4;
+       sg_init_one(&sg, pos, len + 4);
        return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
 }
 
@@ -485,9 +483,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
        plen = skb->len - hdr_len - 12;
 
        crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
-       sg.page = virt_to_page(pos);
-       sg.offset = offset_in_page(pos);
-       sg.length = plen + 4;
+       sg_init_one(&sg, pos, plen + 4);
        if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
                if (net_ratelimit()) {
                        printk(KERN_DEBUG ": TKIP: failed to decrypt "
@@ -539,13 +535,9 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
                printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
                return -1;
        }
-       sg[0].page = virt_to_page(hdr);
-       sg[0].offset = offset_in_page(hdr);
-       sg[0].length = 16;
-
-       sg[1].page = virt_to_page(data);
-       sg[1].offset = offset_in_page(data);
-       sg[1].length = data_len;
+       sg_init_table(sg, 2);
+       sg_set_buf(&sg[0], hdr, 16);
+       sg_set_buf(&sg[1], data, data_len);
 
        if (crypto_hash_setkey(tfm_michael, key, 8))
                return -1;
@@ -586,7 +578,7 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr)
        if (stype & IEEE80211_STYPE_QOS_DATA) {
                const struct ieee80211_hdr_3addrqos *qoshdr =
                        (struct ieee80211_hdr_3addrqos *)skb->data;
-               hdr[12] = qoshdr->qos_ctl & cpu_to_le16(IEEE80211_QCTL_TID);
+               hdr[12] = le16_to_cpu(qoshdr->qos_ctl) & IEEE80211_QCTL_TID;
        } else
                hdr[12] = 0;            /* priority */