]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/mac80211/wpa.c
Merge branch 'linus' into x86/xsave
[karo-tx-linux.git] / net / mac80211 / wpa.c
index ec2ae86d64aac7a1cd36afbb27437536c6f613b4..6db649480e8ff2ae1aa8369be77c2e1e7220b562 100644 (file)
@@ -127,7 +127,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
                if (!(rx->flags & IEEE80211_RX_RA_MATCH))
                        return RX_DROP_UNUSABLE;
 
-               mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx,
+               mac80211_ev_michael_mic_failure(rx->sdata, rx->key->conf.keyidx,
                                                (void *) skb->data);
                return RX_DROP_UNUSABLE;
        }
@@ -152,9 +152,6 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
        int len, tail;
        u8 *pos;
 
-       info->control.icv_len = TKIP_ICV_LEN;
-       info->control.iv_len = TKIP_IV_LEN;
-
        if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
            !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
                /* hwaccel - with no need for preallocated room for IV/ICV */
@@ -256,7 +253,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
 
        res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm,
                                          key, skb->data + hdrlen,
-                                         skb->len - hdrlen, rx->sta->addr,
+                                         skb->len - hdrlen, rx->sta->sta.addr,
                                          hdr->addr1, hwaccel, rx->queue,
                                          &rx->tkip_iv32,
                                          &rx->tkip_iv16);
@@ -274,16 +271,20 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
 }
 
 
-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
                                int encrypted)
 {
        __le16 mask_fc;
        int a4_included;
        u8 qos_tid;
+       u8 *b_0, *aad;
        u16 data_len, len_a;
        unsigned int hdrlen;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 
+       b_0 = scratch + 3 * AES_BLOCK_LEN;
+       aad = scratch + 4 * AES_BLOCK_LEN;
+
        /*
         * Mask FC: zero subtype b4 b5 b6
         * Retry, PwrMgt, MoreData; set Protected
@@ -367,12 +368,9 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
        struct ieee80211_key *key = tx->key;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        int hdrlen, len, tail;
-       u8 *pos, *pn, *b_0, *aad, *scratch;
+       u8 *pos, *pn;
        int i;
 
-       info->control.icv_len = CCMP_MIC_LEN;
-       info->control.iv_len = CCMP_HDR_LEN;
-
        if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
            !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
                /* hwaccel - with no need for preallocated room for CCMP "
@@ -381,10 +379,6 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
                return 0;
        }
 
-       scratch = key->u.ccmp.tx_crypto_buf;
-       b_0 = scratch + 3 * AES_BLOCK_LEN;
-       aad = scratch + 4 * AES_BLOCK_LEN;
-
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
        len = skb->len - hdrlen;
 
@@ -420,8 +414,8 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
        }
 
        pos += CCMP_HDR_LEN;
-       ccmp_special_blocks(skb, pn, b_0, aad, 0);
-       ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, b_0, aad, pos, len,
+       ccmp_special_blocks(skb, pn, key->u.ccmp.tx_crypto_buf, 0);
+       ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, key->u.ccmp.tx_crypto_buf, pos, len,
                                  pos, skb_put(skb, CCMP_MIC_LEN));
 
        return 0;
@@ -483,16 +477,10 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
 
        if (!(rx->status->flag & RX_FLAG_DECRYPTED)) {
                /* hardware didn't decrypt/verify MIC */
-               u8 *scratch, *b_0, *aad;
-
-               scratch = key->u.ccmp.rx_crypto_buf;
-               b_0 = scratch + 3 * AES_BLOCK_LEN;
-               aad = scratch + 4 * AES_BLOCK_LEN;
-
-               ccmp_special_blocks(skb, pn, b_0, aad, 1);
+               ccmp_special_blocks(skb, pn, key->u.ccmp.rx_crypto_buf, 1);
 
                if (ieee80211_aes_ccm_decrypt(
-                           key->u.ccmp.tfm, scratch, b_0, aad,
+                           key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf,
                            skb->data + hdrlen + CCMP_HDR_LEN, data_len,
                            skb->data + skb->len - CCMP_MIC_LEN,
                            skb->data + hdrlen + CCMP_HDR_LEN)) {