mac80211: add a pending patch to remove the dependency on ecb
[lede.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -1048,6 +1048,8 @@ static int ath9k_start(struct ieee80211_
4                 "Starting driver with initial channel: %d MHz\n",
5                 curchan->center_freq);
6  
7 +       ath9k_ps_wakeup(sc);
8 +
9         mutex_lock(&sc->mutex);
10  
11         /* setup initial channel */
12 @@ -1143,6 +1145,8 @@ static int ath9k_start(struct ieee80211_
13  mutex_unlock:
14         mutex_unlock(&sc->mutex);
15  
16 +       ath9k_ps_restore(sc);
17 +
18         return r;
19  }
20  
21 --- a/net/mac80211/ibss.c
22 +++ b/net/mac80211/ibss.c
23 @@ -661,7 +661,6 @@ static void ieee80211_sta_find_ibss(stru
24  static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
25                                         struct sk_buff *req)
26  {
27 -       struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(req);
28         struct ieee80211_mgmt *mgmt = (void *)req->data;
29         struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
30         struct ieee80211_local *local = sdata->local;
31 @@ -685,7 +684,7 @@ static void ieee80211_rx_mgmt_probe_req(
32                mgmt->bssid, tx_last_beacon);
33  #endif /* CONFIG_MAC80211_IBSS_DEBUG */
34  
35 -       if (!tx_last_beacon && !(rx_status->rx_flags & IEEE80211_RX_RA_MATCH))
36 +       if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
37                 return;
38  
39         if (memcmp(mgmt->bssid, ifibss->bssid, ETH_ALEN) != 0 &&
40 --- a/net/mac80211/rc80211_minstrel_ht.c
41 +++ b/net/mac80211/rc80211_minstrel_ht.c
42 @@ -659,18 +659,14 @@ minstrel_ht_update_caps(void *priv, stru
43         struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
44         struct ieee80211_local *local = hw_to_local(mp->hw);
45         u16 sta_cap = sta->ht_cap.cap;
46 +       int n_supported = 0;
47         int ack_dur;
48         int stbc;
49         int i;
50  
51         /* fall back to the old minstrel for legacy stations */
52 -       if (!sta->ht_cap.ht_supported) {
53 -               msp->is_ht = false;
54 -               memset(&msp->legacy, 0, sizeof(msp->legacy));
55 -               msp->legacy.r = msp->ratelist;
56 -               msp->legacy.sample_table = msp->sample_table;
57 -               return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
58 -       }
59 +       if (!sta->ht_cap.ht_supported)
60 +               goto use_legacy;
61  
62         BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) !=
63                 MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS);
64 @@ -725,7 +721,22 @@ minstrel_ht_update_caps(void *priv, stru
65  
66                 mi->groups[i].supported =
67                         mcs->rx_mask[minstrel_mcs_groups[i].streams - 1];
68 +
69 +               if (mi->groups[i].supported)
70 +                       n_supported++;
71         }
72 +
73 +       if (!n_supported)
74 +               goto use_legacy;
75 +
76 +       return;
77 +
78 +use_legacy:
79 +       msp->is_ht = false;
80 +       memset(&msp->legacy, 0, sizeof(msp->legacy));
81 +       msp->legacy.r = msp->ratelist;
82 +       msp->legacy.sample_table = msp->sample_table;
83 +       return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
84  }
85  
86  static void
87 --- a/net/mac80211/ieee80211_i.h
88 +++ b/net/mac80211/ieee80211_i.h
89 @@ -814,8 +814,8 @@ struct ieee80211_local {
90  
91         struct rate_control_ref *rate_ctrl;
92  
93 -       struct crypto_blkcipher *wep_tx_tfm;
94 -       struct crypto_blkcipher *wep_rx_tfm;
95 +       struct crypto_cipher *wep_tx_tfm;
96 +       struct crypto_cipher *wep_rx_tfm;
97         u32 wep_iv;
98  
99         /* see iface.c */
100 --- a/net/mac80211/tkip.c
101 +++ b/net/mac80211/tkip.c
102 @@ -202,7 +202,7 @@ EXPORT_SYMBOL(ieee80211_get_tkip_key);
103   * @payload_len is the length of payload (_not_ including IV/ICV length).
104   * @ta is the transmitter addresses.
105   */
106 -int ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
107 +int ieee80211_tkip_encrypt_data(struct crypto_cipher *tfm,
108                                 struct ieee80211_key *key,
109                                 u8 *pos, size_t payload_len, u8 *ta)
110  {
111 @@ -223,7 +223,7 @@ int ieee80211_tkip_encrypt_data(struct c
112   * beginning of the buffer containing IEEE 802.11 header payload, i.e.,
113   * including IV, Ext. IV, real data, Michael MIC, ICV. @payload_len is the
114   * length of payload, including IV, Ext. IV, MIC, ICV.  */
115 -int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
116 +int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
117                                 struct ieee80211_key *key,
118                                 u8 *payload, size_t payload_len, u8 *ta,
119                                 u8 *ra, int only_iv, int queue,
120 --- a/net/mac80211/tkip.h
121 +++ b/net/mac80211/tkip.h
122 @@ -15,7 +15,7 @@
123  
124  u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key, u16 iv16);
125  
126 -int ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
127 +int ieee80211_tkip_encrypt_data(struct crypto_cipher *tfm,
128                                  struct ieee80211_key *key,
129                                  u8 *pos, size_t payload_len, u8 *ta);
130  enum {
131 @@ -24,7 +24,7 @@ enum {
132         TKIP_DECRYPT_INVALID_KEYIDX = -2,
133         TKIP_DECRYPT_REPLAY = -3,
134  };
135 -int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
136 +int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
137                                 struct ieee80211_key *key,
138                                 u8 *payload, size_t payload_len, u8 *ta,
139                                 u8 *ra, int only_iv, int queue,
140 --- a/net/mac80211/wep.c
141 +++ b/net/mac80211/wep.c
142 @@ -30,17 +30,15 @@ int ieee80211_wep_init(struct ieee80211_
143         /* start WEP IV from a random value */
144         get_random_bytes(&local->wep_iv, WEP_IV_LEN);
145  
146 -       local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
147 -                                               CRYPTO_ALG_ASYNC);
148 +       local->wep_tx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC);
149         if (IS_ERR(local->wep_tx_tfm)) {
150                 local->wep_rx_tfm = ERR_PTR(-EINVAL);
151                 return PTR_ERR(local->wep_tx_tfm);
152         }
153  
154 -       local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
155 -                                               CRYPTO_ALG_ASYNC);
156 +       local->wep_rx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC);
157         if (IS_ERR(local->wep_rx_tfm)) {
158 -               crypto_free_blkcipher(local->wep_tx_tfm);
159 +               crypto_free_cipher(local->wep_tx_tfm);
160                 local->wep_tx_tfm = ERR_PTR(-EINVAL);
161                 return PTR_ERR(local->wep_rx_tfm);
162         }
163 @@ -51,9 +49,9 @@ int ieee80211_wep_init(struct ieee80211_
164  void ieee80211_wep_free(struct ieee80211_local *local)
165  {
166         if (!IS_ERR(local->wep_tx_tfm))
167 -               crypto_free_blkcipher(local->wep_tx_tfm);
168 +               crypto_free_cipher(local->wep_tx_tfm);
169         if (!IS_ERR(local->wep_rx_tfm))
170 -               crypto_free_blkcipher(local->wep_rx_tfm);
171 +               crypto_free_cipher(local->wep_rx_tfm);
172  }
173  
174  static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen)
175 @@ -127,12 +125,11 @@ static void ieee80211_wep_remove_iv(stru
176  /* Perform WEP encryption using given key. data buffer must have tailroom
177   * for 4-byte ICV. data_len must not include this ICV. Note: this function
178   * does _not_ add IV. data = RC4(data | CRC32(data)) */
179 -int ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
180 +int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
181                                size_t klen, u8 *data, size_t data_len)
182  {
183 -       struct blkcipher_desc desc = { .tfm = tfm };
184 -       struct scatterlist sg;
185         __le32 icv;
186 +       int i;
187  
188         if (IS_ERR(tfm))
189                 return -1;
190 @@ -140,9 +137,9 @@ int ieee80211_wep_encrypt_data(struct cr
191         icv = cpu_to_le32(~crc32_le(~0, data, data_len));
192         put_unaligned(icv, (__le32 *)(data + data_len));
193  
194 -       crypto_blkcipher_setkey(tfm, rc4key, klen);
195 -       sg_init_one(&sg, data, data_len + WEP_ICV_LEN);
196 -       crypto_blkcipher_encrypt(&desc, &sg, &sg, sg.length);
197 +       crypto_cipher_setkey(tfm, rc4key, klen);
198 +       for (i = 0; i < data_len + WEP_ICV_LEN; i++)
199 +               crypto_cipher_encrypt_one(tfm, data + i, data + i);
200  
201         return 0;
202  }
203 @@ -186,19 +183,18 @@ int ieee80211_wep_encrypt(struct ieee802
204  /* Perform WEP decryption using given key. data buffer includes encrypted
205   * payload, including 4-byte ICV, but _not_ IV. data_len must not include ICV.
206   * Return 0 on success and -1 on ICV mismatch. */
207 -int ieee80211_wep_decrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
208 +int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
209                                size_t klen, u8 *data, size_t data_len)
210  {
211 -       struct blkcipher_desc desc = { .tfm = tfm };
212 -       struct scatterlist sg;
213         __le32 crc;
214 +       int i;
215  
216         if (IS_ERR(tfm))
217                 return -1;
218  
219 -       crypto_blkcipher_setkey(tfm, rc4key, klen);
220 -       sg_init_one(&sg, data, data_len + WEP_ICV_LEN);
221 -       crypto_blkcipher_decrypt(&desc, &sg, &sg, sg.length);
222 +       crypto_cipher_setkey(tfm, rc4key, klen);
223 +       for (i = 0; i < data_len + WEP_ICV_LEN; i++)
224 +               crypto_cipher_decrypt_one(tfm, data + i, data + i);
225  
226         crc = cpu_to_le32(~crc32_le(~0, data, data_len));
227         if (memcmp(&crc, data + data_len, WEP_ICV_LEN) != 0)
228 --- a/net/mac80211/wep.h
229 +++ b/net/mac80211/wep.h
230 @@ -18,12 +18,12 @@
231  
232  int ieee80211_wep_init(struct ieee80211_local *local);
233  void ieee80211_wep_free(struct ieee80211_local *local);
234 -int ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
235 +int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
236                                 size_t klen, u8 *data, size_t data_len);
237  int ieee80211_wep_encrypt(struct ieee80211_local *local,
238                           struct sk_buff *skb,
239                           const u8 *key, int keylen, int keyidx);
240 -int ieee80211_wep_decrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
241 +int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
242                                size_t klen, u8 *data, size_t data_len);
243  bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key);
244