aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSean MacLennan <seanm@seanm.ca>2011-12-19 23:20:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-22 16:48:59 -0500
commit32c44cb5b9fdc6eaa445bd622008dd672a3dd1a7 (patch)
tree019dcb35135328fc149404b61dbec5fdc4e84b12 /drivers
parent184f1938b29310a0df4298b57a7241832cb0813c (diff)
staging/rtl8192e: Convert to lib80211_crypt_data and lib80211_crypt_ops
Convert rtllib_crypt_data to lib80211_crypt_data and rtllib_crypt_ops to lib80211_crypt_ops. This is almost a 1:1 replacement, only extra_prefix_len and extra_postfix_len changed. Signed-off-by: Sean MacLennan <seanm@seanm.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt.c24
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt.h58
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt_ccmp.c6
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt_tkip.c19
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt_wep.c6
-rw-r--r--drivers/staging/rtl8192e/rtllib_module.c3
-rw-r--r--drivers/staging/rtl8192e/rtllib_rx.c12
-rw-r--r--drivers/staging/rtl8192e/rtllib_softmac.c18
-rw-r--r--drivers/staging/rtl8192e/rtllib_tx.c13
-rw-r--r--drivers/staging/rtl8192e/rtllib_wx.c18
10 files changed, 65 insertions, 112 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c
index c6e2440d44b9..313d089c24fa 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt.c
@@ -21,7 +21,7 @@
21 21
22struct rtllib_crypto_alg { 22struct rtllib_crypto_alg {
23 struct list_head list; 23 struct list_head list;
24 struct rtllib_crypto_ops *ops; 24 struct lib80211_crypto_ops *ops;
25}; 25};
26 26
27 27
@@ -36,11 +36,11 @@ void rtllib_crypt_deinit_entries(struct rtllib_device *ieee,
36 int force) 36 int force)
37{ 37{
38 struct list_head *ptr, *n; 38 struct list_head *ptr, *n;
39 struct rtllib_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 = ieee->crypt_deinit_list.next, n = ptr->next;
42 ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { 42 ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) {
43 entry = list_entry(ptr, struct rtllib_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)
46 continue; 46 continue;
@@ -73,9 +73,9 @@ void rtllib_crypt_deinit_handler(unsigned long data)
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 rtllib_device *ieee,
76 struct rtllib_crypt_data **crypt) 76 struct lib80211_crypt_data **crypt)
77{ 77{
78 struct rtllib_crypt_data *tmp; 78 struct lib80211_crypt_data *tmp;
79 unsigned long flags; 79 unsigned long flags;
80 80
81 if (*crypt == NULL) 81 if (*crypt == NULL)
@@ -98,7 +98,7 @@ void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
98} 98}
99EXPORT_SYMBOL(rtllib_crypt_delayed_deinit); 99EXPORT_SYMBOL(rtllib_crypt_delayed_deinit);
100 100
101int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops) 101int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops)
102{ 102{
103 unsigned long flags; 103 unsigned long flags;
104 struct rtllib_crypto_alg *alg; 104 struct rtllib_crypto_alg *alg;
@@ -123,7 +123,7 @@ int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops)
123} 123}
124EXPORT_SYMBOL(rtllib_register_crypto_ops); 124EXPORT_SYMBOL(rtllib_register_crypto_ops);
125 125
126int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops) 126int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops)
127{ 127{
128 unsigned long flags; 128 unsigned long flags;
129 struct list_head *ptr; 129 struct list_head *ptr;
@@ -155,7 +155,7 @@ int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops)
155EXPORT_SYMBOL(rtllib_unregister_crypto_ops); 155EXPORT_SYMBOL(rtllib_unregister_crypto_ops);
156 156
157 157
158struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name) 158struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name)
159{ 159{
160 unsigned long flags; 160 unsigned long flags;
161 struct list_head *ptr; 161 struct list_head *ptr;
@@ -186,7 +186,7 @@ EXPORT_SYMBOL(rtllib_get_crypto_ops);
186static void * rtllib_crypt_null_init(int keyidx) { return (void *) 1; } 186static void * rtllib_crypt_null_init(int keyidx) { return (void *) 1; }
187static void rtllib_crypt_null_deinit(void *priv) {} 187static void rtllib_crypt_null_deinit(void *priv) {}
188 188
189static struct rtllib_crypto_ops rtllib_crypt_null = { 189static struct lib80211_crypto_ops rtllib_crypt_null = {
190 .name = "NULL", 190 .name = "NULL",
191 .init = rtllib_crypt_null_init, 191 .init = rtllib_crypt_null_init,
192 .deinit = rtllib_crypt_null_deinit, 192 .deinit = rtllib_crypt_null_deinit,
@@ -196,8 +196,10 @@ static struct rtllib_crypto_ops rtllib_crypt_null = {
196 .decrypt_msdu = NULL, 196 .decrypt_msdu = NULL,
197 .set_key = NULL, 197 .set_key = NULL,
198 .get_key = NULL, 198 .get_key = NULL,
199 .extra_prefix_len = 0, 199 .extra_mpdu_prefix_len = 0,
200 .extra_postfix_len = 0, 200 .extra_mpdu_postfix_len = 0,
201 .extra_msdu_prefix_len = 0,
202 .extra_msdu_postfix_len = 0,
201 .owner = THIS_MODULE, 203 .owner = THIS_MODULE,
202}; 204};
203 205
diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h
index 49b90b73ed9c..8c058f2b6690 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt.h
+++ b/drivers/staging/rtl8192e/rtllib_crypt.h
@@ -25,61 +25,11 @@
25 25
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27 27
28struct rtllib_crypto_ops { 28int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops);
29 const char *name; 29int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
30 30struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name);
31 /* init new crypto context (e.g., allocate private data space,
32 * select IV, etc.); returns NULL on failure or pointer to allocated
33 * private data on success */
34 void * (*init)(int keyidx);
35
36 /* deinitialize crypto context and free allocated private data */
37 void (*deinit)(void *priv);
38
39 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return
40 * value from decrypt_mpdu is passed as the keyidx value for
41 * decrypt_msdu. skb must have enough head and tail room for the
42 * encryption; if not, error will be returned; these functions are
43 * called for all MPDUs (i.e., fragments).
44 */
45 int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv);
46 int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv);
47
48 /* These functions are called for full MSDUs, i.e. full frames.
49 * These can be NULL if full MSDU operations are not needed. */
50 int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv);
51 int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len,
52 void *priv, struct rtllib_device* ieee);
53
54 int (*set_key)(void *key, int len, u8 *seq, void *priv);
55 int (*get_key)(void *key, int len, u8 *seq, void *priv);
56
57 /* procfs handler for printing out key information and possible
58 * statistics */
59 char * (*print_stats)(char *p, void *priv);
60
61 /* maximum number of bytes added by encryption; encrypt buf is
62 * allocated with extra_prefix_len bytes, copy of in_buf, and
63 * extra_postfix_len; encrypt need not use all this space, but
64 * the result must start at the beginning of the struct buffer and
65 * correct length must be returned */
66 int extra_prefix_len, extra_postfix_len;
67
68 struct module *owner;
69};
70
71struct rtllib_crypt_data {
72 struct list_head list; /* delayed deletion list */
73 struct rtllib_crypto_ops *ops;
74 void *priv;
75 atomic_t refcnt;
76};
77
78int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops);
79int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops);
80struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name);
81void rtllib_crypt_deinit_entries(struct rtllib_device *, int); 31void rtllib_crypt_deinit_entries(struct rtllib_device *, int);
82void rtllib_crypt_deinit_handler(unsigned long); 32void rtllib_crypt_deinit_handler(unsigned long);
83void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, 33void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
84 struct rtllib_crypt_data **crypt); 34 struct lib80211_crypt_data **crypt);
85#endif 35#endif
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
index 0419c77815d1..f4e52b9223f3 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
@@ -427,7 +427,7 @@ static char *rtllib_ccmp_print_stats(char *p, void *priv)
427 return p; 427 return p;
428} 428}
429 429
430static struct rtllib_crypto_ops rtllib_crypt_ccmp = { 430static struct lib80211_crypto_ops rtllib_crypt_ccmp = {
431 .name = "CCMP", 431 .name = "CCMP",
432 .init = rtllib_ccmp_init, 432 .init = rtllib_ccmp_init,
433 .deinit = rtllib_ccmp_deinit, 433 .deinit = rtllib_ccmp_deinit,
@@ -438,8 +438,8 @@ static struct rtllib_crypto_ops rtllib_crypt_ccmp = {
438 .set_key = rtllib_ccmp_set_key, 438 .set_key = rtllib_ccmp_set_key,
439 .get_key = rtllib_ccmp_get_key, 439 .get_key = rtllib_ccmp_get_key,
440 .print_stats = rtllib_ccmp_print_stats, 440 .print_stats = rtllib_ccmp_print_stats,
441 .extra_prefix_len = CCMP_HDR_LEN, 441 .extra_mpdu_prefix_len = CCMP_HDR_LEN,
442 .extra_postfix_len = CCMP_MIC_LEN, 442 .extra_mpdu_postfix_len = CCMP_MIC_LEN,
443 .owner = THIS_MODULE, 443 .owner = THIS_MODULE,
444}; 444};
445 445
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index f68cda28075a..90e71d8acdae 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -596,8 +596,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev,
596} 596}
597 597
598static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, 598static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
599 int hdr_len, void *priv, 599 int hdr_len, void *priv)
600 struct rtllib_device *ieee)
601{ 600{
602 struct rtllib_tkip_data *tkey = priv; 601 struct rtllib_tkip_data *tkey = priv;
603 u8 mic[8]; 602 u8 mic[8];
@@ -616,23 +615,20 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
616 skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) 615 skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
617 return -1; 616 return -1;
618 617
619 if ((memcmp(mic, skb->data + skb->len - 8, 8) != 0) || 618 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
620 (ieee->force_mic_error)) {
621 struct rtllib_hdr_4addr *hdr; 619 struct rtllib_hdr_4addr *hdr;
622 hdr = (struct rtllib_hdr_4addr *) skb->data; 620 hdr = (struct rtllib_hdr_4addr *) skb->data;
623 printk(KERN_DEBUG "%s: Michael MIC verification failed for " 621 printk(KERN_DEBUG "%s: Michael MIC verification failed for "
624 "MSDU from %pM keyidx=%d\n", 622 "MSDU from %pM keyidx=%d\n",
625 skb->dev ? skb->dev->name : "N/A", hdr->addr2, 623 skb->dev ? skb->dev->name : "N/A", hdr->addr2,
626 keyidx); 624 keyidx);
627 printk(KERN_DEBUG "%d, force_mic_error = %d\n", 625 printk(KERN_DEBUG "%d\n",
628 (memcmp(mic, skb->data + skb->len - 8, 8) != 0),\ 626 memcmp(mic, skb->data + skb->len - 8, 8) != 0);
629 ieee->force_mic_error);
630 if (skb->dev) { 627 if (skb->dev) {
631 printk(KERN_INFO "skb->dev != NULL\n"); 628 printk(KERN_INFO "skb->dev != NULL\n");
632 rtllib_michael_mic_failure(skb->dev, hdr, keyidx); 629 rtllib_michael_mic_failure(skb->dev, hdr, keyidx);
633 } 630 }
634 tkey->dot11RSNAStatsTKIPLocalMICFailures++; 631 tkey->dot11RSNAStatsTKIPLocalMICFailures++;
635 ieee->force_mic_error = false;
636 return -1; 632 return -1;
637 } 633 }
638 634
@@ -738,7 +734,7 @@ static char *rtllib_tkip_print_stats(char *p, void *priv)
738 return p; 734 return p;
739} 735}
740 736
741static struct rtllib_crypto_ops rtllib_crypt_tkip = { 737static struct lib80211_crypto_ops rtllib_crypt_tkip = {
742 .name = "TKIP", 738 .name = "TKIP",
743 .init = rtllib_tkip_init, 739 .init = rtllib_tkip_init,
744 .deinit = rtllib_tkip_deinit, 740 .deinit = rtllib_tkip_deinit,
@@ -749,8 +745,9 @@ static struct rtllib_crypto_ops rtllib_crypt_tkip = {
749 .set_key = rtllib_tkip_set_key, 745 .set_key = rtllib_tkip_set_key,
750 .get_key = rtllib_tkip_get_key, 746 .get_key = rtllib_tkip_get_key,
751 .print_stats = rtllib_tkip_print_stats, 747 .print_stats = rtllib_tkip_print_stats,
752 .extra_prefix_len = 4 + 4, /* IV + ExtIV */ 748 .extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */
753 .extra_postfix_len = 8 + 4, /* MIC + ICV */ 749 .extra_mpdu_postfix_len = 4, /* ICV */
750 .extra_msdu_postfix_len = 8, /* MIC */
754 .owner = THIS_MODULE, 751 .owner = THIS_MODULE,
755}; 752};
756 753
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
index f5e11b4846ee..34e2d0abfd4e 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
@@ -255,7 +255,7 @@ static char *prism2_wep_print_stats(char *p, void *priv)
255 return p; 255 return p;
256} 256}
257 257
258static struct rtllib_crypto_ops rtllib_crypt_wep = { 258static struct lib80211_crypto_ops rtllib_crypt_wep = {
259 .name = "WEP", 259 .name = "WEP",
260 .init = prism2_wep_init, 260 .init = prism2_wep_init,
261 .deinit = prism2_wep_deinit, 261 .deinit = prism2_wep_deinit,
@@ -266,8 +266,8 @@ static struct rtllib_crypto_ops rtllib_crypt_wep = {
266 .set_key = prism2_wep_set_key, 266 .set_key = prism2_wep_set_key,
267 .get_key = prism2_wep_get_key, 267 .get_key = prism2_wep_get_key,
268 .print_stats = prism2_wep_print_stats, 268 .print_stats = prism2_wep_print_stats,
269 .extra_prefix_len = 4, /* IV */ 269 .extra_mpdu_prefix_len = 4, /* IV */
270 .extra_postfix_len = 4, /* ICV */ 270 .extra_mpdu_postfix_len = 4, /* ICV */
271 .owner = THIS_MODULE, 271 .owner = THIS_MODULE,
272}; 272};
273 273
diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
index 63d553f52693..f08926776d15 100644
--- a/drivers/staging/rtl8192e/rtllib_module.c
+++ b/drivers/staging/rtl8192e/rtllib_module.c
@@ -136,6 +136,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
136 ieee->host_decrypt = 1; 136 ieee->host_decrypt = 1;
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 INIT_LIST_HEAD(&ieee->crypt_deinit_list); 140 INIT_LIST_HEAD(&ieee->crypt_deinit_list);
140 _setup_timer(&ieee->crypt_deinit_timer, 141 _setup_timer(&ieee->crypt_deinit_timer,
141 rtllib_crypt_deinit_handler, 142 rtllib_crypt_deinit_handler,
@@ -200,7 +201,7 @@ void free_rtllib(struct net_device *dev)
200 rtllib_crypt_deinit_entries(ieee, 1); 201 rtllib_crypt_deinit_entries(ieee, 1);
201 202
202 for (i = 0; i < NUM_WEP_KEYS; i++) { 203 for (i = 0; i < NUM_WEP_KEYS; i++) {
203 struct rtllib_crypt_data *crypt = ieee->crypt[i]; 204 struct lib80211_crypt_data *crypt = ieee->crypt[i];
204 if (crypt) { 205 if (crypt) {
205 if (crypt->ops) 206 if (crypt->ops)
206 crypt->ops->deinit(crypt->priv); 207 crypt->ops->deinit(crypt->priv);
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index e662fd6b0f99..d02a88bb3a46 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -280,7 +280,7 @@ static int rtllib_is_eapol_frame(struct rtllib_device *ieee,
280/* Called only as a tasklet (software IRQ), by rtllib_rx */ 280/* Called only as a tasklet (software IRQ), by rtllib_rx */
281static inline int 281static inline int
282rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, 282rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
283 struct rtllib_crypt_data *crypt) 283 struct lib80211_crypt_data *crypt)
284{ 284{
285 struct rtllib_hdr_4addr *hdr; 285 struct rtllib_hdr_4addr *hdr;
286 int res, hdrlen; 286 int res, hdrlen;
@@ -321,7 +321,7 @@ rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
321/* Called only as a tasklet (software IRQ), by rtllib_rx */ 321/* Called only as a tasklet (software IRQ), by rtllib_rx */
322static inline int 322static inline int
323rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, 323rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
324 int keyidx, struct rtllib_crypt_data *crypt) 324 int keyidx, struct lib80211_crypt_data *crypt)
325{ 325{
326 struct rtllib_hdr_4addr *hdr; 326 struct rtllib_hdr_4addr *hdr;
327 int res, hdrlen; 327 int res, hdrlen;
@@ -340,7 +340,7 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
340 hdrlen = rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 340 hdrlen = rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
341 341
342 atomic_inc(&crypt->refcnt); 342 atomic_inc(&crypt->refcnt);
343 res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv, ieee); 343 res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
344 atomic_dec(&crypt->refcnt); 344 atomic_dec(&crypt->refcnt);
345 if (res < 0) { 345 if (res < 0) {
346 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" 346 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
@@ -1009,7 +1009,7 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc,
1009} 1009}
1010 1010
1011static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, 1011static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
1012 struct rtllib_crypt_data **crypt, size_t hdrlen) 1012 struct lib80211_crypt_data **crypt, size_t hdrlen)
1013{ 1013{
1014 struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data; 1014 struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;
1015 u16 fc = le16_to_cpu(hdr->frame_ctl); 1015 u16 fc = le16_to_cpu(hdr->frame_ctl);
@@ -1044,7 +1044,7 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
1044 1044
1045static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, 1045static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
1046 struct rtllib_rx_stats *rx_stats, 1046 struct rtllib_rx_stats *rx_stats,
1047 struct rtllib_crypt_data *crypt, size_t hdrlen) 1047 struct lib80211_crypt_data *crypt, size_t hdrlen)
1048{ 1048{
1049 struct rtllib_hdr_4addr *hdr; 1049 struct rtllib_hdr_4addr *hdr;
1050 int keyidx = 0; 1050 int keyidx = 0;
@@ -1252,7 +1252,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
1252{ 1252{
1253 struct net_device *dev = ieee->dev; 1253 struct net_device *dev = ieee->dev;
1254 struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data; 1254 struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;
1255 struct rtllib_crypt_data *crypt = NULL; 1255 struct lib80211_crypt_data *crypt = NULL;
1256 struct rtllib_rxb *rxb = NULL; 1256 struct rtllib_rxb *rxb = NULL;
1257 struct rx_ts_record *pTS = NULL; 1257 struct rx_ts_record *pTS = NULL;
1258 u16 fc, sc, SeqNum = 0; 1258 u16 fc, sc, SeqNum = 0;
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 022bf40122e3..47c163b9e35d 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -836,7 +836,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest)
836 struct sk_buff *skb = NULL; 836 struct sk_buff *skb = NULL;
837 int encrypt; 837 int encrypt;
838 int atim_len, erp_len; 838 int atim_len, erp_len;
839 struct rtllib_crypt_data *crypt; 839 struct lib80211_crypt_data *crypt;
840 840
841 char *ssid = ieee->current_network.ssid; 841 char *ssid = ieee->current_network.ssid;
842 int ssid_len = ieee->current_network.ssid_len; 842 int ssid_len = ieee->current_network.ssid_len;
@@ -982,7 +982,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest)
982 struct sk_buff *skb; 982 struct sk_buff *skb;
983 u8 *tag; 983 u8 *tag;
984 984
985 struct rtllib_crypt_data *crypt; 985 struct lib80211_crypt_data *crypt;
986 struct rtllib_assoc_response_frame *assoc; 986 struct rtllib_assoc_response_frame *assoc;
987 short encrypt; 987 short encrypt;
988 988
@@ -1178,7 +1178,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
1178 unsigned int ckip_ie_len = 0; 1178 unsigned int ckip_ie_len = 0;
1179 unsigned int ccxrm_ie_len = 0; 1179 unsigned int ccxrm_ie_len = 0;
1180 unsigned int cxvernum_ie_len = 0; 1180 unsigned int cxvernum_ie_len = 0;
1181 struct rtllib_crypt_data *crypt; 1181 struct lib80211_crypt_data *crypt;
1182 int encrypt; 1182 int encrypt;
1183 int PMKCacheIdx; 1183 int PMKCacheIdx;
1184 1184
@@ -3345,8 +3345,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
3345 u8 is_mesh) 3345 u8 is_mesh)
3346{ 3346{
3347 int ret = 0; 3347 int ret = 0;
3348 struct rtllib_crypto_ops *ops; 3348 struct lib80211_crypto_ops *ops;
3349 struct rtllib_crypt_data **crypt; 3349 struct lib80211_crypt_data **crypt;
3350 3350
3351 struct rtllib_security sec = { 3351 struct rtllib_security sec = {
3352 .flags = 0, 3352 .flags = 0,
@@ -3408,17 +3408,17 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
3408 goto done; 3408 goto done;
3409 } 3409 }
3410 if (*crypt == NULL || (*crypt)->ops != ops) { 3410 if (*crypt == NULL || (*crypt)->ops != ops) {
3411 struct rtllib_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);
3414 3414
3415 new_crypt = (struct rtllib_crypt_data *) 3415 new_crypt = (struct lib80211_crypt_data *)
3416 kmalloc(sizeof(*new_crypt), GFP_KERNEL); 3416 kmalloc(sizeof(*new_crypt), GFP_KERNEL);
3417 if (new_crypt == NULL) { 3417 if (new_crypt == NULL) {
3418 ret = -ENOMEM; 3418 ret = -ENOMEM;
3419 goto done; 3419 goto done;
3420 } 3420 }
3421 memset(new_crypt, 0, sizeof(struct rtllib_crypt_data)); 3421 memset(new_crypt, 0, sizeof(struct lib80211_crypt_data));
3422 new_crypt->ops = ops; 3422 new_crypt->ops = ops;
3423 if (new_crypt->ops) 3423 if (new_crypt->ops)
3424 new_crypt->priv = 3424 new_crypt->priv =
@@ -3562,7 +3562,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee)
3562 static u8 ccmp_ie[4] = {0x00, 0x50, 0xf2, 0x04}; 3562 static u8 ccmp_ie[4] = {0x00, 0x50, 0xf2, 0x04};
3563 static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04}; 3563 static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04};
3564 int wpa_ie_len = ieee->wpa_ie_len; 3564 int wpa_ie_len = ieee->wpa_ie_len;
3565 struct rtllib_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[ieee->tx_keyidx];
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index b8135be96e47..b038357b6175 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -179,7 +179,7 @@ inline int rtllib_put_snap(u8 *data, u16 h_proto)
179int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, 179int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag,
180 int hdr_len) 180 int hdr_len)
181{ 181{
182 struct rtllib_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[ieee->tx_keyidx];
@@ -568,7 +568,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
568 }; 568 };
569 u8 dest[ETH_ALEN], src[ETH_ALEN]; 569 u8 dest[ETH_ALEN], src[ETH_ALEN];
570 int qos_actived = ieee->current_network.qos_data.active; 570 int qos_actived = ieee->current_network.qos_data.active;
571 struct rtllib_crypt_data *crypt = NULL; 571 struct lib80211_crypt_data *crypt = NULL;
572 struct cb_desc *tcb_desc; 572 struct cb_desc *tcb_desc;
573 u8 bIsMulticast = false; 573 u8 bIsMulticast = false;
574 u8 IsAmsdu = false; 574 u8 IsAmsdu = false;
@@ -741,8 +741,10 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
741 /* Each fragment may need to have room for encryptiong 741 /* Each fragment may need to have room for encryptiong
742 * pre/postfix */ 742 * pre/postfix */
743 if (encrypt) { 743 if (encrypt) {
744 bytes_per_frag -= crypt->ops->extra_prefix_len + 744 bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len +
745 crypt->ops->extra_postfix_len; 745 crypt->ops->extra_mpdu_postfix_len +
746 crypt->ops->extra_msdu_prefix_len +
747 crypt->ops->extra_msdu_postfix_len;
746 } 748 }
747 /* Number of fragments is the total bytes_per_frag / 749 /* Number of fragments is the total bytes_per_frag /
748 * payload_per_fragment */ 750 * payload_per_fragment */
@@ -790,7 +792,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
790 else 792 else
791 tcb_desc->bHwSec = 0; 793 tcb_desc->bHwSec = 0;
792 skb_reserve(skb_frag, 794 skb_reserve(skb_frag,
793 crypt->ops->extra_prefix_len); 795 crypt->ops->extra_mpdu_prefix_len +
796 crypt->ops->extra_msdu_prefix_len);
794 } else { 797 } else {
795 tcb_desc->bHwSec = 0; 798 tcb_desc->bHwSec = 0;
796 } 799 }
diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index 48afd4cb5170..3978ed2137ef 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -306,7 +306,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
306 .flags = 0 306 .flags = 0
307 }; 307 };
308 int i, key, key_provided, len; 308 int i, key, key_provided, len;
309 struct rtllib_crypt_data **crypt; 309 struct lib80211_crypt_data **crypt;
310 310
311 RTLLIB_DEBUG_WX("SET_ENCODE\n"); 311 RTLLIB_DEBUG_WX("SET_ENCODE\n");
312 312
@@ -365,10 +365,10 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
365 } 365 }
366 366
367 if (*crypt == NULL) { 367 if (*crypt == NULL) {
368 struct rtllib_crypt_data *new_crypt; 368 struct lib80211_crypt_data *new_crypt;
369 369
370 /* take WEP into use */ 370 /* take WEP into use */
371 new_crypt = kzalloc(sizeof(struct rtllib_crypt_data), 371 new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
372 GFP_KERNEL); 372 GFP_KERNEL);
373 if (new_crypt == NULL) 373 if (new_crypt == NULL)
374 return -ENOMEM; 374 return -ENOMEM;
@@ -477,7 +477,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
477{ 477{
478 struct iw_point *erq = &(wrqu->encoding); 478 struct iw_point *erq = &(wrqu->encoding);
479 int len, key; 479 int len, key;
480 struct rtllib_crypt_data *crypt; 480 struct lib80211_crypt_data *crypt;
481 481
482 RTLLIB_DEBUG_WX("GET_ENCODE\n"); 482 RTLLIB_DEBUG_WX("GET_ENCODE\n");
483 483
@@ -526,8 +526,8 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
526 int i, idx; 526 int i, idx;
527 int group_key = 0; 527 int group_key = 0;
528 const char *alg, *module; 528 const char *alg, *module;
529 struct rtllib_crypto_ops *ops; 529 struct lib80211_crypto_ops *ops;
530 struct rtllib_crypt_data **crypt; 530 struct lib80211_crypt_data **crypt;
531 531
532 struct rtllib_security sec = { 532 struct rtllib_security sec = {
533 .flags = 0, 533 .flags = 0,
@@ -593,7 +593,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
593 } 593 }
594 printk(KERN_INFO "alg name:%s\n", alg); 594 printk(KERN_INFO "alg name:%s\n", alg);
595 595
596 ops = rtllib_get_crypto_ops(alg); 596 ops = rtllib_get_crypto_ops(alg);
597 if (ops == NULL) { 597 if (ops == NULL) {
598 char tempbuf[100]; 598 char tempbuf[100];
599 599
@@ -611,7 +611,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
611 } 611 }
612 612
613 if (*crypt == NULL || (*crypt)->ops != ops) { 613 if (*crypt == NULL || (*crypt)->ops != ops) {
614 struct rtllib_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);
617 617
@@ -683,7 +683,7 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
683{ 683{
684 struct iw_point *encoding = &wrqu->encoding; 684 struct iw_point *encoding = &wrqu->encoding;
685 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 685 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
686 struct rtllib_crypt_data *crypt; 686 struct lib80211_crypt_data *crypt;
687 int idx, max_key_len; 687 int idx, max_key_len;
688 688
689 max_key_len = encoding->length - sizeof(*ext); 689 max_key_len = encoding->length - sizeof(*ext);