Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281431
b: refs/heads/master
c: 32c44cb
h: refs/heads/master
i:
  281429: 960ef7b
  281427: e25aa2c
  281423: 62da7cf
v: v3
  • Loading branch information
Sean MacLennan authored and Greg Kroah-Hartman committed Dec 22, 2011
1 parent 4568d94 commit 1b1d935
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 113 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 184f1938b29310a0df4298b57a7241832cb0813c
refs/heads/master: 32c44cb5b9fdc6eaa445bd622008dd672a3dd1a7
24 changes: 13 additions & 11 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

struct rtllib_crypto_alg {
struct list_head list;
struct rtllib_crypto_ops *ops;
struct lib80211_crypto_ops *ops;
};


Expand All @@ -36,11 +36,11 @@ void rtllib_crypt_deinit_entries(struct rtllib_device *ieee,
int force)
{
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;
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)
continue;
Expand Down Expand Up @@ -73,9 +73,9 @@ void rtllib_crypt_deinit_handler(unsigned long data)
EXPORT_SYMBOL(rtllib_crypt_deinit_handler);

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;

if (*crypt == NULL)
Expand All @@ -98,7 +98,7 @@ void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
}
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;
struct rtllib_crypto_alg *alg;
Expand All @@ -123,7 +123,7 @@ int rtllib_register_crypto_ops(struct rtllib_crypto_ops *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;
struct list_head *ptr;
Expand Down Expand Up @@ -155,7 +155,7 @@ int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *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;
struct list_head *ptr;
Expand Down Expand Up @@ -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_deinit(void *priv) {}

static struct rtllib_crypto_ops rtllib_crypt_null = {
static struct lib80211_crypto_ops rtllib_crypt_null = {
.name = "NULL",
.init = rtllib_crypt_null_init,
.deinit = rtllib_crypt_null_deinit,
Expand All @@ -196,8 +196,10 @@ static struct rtllib_crypto_ops rtllib_crypt_null = {
.decrypt_msdu = NULL,
.set_key = NULL,
.get_key = NULL,
.extra_prefix_len = 0,
.extra_postfix_len = 0,
.extra_mpdu_prefix_len = 0,
.extra_mpdu_postfix_len = 0,
.extra_msdu_prefix_len = 0,
.extra_msdu_postfix_len = 0,
.owner = THIS_MODULE,
};

Expand Down
58 changes: 4 additions & 54 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,61 +25,11 @@

#include <linux/skbuff.h>

struct rtllib_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);
int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops);
int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name);
void rtllib_crypt_deinit_entries(struct rtllib_device *, int);
void rtllib_crypt_deinit_handler(unsigned long);
void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
struct rtllib_crypt_data **crypt);
struct lib80211_crypt_data **crypt);
#endif
6 changes: 3 additions & 3 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static char *rtllib_ccmp_print_stats(char *p, void *priv)
return p;
}

static struct rtllib_crypto_ops rtllib_crypt_ccmp = {
static struct lib80211_crypto_ops rtllib_crypt_ccmp = {
.name = "CCMP",
.init = rtllib_ccmp_init,
.deinit = rtllib_ccmp_deinit,
Expand All @@ -438,8 +438,8 @@ static struct rtllib_crypto_ops rtllib_crypt_ccmp = {
.set_key = rtllib_ccmp_set_key,
.get_key = rtllib_ccmp_get_key,
.print_stats = rtllib_ccmp_print_stats,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.extra_mpdu_prefix_len = CCMP_HDR_LEN,
.extra_mpdu_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};

Expand Down
19 changes: 8 additions & 11 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
int hdr_len, void *priv,
struct rtllib_device *ieee)
int hdr_len, void *priv)
{
struct rtllib_tkip_data *tkey = priv;
u8 mic[8];
Expand All @@ -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))
return -1;

if ((memcmp(mic, skb->data + skb->len - 8, 8) != 0) ||
(ieee->force_mic_error)) {
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct rtllib_hdr_4addr *hdr;
hdr = (struct rtllib_hdr_4addr *) skb->data;
printk(KERN_DEBUG "%s: Michael MIC verification failed for "
"MSDU from %pM keyidx=%d\n",
skb->dev ? skb->dev->name : "N/A", hdr->addr2,
keyidx);
printk(KERN_DEBUG "%d, force_mic_error = %d\n",
(memcmp(mic, skb->data + skb->len - 8, 8) != 0),\
ieee->force_mic_error);
printk(KERN_DEBUG "%d\n",
memcmp(mic, skb->data + skb->len - 8, 8) != 0);
if (skb->dev) {
printk(KERN_INFO "skb->dev != NULL\n");
rtllib_michael_mic_failure(skb->dev, hdr, keyidx);
}
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
ieee->force_mic_error = false;
return -1;
}

Expand Down Expand Up @@ -738,7 +734,7 @@ static char *rtllib_tkip_print_stats(char *p, void *priv)
return p;
}

