Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2002-2004, Instant802 Networks, Inc. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #include <linux/netdevice.h> |
| 10 | #include <linux/types.h> |
| 11 | #include <linux/slab.h> |
| 12 | #include <linux/skbuff.h> |
| 13 | #include <linux/compiler.h> |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 14 | #include <linux/ieee80211.h> |
| 15 | #include <asm/unaligned.h> |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 16 | #include <net/mac80211.h> |
Johannes Berg | eb063c1 | 2007-08-28 17:01:53 -0400 | [diff] [blame] | 17 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 18 | #include "ieee80211_i.h" |
| 19 | #include "michael.h" |
| 20 | #include "tkip.h" |
| 21 | #include "aes_ccm.h" |
| 22 | #include "wpa.h" |
| 23 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 24 | ieee80211_tx_result |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 25 | ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 26 | { |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 27 | u8 *data, *key, *mic, key_offset; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 28 | size_t data_len; |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 29 | unsigned int hdrlen; |
| 30 | struct ieee80211_hdr *hdr; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 31 | u16 fc; |
| 32 | struct sk_buff *skb = tx->skb; |
| 33 | int authenticator; |
| 34 | int wpa_test = 0; |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 35 | int tail; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 36 | |
| 37 | fc = tx->fc; |
| 38 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 39 | if (!tx->key || tx->key->conf.alg != ALG_TKIP || skb->len < 24 || |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 40 | !WLAN_FC_DATA_PRESENT(fc)) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 41 | return TX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 42 | |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 43 | hdr = (struct ieee80211_hdr *)skb->data; |
| 44 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
| 45 | if (skb->len < hdrlen) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 46 | return TX_DROP; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 47 | |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 48 | data = skb->data + hdrlen; |
| 49 | data_len = skb->len - hdrlen; |
| 50 | |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 51 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 52 | !(tx->flags & IEEE80211_TX_FRAGMENTED) && |
Johannes Berg | 7848ba7 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 53 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) && |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 54 | !wpa_test) { |
| 55 | /* hwaccel - with no need for preallocated room for Michael MIC |
| 56 | */ |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 57 | return TX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 60 | tail = MICHAEL_MIC_LEN; |
| 61 | if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) |
| 62 | tail += TKIP_ICV_LEN; |
| 63 | |
| 64 | if (WARN_ON(skb_tailroom(skb) < tail || |
| 65 | skb_headroom(skb) < TKIP_IV_LEN)) |
| 66 | return TX_DROP; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 67 | |
| 68 | #if 0 |
| 69 | authenticator = fc & IEEE80211_FCTL_FROMDS; /* FIX */ |
| 70 | #else |
| 71 | authenticator = 1; |
| 72 | #endif |
Luis R. Rodriguez | ffd7891 | 2008-06-21 10:02:46 -0400 | [diff] [blame] | 73 | /* At this point we know we're using ALG_TKIP. To get the MIC key |
| 74 | * we now will rely on the offset from the ieee80211_key_conf::key */ |
| 75 | key_offset = authenticator ? |
| 76 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY : |
| 77 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; |
| 78 | key = &tx->key->conf.key[key_offset]; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 79 | mic = skb_put(skb, MICHAEL_MIC_LEN); |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 80 | michael_mic(key, hdr, data, data_len, mic); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 81 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 82 | return TX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 86 | ieee80211_rx_result |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 87 | ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 88 | { |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 89 | u8 *data, *key = NULL, key_offset; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 90 | size_t data_len; |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 91 | unsigned int hdrlen; |
| 92 | struct ieee80211_hdr *hdr; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 93 | u16 fc; |
| 94 | u8 mic[MICHAEL_MIC_LEN]; |
| 95 | struct sk_buff *skb = rx->skb; |
| 96 | int authenticator = 1, wpa_test = 0; |
Joe Perches | 0795af5 | 2007-10-03 17:59:30 -0700 | [diff] [blame] | 97 | DECLARE_MAC_BUF(mac); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 98 | |
| 99 | fc = rx->fc; |
| 100 | |
Johannes Berg | 3017b80 | 2007-08-28 17:01:53 -0400 | [diff] [blame] | 101 | /* |
| 102 | * No way to verify the MIC if the hardware stripped it |
| 103 | */ |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 104 | if (rx->status->flag & RX_FLAG_MMIC_STRIPPED) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 105 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 106 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 107 | if (!rx->key || rx->key->conf.alg != ALG_TKIP || |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 108 | !(rx->fc & IEEE80211_FCTL_PROTECTED) || !WLAN_FC_DATA_PRESENT(fc)) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 109 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 110 | |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 111 | hdr = (struct ieee80211_hdr *)skb->data; |
| 112 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
| 113 | if (skb->len < hdrlen + MICHAEL_MIC_LEN) |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 114 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 115 | |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 116 | data = skb->data + hdrlen; |
| 117 | data_len = skb->len - hdrlen - MICHAEL_MIC_LEN; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 118 | |
| 119 | #if 0 |
| 120 | authenticator = fc & IEEE80211_FCTL_TODS; /* FIX */ |
| 121 | #else |
| 122 | authenticator = 1; |
| 123 | #endif |
Luis R. Rodriguez | ffd7891 | 2008-06-21 10:02:46 -0400 | [diff] [blame] | 124 | /* At this point we know we're using ALG_TKIP. To get the MIC key |
| 125 | * we now will rely on the offset from the ieee80211_key_conf::key */ |
| 126 | key_offset = authenticator ? |
| 127 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY : |
| 128 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY; |
| 129 | key = &rx->key->conf.key[key_offset]; |
Harvey Harrison | 8e8862b | 2008-07-02 11:05:35 -0700 | [diff] [blame^] | 130 | michael_mic(key, hdr, data, data_len, mic); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 131 | if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) { |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 132 | if (!(rx->flags & IEEE80211_RX_RA_MATCH)) |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 133 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 134 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 135 | mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx, |
Johannes Berg | eb063c1 | 2007-08-28 17:01:53 -0400 | [diff] [blame] | 136 | (void *) skb->data); |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 137 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 138 | } |
| 139 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 140 | /* remove Michael MIC from payload */ |
| 141 | skb_trim(skb, skb->len - MICHAEL_MIC_LEN); |
| 142 | |
Johannes Berg | 50741ae | 2007-09-26 15:19:45 +0200 | [diff] [blame] | 143 | /* update IV in key information to be able to detect replays */ |
Harvey Harrison | b0f76b3 | 2008-05-14 16:26:19 -0700 | [diff] [blame] | 144 | rx->key->u.tkip.rx[rx->queue].iv32 = rx->tkip_iv32; |
| 145 | rx->key->u.tkip.rx[rx->queue].iv16 = rx->tkip_iv16; |
Johannes Berg | 50741ae | 2007-09-26 15:19:45 +0200 | [diff] [blame] | 146 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 147 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 151 | static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 152 | { |
| 153 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
| 154 | struct ieee80211_key *key = tx->key; |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 155 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
Harvey Harrison | d5184ca | 2008-06-11 14:21:58 -0700 | [diff] [blame] | 156 | unsigned int hdrlen; |
| 157 | int len, tail; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 158 | u8 *pos; |
| 159 | |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 160 | info->control.icv_len = TKIP_ICV_LEN; |
| 161 | info->control.iv_len = TKIP_IV_LEN; |
| 162 | |
| 163 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && |
| 164 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { |
| 165 | /* hwaccel - with no need for preallocated room for IV/ICV */ |
| 166 | info->control.hw_key = &tx->key->conf; |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 167 | return 0; |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 168 | } |
| 169 | |
Harvey Harrison | d5184ca | 2008-06-11 14:21:58 -0700 | [diff] [blame] | 170 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 171 | len = skb->len - hdrlen; |
| 172 | |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 173 | if (tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 174 | tail = 0; |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 175 | else |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 176 | tail = TKIP_ICV_LEN; |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 177 | |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 178 | if (WARN_ON(skb_tailroom(skb) < tail || |
| 179 | skb_headroom(skb) < TKIP_IV_LEN)) |
| 180 | return -1; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 181 | |
| 182 | pos = skb_push(skb, TKIP_IV_LEN); |
| 183 | memmove(pos, pos + TKIP_IV_LEN, hdrlen); |
| 184 | pos += hdrlen; |
| 185 | |
| 186 | /* Increase IV for the frame */ |
Harvey Harrison | b0f76b3 | 2008-05-14 16:26:19 -0700 | [diff] [blame] | 187 | key->u.tkip.tx.iv16++; |
| 188 | if (key->u.tkip.tx.iv16 == 0) |
| 189 | key->u.tkip.tx.iv32++; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 190 | |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 191 | if (tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 192 | /* hwaccel - with preallocated room for IV */ |
Harvey Harrison | c801242 | 2008-06-11 14:22:00 -0700 | [diff] [blame] | 193 | ieee80211_tkip_add_iv(pos, key, key->u.tkip.tx.iv16); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 194 | |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 195 | info->control.hw_key = &tx->key->conf; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 196 | return 0; |
| 197 | } |
| 198 | |
| 199 | /* Add room for ICV */ |
| 200 | skb_put(skb, TKIP_ICV_LEN); |
| 201 | |
| 202 | hdr = (struct ieee80211_hdr *) skb->data; |
| 203 | ieee80211_tkip_encrypt_data(tx->local->wep_tx_tfm, |
| 204 | key, pos, len, hdr->addr2); |
| 205 | return 0; |
| 206 | } |
| 207 | |
| 208 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 209 | ieee80211_tx_result |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 210 | ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 211 | { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 212 | struct sk_buff *skb = tx->skb; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 213 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 214 | ieee80211_tx_set_protected(tx); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 215 | |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 216 | if (tkip_encrypt_skb(tx, skb) < 0) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 217 | return TX_DROP; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 218 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 219 | if (tx->extra_frag) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 220 | int i; |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 221 | for (i = 0; i < tx->num_extra_frag; i++) { |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 222 | if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 223 | return TX_DROP; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 224 | } |
| 225 | } |
| 226 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 227 | return TX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 231 | ieee80211_rx_result |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 232 | ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 233 | { |
| 234 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 235 | int hdrlen, res, hwaccel = 0, wpa_test = 0; |
| 236 | struct ieee80211_key *key = rx->key; |
| 237 | struct sk_buff *skb = rx->skb; |
Joe Perches | 0795af5 | 2007-10-03 17:59:30 -0700 | [diff] [blame] | 238 | DECLARE_MAC_BUF(mac); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 239 | |
Harvey Harrison | d5184ca | 2008-06-11 14:21:58 -0700 | [diff] [blame] | 240 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 241 | |
Johannes Berg | 4f0d18e | 2007-09-26 15:19:40 +0200 | [diff] [blame] | 242 | if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 243 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 244 | |
| 245 | if (!rx->sta || skb->len - hdrlen < 12) |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 246 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 247 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 248 | if (rx->status->flag & RX_FLAG_DECRYPTED) { |
| 249 | if (rx->status->flag & RX_FLAG_IV_STRIPPED) { |
Johannes Berg | 7848ba7 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 250 | /* |
| 251 | * Hardware took care of all processing, including |
| 252 | * replay protection, and stripped the ICV/IV so |
| 253 | * we cannot do any checks here. |
| 254 | */ |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 255 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | /* let TKIP code verify IV, but skip decryption */ |
| 259 | hwaccel = 1; |
| 260 | } |
| 261 | |
| 262 | res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm, |
| 263 | key, skb->data + hdrlen, |
| 264 | skb->len - hdrlen, rx->sta->addr, |
Emmanuel Grumbach | 9ae4fda | 2008-03-20 15:06:42 +0200 | [diff] [blame] | 265 | hdr->addr1, hwaccel, rx->queue, |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 266 | &rx->tkip_iv32, |
| 267 | &rx->tkip_iv16); |
Johannes Berg | f4ea83d | 2008-06-30 15:10:46 +0200 | [diff] [blame] | 268 | if (res != TKIP_DECRYPT_OK || wpa_test) |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 269 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 270 | |
| 271 | /* Trim ICV */ |
| 272 | skb_trim(skb, skb->len - TKIP_ICV_LEN); |
| 273 | |
| 274 | /* Remove IV */ |
| 275 | memmove(skb->data + TKIP_IV_LEN, skb->data, hdrlen); |
| 276 | skb_pull(skb, TKIP_IV_LEN); |
| 277 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 278 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | |
| 282 | static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad, |
| 283 | int encrypted) |
| 284 | { |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 285 | __le16 mask_fc; |
| 286 | int a4_included; |
| 287 | u8 qos_tid; |
| 288 | u16 data_len, len_a; |
| 289 | unsigned int hdrlen; |
| 290 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 291 | |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 292 | /* |
| 293 | * Mask FC: zero subtype b4 b5 b6 |
| 294 | * Retry, PwrMgt, MoreData; set Protected |
| 295 | */ |
| 296 | mask_fc = hdr->frame_control; |
| 297 | mask_fc &= ~cpu_to_le16(0x0070 | IEEE80211_FCTL_RETRY | |
| 298 | IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA); |
| 299 | mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 300 | |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 301 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
| 302 | len_a = hdrlen - 2; |
| 303 | a4_included = ieee80211_has_a4(hdr->frame_control); |
| 304 | |
| 305 | if (ieee80211_is_data_qos(hdr->frame_control)) |
| 306 | qos_tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; |
| 307 | else |
| 308 | qos_tid = 0; |
| 309 | |
| 310 | data_len = skb->len - hdrlen - CCMP_HDR_LEN; |
| 311 | if (encrypted) |
| 312 | data_len -= CCMP_MIC_LEN; |
| 313 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 314 | /* First block, b_0 */ |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 315 | b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */ |
| 316 | /* Nonce: QoS Priority | A2 | PN */ |
| 317 | b_0[1] = qos_tid; |
Harvey Harrison | 73e1f7c | 2008-07-02 11:05:34 -0700 | [diff] [blame] | 318 | memcpy(&b_0[2], hdr->addr2, ETH_ALEN); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 319 | memcpy(&b_0[8], pn, CCMP_PN_LEN); |
| 320 | /* l(m) */ |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 321 | put_unaligned_be16(data_len, &b_0[14]); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 322 | |
| 323 | /* AAD (extra authenticate-only data) / masked 802.11 header |
| 324 | * FC | A1 | A2 | A3 | SC | [A4] | [QC] */ |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 325 | put_unaligned_be16(len_a, &aad[0]); |
| 326 | put_unaligned(mask_fc, (__le16 *)&aad[2]); |
Harvey Harrison | 73e1f7c | 2008-07-02 11:05:34 -0700 | [diff] [blame] | 327 | memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 328 | |
| 329 | /* Mask Seq#, leave Frag# */ |
| 330 | aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f; |
| 331 | aad[23] = 0; |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 332 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 333 | if (a4_included) { |
Harvey Harrison | 73e1f7c | 2008-07-02 11:05:34 -0700 | [diff] [blame] | 334 | memcpy(&aad[24], hdr->addr4, ETH_ALEN); |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 335 | aad[30] = qos_tid; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 336 | aad[31] = 0; |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 337 | } else { |
Harvey Harrison | 73e1f7c | 2008-07-02 11:05:34 -0700 | [diff] [blame] | 338 | memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN); |
Harvey Harrison | f14df80 | 2008-07-02 11:05:35 -0700 | [diff] [blame] | 339 | aad[24] = qos_tid; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 340 | } |
| 341 | } |
| 342 | |
| 343 | |
| 344 | static inline void ccmp_pn2hdr(u8 *hdr, u8 *pn, int key_id) |
| 345 | { |
| 346 | hdr[0] = pn[5]; |
| 347 | hdr[1] = pn[4]; |
| 348 | hdr[2] = 0; |
| 349 | hdr[3] = 0x20 | (key_id << 6); |
| 350 | hdr[4] = pn[3]; |
| 351 | hdr[5] = pn[2]; |
| 352 | hdr[6] = pn[1]; |
| 353 | hdr[7] = pn[0]; |
| 354 | } |
| 355 | |
| 356 | |
| 357 | static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr) |
| 358 | { |
| 359 | pn[0] = hdr[7]; |
| 360 | pn[1] = hdr[6]; |
| 361 | pn[2] = hdr[5]; |
| 362 | pn[3] = hdr[4]; |
| 363 | pn[4] = hdr[1]; |
| 364 | pn[5] = hdr[0]; |
| 365 | return (hdr[3] >> 6) & 0x03; |
| 366 | } |
| 367 | |
| 368 | |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 369 | static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 370 | { |
| 371 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
| 372 | struct ieee80211_key *key = tx->key; |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 373 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 374 | int hdrlen, len, tail; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 375 | u8 *pos, *pn, *b_0, *aad, *scratch; |
| 376 | int i; |
| 377 | |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 378 | info->control.icv_len = CCMP_MIC_LEN; |
| 379 | info->control.iv_len = CCMP_HDR_LEN; |
| 380 | |
| 381 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && |
| 382 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { |
| 383 | /* hwaccel - with no need for preallocated room for CCMP " |
| 384 | * header or MIC fields */ |
| 385 | info->control.hw_key = &tx->key->conf; |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 386 | return 0; |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 387 | } |
| 388 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 389 | scratch = key->u.ccmp.tx_crypto_buf; |
| 390 | b_0 = scratch + 3 * AES_BLOCK_LEN; |
| 391 | aad = scratch + 4 * AES_BLOCK_LEN; |
| 392 | |
Harvey Harrison | d5184ca | 2008-06-11 14:21:58 -0700 | [diff] [blame] | 393 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 394 | len = skb->len - hdrlen; |
| 395 | |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 396 | if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 397 | tail = 0; |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 398 | else |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 399 | tail = CCMP_MIC_LEN; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 400 | |
Johannes Berg | 23c0752 | 2008-05-29 10:38:53 +0200 | [diff] [blame] | 401 | if (WARN_ON(skb_tailroom(skb) < tail || |
| 402 | skb_headroom(skb) < CCMP_HDR_LEN)) |
| 403 | return -1; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 404 | |
| 405 | pos = skb_push(skb, CCMP_HDR_LEN); |
| 406 | memmove(pos, pos + CCMP_HDR_LEN, hdrlen); |
| 407 | hdr = (struct ieee80211_hdr *) pos; |
| 408 | pos += hdrlen; |
| 409 | |
| 410 | /* PN = PN + 1 */ |
| 411 | pn = key->u.ccmp.tx_pn; |
| 412 | |
| 413 | for (i = CCMP_PN_LEN - 1; i >= 0; i--) { |
| 414 | pn[i]++; |
| 415 | if (pn[i]) |
| 416 | break; |
| 417 | } |
| 418 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 419 | ccmp_pn2hdr(pos, pn, key->conf.keyidx); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 420 | |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 421 | if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 422 | /* hwaccel - with preallocated room for CCMP header */ |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 423 | info->control.hw_key = &tx->key->conf; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 424 | return 0; |
| 425 | } |
| 426 | |
| 427 | pos += CCMP_HDR_LEN; |
| 428 | ccmp_special_blocks(skb, pn, b_0, aad, 0); |
| 429 | ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, b_0, aad, pos, len, |
| 430 | pos, skb_put(skb, CCMP_MIC_LEN)); |
| 431 | |
| 432 | return 0; |
| 433 | } |
| 434 | |
| 435 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 436 | ieee80211_tx_result |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 437 | ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 438 | { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 439 | struct sk_buff *skb = tx->skb; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 440 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 441 | ieee80211_tx_set_protected(tx); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 442 | |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 443 | if (ccmp_encrypt_skb(tx, skb) < 0) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 444 | return TX_DROP; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 445 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 446 | if (tx->extra_frag) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 447 | int i; |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 448 | for (i = 0; i < tx->num_extra_frag; i++) { |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 449 | if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 450 | return TX_DROP; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 451 | } |
| 452 | } |
| 453 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 454 | return TX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 458 | ieee80211_rx_result |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 459 | ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 460 | { |
| 461 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 462 | int hdrlen; |
| 463 | struct ieee80211_key *key = rx->key; |
| 464 | struct sk_buff *skb = rx->skb; |
| 465 | u8 pn[CCMP_PN_LEN]; |
| 466 | int data_len; |
Joe Perches | 0795af5 | 2007-10-03 17:59:30 -0700 | [diff] [blame] | 467 | DECLARE_MAC_BUF(mac); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 468 | |
Harvey Harrison | d5184ca | 2008-06-11 14:21:58 -0700 | [diff] [blame] | 469 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 470 | |
Johannes Berg | 4f0d18e | 2007-09-26 15:19:40 +0200 | [diff] [blame] | 471 | if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 472 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 473 | |
| 474 | data_len = skb->len - hdrlen - CCMP_HDR_LEN - CCMP_MIC_LEN; |
| 475 | if (!rx->sta || data_len < 0) |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 476 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 477 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 478 | if ((rx->status->flag & RX_FLAG_DECRYPTED) && |
| 479 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 480 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 481 | |
| 482 | (void) ccmp_hdr2pn(pn, skb->data + hdrlen); |
| 483 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 484 | if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 485 | key->u.ccmp.replays++; |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 486 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 487 | } |
| 488 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 489 | if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { |
Johannes Berg | 7848ba7 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 490 | /* hardware didn't decrypt/verify MIC */ |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 491 | u8 *scratch, *b_0, *aad; |
| 492 | |
| 493 | scratch = key->u.ccmp.rx_crypto_buf; |
| 494 | b_0 = scratch + 3 * AES_BLOCK_LEN; |
| 495 | aad = scratch + 4 * AES_BLOCK_LEN; |
| 496 | |
| 497 | ccmp_special_blocks(skb, pn, b_0, aad, 1); |
| 498 | |
| 499 | if (ieee80211_aes_ccm_decrypt( |
| 500 | key->u.ccmp.tfm, scratch, b_0, aad, |
| 501 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, |
| 502 | skb->data + skb->len - CCMP_MIC_LEN, |
| 503 | skb->data + hdrlen + CCMP_HDR_LEN)) { |
Johannes Berg | e4c26ad | 2008-01-31 19:48:21 +0100 | [diff] [blame] | 504 | return RX_DROP_UNUSABLE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 505 | } |
| 506 | } |
| 507 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 508 | memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 509 | |
| 510 | /* Remove CCMP header and MIC */ |
| 511 | skb_trim(skb, skb->len - CCMP_MIC_LEN); |
| 512 | memmove(skb->data + CCMP_HDR_LEN, skb->data, hdrlen); |
| 513 | skb_pull(skb, CCMP_HDR_LEN); |
| 514 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 515 | return RX_CONTINUE; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 516 | } |