Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267904
b: refs/heads/master
c: a44325f
h: refs/heads/master
v: v3
  • Loading branch information
Larry Finger authored and Greg Kroah-Hartman committed Aug 25, 2011
1 parent d4f8b00 commit 59ddd40
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 183 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: b448b0cc13112c7bdfdef2b242f15f2c86bd31f1
refs/heads/master: a44325f98563c39bc63311db7471b848153e49fe
69 changes: 34 additions & 35 deletions trunk/drivers/staging/rtl8192e/rtl_eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ void eprom_cs(struct net_device *dev, short bit)
{
if (bit)
write_nic_byte(dev, EPROM_CMD,
(1<<EPROM_CS_SHIFT) | \
(1 << EPROM_CS_SHIFT) |
read_nic_byte(dev, EPROM_CMD));
else
write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD)\
&~(1<<EPROM_CS_SHIFT));
write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD)
& ~(1<<EPROM_CS_SHIFT));

udelay(EPROM_DELAY);
}
Expand All @@ -42,22 +42,22 @@ void eprom_cs(struct net_device *dev, short bit)
void eprom_ck_cycle(struct net_device *dev)
{
write_nic_byte(dev, EPROM_CMD,
(1<<EPROM_CK_SHIFT) | read_nic_byte(dev,EPROM_CMD));
(1<<EPROM_CK_SHIFT) | read_nic_byte(dev, EPROM_CMD));
udelay(EPROM_DELAY);
write_nic_byte(dev, EPROM_CMD,
read_nic_byte(dev, EPROM_CMD) &~ (1<<EPROM_CK_SHIFT));
read_nic_byte(dev, EPROM_CMD) & ~(1<<EPROM_CK_SHIFT));
udelay(EPROM_DELAY);
}


void eprom_w(struct net_device *dev,short bit)
void eprom_w(struct net_device *dev, short bit)
{
if (bit)
write_nic_byte(dev, EPROM_CMD, (1<<EPROM_W_SHIFT) | \
read_nic_byte(dev,EPROM_CMD));
write_nic_byte(dev, EPROM_CMD, (1<<EPROM_W_SHIFT) |
read_nic_byte(dev, EPROM_CMD));
else
write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev,EPROM_CMD)\
&~(1<<EPROM_W_SHIFT));
write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD)
& ~(1<<EPROM_W_SHIFT));