static struct rtllib_crypto_ops rtllib_crypt_tkip = {
static struct lib80211_crypto_ops rtllib_crypt_tkip = {
.name = "TKIP",
.init = rtllib_tkip_init,
.deinit = rtllib_tkip_deinit,
Expand All @@ -749,8 +745,9 @@ static struct rtllib_crypto_ops rtllib_crypt_tkip = {
.set_key = rtllib_tkip_set_key,
.get_key = rtllib_tkip_get_key,
.print_stats = rtllib_tkip_print_stats,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_mpdu_postfix_len = 4, /* ICV */
.extra_msdu_postfix_len = 8, /* MIC */
.owner = THIS_MODULE,
};

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt_wep.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static char *prism2_wep_print_stats(char *p, void *priv)
return p;
}

static struct rtllib_crypto_ops rtllib_crypt_wep = {
static struct lib80211_crypto_ops rtllib_crypt_wep = {
.name = "WEP",
.init = prism2_wep_init,
.deinit = prism2_wep_deinit,
Expand All @@ -266,8 +266,8 @@ static struct rtllib_crypto_ops rtllib_crypt_wep = {
.set_key = prism2_wep_set_key,
.get_key = prism2_wep_get_key,
.print_stats = prism2_wep_print_stats,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.extra_mpdu_prefix_len = 4, /* IV */
.extra_mpdu_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/staging/rtl8192e/rtllib_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
ieee->host_decrypt = 1;
ieee->ieee802_1x = 1; /* Default to supporting 802.1x */

/* SAM Init here */
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
_setup_timer(&ieee->crypt_deinit_timer,
rtllib_crypt_deinit_handler,
Expand Down Expand Up @@ -200,7 +201,7 @@ void free_rtllib(struct net_device *dev)
rtllib_crypt_deinit_entries(ieee, 1);

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->ops)
crypt->ops->deinit(crypt->priv);
Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/staging/rtl8192e/rtllib_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ static int rtllib_is_eapol_frame(struct rtllib_device *ieee,
/* Called only as a tasklet (software IRQ), by rtllib_rx */
static inline int
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;
int res, hdrlen;
Expand Down Expand Up @@ -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 */
static inline int
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;
int res, hdrlen;
Expand All @@ -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));

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);
if (res < 0) {
printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
Expand Down Expand Up @@ -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,
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;
u16 fc = le16_to_cpu(hdr->frame_ctl);
Expand Down Expand Up @@ -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,
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;
int keyidx = 0;
Expand Down Expand Up @@ -1252,7 +1252,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
{
struct net_device *dev = ieee->dev;
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 rx_ts_record *pTS = NULL;
u16 fc, sc, SeqNum = 0;
Expand Down
18 changes: 9 additions & 9 deletions trunk/drivers/staging/rtl8192e/rtllib_softmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest)
struct sk_buff *skb = NULL;
int encrypt;
int atim_len, erp_len;
struct rtllib_crypt_data *crypt;
struct lib80211_crypt_data *crypt;

char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
Expand Down Expand Up @@ -982,7 +982,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest)
struct sk_buff *skb;
u8 *tag;

struct rtllib_crypt_data *crypt;
struct lib80211_crypt_data *crypt;
struct rtllib_assoc_response_frame *assoc;
short encrypt;

Expand Down Expand Up @@ -1178,7 +1178,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
unsigned int ckip_ie_len = 0;
unsigned int ccxrm_ie_len = 0;
unsigned int cxvernum_ie_len = 0;
struct rtllib_crypt_data *crypt;
struct lib80211_crypt_data *crypt;
int encrypt;
int PMKCacheIdx;

Expand Down Expand Up @@ -3345,8 +3345,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
u8 is_mesh)
{
int ret = 0;
struct rtllib_crypto_ops *ops;
struct rtllib_crypt_data **crypt;
struct lib80211_crypto_ops *ops;
struct lib80211_crypt_data **crypt;

struct rtllib_security sec = {
.flags = 0,
Expand Down Expand Up @@ -3408,17 +3408,17 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
goto done;
}
if (*crypt == NULL || (*crypt)->ops != ops) {
struct rtllib_crypt_data *new_crypt;
struct lib80211_crypt_data *new_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);
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
}
memset(new_crypt, 0, sizeof(struct rtllib_crypt_data));
memset(new_crypt, 0, sizeof(struct lib80211_crypt_data));
new_crypt->ops = ops;
if (new_crypt->ops)
new_crypt->priv =
Expand Down Expand Up @@ -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_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04};
int wpa_ie_len = ieee->wpa_ie_len;
struct rtllib_crypt_data *crypt;
struct lib80211_crypt_data *crypt;
int encrypt;

crypt = ieee->crypt[ieee->tx_keyidx];
Expand Down
Loading

0 comments on commit 1b1d935

Please sign in to comment.