aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2008-10-29 11:35:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-11-21 11:08:17 -0500
commit274bfb8dc5ffa16cb073801bebe76ab7f4e2e73d (patch)
tree04cd3f6a062496911b56737daa6a0858b769ccd6 /drivers/net/wireless
parentdfe1bafdbac1c7b48b636fb7ace799e78170e0d6 (diff)
lib80211: absorb crypto bits from net/ieee80211
These bits are shared already between ipw2x00 and hostap, and could probably be shared both more cleanly and with other drivers. This commit simply relocates the code to lib80211 and adjusts the drivers appropriately. Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/hostap/Kconfig6
-rw-r--r--drivers/net/wireless/hostap/hostap.h2
-rw-r--r--drivers/net/wireless/hostap/hostap_80211.h2
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c10
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c8
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c12
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.h8
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c36
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c110
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c19
-rw-r--r--drivers/net/wireless/hostap/hostap_proc.c20
-rw-r--r--drivers/net/wireless/hostap/hostap_wlan.h6
-rw-r--r--drivers/net/wireless/ipw2100.c12
-rw-r--r--drivers/net/wireless/ipw2200.c12
14 files changed, 136 insertions, 127 deletions
diff --git a/drivers/net/wireless/hostap/Kconfig b/drivers/net/wireless/hostap/Kconfig
index 1fef33169fdd..87bbd4db4bad 100644
--- a/drivers/net/wireless/hostap/Kconfig
+++ b/drivers/net/wireless/hostap/Kconfig
@@ -2,8 +2,10 @@ config HOSTAP
2 tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)" 2 tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)"
3 depends on WLAN_80211 3 depends on WLAN_80211
4 select WIRELESS_EXT 4 select WIRELESS_EXT
5 select IEEE80211 5 select LIB80211
6 select IEEE80211_CRYPT_WEP 6 select LIB80211_CRYPT_WEP
7 select LIB80211_CRYPT_TKIP
8 select LIB80211_CRYPT_CCMP
7 ---help--- 9 ---help---
8 Shared driver code for IEEE 802.11b wireless cards based on 10 Shared driver code for IEEE 802.11b wireless cards based on
9 Intersil Prism2/2.5/3 chipset. This driver supports so called 11 Intersil Prism2/2.5/3 chipset. This driver supports so called
diff --git a/drivers/net/wireless/hostap/hostap.h b/drivers/net/wireless/hostap/hostap.h
index 3a386a636cca..2453deaa3e00 100644
--- a/drivers/net/wireless/hostap/hostap.h
+++ b/drivers/net/wireless/hostap/hostap.h
@@ -63,7 +63,7 @@ void ap_control_flush_macs(struct mac_restrictions *mac_restrictions);
63int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac); 63int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac);
64void ap_control_kickall(struct ap_data *ap); 64void ap_control_kickall(struct ap_data *ap);
65void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, 65void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent,
66 struct ieee80211_crypt_data ***crypt); 66 struct lib80211_crypt_data ***crypt);
67int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], 67int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[],
68 struct iw_quality qual[], int buf_size, 68 struct iw_quality qual[], int buf_size,
69 int aplist); 69 int aplist);
diff --git a/drivers/net/wireless/hostap/hostap_80211.h b/drivers/net/wireless/hostap/hostap_80211.h
index 3694b1eba521..3a9474d9a907 100644
--- a/drivers/net/wireless/hostap/hostap_80211.h
+++ b/drivers/net/wireless/hostap/hostap_80211.h
@@ -2,7 +2,7 @@
2#define HOSTAP_80211_H 2#define HOSTAP_80211_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <net/ieee80211_crypt.h> 5#include <net/ieee80211.h>
6 6
7struct hostap_ieee80211_mgmt { 7struct hostap_ieee80211_mgmt {
8 __le16 frame_control; 8 __le16 frame_control;
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 5f64461aa54e..19b1bf0478bd 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -1,5 +1,5 @@
1#include <linux/etherdevice.h> 1#include <linux/etherdevice.h>
2#include <net/ieee80211_crypt.h> 2#include <net/lib80211.h>
3 3
4#include "hostap_80211.h" 4#include "hostap_80211.h"
5#include "hostap.h" 5#include "hostap.h"
@@ -649,7 +649,7 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb)
649/* Called only as a tasklet (software IRQ) */ 649/* Called only as a tasklet (software IRQ) */
650static int 650static int
651hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, 651hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
652 struct ieee80211_crypt_data *crypt) 652 struct lib80211_crypt_data *crypt)
653{ 653{
654 struct ieee80211_hdr_4addr *hdr; 654 struct ieee80211_hdr_4addr *hdr;
655 int res, hdrlen; 655 int res, hdrlen;
@@ -687,7 +687,7 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
687/* Called only as a tasklet (software IRQ) */ 687/* Called only as a tasklet (software IRQ) */
688static int 688static int
689hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, 689hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb,
690 int keyidx, struct ieee80211_crypt_data *crypt) 690 int keyidx, struct lib80211_crypt_data *crypt)
691{ 691{
692 struct ieee80211_hdr_4addr *hdr; 692 struct ieee80211_hdr_4addr *hdr;
693 int res, hdrlen; 693 int res, hdrlen;
@@ -733,7 +733,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
733 int from_assoc_ap = 0; 733 int from_assoc_ap = 0;
734 u8 dst[ETH_ALEN]; 734 u8 dst[ETH_ALEN];
735 u8 src[ETH_ALEN]; 735 u8 src[ETH_ALEN];
736 struct ieee80211_crypt_data *crypt = NULL; 736 struct lib80211_crypt_data *crypt = NULL;
737 void *sta = NULL; 737 void *sta = NULL;
738 int keyidx = 0; 738 int keyidx = 0;
739 739
@@ -785,7 +785,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
785 int idx = 0; 785 int idx = 0;
786 if (skb->len >= hdrlen + 3) 786 if (skb->len >= hdrlen + 3)
787 idx = skb->data[hdrlen + 3] >> 6; 787 idx = skb->data[hdrlen + 3] >> 6;
788 crypt = local->crypt[idx]; 788 crypt = local->crypt_info.crypt[idx];
789 sta = NULL; 789 sta = NULL;
790 790
791 /* Use station specific key to override default keys if the 791 /* Use station specific key to override default keys if the
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 075247188e64..078a010f39a0 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -306,7 +306,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
306 306
307/* Called only from software IRQ */ 307/* Called only from software IRQ */
308static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, 308static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
309 struct ieee80211_crypt_data *crypt) 309 struct lib80211_crypt_data *crypt)
310{ 310{
311 struct hostap_interface *iface; 311 struct hostap_interface *iface;
312 local_info_t *local; 312 local_info_t *local;
@@ -405,7 +405,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
405 if (local->host_encrypt) { 405 if (local->host_encrypt) {
406 /* Set crypt to default algorithm and key; will be replaced in 406 /* Set crypt to default algorithm and key; will be replaced in
407 * AP code if STA has own alg/key */ 407 * AP code if STA has own alg/key */
408 tx.crypt = local->crypt[local->tx_keyidx]; 408 tx.crypt = local->crypt_info.crypt[local->crypt_info.tx_keyidx];
409 tx.host_encrypt = 1; 409 tx.host_encrypt = 1;
410 } else { 410 } else {
411 tx.crypt = NULL; 411 tx.crypt = NULL;
@@ -487,7 +487,9 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
487 487
488 if (tx.crypt && (!tx.crypt->ops || !tx.crypt->ops->encrypt_mpdu)) 488 if (tx.crypt && (!tx.crypt->ops || !tx.crypt->ops->encrypt_mpdu))
489 tx.crypt = NULL; 489 tx.crypt = NULL;
490 else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) { 490 else if ((tx.crypt ||
491 local->crypt_info.crypt[local->crypt_info.tx_keyidx]) &&
492 !no_encrypt) {
491 /* Add ISWEP flag both for firmware and host based encryption 493 /* Add ISWEP flag both for firmware and host based encryption
492 */ 494 */
493 fc |= IEEE80211_FCTL_PROTECTED; 495 fc |= IEEE80211_FCTL_PROTECTED;
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index dec3dbe1bf8f..0903db786d5f 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1206,7 +1206,7 @@ static void prism2_check_tx_rates(struct sta_info *sta)
1206 1206
1207static void ap_crypt_init(struct ap_data *ap) 1207static void ap_crypt_init(struct ap_data *ap)
1208{ 1208{
1209 ap->crypt = ieee80211_get_crypto_ops("WEP"); 1209 ap->crypt = lib80211_get_crypto_ops("WEP");
1210 1210
1211 if (ap->crypt) { 1211 if (ap->crypt) {
1212 if (ap->crypt->init) { 1212 if (ap->crypt->init) {
@@ -1224,7 +1224,7 @@ static void ap_crypt_init(struct ap_data *ap)
1224 1224
1225 if (ap->crypt == NULL) { 1225 if (ap->crypt == NULL) {
1226 printk(KERN_WARNING "AP could not initialize WEP: load module " 1226 printk(KERN_WARNING "AP could not initialize WEP: load module "
1227 "ieee80211_crypt_wep.ko\n"); 1227 "lib80211_crypt_wep.ko\n");
1228 } 1228 }
1229} 1229}
1230 1230
@@ -1293,7 +1293,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1293 __le16 *pos; 1293 __le16 *pos;
1294 u16 resp = WLAN_STATUS_SUCCESS, fc; 1294 u16 resp = WLAN_STATUS_SUCCESS, fc;
1295 struct sta_info *sta = NULL; 1295 struct sta_info *sta = NULL;
1296 struct ieee80211_crypt_data *crypt; 1296 struct lib80211_crypt_data *crypt;
1297 char *txt = ""; 1297 char *txt = "";
1298 1298
1299 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1299 len = skb->len - IEEE80211_MGMT_HDR_LEN;
@@ -1319,7 +1319,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1319 int idx = 0; 1319 int idx = 0;
1320 if (skb->len >= hdrlen + 3) 1320 if (skb->len >= hdrlen + 3)
1321 idx = skb->data[hdrlen + 3] >> 6; 1321 idx = skb->data[hdrlen + 3] >> 6;
1322 crypt = local->crypt[idx]; 1322 crypt = local->crypt_info.crypt[idx];
1323 } 1323 }
1324 1324
1325 pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); 1325 pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN);
@@ -3065,7 +3065,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3065/* Called only as a tasklet (software IRQ) */ 3065/* Called only as a tasklet (software IRQ) */
3066int hostap_handle_sta_crypto(local_info_t *local, 3066int hostap_handle_sta_crypto(local_info_t *local,
3067 struct ieee80211_hdr_4addr *hdr, 3067 struct ieee80211_hdr_4addr *hdr,
3068 struct ieee80211_crypt_data **crypt, 3068 struct lib80211_crypt_data **crypt,
3069 void **sta_ptr) 3069 void **sta_ptr)
3070{ 3070{
3071 struct sta_info *sta; 3071 struct sta_info *sta;
@@ -3213,7 +3213,7 @@ void hostap_update_rates(local_info_t *local)
3213 3213
3214 3214
3215void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, 3215void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent,
3216 struct ieee80211_crypt_data ***crypt) 3216 struct lib80211_crypt_data ***crypt)
3217{ 3217{
3218 struct sta_info *sta; 3218 struct sta_info *sta;
3219 3219
diff --git a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h
index 2fa2452b6b07..d36e4b175336 100644
--- a/drivers/net/wireless/hostap/hostap_ap.h
+++ b/drivers/net/wireless/hostap/hostap_ap.h
@@ -74,7 +74,7 @@ struct sta_info {
74 u32 tx_since_last_failure; 74 u32 tx_since_last_failure;
75 u32 tx_consecutive_exc; 75 u32 tx_consecutive_exc;
76 76
77 struct ieee80211_crypt_data *crypt; 77 struct lib80211_crypt_data *crypt;
78 78
79 int ap; /* whether this station is an AP */ 79 int ap; /* whether this station is an AP */
80 80
@@ -209,7 +209,7 @@ struct ap_data {
209 209
210 /* WEP operations for generating challenges to be used with shared key 210 /* WEP operations for generating challenges to be used with shared key
211 * authentication */ 211 * authentication */
212 struct ieee80211_crypto_ops *crypt; 212 struct lib80211_crypto_ops *crypt;
213 void *crypt_priv; 213 void *crypt_priv;
214#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 214#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
215}; 215};
@@ -229,7 +229,7 @@ typedef enum {
229struct hostap_tx_data { 229struct hostap_tx_data {
230 struct sk_buff *skb; 230 struct sk_buff *skb;
231 int host_encrypt; 231 int host_encrypt;
232 struct ieee80211_crypt_data *crypt; 232 struct lib80211_crypt_data *crypt;
233 void *sta_ptr; 233 void *sta_ptr;
234}; 234};
235ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); 235ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx);
@@ -244,7 +244,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
244 struct hostap_80211_rx_status *rx_stats, 244 struct hostap_80211_rx_status *rx_stats,
245 int wds); 245 int wds);
246int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr_4addr *hdr, 246int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
247 struct ieee80211_crypt_data **crypt, 247 struct lib80211_crypt_data **crypt,
248 void **sta_ptr); 248 void **sta_ptr);
249int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); 249int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr);
250int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); 250int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr);
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index fd7f7ceeac46..066299fc9259 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -47,7 +47,7 @@
47#include <linux/wireless.h> 47#include <linux/wireless.h>
48#include <net/iw_handler.h> 48#include <net/iw_handler.h>
49#include <net/ieee80211.h> 49#include <net/ieee80211.h>
50#include <net/ieee80211_crypt.h> 50#include <net/lib80211.h>
51#include <asm/irq.h> 51#include <asm/irq.h>
52 52
53#include "hostap_80211.h" 53#include "hostap_80211.h"
@@ -2791,11 +2791,12 @@ static void prism2_check_sta_fw_version(local_info_t *local)
2791static void prism2_crypt_deinit_entries(local_info_t *local, int force) 2791static void prism2_crypt_deinit_entries(local_info_t *local, int force)
2792{ 2792{
2793 struct list_head *ptr, *n; 2793 struct list_head *ptr, *n;
2794 struct ieee80211_crypt_data *entry; 2794 struct lib80211_crypt_data *entry;
2795 2795
2796 for (ptr = local->crypt_deinit_list.next, n = ptr->next; 2796 for (ptr = local->crypt_info.crypt_deinit_list.next, n = ptr->next;
2797 ptr != &local->crypt_deinit_list; ptr = n, n = ptr->next) { 2797 ptr != &local->crypt_info.crypt_deinit_list;
2798 entry = list_entry(ptr, struct ieee80211_crypt_data, list); 2798 ptr = n, n = ptr->next) {
2799 entry = list_entry(ptr, struct lib80211_crypt_data, list);
2799 2800
2800 if (atomic_read(&entry->refcnt) != 0 && !force) 2801 if (atomic_read(&entry->refcnt) != 0 && !force)
2801 continue; 2802 continue;
@@ -2816,11 +2817,11 @@ static void prism2_crypt_deinit_handler(unsigned long data)
2816 2817
2817 spin_lock_irqsave(&local->lock, flags); 2818 spin_lock_irqsave(&local->lock, flags);
2818 prism2_crypt_deinit_entries(local, 0); 2819 prism2_crypt_deinit_entries(local, 0);
2819 if (!list_empty(&local->crypt_deinit_list)) { 2820 if (!list_empty(&local->crypt_info.crypt_deinit_list)) {
2820 printk(KERN_DEBUG "%s: entries remaining in delayed crypt " 2821 printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
2821 "deletion list\n", local->dev->name); 2822 "deletion list\n", local->dev->name);
2822 local->crypt_deinit_timer.expires = jiffies + HZ; 2823 local->crypt_info.crypt_deinit_timer.expires = jiffies + HZ;
2823 add_timer(&local->crypt_deinit_timer); 2824 add_timer(&local->crypt_info.crypt_deinit_timer);
2824 } 2825 }
2825 spin_unlock_irqrestore(&local->lock, flags); 2826 spin_unlock_irqrestore(&local->lock, flags);
2826 2827
@@ -3250,10 +3251,13 @@ while (0)
3250 3251
3251 INIT_LIST_HEAD(&local->cmd_queue); 3252 INIT_LIST_HEAD(&local->cmd_queue);
3252 init_waitqueue_head(&local->hostscan_wq); 3253 init_waitqueue_head(&local->hostscan_wq);
3253 INIT_LIST_HEAD(&local->crypt_deinit_list); 3254
3254 init_timer(&local->crypt_deinit_timer); 3255 local->crypt_info.name = dev->name;
3255 local->crypt_deinit_timer.data = (unsigned long) local; 3256 local->crypt_info.lock = &local->lock;
3256 local->crypt_deinit_timer.function = prism2_crypt_deinit_handler; 3257 INIT_LIST_HEAD(&local->crypt_info.crypt_deinit_list);
3258 init_timer(&local->crypt_info.crypt_deinit_timer);
3259 local->crypt_info.crypt_deinit_timer.data = (unsigned long) local;
3260 local->crypt_info.crypt_deinit_timer.function = prism2_crypt_deinit_handler;
3257 3261
3258 init_timer(&local->passive_scan_timer); 3262 init_timer(&local->passive_scan_timer);
3259 local->passive_scan_timer.data = (unsigned long) local; 3263 local->passive_scan_timer.data = (unsigned long) local;
@@ -3354,8 +3358,8 @@ static void prism2_free_local_data(struct net_device *dev)
3354 3358
3355 flush_scheduled_work(); 3359 flush_scheduled_work();
3356 3360
3357 if (timer_pending(&local->crypt_deinit_timer)) 3361 if (timer_pending(&local->crypt_info.crypt_deinit_timer))
3358 del_timer(&local->crypt_deinit_timer); 3362 del_timer(&local->crypt_info.crypt_deinit_timer);
3359 prism2_crypt_deinit_entries(local, 1); 3363 prism2_crypt_deinit_entries(local, 1);
3360 3364
3361 if (timer_pending(&local->passive_scan_timer)) 3365 if (timer_pending(&local->passive_scan_timer))
@@ -3374,12 +3378,12 @@ static void prism2_free_local_data(struct net_device *dev)
3374 prism2_callback(local, PRISM2_CALLBACK_DISABLE); 3378 prism2_callback(local, PRISM2_CALLBACK_DISABLE);
3375 3379
3376 for (i = 0; i < WEP_KEYS; i++) { 3380 for (i = 0; i < WEP_KEYS; i++) {
3377 struct ieee80211_crypt_data *crypt = local->crypt[i]; 3381 struct lib80211_crypt_data *crypt = local->crypt_info.crypt[i];
3378 if (crypt) { 3382 if (crypt) {
3379 if (crypt->ops) 3383 if (crypt->ops)
3380 crypt->ops->deinit(crypt->priv); 3384 crypt->ops->deinit(crypt->priv);
3381 kfree(crypt); 3385 kfree(crypt);
3382 local->crypt[i] = NULL; 3386 local->crypt_info.crypt[i] = NULL;
3383 } 3387 }
3384 } 3388 }
3385 3389
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 2318c5df7a08..29aebb679099 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -2,7 +2,7 @@
2 2
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/ethtool.h> 4#include <linux/ethtool.h>
5#include <net/ieee80211_crypt.h> 5#include <net/lib80211.h>
6 6
7#include "hostap_wlan.h" 7#include "hostap_wlan.h"
8#include "hostap.h" 8#include "hostap.h"
@@ -117,9 +117,9 @@ static int prism2_get_name(struct net_device *dev,
117 117
118 118
119static void prism2_crypt_delayed_deinit(local_info_t *local, 119static void prism2_crypt_delayed_deinit(local_info_t *local,
120 struct ieee80211_crypt_data **crypt) 120 struct lib80211_crypt_data **crypt)
121{ 121{
122 struct ieee80211_crypt_data *tmp; 122 struct lib80211_crypt_data *tmp;
123 unsigned long flags; 123 unsigned long flags;
124 124
125 tmp = *crypt; 125 tmp = *crypt;
@@ -133,10 +133,10 @@ static void prism2_crypt_delayed_deinit(local_info_t *local,
133 * locking. */ 133 * locking. */
134 134
135 spin_lock_irqsave(&local->lock, flags); 135 spin_lock_irqsave(&local->lock, flags);
136 list_add(&tmp->list, &local->crypt_deinit_list); 136 list_add(&tmp->list, &local->crypt_info.crypt_deinit_list);
137 if (!timer_pending(&local->crypt_deinit_timer)) { 137 if (!timer_pending(&local->crypt_info.crypt_deinit_timer)) {
138 local->crypt_deinit_timer.expires = jiffies + HZ; 138 local->crypt_info.crypt_deinit_timer.expires = jiffies + HZ;
139 add_timer(&local->crypt_deinit_timer); 139 add_timer(&local->crypt_info.crypt_deinit_timer);
140 } 140 }
141 spin_unlock_irqrestore(&local->lock, flags); 141 spin_unlock_irqrestore(&local->lock, flags);
142} 142}
@@ -149,20 +149,20 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
149 struct hostap_interface *iface; 149 struct hostap_interface *iface;
150 local_info_t *local; 150 local_info_t *local;
151 int i; 151 int i;
152 struct ieee80211_crypt_data **crypt; 152 struct lib80211_crypt_data **crypt;
153 153
154 iface = netdev_priv(dev); 154 iface = netdev_priv(dev);
155 local = iface->local; 155 local = iface->local;
156 156
157 i = erq->flags & IW_ENCODE_INDEX; 157 i = erq->flags & IW_ENCODE_INDEX;
158 if (i < 1 || i > 4) 158 if (i < 1 || i > 4)
159 i = local->tx_keyidx; 159 i = local->crypt_info.tx_keyidx;
160 else 160 else
161 i--; 161 i--;
162 if (i < 0 || i >= WEP_KEYS) 162 if (i < 0 || i >= WEP_KEYS)
163 return -EINVAL; 163 return -EINVAL;
164 164
165 crypt = &local->crypt[i]; 165 crypt = &local->crypt_info.crypt[i];
166 166
167 if (erq->flags & IW_ENCODE_DISABLED) { 167 if (erq->flags & IW_ENCODE_DISABLED) {
168 if (*crypt) 168 if (*crypt)
@@ -177,17 +177,17 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
177 } 177 }
178 178
179 if (*crypt == NULL) { 179 if (*crypt == NULL) {
180 struct ieee80211_crypt_data *new_crypt; 180 struct lib80211_crypt_data *new_crypt;
181 181
182 /* take WEP into use */ 182 /* take WEP into use */
183 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), 183 new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
184 GFP_KERNEL); 184 GFP_KERNEL);
185 if (new_crypt == NULL) 185 if (new_crypt == NULL)
186 return -ENOMEM; 186 return -ENOMEM;
187 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 187 new_crypt->ops = lib80211_get_crypto_ops("WEP");
188 if (!new_crypt->ops) { 188 if (!new_crypt->ops) {
189 request_module("ieee80211_crypt_wep"); 189 request_module("lib80211_crypt_wep");
190 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 190 new_crypt->ops = lib80211_get_crypto_ops("WEP");
191 } 191 }
192 if (new_crypt->ops) 192 if (new_crypt->ops)
193 new_crypt->priv = new_crypt->ops->init(i); 193 new_crypt->priv = new_crypt->ops->init(i);
@@ -210,16 +210,16 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
210 memset(keybuf + erq->length, 0, len - erq->length); 210 memset(keybuf + erq->length, 0, len - erq->length);
211 (*crypt)->ops->set_key(keybuf, len, NULL, (*crypt)->priv); 211 (*crypt)->ops->set_key(keybuf, len, NULL, (*crypt)->priv);
212 for (j = 0; j < WEP_KEYS; j++) { 212 for (j = 0; j < WEP_KEYS; j++) {
213 if (j != i && local->crypt[j]) { 213 if (j != i && local->crypt_info.crypt[j]) {
214 first = 0; 214 first = 0;
215 break; 215 break;
216 } 216 }
217 } 217 }
218 if (first) 218 if (first)
219 local->tx_keyidx = i; 219 local->crypt_info.tx_keyidx = i;
220 } else { 220 } else {
221 /* No key data - just set the default TX key index */ 221 /* No key data - just set the default TX key index */
222 local->tx_keyidx = i; 222 local->crypt_info.tx_keyidx = i;
223 } 223 }
224 224
225 done: 225 done:
@@ -252,20 +252,20 @@ static int prism2_ioctl_giwencode(struct net_device *dev,
252 local_info_t *local; 252 local_info_t *local;
253 int i, len; 253 int i, len;
254 u16 val; 254 u16 val;
255 struct ieee80211_crypt_data *crypt; 255 struct lib80211_crypt_data *crypt;
256 256
257 iface = netdev_priv(dev); 257 iface = netdev_priv(dev);
258 local = iface->local; 258 local = iface->local;
259 259
260 i = erq->flags & IW_ENCODE_INDEX; 260 i = erq->flags & IW_ENCODE_INDEX;
261 if (i < 1 || i > 4) 261 if (i < 1 || i > 4)
262 i = local->tx_keyidx; 262 i = local->crypt_info.tx_keyidx;
263 else 263 else
264 i--; 264 i--;
265 if (i < 0 || i >= WEP_KEYS) 265 if (i < 0 || i >= WEP_KEYS)
266 return -EINVAL; 266 return -EINVAL;
267 267
268 crypt = local->crypt[i]; 268 crypt = local->crypt_info.crypt[i];
269 erq->flags = i + 1; 269 erq->flags = i + 1;
270 270
271 if (crypt == NULL || crypt->ops == NULL) { 271 if (crypt == NULL || crypt->ops == NULL) {
@@ -3227,8 +3227,8 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3227 local_info_t *local = iface->local; 3227 local_info_t *local = iface->local;
3228 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 3228 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
3229 int i, ret = 0; 3229 int i, ret = 0;
3230 struct ieee80211_crypto_ops *ops; 3230 struct lib80211_crypto_ops *ops;
3231 struct ieee80211_crypt_data **crypt; 3231 struct lib80211_crypt_data **crypt;
3232 void *sta_ptr; 3232 void *sta_ptr;
3233 u8 *addr; 3233 u8 *addr;
3234 const char *alg, *module; 3234 const char *alg, *module;
@@ -3237,7 +3237,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3237 if (i > WEP_KEYS) 3237 if (i > WEP_KEYS)
3238 return -EINVAL; 3238 return -EINVAL;
3239 if (i < 1 || i > WEP_KEYS) 3239 if (i < 1 || i > WEP_KEYS)
3240 i = local->tx_keyidx; 3240 i = local->crypt_info.tx_keyidx;
3241 else 3241 else
3242 i--; 3242 i--;
3243 if (i < 0 || i >= WEP_KEYS) 3243 if (i < 0 || i >= WEP_KEYS)
@@ -3247,7 +3247,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3247 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && 3247 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff &&
3248 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) { 3248 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) {
3249 sta_ptr = NULL; 3249 sta_ptr = NULL;
3250 crypt = &local->crypt[i]; 3250 crypt = &local->crypt_info.crypt[i];
3251 } else { 3251 } else {
3252 if (i != 0) 3252 if (i != 0)
3253 return -EINVAL; 3253 return -EINVAL;
@@ -3260,7 +3260,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3260 * is emulated by using default key idx 0. 3260 * is emulated by using default key idx 0.
3261 */ 3261 */
3262 i = 0; 3262 i = 0;
3263 crypt = &local->crypt[i]; 3263 crypt = &local->crypt_info.crypt[i];
3264 } else 3264 } else
3265 return -EINVAL; 3265 return -EINVAL;
3266 } 3266 }
@@ -3276,15 +3276,15 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3276 switch (ext->alg) { 3276 switch (ext->alg) {
3277 case IW_ENCODE_ALG_WEP: 3277 case IW_ENCODE_ALG_WEP:
3278 alg = "WEP"; 3278 alg = "WEP";
3279 module = "ieee80211_crypt_wep"; 3279 module = "lib80211_crypt_wep";
3280 break; 3280 break;
3281 case IW_ENCODE_ALG_TKIP: 3281 case IW_ENCODE_ALG_TKIP:
3282 alg = "TKIP"; 3282 alg = "TKIP";
3283 module = "ieee80211_crypt_tkip"; 3283 module = "lib80211_crypt_tkip";
3284 break; 3284 break;
3285 case IW_ENCODE_ALG_CCMP: 3285 case IW_ENCODE_ALG_CCMP:
3286 alg = "CCMP"; 3286 alg = "CCMP";
3287 module = "ieee80211_crypt_ccmp"; 3287 module = "lib80211_crypt_ccmp";
3288 break; 3288 break;
3289 default: 3289 default:
3290 printk(KERN_DEBUG "%s: unsupported algorithm %d\n", 3290 printk(KERN_DEBUG "%s: unsupported algorithm %d\n",
@@ -3293,10 +3293,10 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3293 goto done; 3293 goto done;
3294 } 3294 }
3295 3295
3296 ops = ieee80211_get_crypto_ops(alg); 3296 ops = lib80211_get_crypto_ops(alg);
3297 if (ops == NULL) { 3297 if (ops == NULL) {
3298 request_module(module); 3298 request_module(module);
3299 ops = ieee80211_get_crypto_ops(alg); 3299 ops = lib80211_get_crypto_ops(alg);
3300 } 3300 }
3301 if (ops == NULL) { 3301 if (ops == NULL) {
3302 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n", 3302 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n",
@@ -3315,11 +3315,11 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3315 } 3315 }
3316 3316
3317 if (*crypt == NULL || (*crypt)->ops != ops) { 3317 if (*crypt == NULL || (*crypt)->ops != ops) {
3318 struct ieee80211_crypt_data *new_crypt; 3318 struct lib80211_crypt_data *new_crypt;
3319 3319
3320 prism2_crypt_delayed_deinit(local, crypt); 3320 prism2_crypt_delayed_deinit(local, crypt);
3321 3321
3322 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), 3322 new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
3323 GFP_KERNEL); 3323 GFP_KERNEL);
3324 if (new_crypt == NULL) { 3324 if (new_crypt == NULL) {
3325 ret = -ENOMEM; 3325 ret = -ENOMEM;
@@ -3354,20 +3354,20 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3354 3354
3355 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { 3355 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
3356 if (!sta_ptr) 3356 if (!sta_ptr)
3357 local->tx_keyidx = i; 3357 local->crypt_info.tx_keyidx = i;
3358 } 3358 }
3359 3359
3360 3360
3361 if (sta_ptr == NULL && ext->key_len > 0) { 3361 if (sta_ptr == NULL && ext->key_len > 0) {
3362 int first = 1, j; 3362 int first = 1, j;
3363 for (j = 0; j < WEP_KEYS; j++) { 3363 for (j = 0; j < WEP_KEYS; j++) {
3364 if (j != i && local->crypt[j]) { 3364 if (j != i && local->crypt_info.crypt[j]) {
3365 first = 0; 3365 first = 0;
3366 break; 3366 break;
3367 } 3367 }
3368 } 3368 }
3369 if (first) 3369 if (first)
3370 local->tx_keyidx = i; 3370 local->crypt_info.tx_keyidx = i;
3371 } 3371 }
3372 3372
3373 done: 3373 done:
@@ -3399,7 +3399,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev,
3399{ 3399{
3400 struct hostap_interface *iface = netdev_priv(dev); 3400 struct hostap_interface *iface = netdev_priv(dev);
3401 local_info_t *local = iface->local; 3401 local_info_t *local = iface->local;
3402 struct ieee80211_crypt_data **crypt; 3402 struct lib80211_crypt_data **crypt;
3403 void *sta_ptr; 3403 void *sta_ptr;
3404 int max_key_len, i; 3404 int max_key_len, i;
3405 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 3405 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
@@ -3411,7 +3411,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev,
3411 3411
3412 i = erq->flags & IW_ENCODE_INDEX; 3412 i = erq->flags & IW_ENCODE_INDEX;
3413 if (i < 1 || i > WEP_KEYS) 3413 if (i < 1 || i > WEP_KEYS)
3414 i = local->tx_keyidx; 3414 i = local->crypt_info.tx_keyidx;
3415 else 3415 else
3416 i--; 3416 i--;
3417 3417
@@ -3419,7 +3419,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev,
3419 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && 3419 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff &&
3420 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) { 3420 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) {
3421 sta_ptr = NULL; 3421 sta_ptr = NULL;
3422 crypt = &local->crypt[i]; 3422 crypt = &local->crypt_info.crypt[i];
3423 } else { 3423 } else {
3424 i = 0; 3424 i = 0;
3425 sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt); 3425 sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt);
@@ -3468,8 +3468,8 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3468 int param_len) 3468 int param_len)
3469{ 3469{
3470 int ret = 0; 3470 int ret = 0;
3471 struct ieee80211_crypto_ops *ops; 3471 struct lib80211_crypto_ops *ops;
3472 struct ieee80211_crypt_data **crypt; 3472 struct lib80211_crypt_data **crypt;
3473 void *sta_ptr; 3473 void *sta_ptr;
3474 3474
3475 param->u.crypt.err = 0; 3475 param->u.crypt.err = 0;
@@ -3486,7 +3486,7 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3486 if (param->u.crypt.idx >= WEP_KEYS) 3486 if (param->u.crypt.idx >= WEP_KEYS)
3487 return -EINVAL; 3487 return -EINVAL;
3488 sta_ptr = NULL; 3488 sta_ptr = NULL;
3489 crypt = &local->crypt[param->u.crypt.idx]; 3489 crypt = &local->crypt_info.crypt[param->u.crypt.idx];
3490 } else { 3490 } else {
3491 if (param->u.crypt.idx) 3491 if (param->u.crypt.idx)
3492 return -EINVAL; 3492 return -EINVAL;
@@ -3507,16 +3507,16 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3507 goto done; 3507 goto done;
3508 } 3508 }
3509 3509
3510 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3510 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3511 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { 3511 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
3512 request_module("ieee80211_crypt_wep"); 3512 request_module("lib80211_crypt_wep");
3513 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3513 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3514 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { 3514 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
3515 request_module("ieee80211_crypt_tkip"); 3515 request_module("lib80211_crypt_tkip");
3516 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3516 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3517 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { 3517 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
3518 request_module("ieee80211_crypt_ccmp"); 3518 request_module("lib80211_crypt_ccmp");
3519 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3519 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3520 } 3520 }
3521 if (ops == NULL) { 3521 if (ops == NULL) {
3522 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n", 3522 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n",
@@ -3531,11 +3531,11 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3531 local->host_decrypt = local->host_encrypt = 1; 3531 local->host_decrypt = local->host_encrypt = 1;
3532 3532
3533 if (*crypt == NULL || (*crypt)->ops != ops) { 3533 if (*crypt == NULL || (*crypt)->ops != ops) {
3534 struct ieee80211_crypt_data *new_crypt; 3534 struct lib80211_crypt_data *new_crypt;
3535 3535
3536 prism2_crypt_delayed_deinit(local, crypt); 3536 prism2_crypt_delayed_deinit(local, crypt);
3537 3537
3538 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), 3538 new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
3539 GFP_KERNEL); 3539 GFP_KERNEL);
3540 if (new_crypt == NULL) { 3540 if (new_crypt == NULL) {
3541 ret = -ENOMEM; 3541 ret = -ENOMEM;
@@ -3568,7 +3568,7 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3568 3568
3569 if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { 3569 if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) {
3570 if (!sta_ptr) 3570 if (!sta_ptr)
3571 local->tx_keyidx = param->u.crypt.idx; 3571 local->crypt_info.tx_keyidx = param->u.crypt.idx;
3572 else if (param->u.crypt.idx) { 3572 else if (param->u.crypt.idx) {
3573 printk(KERN_DEBUG "%s: TX key idx setting failed\n", 3573 printk(KERN_DEBUG "%s: TX key idx setting failed\n",
3574 local->dev->name); 3574 local->dev->name);
@@ -3604,7 +3604,7 @@ static int prism2_ioctl_get_encryption(local_info_t *local,
3604 struct prism2_hostapd_param *param, 3604 struct prism2_hostapd_param *param,
3605 int param_len) 3605 int param_len)
3606{ 3606{
3607 struct ieee80211_crypt_data **crypt; 3607 struct lib80211_crypt_data **crypt;
3608 void *sta_ptr; 3608 void *sta_ptr;
3609 int max_key_len; 3609 int max_key_len;
3610 3610
@@ -3620,8 +3620,8 @@ static int prism2_ioctl_get_encryption(local_info_t *local,
3620 param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 3620 param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
3621 sta_ptr = NULL; 3621 sta_ptr = NULL;
3622 if (param->u.crypt.idx >= WEP_KEYS) 3622 if (param->u.crypt.idx >= WEP_KEYS)
3623 param->u.crypt.idx = local->tx_keyidx; 3623 param->u.crypt.idx = local->crypt_info.tx_keyidx;
3624 crypt = &local->crypt[param->u.crypt.idx]; 3624 crypt = &local->crypt_info.crypt[param->u.crypt.idx];
3625 } else { 3625 } else {
3626 param->u.crypt.idx = 0; 3626 param->u.crypt.idx = 0;
3627 sta_ptr = ap_crypt_get_ptrs(local->ap, param->sta_addr, 0, 3627 sta_ptr = ap_crypt_get_ptrs(local->ap, param->sta_addr, 0,
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 4c36eb2fafd1..02a312ca8607 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -27,7 +27,7 @@
27#include <net/net_namespace.h> 27#include <net/net_namespace.h>
28#include <net/iw_handler.h> 28#include <net/iw_handler.h>
29#include <net/ieee80211.h> 29#include <net/ieee80211.h>
30#include <net/ieee80211_crypt.h> 30#include <net/lib80211.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32 32
33#include "hostap_wlan.h" 33#include "hostap_wlan.h"
@@ -343,10 +343,11 @@ int hostap_set_encryption(local_info_t *local)
343 char keybuf[WEP_KEY_LEN + 1]; 343 char keybuf[WEP_KEY_LEN + 1];
344 enum { NONE, WEP, OTHER } encrypt_type; 344 enum { NONE, WEP, OTHER } encrypt_type;
345 345
346 idx = local->tx_keyidx; 346 idx = local->crypt_info.tx_keyidx;
347 if (local->crypt[idx] == NULL || local->crypt[idx]->ops == NULL) 347 if (local->crypt_info.crypt[idx] == NULL ||
348 local->crypt_info.crypt[idx]->ops == NULL)
348 encrypt_type = NONE; 349 encrypt_type = NONE;
349 else if (strcmp(local->crypt[idx]->ops->name, "WEP") == 0) 350 else if (strcmp(local->crypt_info.crypt[idx]->ops->name, "WEP") == 0)
350 encrypt_type = WEP; 351 encrypt_type = WEP;
351 else 352 else
352 encrypt_type = OTHER; 353 encrypt_type = OTHER;
@@ -394,17 +395,17 @@ int hostap_set_encryption(local_info_t *local)
394 /* 104-bit support seems to require that all the keys are set to the 395 /* 104-bit support seems to require that all the keys are set to the
395 * same keylen */ 396 * same keylen */
396 keylen = 6; /* first 5 octets */ 397 keylen = 6; /* first 5 octets */
397 len = local->crypt[idx]->ops->get_key(keybuf, sizeof(keybuf), 398 len = local->crypt_info.crypt[idx]->ops->get_key(keybuf, sizeof(keybuf), NULL,
398 NULL, local->crypt[idx]->priv); 399 local->crypt_info.crypt[idx]->priv);
399 if (idx >= 0 && idx < WEP_KEYS && len > 5) 400 if (idx >= 0 && idx < WEP_KEYS && len > 5)
400 keylen = WEP_KEY_LEN + 1; /* first 13 octets */ 401 keylen = WEP_KEY_LEN + 1; /* first 13 octets */
401 402
402 for (i = 0; i < WEP_KEYS; i++) { 403 for (i = 0; i < WEP_KEYS; i++) {
403 memset(keybuf, 0, sizeof(keybuf)); 404 memset(keybuf, 0, sizeof(keybuf));
404 if (local->crypt[i]) { 405 if (local->crypt_info.crypt[i]) {
405 (void) local->crypt[i]->ops->get_key( 406 (void) local->crypt_info.crypt[i]->ops->get_key(
406 keybuf, sizeof(keybuf), 407 keybuf, sizeof(keybuf),
407 NULL, local->crypt[i]->priv); 408 NULL, local->crypt_info.crypt[i]->priv);
408 } 409 }
409 if (local->func->set_rid(local->dev, 410 if (local->func->set_rid(local->dev,
410 HFA384X_RID_CNFDEFAULTKEY0 + i, 411 HFA384X_RID_CNFDEFAULTKEY0 + i,
diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c
index ae7d3caf3dae..005ff25a405f 100644
--- a/drivers/net/wireless/hostap/hostap_proc.c
+++ b/drivers/net/wireless/hostap/hostap_proc.c
@@ -2,7 +2,7 @@
2 2
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/proc_fs.h> 4#include <linux/proc_fs.h>
5#include <net/ieee80211_crypt.h> 5#include <net/lib80211.h>
6 6
7#include "hostap_wlan.h" 7#include "hostap_wlan.h"
8#include "hostap.h" 8#include "hostap.h"
@@ -36,9 +36,10 @@ static int prism2_debug_proc_read(char *page, char **start, off_t off,
36 p += sprintf(p, "dev_enabled=%d\n", local->dev_enabled); 36 p += sprintf(p, "dev_enabled=%d\n", local->dev_enabled);
37 p += sprintf(p, "sw_tick_stuck=%d\n", local->sw_tick_stuck); 37 p += sprintf(p, "sw_tick_stuck=%d\n", local->sw_tick_stuck);
38 for (i = 0; i < WEP_KEYS; i++) { 38 for (i = 0; i < WEP_KEYS; i++) {
39 if (local->crypt[i] && local->crypt[i]->ops) { 39 if (local->crypt_info.crypt[i] &&
40 p += sprintf(p, "crypt[%d]=%s\n", 40 local->crypt_info.crypt[i]->ops) {
41 i, local->crypt[i]->ops->name); 41 p += sprintf(p, "crypt[%d]=%s\n", i,
42 local->crypt_info.crypt[i]->ops->name);
42 } 43 }
43 } 44 }
44 p += sprintf(p, "pri_only=%d\n", local->pri_only); 45 p += sprintf(p, "pri_only=%d\n", local->pri_only);
@@ -206,12 +207,13 @@ static int prism2_crypt_proc_read(char *page, char **start, off_t off,
206 return 0; 207 return 0;
207 } 208 }
208 209
209 p += sprintf(p, "tx_keyidx=%d\n", local->tx_keyidx); 210 p += sprintf(p, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx);
210 for (i = 0; i < WEP_KEYS; i++) { 211 for (i = 0; i < WEP_KEYS; i++) {
211 if (local->crypt[i] && local->crypt[i]->ops && 212 if (local->crypt_info.crypt[i] &&
212 local->crypt[i]->ops->print_stats) { 213 local->crypt_info.crypt[i]->ops &&
213 p = local->crypt[i]->ops->print_stats( 214 local->crypt_info.crypt[i]->ops->print_stats) {
214 p, local->crypt[i]->priv); 215 p = local->crypt_info.crypt[i]->ops->print_stats(
216 p, local->crypt_info.crypt[i]->priv);
215 } 217 }
216 } 218 }
217 219
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
index d2c7a56b8b59..4d8d51a353cd 100644
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -6,6 +6,7 @@
6#include <linux/mutex.h> 6#include <linux/mutex.h>
7#include <net/iw_handler.h> 7#include <net/iw_handler.h>
8#include <net/ieee80211_radiotap.h> 8#include <net/ieee80211_radiotap.h>
9#include <net/lib80211.h>
9 10
10#include "hostap_config.h" 11#include "hostap_config.h"
11#include "hostap_common.h" 12#include "hostap_common.h"
@@ -763,10 +764,7 @@ struct local_info {
763 764
764#define WEP_KEYS 4 765#define WEP_KEYS 4
765#define WEP_KEY_LEN 13 766#define WEP_KEY_LEN 13
766 struct ieee80211_crypt_data *crypt[WEP_KEYS]; 767 struct lib80211_crypt_info crypt_info;
767 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
768 struct timer_list crypt_deinit_timer;
769 struct list_head crypt_deinit_list;
770 768
771 int open_wep; /* allow unencrypted frames */ 769 int open_wep; /* allow unencrypted frames */
772 int host_encrypt; 770 int host_encrypt;
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 062c9f280304..2d2044d3d1c9 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -4010,7 +4010,7 @@ static ssize_t show_internals(struct device *d, struct device_attribute *attr,
4010 else 4010 else
4011 len += sprintf(buf + len, "not connected\n"); 4011 len += sprintf(buf + len, "not connected\n");
4012 4012
4013 DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], "p"); 4013 DUMP_VAR(ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx], "p");
4014 DUMP_VAR(status, "08lx"); 4014 DUMP_VAR(status, "08lx");
4015 DUMP_VAR(config, "08lx"); 4015 DUMP_VAR(config, "08lx");
4016 DUMP_VAR(capability, "08lx"); 4016 DUMP_VAR(capability, "08lx");
@@ -5514,7 +5514,7 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode)
5514 } 5514 }
5515 } 5515 }
5516 5516
5517 ipw2100_set_key_index(priv, priv->ieee->tx_keyidx, 1); 5517 ipw2100_set_key_index(priv, priv->ieee->crypt_info.tx_keyidx, 1);
5518 } 5518 }
5519 5519
5520 /* Always enable privacy so the Host can filter WEP packets if 5520 /* Always enable privacy so the Host can filter WEP packets if
@@ -7620,7 +7620,7 @@ static int ipw2100_wx_set_auth(struct net_device *dev,
7620 struct ipw2100_priv *priv = ieee80211_priv(dev); 7620 struct ipw2100_priv *priv = ieee80211_priv(dev);
7621 struct ieee80211_device *ieee = priv->ieee; 7621 struct ieee80211_device *ieee = priv->ieee;
7622 struct iw_param *param = &wrqu->param; 7622 struct iw_param *param = &wrqu->param;
7623 struct ieee80211_crypt_data *crypt; 7623 struct lib80211_crypt_data *crypt;
7624 unsigned long flags; 7624 unsigned long flags;
7625 int ret = 0; 7625 int ret = 0;
7626 7626
@@ -7635,7 +7635,7 @@ static int ipw2100_wx_set_auth(struct net_device *dev,
7635 break; 7635 break;
7636 7636
7637 case IW_AUTH_TKIP_COUNTERMEASURES: 7637 case IW_AUTH_TKIP_COUNTERMEASURES:
7638 crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; 7638 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx];
7639 if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) 7639 if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags)
7640 break; 7640 break;
7641 7641
@@ -7712,7 +7712,7 @@ static int ipw2100_wx_get_auth(struct net_device *dev,
7712{ 7712{
7713 struct ipw2100_priv *priv = ieee80211_priv(dev); 7713 struct ipw2100_priv *priv = ieee80211_priv(dev);
7714 struct ieee80211_device *ieee = priv->ieee; 7714 struct ieee80211_device *ieee = priv->ieee;
7715 struct ieee80211_crypt_data *crypt; 7715 struct lib80211_crypt_data *crypt;
7716 struct iw_param *param = &wrqu->param; 7716 struct iw_param *param = &wrqu->param;
7717 int ret = 0; 7717 int ret = 0;
7718 7718
@@ -7728,7 +7728,7 @@ static int ipw2100_wx_get_auth(struct net_device *dev,
7728 break; 7728 break;
7729 7729
7730 case IW_AUTH_TKIP_COUNTERMEASURES: 7730 case IW_AUTH_TKIP_COUNTERMEASURES:
7731 crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; 7731 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx];
7732 if (!crypt || !crypt->ops->get_flags) { 7732 if (!crypt || !crypt->ops->get_flags) {
7733 IPW_DEBUG_WARNING("Can't get TKIP countermeasures: " 7733 IPW_DEBUG_WARNING("Can't get TKIP countermeasures: "
7734 "crypt not set!\n"); 7734 "crypt not set!\n");
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 6ca0f1c05048..d2a2b7586d08 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -6600,7 +6600,7 @@ static int ipw_wx_set_auth(struct net_device *dev,
6600 struct ipw_priv *priv = ieee80211_priv(dev); 6600 struct ipw_priv *priv = ieee80211_priv(dev);
6601 struct ieee80211_device *ieee = priv->ieee; 6601 struct ieee80211_device *ieee = priv->ieee;
6602 struct iw_param *param = &wrqu->param; 6602 struct iw_param *param = &wrqu->param;
6603 struct ieee80211_crypt_data *crypt; 6603 struct lib80211_crypt_data *crypt;
6604 unsigned long flags; 6604 unsigned long flags;
6605 int ret = 0; 6605 int ret = 0;
6606 6606
@@ -6622,7 +6622,7 @@ static int ipw_wx_set_auth(struct net_device *dev,
6622 break; 6622 break;
6623 6623
6624 case IW_AUTH_TKIP_COUNTERMEASURES: 6624 case IW_AUTH_TKIP_COUNTERMEASURES:
6625 crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; 6625 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx];
6626 if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) 6626 if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags)
6627 break; 6627 break;
6628 6628
@@ -6699,7 +6699,7 @@ static int ipw_wx_get_auth(struct net_device *dev,
6699{ 6699{
6700 struct ipw_priv *priv = ieee80211_priv(dev); 6700 struct ipw_priv *priv = ieee80211_priv(dev);
6701 struct ieee80211_device *ieee = priv->ieee; 6701 struct ieee80211_device *ieee = priv->ieee;
6702 struct ieee80211_crypt_data *crypt; 6702 struct lib80211_crypt_data *crypt;
6703 struct iw_param *param = &wrqu->param; 6703 struct iw_param *param = &wrqu->param;
6704 int ret = 0; 6704 int ret = 0;
6705 6705
@@ -6715,7 +6715,7 @@ static int ipw_wx_get_auth(struct net_device *dev,
6715 break; 6715 break;
6716 6716
6717 case IW_AUTH_TKIP_COUNTERMEASURES: 6717 case IW_AUTH_TKIP_COUNTERMEASURES:
6718 crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; 6718 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx];
6719 if (!crypt || !crypt->ops->get_flags) 6719 if (!crypt || !crypt->ops->get_flags)
6720 break; 6720 break;
6721 6721
@@ -10251,8 +10251,8 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10251 case SEC_LEVEL_1: 10251 case SEC_LEVEL_1:
10252 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= 10252 tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |=
10253 cpu_to_le16(IEEE80211_FCTL_PROTECTED); 10253 cpu_to_le16(IEEE80211_FCTL_PROTECTED);
10254 tfd->u.data.key_index = priv->ieee->tx_keyidx; 10254 tfd->u.data.key_index = priv->ieee->crypt_info.tx_keyidx;
10255 if (priv->ieee->sec.key_sizes[priv->ieee->tx_keyidx] <= 10255 if (priv->ieee->sec.key_sizes[priv->ieee->crypt_info.tx_keyidx] <=
10256 40) 10256 40)
10257 tfd->u.data.key_index |= DCT_WEP_KEY_64Bit; 10257 tfd->u.data.key_index |= DCT_WEP_KEY_64Bit;
10258 else 10258 else