aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean MacLennan <seanm@seanm.ca>2011-12-19 23:21:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-22 16:48:59 -0500
commit0ddcf5fdfac6bd80e153ee5c405bdfc9cb868b95 (patch)
tree521df3600ec21e1ffe93b40f8d64c72d8419d48e
parent32c44cb5b9fdc6eaa445bd622008dd672a3dd1a7 (diff)
staging/rtl8192e: Convert to lib80211_crypt_info
Convert rtllib to use lib80211_crypt_info. Signed-off-by: Sean MacLennan <seanm@seanm.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/rtl_wx.c2
-rw-r--r--drivers/staging/rtl8192e/rtllib.h8
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt.c38
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt.h6
-rw-r--r--drivers/staging/rtl8192e/rtllib_module.c16
-rw-r--r--drivers/staging/rtl8192e/rtllib_rx.c2
-rw-r--r--drivers/staging/rtl8192e/rtllib_softmac.c18
-rw-r--r--drivers/staging/rtl8192e/rtllib_tx.c4
-rw-r--r--drivers/staging/rtl8192e/rtllib_wx.c40
9 files changed, 66 insertions, 68 deletions
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 44fffe2f3d07..4e93669210af 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -802,7 +802,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
802 802
803 switch (wrqu->encoding.flags & IW_ENCODE_INDEX) { 803 switch (wrqu->encoding.flags & IW_ENCODE_INDEX) {
804 case 0: 804 case 0:
805 key_idx = ieee->tx_keyidx; 805 key_idx = ieee->crypt_info.tx_keyidx;
806 break; 806 break;
807 case 1: 807 case 1:
808 key_idx = 0; 808 key_idx = 0;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 17097e7ed9f6..a8133d4a1541 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -2188,14 +2188,10 @@ struct rtllib_device {
2188 u8 ap_mac_addr[6]; 2188 u8 ap_mac_addr[6];
2189 u16 pairwise_key_type; 2189 u16 pairwise_key_type;
2190 u16 group_key_type; 2190 u16 group_key_type;
2191 struct list_head crypt_deinit_list;
2192 struct rtllib_crypt_data *crypt[NUM_WEP_KEYS];
2193 2191
2194 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ 2192 struct lib80211_crypt_info crypt_info;
2195 struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY];
2196 struct timer_list crypt_deinit_timer;
2197 int crypt_quiesced;
2198 2193
2194 struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY];
2199 int bcrx_sta_key; /* use individual keys to override default keys even 2195 int bcrx_sta_key; /* use individual keys to override default keys even
2200 * with RX of broad/multicast frames */ 2196 * with RX of broad/multicast frames */
2201 2197
diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c
index 313d089c24fa..606a2f5158fd 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt.c
@@ -32,14 +32,14 @@ struct rtllib_crypto {
32 32
33static struct rtllib_crypto *hcrypt; 33static struct rtllib_crypto *hcrypt;
34 34
35void rtllib_crypt_deinit_entries(struct rtllib_device *ieee, 35void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info,
36 int force) 36 int force)
37{ 37{
38 struct list_head *ptr, *n; 38 struct list_head *ptr, *n;
39 struct lib80211_crypt_data *entry; 39 struct lib80211_crypt_data *entry;
40 40
41 for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; 41 for (ptr = info->crypt_deinit_list.next, n = ptr->next;
42 ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { 42 ptr != &info->crypt_deinit_list; ptr = n, n = ptr->next) {
43 entry = list_entry(ptr, struct lib80211_crypt_data, list); 43 entry = list_entry(ptr, struct lib80211_crypt_data, list);
44 44
45 if (atomic_read(&entry->refcnt) != 0 && !force) 45 if (atomic_read(&entry->refcnt) != 0 && !force)
@@ -56,24 +56,24 @@ EXPORT_SYMBOL(rtllib_crypt_deinit_entries);
56 56
57void rtllib_crypt_deinit_handler(unsigned long data) 57void rtllib_crypt_deinit_handler(unsigned long data)
58{ 58{
59 struct rtllib_device *ieee = (struct rtllib_device *)data; 59 struct lib80211_crypt_info *info = (struct lib80211_crypt_info *)data;
60 unsigned long flags; 60 unsigned long flags;
61 61
62 spin_lock_irqsave(&ieee->lock, flags); 62 spin_lock_irqsave(info->lock, flags);
63 rtllib_crypt_deinit_entries(ieee, 0); 63 rtllib_crypt_deinit_entries(info, 0);
64 if (!list_empty(&ieee->crypt_deinit_list)) { 64 if (!list_empty(&info->crypt_deinit_list)) {
65 printk(KERN_DEBUG "%s: entries remaining in delayed crypt " 65 printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
66 "deletion list\n", ieee->dev->name); 66 "deletion list\n", info->name);
67 ieee->crypt_deinit_timer.expires = jiffies + HZ; 67 info->crypt_deinit_timer.expires = jiffies + HZ;
68 add_timer(&ieee->crypt_deinit_timer); 68 add_timer(&info->crypt_deinit_timer);
69 } 69 }
70 spin_unlock_irqrestore(&ieee->lock, flags); 70 spin_unlock_irqrestore(info->lock, flags);
71 71
72} 72}
73EXPORT_SYMBOL(rtllib_crypt_deinit_handler); 73EXPORT_SYMBOL(rtllib_crypt_deinit_handler);
74 74
75void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, 75void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info,
76 struct lib80211_crypt_data **crypt) 76 struct lib80211_crypt_data **crypt)
77{ 77{
78 struct lib80211_crypt_data *tmp; 78 struct lib80211_crypt_data *tmp;
79 unsigned long flags; 79 unsigned long flags;
@@ -88,13 +88,13 @@ void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
88 * decrypt operations. Use a list of delayed deinits to avoid needing 88 * decrypt operations. Use a list of delayed deinits to avoid needing
89 * locking. */ 89 * locking. */
90 90
91 spin_lock_irqsave(&ieee->lock, flags); 91 spin_lock_irqsave(info->lock, flags);
92 list_add(&tmp->list, &ieee->crypt_deinit_list); 92 list_add(&tmp->list, &info->crypt_deinit_list);
93 if (!timer_pending(&ieee->crypt_deinit_timer)) { 93 if (!timer_pending(&info->crypt_deinit_timer)) {
94 ieee->crypt_deinit_timer.expires = jiffies + HZ; 94 info->crypt_deinit_timer.expires = jiffies + HZ;
95 add_timer(&ieee->crypt_deinit_timer); 95 add_timer(&info->crypt_deinit_timer);
96 } 96 }
97 spin_unlock_irqrestore(&ieee->lock, flags); 97 spin_unlock_irqrestore(info->lock, flags);
98} 98}
99EXPORT_SYMBOL(rtllib_crypt_delayed_deinit); 99EXPORT_SYMBOL(rtllib_crypt_delayed_deinit);
100 100
diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h
index 8c058f2b6690..e177c9287b44 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt.h
+++ b/drivers/staging/rtl8192e/rtllib_crypt.h
@@ -28,8 +28,8 @@
28int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops); 28int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops);
29int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops); 29int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
30struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name); 30struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name);
31void rtllib_crypt_deinit_entries(struct rtllib_device *, int); 31void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info, int force);
32void rtllib_crypt_deinit_handler(unsigned long); 32void rtllib_crypt_deinit_handler(unsigned long data);
33void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, 33void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info,
34 struct lib80211_crypt_data **crypt); 34 struct lib80211_crypt_data **crypt);
35#endif 35#endif
diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
index f08926776d15..35ea93de3682 100644
--- a/drivers/staging/rtl8192e/rtllib_module.c
+++ b/drivers/staging/rtl8192e/rtllib_module.c
@@ -137,10 +137,10 @@ struct net_device *alloc_rtllib(int sizeof_priv)
137 ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ 137 ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
138 138
139 /* SAM Init here */ 139 /* SAM Init here */
140 INIT_LIST_HEAD(&ieee->crypt_deinit_list); 140 INIT_LIST_HEAD(&ieee->crypt_info.crypt_deinit_list);
141 _setup_timer(&ieee->crypt_deinit_timer, 141 _setup_timer(&ieee->crypt_info.crypt_deinit_timer,
142 rtllib_crypt_deinit_handler, 142 rtllib_crypt_deinit_handler,
143 (unsigned long) ieee); 143 (unsigned long)&ieee->crypt_info);
144 ieee->rtllib_ap_sec_type = rtllib_ap_sec_type; 144 ieee->rtllib_ap_sec_type = rtllib_ap_sec_type;
145 145
146 spin_lock_init(&ieee->lock); 146 spin_lock_init(&ieee->lock);
@@ -197,16 +197,18 @@ void free_rtllib(struct net_device *dev)
197 kfree(ieee->pHTInfo); 197 kfree(ieee->pHTInfo);
198 ieee->pHTInfo = NULL; 198 ieee->pHTInfo = NULL;
199 rtllib_softmac_free(ieee); 199 rtllib_softmac_free(ieee);
200 del_timer_sync(&ieee->crypt_deinit_timer); 200
201 rtllib_crypt_deinit_entries(ieee, 1); 201 /* SAM cleanup */
202 del_timer_sync(&ieee->crypt_info.crypt_deinit_timer);
203 rtllib_crypt_deinit_entries(&ieee->crypt_info, 1);
202 204
203 for (i = 0; i < NUM_WEP_KEYS; i++) { 205 for (i = 0; i < NUM_WEP_KEYS; i++) {
204 struct lib80211_crypt_data *crypt = ieee->crypt[i]; 206 struct lib80211_crypt_data *crypt = ieee->crypt_info.crypt[i];
205 if (crypt) { 207 if (crypt) {
206 if (crypt->ops) 208 if (crypt->ops)
207 crypt->ops->deinit(crypt->priv); 209 crypt->ops->deinit(crypt->priv);
208 kfree(crypt); 210 kfree(crypt);
209 ieee->crypt[i] = NULL; 211 ieee->crypt_info.crypt[i] = NULL;
210 } 212 }
211 } 213 }
212 214
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index d02a88bb3a46..6c5061f12bad 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1019,7 +1019,7 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
1019 if (skb->len >= hdrlen + 3) 1019 if (skb->len >= hdrlen + 3)
1020 idx = skb->data[hdrlen + 3] >> 6; 1020 idx = skb->data[hdrlen + 3] >> 6;
1021 1021
1022 *crypt = ieee->crypt[idx]; 1022 *crypt = ieee->crypt_info.crypt[idx];
1023 /* allow NULL decrypt to indicate an station specific override 1023 /* allow NULL decrypt to indicate an station specific override
1024 * for default encryption */ 1024 * for default encryption */
1025 if (*crypt && ((*crypt)->ops == NULL || 1025 if (*crypt && ((*crypt)->ops == NULL ||
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 47c163b9e35d..80d147693490 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -871,7 +871,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest)
871 } else 871 } else
872 erp_len = 0; 872 erp_len = 0;
873 873
874 crypt = ieee->crypt[ieee->tx_keyidx]; 874 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
875 encrypt = ieee->host_encrypt && crypt && crypt->ops && 875 encrypt = ieee->host_encrypt && crypt && crypt->ops &&
876 ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); 876 ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len));
877 if (ieee->pHTInfo->bCurrentHTSupport) { 877 if (ieee->pHTInfo->bCurrentHTSupport) {
@@ -923,7 +923,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest)
923 cpu_to_le16((beacon_buf->capability |= 923 cpu_to_le16((beacon_buf->capability |=
924 WLAN_CAPABILITY_SHORT_SLOT_TIME)); 924 WLAN_CAPABILITY_SHORT_SLOT_TIME));
925 925
926 crypt = ieee->crypt[ieee->tx_keyidx]; 926 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
927 if (encrypt) 927 if (encrypt)
928 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); 928 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
929 929
@@ -1013,7 +1013,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest)
1013 cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); 1013 cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME);
1014 1014
1015 if (ieee->host_encrypt) 1015 if (ieee->host_encrypt)
1016 crypt = ieee->crypt[ieee->tx_keyidx]; 1016 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
1017 else 1017 else
1018 crypt = NULL; 1018 crypt = NULL;
1019 1019
@@ -1191,7 +1191,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
1191 unsigned int turbo_info_len = beacon->Turbo_Enable ? 9 : 0; 1191 unsigned int turbo_info_len = beacon->Turbo_Enable ? 9 : 0;
1192 1192
1193 int len = 0; 1193 int len = 0;
1194 crypt = ieee->crypt[ieee->tx_keyidx]; 1194 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
1195 if (crypt != NULL) 1195 if (crypt != NULL)
1196 encrypt = ieee->host_encrypt && crypt && crypt->ops && 1196 encrypt = ieee->host_encrypt && crypt && crypt->ops &&
1197 ((0 == strcmp(crypt->ops->name, "WEP") || 1197 ((0 == strcmp(crypt->ops->name, "WEP") ||
@@ -3367,7 +3367,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
3367 param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 3367 param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
3368 if (param->u.crypt.idx >= NUM_WEP_KEYS) 3368 if (param->u.crypt.idx >= NUM_WEP_KEYS)
3369 return -EINVAL; 3369 return -EINVAL;
3370 crypt = &ieee->crypt[param->u.crypt.idx]; 3370 crypt = &ieee->crypt_info.crypt[param->u.crypt.idx];
3371 } else { 3371 } else {
3372 return -EINVAL; 3372 return -EINVAL;
3373 } 3373 }
@@ -3377,7 +3377,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
3377 sec.enabled = 0; 3377 sec.enabled = 0;
3378 sec.level = SEC_LEVEL_0; 3378 sec.level = SEC_LEVEL_0;
3379 sec.flags |= SEC_ENABLED | SEC_LEVEL; 3379 sec.flags |= SEC_ENABLED | SEC_LEVEL;
3380 rtllib_crypt_delayed_deinit(ieee, crypt); 3380 rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
3381 } 3381 }
3382 goto done; 3382 goto done;
3383 } 3383 }
@@ -3410,7 +3410,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
3410 if (*crypt == NULL || (*crypt)->ops != ops) { 3410 if (*crypt == NULL || (*crypt)->ops != ops) {
3411 struct lib80211_crypt_data *new_crypt; 3411 struct lib80211_crypt_data *new_crypt;
3412 3412
3413 rtllib_crypt_delayed_deinit(ieee, crypt); 3413 rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
3414 3414
3415 new_crypt = (struct lib80211_crypt_data *) 3415 new_crypt = (struct lib80211_crypt_data *)
3416 kmalloc(sizeof(*new_crypt), GFP_KERNEL); 3416 kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -3446,7 +3446,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
3446 3446
3447 skip_host_crypt: 3447 skip_host_crypt:
3448 if (param->u.crypt.set_tx) { 3448 if (param->u.crypt.set_tx) {
3449 ieee->tx_keyidx = param->u.crypt.idx; 3449 ieee->crypt_info.tx_keyidx = param->u.crypt.idx;
3450 sec.active_key = param->u.crypt.idx; 3450 sec.active_key = param->u.crypt.idx;
3451 sec.flags |= SEC_ACTIVE_KEY; 3451 sec.flags |= SEC_ACTIVE_KEY;
3452 } else 3452 } else
@@ -3565,7 +3565,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee)
3565 struct lib80211_crypt_data *crypt; 3565 struct lib80211_crypt_data *crypt;
3566 int encrypt; 3566 int encrypt;
3567 3567
3568 crypt = ieee->crypt[ieee->tx_keyidx]; 3568 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
3569 encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY) 3569 encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY)
3570 || (ieee->host_encrypt && crypt && crypt->ops && 3570 || (ieee->host_encrypt && crypt && crypt->ops &&
3571 (0 == strcmp(crypt->ops->name, "WEP"))); 3571 (0 == strcmp(crypt->ops->name, "WEP")));
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index b038357b6175..f451bfc27a86 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -182,7 +182,7 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag,
182 struct lib80211_crypt_data *crypt = NULL; 182 struct lib80211_crypt_data *crypt = NULL;
183 int res; 183 int res;
184 184
185 crypt = ieee->crypt[ieee->tx_keyidx]; 185 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
186 186
187 if (!(crypt && crypt->ops)) { 187 if (!(crypt && crypt->ops)) {
188 printk(KERN_INFO "=========>%s(), crypt is null\n", __func__); 188 printk(KERN_INFO "=========>%s(), crypt is null\n", __func__);
@@ -645,7 +645,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
645 } 645 }
646 646
647 skb->priority = rtllib_classify(skb, IsAmsdu); 647 skb->priority = rtllib_classify(skb, IsAmsdu);
648 crypt = ieee->crypt[ieee->tx_keyidx]; 648 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
649 encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && 649 encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
650 ieee->host_encrypt && crypt && crypt->ops; 650 ieee->host_encrypt && crypt && crypt->ops;
651 if (!encrypt && ieee->ieee802_1x && 651 if (!encrypt && ieee->ieee802_1x &&
diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index 3978ed2137ef..1328dbc92f10 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -318,28 +318,28 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
318 key_provided = 1; 318 key_provided = 1;
319 } else { 319 } else {
320 key_provided = 0; 320 key_provided = 0;
321 key = ieee->tx_keyidx; 321 key = ieee->crypt_info.tx_keyidx;
322 } 322 }
323 323
324 RTLLIB_DEBUG_WX("Key: %d [%s]\n", key, key_provided ? 324 RTLLIB_DEBUG_WX("Key: %d [%s]\n", key, key_provided ?
325 "provided" : "default"); 325 "provided" : "default");
326 crypt = &ieee->crypt[key]; 326 crypt = &ieee->crypt_info.crypt[key];
327 if (erq->flags & IW_ENCODE_DISABLED) { 327 if (erq->flags & IW_ENCODE_DISABLED) {
328 if (key_provided && *crypt) { 328 if (key_provided && *crypt) {
329 RTLLIB_DEBUG_WX("Disabling encryption on key %d.\n", 329 RTLLIB_DEBUG_WX("Disabling encryption on key %d.\n",
330 key); 330 key);
331 rtllib_crypt_delayed_deinit(ieee, crypt); 331 rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
332 } else 332 } else
333 RTLLIB_DEBUG_WX("Disabling encryption.\n"); 333 RTLLIB_DEBUG_WX("Disabling encryption.\n");
334 334
335 /* Check all the keys to see if any are still configured, 335 /* Check all the keys to see if any are still configured,
336 * and if no key index was provided, de-init them all */ 336 * and if no key index was provided, de-init them all */
337 for (i = 0; i < NUM_WEP_KEYS; i++) { 337 for (i = 0; i < NUM_WEP_KEYS; i++) {
338 if (ieee->crypt[i] != NULL) { 338 if (ieee->crypt_info.crypt[i] != NULL) {
339 if (key_provided) 339 if (key_provided)
340 break; 340 break;
341 rtllib_crypt_delayed_deinit(ieee, 341 rtllib_crypt_delayed_deinit(&ieee->crypt_info,
342 &ieee->crypt[i]); 342 &ieee->crypt_info.crypt[i]);
343 } 343 }
344 } 344 }
345 345
@@ -361,7 +361,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
361 strcmp((*crypt)->ops->name, "WEP") != 0) { 361 strcmp((*crypt)->ops->name, "WEP") != 0) {
362 /* changing to use WEP; deinit previously used algorithm 362 /* changing to use WEP; deinit previously used algorithm
363 * on this key */ 363 * on this key */
364 rtllib_crypt_delayed_deinit(ieee, crypt); 364 rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
365 } 365 }
366 366
367 if (*crypt == NULL) { 367 if (*crypt == NULL) {
@@ -411,7 +411,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
411 * explicitely set */ 411 * explicitely set */
412 if (key == sec.active_key) 412 if (key == sec.active_key)
413 sec.flags |= SEC_ACTIVE_KEY; 413 sec.flags |= SEC_ACTIVE_KEY;
414 ieee->tx_keyidx = key; 414 ieee->crypt_info.tx_keyidx = key;
415 415
416 } else { 416 } else {
417 len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, 417 len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN,
@@ -434,7 +434,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
434 if (key_provided) { 434 if (key_provided) {
435 RTLLIB_DEBUG_WX( 435 RTLLIB_DEBUG_WX(
436 "Setting key %d to default Tx key.\n", key); 436 "Setting key %d to default Tx key.\n", key);
437 ieee->tx_keyidx = key; 437 ieee->crypt_info.tx_keyidx = key;
438 sec.active_key = key; 438 sec.active_key = key;
439 sec.flags |= SEC_ACTIVE_KEY; 439 sec.flags |= SEC_ACTIVE_KEY;
440 } 440 }
@@ -490,9 +490,9 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
490 return -EINVAL; 490 return -EINVAL;
491 key--; 491 key--;
492 } else { 492 } else {
493 key = ieee->tx_keyidx; 493 key = ieee->crypt_info.tx_keyidx;
494 } 494 }
495 crypt = ieee->crypt[key]; 495 crypt = ieee->crypt_info.crypt[key];
496 496
497 erq->flags = key + 1; 497 erq->flags = key + 1;
498 498
@@ -538,17 +538,17 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
538 return -EINVAL; 538 return -EINVAL;
539 idx--; 539 idx--;
540 } else{ 540 } else{
541 idx = ieee->tx_keyidx; 541 idx = ieee->crypt_info.tx_keyidx;
542 } 542 }
543 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { 543 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
544 crypt = &ieee->crypt[idx]; 544 crypt = &ieee->crypt_info.crypt[idx];
545 group_key = 1; 545 group_key = 1;
546 } else { 546 } else {
547 /* some Cisco APs use idx>0 for unicast in dynamic WEP */ 547 /* some Cisco APs use idx>0 for unicast in dynamic WEP */
548 if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) 548 if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP)
549 return -EINVAL; 549 return -EINVAL;
550 if (ieee->iw_mode == IW_MODE_INFRA) 550 if (ieee->iw_mode == IW_MODE_INFRA)
551 crypt = &ieee->crypt[idx]; 551 crypt = &ieee->crypt_info.crypt[idx];
552 else 552 else
553 return -EINVAL; 553 return -EINVAL;
554 } 554 }
@@ -557,10 +557,10 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
557 if ((encoding->flags & IW_ENCODE_DISABLED) || 557 if ((encoding->flags & IW_ENCODE_DISABLED) ||
558 ext->alg == IW_ENCODE_ALG_NONE) { 558 ext->alg == IW_ENCODE_ALG_NONE) {
559 if (*crypt) 559 if (*crypt)
560 rtllib_crypt_delayed_deinit(ieee, crypt); 560 rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
561 561
562 for (i = 0; i < NUM_WEP_KEYS; i++) { 562 for (i = 0; i < NUM_WEP_KEYS; i++) {
563 if (ieee->crypt[i] != NULL) 563 if (ieee->crypt_info.crypt[i] != NULL)
564 break; 564 break;
565 } 565 }
566 if (i == NUM_WEP_KEYS) { 566 if (i == NUM_WEP_KEYS) {
@@ -613,7 +613,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
613 if (*crypt == NULL || (*crypt)->ops != ops) { 613 if (*crypt == NULL || (*crypt)->ops != ops) {
614 struct lib80211_crypt_data *new_crypt; 614 struct lib80211_crypt_data *new_crypt;
615 615
616 rtllib_crypt_delayed_deinit(ieee, crypt); 616 rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
617 617
618 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); 618 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
619 if (new_crypt == NULL) { 619 if (new_crypt == NULL) {
@@ -642,7 +642,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
642 goto done; 642 goto done;
643 } 643 }
644 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { 644 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
645 ieee->tx_keyidx = idx; 645 ieee->crypt_info.tx_keyidx = idx;
646 sec.active_key = idx; 646 sec.active_key = idx;
647 sec.flags |= SEC_ACTIVE_KEY; 647 sec.flags |= SEC_ACTIVE_KEY;
648 } 648 }
@@ -696,14 +696,14 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
696 return -EINVAL; 696 return -EINVAL;
697 idx--; 697 idx--;
698 } else { 698 } else {
699 idx = ieee->tx_keyidx; 699 idx = ieee->crypt_info.tx_keyidx;
700 } 700 }
701 if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && 701 if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) &&
702 (ext->alg != IW_ENCODE_ALG_WEP)) 702 (ext->alg != IW_ENCODE_ALG_WEP))
703 if (idx != 0 || (ieee->iw_mode != IW_MODE_INFRA)) 703 if (idx != 0 || (ieee->iw_mode != IW_MODE_INFRA))
704 return -EINVAL; 704 return -EINVAL;
705 705
706 crypt = ieee->crypt[idx]; 706 crypt = ieee->crypt_info.crypt[idx];
707 707
708 encoding->flags = idx + 1; 708 encoding->flags = idx + 1;
709 memset(ext, 0, sizeof(*ext)); 709 memset(ext, 0, sizeof(*ext));