udelay(EPROM_DELAY);
}
Expand All @@ -67,7 +67,7 @@ short eprom_r(struct net_device *dev)
{
short bit;

bit=(read_nic_byte(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT) );
bit = (read_nic_byte(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT));
udelay(EPROM_DELAY);

if (bit)
Expand All @@ -80,45 +80,44 @@ void eprom_send_bits_string(struct net_device *dev, short b[], int len)
{
int i;

for (i=0; i<len; i++){
for (i = 0; i < len; i++) {
eprom_w(dev, b[i]);
eprom_ck_cycle(dev);
}
}


u32 eprom_read(struct net_device *dev, u32 addr)
{
struct r8192_priv *priv = rtllib_priv(dev);
short read_cmd[]={1,1,0};
short read_cmd[] = {1, 1, 0};
short addr_str[8];
int i;
int addr_len;
u32 ret;

ret=0;
ret = 0;
write_nic_byte(dev, EPROM_CMD,
(EPROM_CMD_PROGRAM<<EPROM_CMD_OPERATING_MODE_SHIFT));
(EPROM_CMD_PROGRAM << EPROM_CMD_OPERATING_MODE_SHIFT));
udelay(EPROM_DELAY);

if (priv->epromtype==EEPROM_93C56){
addr_str[7]=addr & 1;
addr_str[6]=addr & (1<<1);
addr_str[5]=addr & (1<<2);
addr_str[4]=addr & (1<<3);
addr_str[3]=addr & (1<<4);
addr_str[2]=addr & (1<<5);
addr_str[1]=addr & (1<<6);
addr_str[0]=addr & (1<<7);
addr_len=8;
}else{
addr_str[5]=addr & 1;
addr_str[4]=addr & (1<<1);
addr_str[3]=addr & (1<<2);
addr_str[2]=addr & (1<<3);
addr_str[1]=addr & (1<<4);
addr_str[0]=addr & (1<<5);
addr_len=6;
if (priv->epromtype == EEPROM_93C56) {
addr_str[7] = addr & 1;
addr_str[6] = addr & (1<<1);
addr_str[5] = addr & (1<<2);
addr_str[4] = addr & (1<<3);
addr_str[3] = addr & (1<<4);
addr_str[2] = addr & (1<<5);
addr_str[1] = addr & (1<<6);
addr_str[0] = addr & (1<<7);
addr_len = 8;
} else {
addr_str[5] = addr & 1;
addr_str[4] = addr & (1<<1);
addr_str[3] = addr & (1<<2);
addr_str[2] = addr & (1<<3);
addr_str[1] = addr & (1<<4);
addr_str[0] = addr & (1<<5);
addr_len = 6;
}
eprom_cs(dev, 1);
eprom_ck_cycle(dev);
Expand All @@ -127,7 +126,7 @@ u32 eprom_read(struct net_device *dev, u32 addr)

eprom_w(dev, 0);

for (i = 0; i < 16; i++){
for (i = 0; i < 16; i++) {
eprom_ck_cycle(dev);
ret |= (eprom_r(dev)<<(15-i));
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/rtl8192e/rtl_eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@

#define EPROM_DELAY 10

u32 eprom_read(struct net_device *dev,u32 addr);
u32 eprom_read(struct net_device *dev, u32 addr);
6 changes: 3 additions & 3 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <asm/string.h>
#include <asm/errno.h>
#include <linux/string.h>
#include <linux/errno.h>

#include "rtllib.h"

Expand Down Expand Up @@ -152,7 +152,7 @@ int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops)
}


struct rtllib_crypto_ops * rtllib_get_crypto_ops(const char *name)
struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name)
{
unsigned long flags;
struct list_head *ptr;
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ struct rtllib_crypto_ops {
/* 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 */
* 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;
Expand All @@ -77,9 +77,9 @@ struct rtllib_crypt_data {

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);
struct rtllib_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 rtllib_crypt_data **crypt);
#endif
30 changes: 17 additions & 13 deletions trunk/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <linux/netdevice.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <asm/string.h>
#include <linux/string.h>
#include <linux/wireless.h>
#include "rtllib.h"

Expand Down Expand Up @@ -56,10 +56,10 @@ struct rtllib_ccmp_data {
void rtllib_ccmp_aes_encrypt(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
crypto_cipher_encrypt_one((void*)tfm, ct, pt);
crypto_cipher_encrypt_one((void *)tfm, ct, pt);
}

static void * rtllib_ccmp_init(int key_idx)
static void *rtllib_ccmp_init(int key_idx)
{
struct rtllib_ccmp_data *priv;

Expand All @@ -69,7 +69,7 @@ static void * rtllib_ccmp_init(int key_idx)
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;

priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
"crypto API aes\n");
Expand All @@ -81,7 +81,7 @@ static void * rtllib_ccmp_init(int key_idx)
fail:
if (priv) {
if (priv->tfm)
crypto_free_cipher((void*)priv->tfm);
crypto_free_cipher((void *)priv->tfm);
kfree(priv);
}

Expand All @@ -93,7 +93,7 @@ static void rtllib_ccmp_deinit(void *priv)
{
struct rtllib_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
crypto_free_cipher((void*)_priv->tfm);
crypto_free_cipher((void *)_priv->tfm);
kfree(priv);
}

Expand Down Expand Up @@ -124,7 +124,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
/*
qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) &&
(WLAN_FC_GET_STYPE(fc) & 0x08));
*/
*/
qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) &&
(WLAN_FC_GET_STYPE(fc) & 0x80));
aad_len = 22;
Expand Down Expand Up @@ -192,7 +192,8 @@ static int rtllib_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
int data_len, i;
u8 *pos;
struct rtllib_hdr_4addr *hdr;
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb +
MAX_DEV_ADDR_SIZE);
if (skb_headroom(skb) < CCMP_HDR_LEN ||
skb_tailroom(skb) < CCMP_MIC_LEN ||
skb->len < hdr_len)
Expand Down Expand Up @@ -232,7 +233,8 @@ static int rtllib_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)

mic = skb_put(skb, CCMP_MIC_LEN);

ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len,
b0, b, s0);

blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
Expand Down Expand Up @@ -262,7 +264,8 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
struct rtllib_ccmp_data *key = priv;
u8 keyidx, *pos;
struct rtllib_hdr_4addr *hdr;
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb +
MAX_DEV_ADDR_SIZE);
u8 pn[6];

if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) {
Expand Down Expand Up @@ -308,7 +311,8 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return -4;
}
if (!tcb_desc->bHwSec) {
size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN;
size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN -
CCMP_MIC_LEN;
u8 *mic = skb->data + skb->len - CCMP_MIC_LEN;
u8 *b0 = key->rx_b0;
u8 *b = key->rx_b;
Expand Down Expand Up @@ -376,7 +380,7 @@ static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
data->rx_pn[4] = seq[1];
data->rx_pn[5] = seq[0];
}
crypto_cipher_setkey((void*)data->tfm, data->key, CCMP_TK_LEN);
crypto_cipher_setkey((void *)data->tfm, data->key, CCMP_TK_LEN);
} else if (len == 0)
data->key_set = 0;
else
Expand Down Expand Up @@ -410,7 +414,7 @@ static int rtllib_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
}


static char * rtllib_ccmp_print_stats(char *p, void *priv)
static char *rtllib_ccmp_print_stats(char *p, void *priv)
{
struct rtllib_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
Expand Down
Loading

0 comments on commit 59ddd40

Please sign in to comment.