Commit 32c44cb5 authored by Sean MacLennan's avatar Sean MacLennan Committed by Greg Kroah-Hartman

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: default avatarSean MacLennan <seanm@seanm.ca>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 184f1938
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
struct rtllib_crypto_alg { struct rtllib_crypto_alg {
struct list_head list; struct list_head list;
struct rtllib_crypto_ops *ops; struct lib80211_crypto_ops *ops;
}; };
...@@ -36,11 +36,11 @@ void rtllib_crypt_deinit_entries(struct rtllib_device *ieee, ...@@ -36,11 +36,11 @@ void rtllib_crypt_deinit_entries(struct rtllib_device *ieee,
int force) int force)
{ {
struct list_head *ptr, *n; struct list_head *ptr, *n;
struct rtllib_crypt_data *entry; struct lib80211_crypt_data *entry;
for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; for (ptr = ieee->crypt_deinit_list.next, n = ptr->next;
ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) {
entry = list_entry(ptr, struct rtllib_crypt_data, list); entry = list_entry(ptr, struct lib80211_crypt_data, list);
if (atomic_read(&entry->refcnt) != 0 && !force) if (atomic_read(&entry->refcnt) != 0 && !force)
continue; continue;
...@@ -73,9 +73,9 @@ void rtllib_crypt_deinit_handler(unsigned long data) ...@@ -73,9 +73,9 @@ void rtllib_crypt_deinit_handler(unsigned long data)
EXPORT_SYMBOL(rtllib_crypt_deinit_handler); EXPORT_SYMBOL(rtllib_crypt_deinit_handler);
void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
struct rtllib_crypt_data **crypt) struct lib80211_crypt_data **crypt)
{ {
struct rtllib_crypt_data *tmp; struct lib80211_crypt_data *tmp;
unsigned long flags; unsigned long flags;
if (*crypt == NULL) if (*crypt == NULL)
...@@ -98,7 +98,7 @@ void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, ...@@ -98,7 +98,7 @@ void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
} }
EXPORT_SYMBOL(rtllib_crypt_delayed_deinit); EXPORT_SYMBOL(rtllib_crypt_delayed_deinit);
int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops) int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops)
{ {
unsigned long flags; unsigned long flags;
struct rtllib_crypto_alg *alg; struct rtllib_crypto_alg *alg;
...@@ -123,7 +123,7 @@ int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops) ...@@ -123,7 +123,7 @@ int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops)
} }
EXPORT_SYMBOL(rtllib_register_crypto_ops); EXPORT_SYMBOL(rtllib_register_crypto_ops);
int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops) int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops)
{ {
unsigned long flags; unsigned long flags;
struct list_head *ptr; struct list_head *ptr;
...@@ -155,7 +155,7 @@ int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops) ...@@ -155,7 +155,7 @@ int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops)
EXPORT_SYMBOL(rtllib_unregister_crypto_ops); EXPORT_SYMBOL(rtllib_unregister_crypto_ops);
struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name) struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name)
{ {
unsigned long flags; unsigned long flags;
struct list_head *ptr; struct list_head *ptr;
...@@ -186,7 +186,7 @@ EXPORT_SYMBOL(rtllib_get_crypto_ops); ...@@ -186,7 +186,7 @@ EXPORT_SYMBOL(rtllib_get_crypto_ops);
static void * rtllib_crypt_null_init(int keyidx) { return (void *) 1; } static void * rtllib_crypt_null_init(int keyidx) { return (void *) 1; }
static void rtllib_crypt_null_deinit(void *priv) {} static void rtllib_crypt_null_deinit(void *priv) {}
static struct rtllib_crypto_ops rtllib_crypt_null = { static struct lib80211_crypto_ops rtllib_crypt_null = {
.name = "NULL", .name = "NULL",
.init = rtllib_crypt_null_init, .init = rtllib_crypt_null_init,
.deinit = rtllib_crypt_null_deinit, .deinit = rtllib_crypt_null_deinit,
...@@ -196,8 +196,10 @@ static struct rtllib_crypto_ops rtllib_crypt_null = { ...@@ -196,8 +196,10 @@ static struct rtllib_crypto_ops rtllib_crypt_null = {
.decrypt_msdu = NULL, .decrypt_msdu = NULL,
.set_key = NULL, .set_key = NULL,
.get_key = NULL, .get_key = NULL,
.extra_prefix_len = 0, .extra_mpdu_prefix_len = 0,
.extra_postfix_len = 0, .extra_mpdu_postfix_len = 0,
.extra_msdu_prefix_len = 0,
.extra_msdu_postfix_len = 0,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
...@@ -25,61 +25,11 @@ ...@@ -25,61 +25,11 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
struct rtllib_crypto_ops { int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops);
const char *name; int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name);
/* init new crypto context (e.g., allocate private data space,
* select IV, etc.); returns NULL on failure or pointer to allocated
* private data on success */
void * (*init)(int keyidx);
/* deinitialize crypto context and free allocated private data */
void (*deinit)(void *priv);
/* encrypt/decrypt return < 0 on error or >= 0 on success. The return
* value from decrypt_mpdu is passed as the keyidx value for
* decrypt_msdu. skb must have enough head and tail room for the
* encryption; if not, error will be returned; these functions are
* called for all MPDUs (i.e., fragments).
*/
int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv);
int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv);
/* These functions are called for full MSDUs, i.e. full frames.
* These can be NULL if full MSDU operations are not needed. */
int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv);
int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len,
void *priv, struct rtllib_device* ieee);
int (*set_key)(void *key, int len, u8 *seq, void *priv);
int (*get_key)(void *key, int len, u8 *seq, void *priv);
/* procfs handler for printing out key information and possible
* statistics */
char * (*print_stats)(char *p, void *priv);
/* maximum number of bytes added by encryption; encrypt buf is
* allocated with extra_prefix_len bytes, copy of in_buf, and
* extra_postfix_len; encrypt need not use all this space, but
* the result must start at the beginning of the struct buffer and
* correct length must be returned */
int extra_prefix_len, extra_postfix_len;
struct module *owner;
};
struct rtllib_crypt_data {
struct list_head list; /* delayed deletion list */
struct rtllib_crypto_ops *ops;
void *priv;
atomic_t refcnt;
};
int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops);
int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops);
struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name);
void rtllib_crypt_deinit_entries(struct rtllib_device *, int); void rtllib_crypt_deinit_entries(struct rtllib_device *, int);
void rtllib_crypt_deinit_handler(unsigned long); void rtllib_crypt_deinit_handler(unsigned long);
void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
struct rtllib_crypt_data **crypt); struct lib80211_crypt_data **crypt);
#endif #endif
...@@ -427,7 +427,7 @@ static char *rtllib_ccmp_print_stats(char *p, void *priv) ...@@ -427,7 +427,7 @@ static char *rtllib_ccmp_print_stats(char *p, void *priv)
return p; return p;
} }
static struct rtllib_crypto_ops rtllib_crypt_ccmp = { static struct lib80211_crypto_ops rtllib_crypt_ccmp = {
.name = "CCMP", .name = "CCMP",
.init = rtllib_ccmp_init, .init = rtllib_ccmp_init,
.deinit = rtllib_ccmp_deinit, .deinit = rtllib_ccmp_deinit,
...@@ -438,8 +438,8 @@ static struct rtllib_crypto_ops rtllib_crypt_ccmp = { ...@@ -438,8 +438,8 @@ static struct rtllib_crypto_ops rtllib_crypt_ccmp = {
.set_key = rtllib_ccmp_set_key, .set_key = rtllib_ccmp_set_key,
.get_key = rtllib_ccmp_get_key, .get_key = rtllib_ccmp_get_key,
.print_stats = rtllib_ccmp_print_stats, .print_stats = rtllib_ccmp_print_stats,
.extra_prefix_len = CCMP_HDR_LEN, .extra_mpdu_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN, .extra_mpdu_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
...@@ -596,8 +596,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev, ...@@ -596,8 +596,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev,
} }
static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv, int hdr_len, void *priv)
struct rtllib_device *ieee)
{ {
struct rtllib_tkip_data *tkey = priv; struct rtllib_tkip_data *tkey = priv;
u8 mic[8]; u8 mic[8];
...@@ -616,23 +615,20 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, ...@@ -616,23 +615,20 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1; return -1;
if ((memcmp(mic, skb->data + skb->len - 8, 8) != 0) || if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
(ieee->force_mic_error)) {
struct rtllib_hdr_4addr *hdr; struct rtllib_hdr_4addr *hdr;
hdr = (struct rtllib_hdr_4addr *) skb->data; hdr = (struct rtllib_hdr_4addr *) skb->data;
printk(KERN_DEBUG "%s: Michael MIC verification failed for " printk(KERN_DEBUG "%s: Michael MIC verification failed for "
"MSDU from %pM keyidx=%d\n", "MSDU from %pM keyidx=%d\n",
skb->dev ? skb->dev->name : "N/A", hdr->addr2, skb->dev ? skb->dev->name : "N/A", hdr->addr2,
keyidx); keyidx);
printk(KERN_DEBUG "%d, force_mic_error = %d\n", printk(KERN_DEBUG "%d\n",
(memcmp(mic, skb->data + skb->len - 8, 8) != 0),\ memcmp(mic, skb->data + skb->len - 8, 8) != 0);
ieee->force_mic_error);
if (skb->dev) { if (skb->dev) {
printk(KERN_INFO "skb->dev != NULL\n"); printk(KERN_INFO "skb->dev != NULL\n");
rtllib_michael_mic_failure(skb->dev, hdr, keyidx); rtllib_michael_mic_failure(skb->dev, hdr, keyidx);
} }
tkey->dot11RSNAStatsTKIPLocalMICFailures++; tkey->dot11RSNAStatsTKIPLocalMICFailures++;
ieee->force_mic_error = false;
return -1; return -1;
} }
...@@ -738,7 +734,7 @@ static char *rtllib_tkip_print_stats(char *p, void *priv) ...@@ -738,7 +734,7 @@ static char *rtllib_tkip_print_stats(char *p, void *priv)
return p; return p;
} }
static struct rtllib_crypto_ops rtllib_crypt_tkip = { static struct lib80211_crypto_ops rtllib_crypt_tkip = {
.name = "TKIP", .name = "TKIP",
.init = rtllib_tkip_init, .init = rtllib_tkip_init,
.deinit = rtllib_tkip_deinit, .deinit = rtllib_tkip_deinit,
...@@ -749,8 +745,9 @@ static struct rtllib_crypto_ops rtllib_crypt_tkip = { ...@@ -749,8 +745,9 @@ static struct rtllib_crypto_ops rtllib_crypt_tkip = {
.set_key = rtllib_tkip_set_key, .set_key = rtllib_tkip_set_key,
.get_key = rtllib_tkip_get_key, .get_key = rtllib_tkip_get_key,
.print_stats = rtllib_tkip_print_stats, .print_stats = rtllib_tkip_print_stats,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */ .extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */ .extra_mpdu_postfix_len = 4, /* ICV */
.extra_msdu_postfix_len = 8, /* MIC */
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
...@@ -255,7 +255,7 @@ static char *prism2_wep_print_stats(char *p, void *priv) ...@@ -255,7 +255,7 @@ static char *prism2_wep_print_stats(char *p, void *priv)
return p; return p;
} }
static struct rtllib_crypto_ops rtllib_crypt_wep = { static struct lib80211_crypto_ops rtllib_crypt_wep = {
.name = "WEP", .name = "WEP",
.init = prism2_wep_init, .init = prism2_wep_init,
.deinit = prism2_wep_deinit, .deinit = prism2_wep_deinit,
...@@ -266,8 +266,8 @@ static struct rtllib_crypto_ops rtllib_crypt_wep = { ...@@ -266,8 +266,8 @@ static struct rtllib_crypto_ops rtllib_crypt_wep = {
.set_key = prism2_wep_set_key, .set_key = prism2_wep_set_key,
.get_key = prism2_wep_get_key, .get_key = prism2_wep_get_key,
.print_stats = prism2_wep_print_stats, .print_stats = prism2_wep_print_stats,
.extra_prefix_len = 4, /* IV */ .extra_mpdu_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */ .extra_mpdu_postfix_len = 4, /* ICV */
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
...@@ -136,6 +136,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) ...@@ -136,6 +136,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
ieee->host_decrypt = 1; ieee->host_decrypt = 1;
ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
/* SAM Init here */
INIT_LIST_HEAD(&ieee->crypt_deinit_list); INIT_LIST_HEAD(&ieee->crypt_deinit_list);
_setup_timer(&ieee->crypt_deinit_timer, _setup_timer(&ieee->crypt_deinit_timer,
rtllib_crypt_deinit_handler, rtllib_crypt_deinit_handler,
...@@ -200,7 +201,7 @@ void free_rtllib(struct net_device *dev) ...@@ -200,7 +201,7 @@ void free_rtllib(struct net_device *dev)
rtllib_crypt_deinit_entries(ieee, 1); rtllib_crypt_deinit_entries(ieee, 1);
for (i = 0; i < NUM_WEP_KEYS; i++) { for (i = 0; i < NUM_WEP_KEYS; i++) {
struct rtllib_crypt_data *crypt = ieee->crypt[i]; struct lib80211_crypt_data *crypt = ieee->crypt[i];
if (crypt) { if (crypt) {
if (crypt->ops) if (crypt->ops)
crypt->ops->deinit(crypt->priv); crypt->ops->deinit(crypt->priv);
......
...@@ -280,7 +280,7 @@ static int rtllib_is_eapol_frame(struct rtllib_device *ieee, ...@@ -280,7 +280,7 @@ static int rtllib_is_eapol_frame(struct rtllib_device *ieee,
/* Called only as a tasklet (software IRQ), by rtllib_rx */ /* Called only as a tasklet (software IRQ), by rtllib_rx */
static inline int static inline int
rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
struct rtllib_crypt_data *crypt) struct lib80211_crypt_data *crypt)
{ {
struct rtllib_hdr_4addr *hdr; struct rtllib_hdr_4addr *hdr;
int res, hdrlen; int res, hdrlen;
...@@ -321,7 +321,7 @@ rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -321,7 +321,7 @@ rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
/* Called only as a tasklet (software IRQ), by rtllib_rx */ /* Called only as a tasklet (software IRQ), by rtllib_rx */
static inline int static inline int
rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
int keyidx, struct rtllib_crypt_data *crypt) int keyidx, struct lib80211_crypt_data *crypt)
{ {
struct rtllib_hdr_4addr *hdr; struct rtllib_hdr_4addr *hdr;
int res, hdrlen; int res, hdrlen;
...@@ -340,7 +340,7 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -340,7 +340,7 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
hdrlen = rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); hdrlen = rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt); atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv, ieee); res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
atomic_dec(&crypt->refcnt); atomic_dec(&crypt->refcnt);
if (res < 0) { if (res < 0) {
printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" 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,7 +1009,7 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc,
} }
static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
struct rtllib_crypt_data **crypt, size_t hdrlen) struct lib80211_crypt_data **crypt, size_t hdrlen)
{ {
struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data; struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;
u16 fc = le16_to_cpu(hdr->frame_ctl); 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,7 +1044,7 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
struct rtllib_rx_stats *rx_stats, struct rtllib_rx_stats *rx_stats,
struct rtllib_crypt_data *crypt, size_t hdrlen) struct lib80211_crypt_data *crypt, size_t hdrlen)
{ {
struct rtllib_hdr_4addr *hdr; struct rtllib_hdr_4addr *hdr;
int keyidx = 0; int keyidx = 0;
...@@ -1252,7 +1252,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -1252,7 +1252,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
{ {
struct net_device *dev = ieee->dev; struct net_device *dev = ieee->dev;
struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data; struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;
struct rtllib_crypt_data *crypt = NULL; struct lib80211_crypt_data *crypt = NULL;
struct rtllib_rxb *rxb = NULL; struct rtllib_rxb *rxb = NULL;
struct rx_ts_record *pTS = NULL; struct rx_ts_record *pTS = NULL;
u16 fc, sc, SeqNum = 0; u16 fc, sc, SeqNum = 0;
......
...@@ -836,7 +836,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) ...@@ -836,7 +836,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest)
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
int encrypt; int encrypt;
int atim_len, erp_len; int atim_len, erp_len;
struct rtllib_crypt_data *crypt; struct lib80211_crypt_data *crypt;
char *ssid = ieee->current_network.ssid; char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len; 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,7 +982,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest)
struct sk_buff *skb; struct sk_buff *skb;
u8 *tag; u8 *tag;
struct rtllib_crypt_data *crypt; struct lib80211_crypt_data *crypt;
struct rtllib_assoc_response_frame *assoc; struct rtllib_assoc_response_frame *assoc;
short encrypt; short encrypt;
...@@ -1178,7 +1178,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, ...@@ -1178,7 +1178,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
unsigned int ckip_ie_len = 0; unsigned int ckip_ie_len = 0;
unsigned int ccxrm_ie_len = 0; unsigned int ccxrm_ie_len = 0;
unsigned int cxvernum_ie_len = 0; unsigned int cxvernum_ie_len = 0;
struct rtllib_crypt_data *crypt; struct lib80211_crypt_data *crypt;
int encrypt; int encrypt;
int PMKCacheIdx; int PMKCacheIdx;
...@@ -3345,8 +3345,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, ...@@ -3345,8 +3345,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
u8 is_mesh) u8 is_mesh)
{ {
int ret = 0; int ret = 0;
struct rtllib_crypto_ops *ops; struct lib80211_crypto_ops *ops;
struct rtllib_crypt_data **crypt; struct lib80211_crypt_data **crypt;
struct rtllib_security sec = { struct rtllib_security sec = {
.flags = 0, .flags = 0,
...@@ -3408,17 +3408,17 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, ...@@ -3408,17 +3408,17 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
goto done; goto done;
} }
if (*crypt == NULL || (*crypt)->ops != ops) { if (*crypt == NULL || (*crypt)->ops != ops) {
struct rtllib_crypt_data *new_crypt; struct lib80211_crypt_data *new_crypt;
rtllib_crypt_delayed_deinit(ieee, crypt); rtllib_crypt_delayed_deinit(ieee, crypt);
new_crypt = (struct rtllib_crypt_data *) new_crypt = (struct lib80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL); kmalloc(sizeof(*new_crypt), GFP_KERNEL);
if (new_crypt == NULL) { if (new_crypt == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
} }
memset(new_crypt, 0, sizeof(struct rtllib_crypt_data)); memset(new_crypt, 0, sizeof(struct lib80211_crypt_data));
new_crypt->ops = ops; new_crypt->ops = ops;
if (new_crypt->ops) if (new_crypt->ops)
new_crypt->priv = new_crypt->priv =
...@@ -3562,7 +3562,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee) ...@@ -3562,7 +3562,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee)
static u8 ccmp_ie[4] = {0x00, 0x50, 0xf2, 0x04}; static u8 ccmp_ie[4] = {0x00, 0x50, 0xf2, 0x04};
static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04}; static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04};
int wpa_ie_len = ieee->wpa_ie_len; int wpa_ie_len = ieee->wpa_ie_len;
struct rtllib_crypt_data *crypt; struct lib80211_crypt_data *crypt;
int encrypt; int encrypt;
crypt = ieee->crypt[ieee->tx_keyidx]; crypt = ieee->crypt[ieee->tx_keyidx];
......
...@@ -179,7 +179,7 @@ inline int rtllib_put_snap(u8 *data, u16 h_proto) ...@@ -179,7 +179,7 @@ inline int rtllib_put_snap(u8 *data, u16 h_proto)
int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag,
int hdr_len) int hdr_len)
{ {
struct rtllib_crypt_data *crypt = NULL; struct lib80211_crypt_data *crypt = NULL;
int res; int res;
crypt = ieee->crypt[ieee->tx_keyidx]; crypt = ieee->crypt[ieee->tx_keyidx];
...@@ -568,7 +568,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -568,7 +568,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
}; };
u8 dest[ETH_ALEN], src[ETH_ALEN]; u8 dest[ETH_ALEN], src[ETH_ALEN];
int qos_actived = ieee->current_network.qos_data.active; int qos_actived = ieee->current_network.qos_data.active;
struct rtllib_crypt_data *crypt = NULL; struct lib80211_crypt_data *crypt = NULL;
struct cb_desc *tcb_desc; struct cb_desc *tcb_desc;
u8 bIsMulticast = false; u8 bIsMulticast = false;
u8 IsAmsdu = false; u8 IsAmsdu = false;
...@@ -741,8 +741,10 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -741,8 +741,10 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
/* Each fragment may need to have room for encryptiong /* Each fragment may need to have room for encryptiong
* pre/postfix */ * pre/postfix */
if (encrypt) { if (encrypt) {
bytes_per_frag -= crypt->ops->extra_prefix_len + bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len +
crypt->ops->extra_postfix_len; crypt->ops->extra_mpdu_postfix_len +
crypt->ops->extra_msdu_prefix_len +
crypt->ops->extra_msdu_postfix_len;
} }
/* Number of fragments is the total bytes_per_frag / /* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */ * payload_per_fragment */
...@@ -790,7 +792,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -790,7 +792,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
else else
tcb_desc->bHwSec = 0; tcb_desc->bHwSec = 0;
skb_reserve(skb_frag, skb_reserve(skb_frag,
crypt->ops->extra_prefix_len); crypt->ops->extra_mpdu_prefix_len +
crypt->ops->extra_msdu_prefix_len);
} else { } else {
tcb_desc->bHwSec = 0; tcb_desc->bHwSec = 0;
} }
......
...@@ -306,7 +306,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, ...@@ -306,7 +306,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
.flags = 0 .flags = 0
}; };
int i, key, key_provided, len; int i, key, key_provided, len;
struct rtllib_crypt_data **crypt; struct lib80211_crypt_data **crypt;
RTLLIB_DEBUG_WX("SET_ENCODE\n"); RTLLIB_DEBUG_WX("SET_ENCODE\n");
...@@ -365,10 +365,10 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, ...@@ -365,10 +365,10 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
} }
if (*crypt == NULL) { if (*crypt == NULL) {
struct rtllib_crypt_data *new_crypt; struct lib80211_crypt_data *new_crypt;
/* take WEP into use */ /* take WEP into use */
new_crypt = kzalloc(sizeof(struct rtllib_crypt_data), new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
GFP_KERNEL); GFP_KERNEL);
if (new_crypt == NULL) if (new_crypt == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -477,7 +477,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee, ...@@ -477,7 +477,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
{ {
struct iw_point *erq = &(wrqu->encoding); struct iw_point *erq = &(wrqu->encoding);
int len, key; int len, key;
struct rtllib_crypt_data *crypt; struct lib80211_crypt_data *crypt;
RTLLIB_DEBUG_WX("GET_ENCODE\n"); RTLLIB_DEBUG_WX("GET_ENCODE\n");
...@@ -526,8 +526,8 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ...@@ -526,8 +526,8 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
int i, idx; int i, idx;
int group_key = 0; int group_key = 0;
const char *alg, *module; const char *alg, *module;
struct rtllib_crypto_ops *ops; struct lib80211_crypto_ops *ops;
struct rtllib_crypt_data **crypt; struct lib80211_crypt_data **crypt;
struct rtllib_security sec = { struct rtllib_security sec = {
.flags = 0, .flags = 0,
...@@ -593,7 +593,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ...@@ -593,7 +593,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
} }
printk(KERN_INFO "alg name:%s\n", alg); printk(KERN_INFO "alg name:%s\n", alg);
ops = rtllib_get_crypto_ops(alg); ops = rtllib_get_crypto_ops(alg);
if (ops == NULL) { if (ops == NULL) {
char tempbuf[100]; char tempbuf[100];
...@@ -611,7 +611,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ...@@ -611,7 +611,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
} }
if (*crypt == NULL || (*crypt)->ops != ops) { if (*crypt == NULL || (*crypt)->ops != ops) {
struct rtllib_crypt_data *new_crypt; struct lib80211_crypt_data *new_crypt;
rtllib_crypt_delayed_deinit(ieee, crypt); rtllib_crypt_delayed_deinit(ieee, crypt);
...@@ -683,7 +683,7 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee, ...@@ -683,7 +683,7 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
{ {
struct iw_point *encoding = &wrqu->encoding; struct iw_point *encoding = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
struct rtllib_crypt_data *crypt; struct lib80211_crypt_data *crypt;
int idx, max_key_len; int idx, max_key_len;
max_key_len = encoding->length - sizeof(*ext); max_key_len = encoding->length - sizeof(*ext);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment