提交 0edd5b44 编写于 作者: J Jeff Garzik

[wireless ieee80211,ipw2200] Lindent source code

No code changes, just Lindent + manual fixups.

This prepares us for updating to the latest Intel driver code, plus
gives the source code a nice facelift.
上级 bbeec90b
此差异已折叠。
此差异已折叠。
...@@ -30,7 +30,6 @@ struct ieee80211_crypto_alg { ...@@ -30,7 +30,6 @@ struct ieee80211_crypto_alg {
struct ieee80211_crypto_ops *ops; struct ieee80211_crypto_ops *ops;
}; };
struct ieee80211_crypto { struct ieee80211_crypto {
struct list_head algs; struct list_head algs;
spinlock_t lock; spinlock_t lock;
...@@ -38,8 +37,7 @@ struct ieee80211_crypto { ...@@ -38,8 +37,7 @@ struct ieee80211_crypto {
static struct ieee80211_crypto *hcrypt; static struct ieee80211_crypto *hcrypt;
void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force)
int force)
{ {
struct list_head *ptr, *n; struct list_head *ptr, *n;
struct ieee80211_crypt_data *entry; struct ieee80211_crypt_data *entry;
...@@ -140,7 +138,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) ...@@ -140,7 +138,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
spin_lock_irqsave(&hcrypt->lock, flags); spin_lock_irqsave(&hcrypt->lock, flags);
for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) {
struct ieee80211_crypto_alg *alg = struct ieee80211_crypto_alg *alg =
(struct ieee80211_crypto_alg *) ptr; (struct ieee80211_crypto_alg *)ptr;
if (alg->ops == ops) { if (alg->ops == ops) {
list_del(&alg->list); list_del(&alg->list);
del_alg = alg; del_alg = alg;
...@@ -158,8 +156,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) ...@@ -158,8 +156,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
return del_alg ? 0 : -1; return del_alg ? 0 : -1;
} }
struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name)
struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
{ {
unsigned long flags; unsigned long flags;
struct list_head *ptr; struct list_head *ptr;
...@@ -171,7 +168,7 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) ...@@ -171,7 +168,7 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
spin_lock_irqsave(&hcrypt->lock, flags); spin_lock_irqsave(&hcrypt->lock, flags);
for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) {
struct ieee80211_crypto_alg *alg = struct ieee80211_crypto_alg *alg =
(struct ieee80211_crypto_alg *) ptr; (struct ieee80211_crypto_alg *)ptr;
if (strcmp(alg->ops->name, name) == 0) { if (strcmp(alg->ops->name, name) == 0) {
found_alg = alg; found_alg = alg;
break; break;
...@@ -185,9 +182,13 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) ...@@ -185,9 +182,13 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
return NULL; return NULL;
} }
static void *ieee80211_crypt_null_init(int keyidx)
static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } {
static void ieee80211_crypt_null_deinit(void *priv) {} return (void *)1;
}
static void ieee80211_crypt_null_deinit(void *priv)
{
}
static struct ieee80211_crypto_ops ieee80211_crypt_null = { static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL", .name = "NULL",
...@@ -204,7 +205,6 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { ...@@ -204,7 +205,6 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_init(void) static int __init ieee80211_crypto_init(void)
{ {
int ret = -ENOMEM; int ret = -ENOMEM;
...@@ -222,11 +222,10 @@ static int __init ieee80211_crypto_init(void) ...@@ -222,11 +222,10 @@ static int __init ieee80211_crypto_init(void)
kfree(hcrypt); kfree(hcrypt);
hcrypt = NULL; hcrypt = NULL;
} }
out: out:
return ret; return ret;
} }
static void __exit ieee80211_crypto_deinit(void) static void __exit ieee80211_crypto_deinit(void)
{ {
struct list_head *ptr, *n; struct list_head *ptr, *n;
...@@ -237,7 +236,7 @@ static void __exit ieee80211_crypto_deinit(void) ...@@ -237,7 +236,7 @@ static void __exit ieee80211_crypto_deinit(void)
for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs;
ptr = n, n = ptr->next) { ptr = n, n = ptr->next) {
struct ieee80211_crypto_alg *alg = struct ieee80211_crypto_alg *alg =
(struct ieee80211_crypto_alg *) ptr; (struct ieee80211_crypto_alg *)ptr;
list_del(ptr); list_del(ptr);
printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm "
"'%s' (deinit)\n", alg->ops->name); "'%s' (deinit)\n", alg->ops->name);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
...@@ -55,7 +54,7 @@ struct ieee80211_ccmp_data { ...@@ -55,7 +54,7 @@ struct ieee80211_ccmp_data {
/* scratch buffers for virt_to_page() (crypto API) */ /* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN]; tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN];
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
}; };
...@@ -75,7 +74,7 @@ static void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, ...@@ -75,7 +74,7 @@ static void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
} }
static void * ieee80211_ccmp_init(int key_idx) static void *ieee80211_ccmp_init(int key_idx)
{ {
struct ieee80211_ccmp_data *priv; struct ieee80211_ccmp_data *priv;
...@@ -94,7 +93,7 @@ static void * ieee80211_ccmp_init(int key_idx) ...@@ -94,7 +93,7 @@ static void * ieee80211_ccmp_init(int key_idx)
return priv; return priv;
fail: fail:
if (priv) { if (priv) {
if (priv->tfm) if (priv->tfm)
crypto_free_tfm(priv->tfm); crypto_free_tfm(priv->tfm);
...@@ -104,7 +103,6 @@ static void * ieee80211_ccmp_init(int key_idx) ...@@ -104,7 +103,6 @@ static void * ieee80211_ccmp_init(int key_idx)
return NULL; return NULL;
} }
static void ieee80211_ccmp_deinit(void *priv) static void ieee80211_ccmp_deinit(void *priv)
{ {
struct ieee80211_ccmp_data *_priv = priv; struct ieee80211_ccmp_data *_priv = priv;
...@@ -113,19 +111,16 @@ static void ieee80211_ccmp_deinit(void *priv) ...@@ -113,19 +111,16 @@ static void ieee80211_ccmp_deinit(void *priv)
kfree(priv); kfree(priv);
} }
static inline void xor_block(u8 * b, u8 * a, size_t len)
static inline void xor_block(u8 *b, u8 *a, size_t len)
{ {
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
b[i] ^= a[i]; b[i] ^= a[i];
} }
static void ccmp_init_blocks(struct crypto_tfm *tfm, static void ccmp_init_blocks(struct crypto_tfm *tfm,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth, u8 * pn, size_t dlen, u8 * b0, u8 * auth, u8 * s0)
u8 *s0)
{ {
u8 *pos, qc = 0; u8 *pos, qc = 0;
size_t aad_len; size_t aad_len;
...@@ -142,7 +137,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, ...@@ -142,7 +137,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
if (a4_included) if (a4_included)
aad_len += 6; aad_len += 6;
if (qc_included) { if (qc_included) {
pos = (u8 *) &hdr->addr4; pos = (u8 *) & hdr->addr4;
if (a4_included) if (a4_included)
pos += 6; pos += 6;
qc = *pos & 0x0f; qc = *pos & 0x0f;
...@@ -169,14 +164,14 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, ...@@ -169,14 +164,14 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
* QC (if present) * QC (if present)
*/ */
pos = (u8 *) hdr; pos = (u8 *) hdr;
aad[0] = 0; /* aad_len >> 8 */ aad[0] = 0; /* aad_len >> 8 */
aad[1] = aad_len & 0xff; aad[1] = aad_len & 0xff;
aad[2] = pos[0] & 0x8f; aad[2] = pos[0] & 0x8f;
aad[3] = pos[1] & 0xc7; aad[3] = pos[1] & 0xc7;
memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN);
pos = (u8 *) &hdr->seq_ctl; pos = (u8 *) & hdr->seq_ctl;
aad[22] = pos[0] & 0x0f; aad[22] = pos[0] & 0x0f;
aad[23] = 0; /* all bits masked */ aad[23] = 0; /* all bits masked */
memset(aad + 24, 0, 8); memset(aad + 24, 0, 8);
if (a4_included) if (a4_included)
memcpy(aad + 24, hdr->addr4, ETH_ALEN); memcpy(aad + 24, hdr->addr4, ETH_ALEN);
...@@ -196,7 +191,6 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, ...@@ -196,7 +191,6 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
ieee80211_ccmp_aes_encrypt(tfm, b0, s0); ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
} }
static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct ieee80211_ccmp_data *key = priv; struct ieee80211_ccmp_data *key = priv;
...@@ -209,8 +203,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -209,8 +203,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
u8 *s0 = key->tx_s0; u8 *s0 = key->tx_s0;
if (skb_headroom(skb) < CCMP_HDR_LEN || if (skb_headroom(skb) < CCMP_HDR_LEN ||
skb_tailroom(skb) < CCMP_MIC_LEN || skb_tailroom(skb) < CCMP_MIC_LEN || skb->len < hdr_len)
skb->len < hdr_len)
return -1; return -1;
data_len = skb->len - hdr_len; data_len = skb->len - hdr_len;
...@@ -230,13 +223,13 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -230,13 +223,13 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
*pos++ = key->tx_pn[5]; *pos++ = key->tx_pn[5];
*pos++ = key->tx_pn[4]; *pos++ = key->tx_pn[4];
*pos++ = 0; *pos++ = 0;
*pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */; *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */ ;
*pos++ = key->tx_pn[3]; *pos++ = key->tx_pn[3];
*pos++ = key->tx_pn[2]; *pos++ = key->tx_pn[2];
*pos++ = key->tx_pn[1]; *pos++ = key->tx_pn[1];
*pos++ = key->tx_pn[0]; *pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
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; blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
...@@ -261,7 +254,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -261,7 +254,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
return 0; return 0;
} }
static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct ieee80211_ccmp_data *key = priv; struct ieee80211_ccmp_data *key = priv;
...@@ -280,7 +272,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -280,7 +272,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return -1; return -1;
} }
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
pos = skb->data + hdr_len; pos = skb->data + hdr_len;
keyidx = pos[3]; keyidx = pos[3];
if (!(keyidx & (1 << 5))) { if (!(keyidx & (1 << 5))) {
...@@ -364,8 +356,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -364,8 +356,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return keyidx; return keyidx;
} }
static int ieee80211_ccmp_set_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_ccmp_data *data = priv; struct ieee80211_ccmp_data *data = priv;
int keyidx; int keyidx;
...@@ -395,8 +386,7 @@ static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) ...@@ -395,8 +386,7 @@ static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
return 0; return 0;
} }
static int ieee80211_ccmp_get_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_ccmp_data *data = priv; struct ieee80211_ccmp_data *data = priv;
...@@ -419,8 +409,7 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) ...@@ -419,8 +409,7 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
return CCMP_TK_LEN; return CCMP_TK_LEN;
} }
static char *ieee80211_ccmp_print_stats(char *p, void *priv)
static char * ieee80211_ccmp_print_stats(char *p, void *priv)
{ {
struct ieee80211_ccmp_data *ccmp = priv; struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d " p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
...@@ -436,7 +425,6 @@ static char * ieee80211_ccmp_print_stats(char *p, void *priv) ...@@ -436,7 +425,6 @@ static char * ieee80211_ccmp_print_stats(char *p, void *priv)
return p; return p;
} }
static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
.name = "CCMP", .name = "CCMP",
.init = ieee80211_ccmp_init, .init = ieee80211_ccmp_init,
...@@ -453,18 +441,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { ...@@ -453,18 +441,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_ccmp_init(void) static int __init ieee80211_crypto_ccmp_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
} }
static void __exit ieee80211_crypto_ccmp_exit(void) static void __exit ieee80211_crypto_ccmp_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
} }
module_init(ieee80211_crypto_ccmp_init); module_init(ieee80211_crypto_ccmp_init);
module_exit(ieee80211_crypto_ccmp_exit); module_exit(ieee80211_crypto_ccmp_exit);
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
#include <linux/crc32.h> #include <linux/crc32.h>
...@@ -62,7 +61,7 @@ struct ieee80211_tkip_data { ...@@ -62,7 +61,7 @@ struct ieee80211_tkip_data {
u8 rx_hdr[16], tx_hdr[16]; u8 rx_hdr[16], tx_hdr[16];
}; };
static void * ieee80211_tkip_init(int key_idx) static void *ieee80211_tkip_init(int key_idx)
{ {
struct ieee80211_tkip_data *priv; struct ieee80211_tkip_data *priv;
...@@ -88,7 +87,7 @@ static void * ieee80211_tkip_init(int key_idx) ...@@ -88,7 +87,7 @@ static void * ieee80211_tkip_init(int key_idx)
return priv; return priv;
fail: fail:
if (priv) { if (priv) {
if (priv->tfm_michael) if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael); crypto_free_tfm(priv->tfm_michael);
...@@ -100,7 +99,6 @@ static void * ieee80211_tkip_init(int key_idx) ...@@ -100,7 +99,6 @@ static void * ieee80211_tkip_init(int key_idx)
return NULL; return NULL;
} }
static void ieee80211_tkip_deinit(void *priv) static void ieee80211_tkip_deinit(void *priv)
{ {
struct ieee80211_tkip_data *_priv = priv; struct ieee80211_tkip_data *_priv = priv;
...@@ -111,51 +109,42 @@ static void ieee80211_tkip_deinit(void *priv) ...@@ -111,51 +109,42 @@ static void ieee80211_tkip_deinit(void *priv)
kfree(priv); kfree(priv);
} }
static inline u16 RotR1(u16 val) static inline u16 RotR1(u16 val)
{ {
return (val >> 1) | (val << 15); return (val >> 1) | (val << 15);
} }
static inline u8 Lo8(u16 val) static inline u8 Lo8(u16 val)
{ {
return val & 0xff; return val & 0xff;
} }
static inline u8 Hi8(u16 val) static inline u8 Hi8(u16 val)
{ {
return val >> 8; return val >> 8;
} }
static inline u16 Lo16(u32 val) static inline u16 Lo16(u32 val)
{ {
return val & 0xffff; return val & 0xffff;
} }
static inline u16 Hi16(u32 val) static inline u16 Hi16(u32 val)
{ {
return val >> 16; return val >> 16;
} }
static inline u16 Mk16(u8 hi, u8 lo) static inline u16 Mk16(u8 hi, u8 lo)
{ {
return lo | (((u16) hi) << 8); return lo | (((u16) hi) << 8);
} }
static inline u16 Mk16_le(u16 * v)
static inline u16 Mk16_le(u16 *v)
{ {
return le16_to_cpu(*v); return le16_to_cpu(*v);
} }
static const u16 Sbox[256] = {
static const u16 Sbox[256] =
{
0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154,
0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A,
0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B,
...@@ -190,17 +179,16 @@ static const u16 Sbox[256] = ...@@ -190,17 +179,16 @@ static const u16 Sbox[256] =
0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A,
}; };
static inline u16 _S_(u16 v) static inline u16 _S_(u16 v)
{ {
u16 t = Sbox[Hi8(v)]; u16 t = Sbox[Hi8(v)];
return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8));
} }
#define PHASE1_LOOP_COUNT 8 #define PHASE1_LOOP_COUNT 8
static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) static void tkip_mixing_phase1(u16 * TTAK, const u8 * TK, const u8 * TA,
u32 IV32)
{ {
int i, j; int i, j;
...@@ -221,13 +209,12 @@ static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) ...@@ -221,13 +209,12 @@ static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
} }
} }
static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK,
static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16) u16 IV16)
{ {
/* Make temporary area overlap WEP seed so that the final copy can be /* Make temporary area overlap WEP seed so that the final copy can be
* avoided on little endian hosts. */ * avoided on little endian hosts. */
u16 *PPK = (u16 *) &WEPSeed[4]; u16 *PPK = (u16 *) & WEPSeed[4];
/* Step 1 - make copy of TTAK and bring in TSC */ /* Step 1 - make copy of TTAK and bring in TSC */
PPK[0] = TTAK[0]; PPK[0] = TTAK[0];
...@@ -238,15 +225,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, ...@@ -238,15 +225,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
PPK[5] = TTAK[4] + IV16; PPK[5] = TTAK[4] + IV16;
/* Step 2 - 96-bit bijective mixing using S-box */ /* Step 2 - 96-bit bijective mixing using S-box */
PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) & TK[0]));
PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) & TK[2]));
PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) & TK[4]));
PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) & TK[6]));
PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) & TK[8]));
PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) & TK[10]));
PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) & TK[12]));
PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) & TK[14]));
PPK[2] += RotR1(PPK[1]); PPK[2] += RotR1(PPK[1]);
PPK[3] += RotR1(PPK[2]); PPK[3] += RotR1(PPK[2]);
PPK[4] += RotR1(PPK[3]); PPK[4] += RotR1(PPK[3]);
...@@ -257,7 +244,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, ...@@ -257,7 +244,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
WEPSeed[0] = Hi8(IV16); WEPSeed[0] = Hi8(IV16);
WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
WEPSeed[2] = Lo8(IV16); WEPSeed[2] = Lo8(IV16);
WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) & TK[0])) >> 1);
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
{ {
...@@ -281,7 +268,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -281,7 +268,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
skb->len < hdr_len) skb->len < hdr_len)
return -1; return -1;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
if (!tkey->tx_phase1_done) { if (!tkey->tx_phase1_done) {
tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32); tkey->tx_iv32);
...@@ -298,7 +285,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -298,7 +285,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
*pos++ = rc4key[0]; *pos++ = rc4key[0];
*pos++ = rc4key[1]; *pos++ = rc4key[1];
*pos++ = rc4key[2]; *pos++ = rc4key[2];
*pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */; *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ;
*pos++ = tkey->tx_iv32 & 0xff; *pos++ = tkey->tx_iv32 & 0xff;
*pos++ = (tkey->tx_iv32 >> 8) & 0xff; *pos++ = (tkey->tx_iv32 >> 8) & 0xff;
*pos++ = (tkey->tx_iv32 >> 16) & 0xff; *pos++ = (tkey->tx_iv32 >> 16) & 0xff;
...@@ -341,7 +328,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -341,7 +328,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
if (skb->len < hdr_len + 8 + 4) if (skb->len < hdr_len + 8 + 4)
return -1; return -1;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
pos = skb->data + hdr_len; pos = skb->data + hdr_len;
keyidx = pos[3]; keyidx = pos[3];
if (!(keyidx & (1 << 5))) { if (!(keyidx & (1 << 5))) {
...@@ -427,9 +414,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -427,9 +414,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return keyidx; return keyidx;
} }
static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr,
static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, u8 * data, size_t data_len, u8 * mic)
u8 *data, size_t data_len, u8 *mic)
{ {
struct scatterlist sg[2]; struct scatterlist sg[2];
...@@ -453,37 +439,37 @@ static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, ...@@ -453,37 +439,37 @@ static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
return 0; return 0;
} }
static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr)
{ {
struct ieee80211_hdr *hdr11; struct ieee80211_hdr *hdr11;
hdr11 = (struct ieee80211_hdr *) skb->data; hdr11 = (struct ieee80211_hdr *)skb->data;
switch (le16_to_cpu(hdr11->frame_ctl) & switch (le16_to_cpu(hdr11->frame_ctl) &
(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_TODS: case IEEE80211_FCTL_TODS:
memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */
memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */
break; break;
case IEEE80211_FCTL_FROMDS: case IEEE80211_FCTL_FROMDS:
memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */
memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */
break; break;
case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS:
memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */
memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */
break; break;
case 0: case 0:
memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */
memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */
break; break;
} }
hdr[12] = 0; /* priority */ hdr[12] = 0; /* priority */
hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */
} }
static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len,
static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) void *priv)
{ {
struct ieee80211_tkip_data *tkey = priv; struct ieee80211_tkip_data *tkey = priv;
u8 *pos; u8 *pos;
...@@ -504,11 +490,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri ...@@ -504,11 +490,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri
return 0; return 0;
} }
#if WIRELESS_EXT >= 18 #if WIRELESS_EXT >= 18
static void ieee80211_michael_mic_failure(struct net_device *dev, static void ieee80211_michael_mic_failure(struct net_device *dev,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr, int keyidx)
int keyidx)
{ {
union iwreq_data wrqu; union iwreq_data wrqu;
struct iw_michaelmicfailure ev; struct iw_michaelmicfailure ev;
...@@ -524,12 +508,11 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, ...@@ -524,12 +508,11 @@ static void ieee80211_michael_mic_failure(struct net_device *dev,
memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN);
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = sizeof(ev); wrqu.data.length = sizeof(ev);
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev);
} }
#elif WIRELESS_EXT >= 15 #elif WIRELESS_EXT >= 15
static void ieee80211_michael_mic_failure(struct net_device *dev, static void ieee80211_michael_mic_failure(struct net_device *dev,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr, int keyidx)
int keyidx)
{ {
union iwreq_data wrqu; union iwreq_data wrqu;
char buf[128]; char buf[128];
...@@ -542,17 +525,16 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, ...@@ -542,17 +525,16 @@ static void ieee80211_michael_mic_failure(struct net_device *dev,
wrqu.data.length = strlen(buf); wrqu.data.length = strlen(buf);
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
} }
#else /* WIRELESS_EXT >= 15 */ #else /* WIRELESS_EXT >= 15 */
static inline void ieee80211_michael_mic_failure(struct net_device *dev, static inline void ieee80211_michael_mic_failure(struct net_device *dev,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr,
int keyidx) int keyidx)
{ {
} }
#endif /* WIRELESS_EXT >= 15 */ #endif /* WIRELESS_EXT >= 15 */
static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv) int hdr_len, void *priv)
{ {
struct ieee80211_tkip_data *tkey = priv; struct ieee80211_tkip_data *tkey = priv;
u8 mic[8]; u8 mic[8];
...@@ -566,7 +548,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, ...@@ -566,7 +548,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
return -1; return -1;
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
printk(KERN_DEBUG "%s: Michael MIC verification failed for " printk(KERN_DEBUG "%s: Michael MIC verification failed for "
"MSDU from " MAC_FMT " keyidx=%d\n", "MSDU from " MAC_FMT " keyidx=%d\n",
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
...@@ -587,8 +569,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, ...@@ -587,8 +569,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
return 0; return 0;
} }
static int ieee80211_tkip_set_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_tkip_data *tkey = priv; struct ieee80211_tkip_data *tkey = priv;
int keyidx; int keyidx;
...@@ -603,10 +584,10 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) ...@@ -603,10 +584,10 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
if (len == TKIP_KEY_LEN) { if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN); memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1; tkey->key_set = 1;
tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ tkey->tx_iv16 = 1; /* TSC is initialized to 1 */
if (seq) { if (seq) {
tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) |
(seq[3] << 8) | seq[2]; (seq[3] << 8) | seq[2];
tkey->rx_iv16 = (seq[1] << 8) | seq[0]; tkey->rx_iv16 = (seq[1] << 8) | seq[0];
} }
} else if (len == 0) } else if (len == 0)
...@@ -617,8 +598,7 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) ...@@ -617,8 +598,7 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
return 0; return 0;
} }
static int ieee80211_tkip_get_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_tkip_data *tkey = priv; struct ieee80211_tkip_data *tkey = priv;
...@@ -647,8 +627,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) ...@@ -647,8 +627,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
return TKIP_KEY_LEN; return TKIP_KEY_LEN;
} }
static char *ieee80211_tkip_print_stats(char *p, void *priv)
static char * ieee80211_tkip_print_stats(char *p, void *priv)
{ {
struct ieee80211_tkip_data *tkip = priv; struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d " p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
...@@ -674,7 +653,6 @@ static char * ieee80211_tkip_print_stats(char *p, void *priv) ...@@ -674,7 +653,6 @@ static char * ieee80211_tkip_print_stats(char *p, void *priv)
return p; return p;
} }
static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
.name = "TKIP", .name = "TKIP",
.init = ieee80211_tkip_init, .init = ieee80211_tkip_init,
...@@ -686,23 +664,20 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { ...@@ -686,23 +664,20 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
.set_key = ieee80211_tkip_set_key, .set_key = ieee80211_tkip_set_key,
.get_key = ieee80211_tkip_get_key, .get_key = ieee80211_tkip_get_key,
.print_stats = ieee80211_tkip_print_stats, .print_stats = ieee80211_tkip_print_stats,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */ .extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */ .extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_tkip_init(void) static int __init ieee80211_crypto_tkip_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
} }
static void __exit ieee80211_crypto_tkip_exit(void) static void __exit ieee80211_crypto_tkip_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
} }
module_init(ieee80211_crypto_tkip_init); module_init(ieee80211_crypto_tkip_init);
module_exit(ieee80211_crypto_tkip_exit); module_exit(ieee80211_crypto_tkip_exit);
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
#include <linux/crc32.h> #include <linux/crc32.h>
...@@ -29,7 +28,6 @@ MODULE_AUTHOR("Jouni Malinen"); ...@@ -29,7 +28,6 @@ MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP"); MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
struct prism2_wep_data { struct prism2_wep_data {
u32 iv; u32 iv;
#define WEP_KEY_LEN 13 #define WEP_KEY_LEN 13
...@@ -39,8 +37,7 @@ struct prism2_wep_data { ...@@ -39,8 +37,7 @@ struct prism2_wep_data {
struct crypto_tfm *tfm; struct crypto_tfm *tfm;
}; };
static void *prism2_wep_init(int keyidx)
static void * prism2_wep_init(int keyidx)
{ {
struct prism2_wep_data *priv; struct prism2_wep_data *priv;
...@@ -62,7 +59,7 @@ static void * prism2_wep_init(int keyidx) ...@@ -62,7 +59,7 @@ static void * prism2_wep_init(int keyidx)
return priv; return priv;
fail: fail:
if (priv) { if (priv) {
if (priv->tfm) if (priv->tfm)
crypto_free_tfm(priv->tfm); crypto_free_tfm(priv->tfm);
...@@ -71,7 +68,6 @@ static void * prism2_wep_init(int keyidx) ...@@ -71,7 +68,6 @@ static void * prism2_wep_init(int keyidx)
return NULL; return NULL;
} }
static void prism2_wep_deinit(void *priv) static void prism2_wep_deinit(void *priv)
{ {
struct prism2_wep_data *_priv = priv; struct prism2_wep_data *_priv = priv;
...@@ -80,7 +76,6 @@ static void prism2_wep_deinit(void *priv) ...@@ -80,7 +76,6 @@ static void prism2_wep_deinit(void *priv)
kfree(priv); kfree(priv);
} }
/* Perform WEP encryption on given skb that has at least 4 bytes of headroom /* Perform WEP encryption on given skb that has at least 4 bytes of headroom
* for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted,
* so the payload length increases with 8 bytes. * so the payload length increases with 8 bytes.
...@@ -143,7 +138,6 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -143,7 +138,6 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
return 0; return 0;
} }
/* Perform WEP decryption on given buffer. Buffer includes whole WEP part of /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of
* the frame: IV (4 bytes), encrypted payload (including SNAP header), * the frame: IV (4 bytes), encrypted payload (including SNAP header),
* ICV (4 bytes). len includes both IV and ICV. * ICV (4 bytes). len includes both IV and ICV.
...@@ -202,8 +196,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -202,8 +196,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return 0; return 0;
} }
static int prism2_wep_set_key(void *key, int len, u8 * seq, void *priv)
static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
{ {
struct prism2_wep_data *wep = priv; struct prism2_wep_data *wep = priv;
...@@ -216,8 +209,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) ...@@ -216,8 +209,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
return 0; return 0;
} }
static int prism2_wep_get_key(void *key, int len, u8 * seq, void *priv)
static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
{ {
struct prism2_wep_data *wep = priv; struct prism2_wep_data *wep = priv;
...@@ -229,16 +221,13 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) ...@@ -229,16 +221,13 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
return wep->key_len; return wep->key_len;
} }
static char *prism2_wep_print_stats(char *p, void *priv)
static char * prism2_wep_print_stats(char *p, void *priv)
{ {
struct prism2_wep_data *wep = priv; struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n", p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len);
wep->key_idx, wep->key_len);
return p; return p;
} }
static struct ieee80211_crypto_ops ieee80211_crypt_wep = { static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
.name = "WEP", .name = "WEP",
.init = prism2_wep_init, .init = prism2_wep_init,
...@@ -250,23 +239,20 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { ...@@ -250,23 +239,20 @@ static struct ieee80211_crypto_ops ieee80211_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_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */ .extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_wep_init(void) static int __init ieee80211_crypto_wep_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
} }
static void __exit ieee80211_crypto_wep_exit(void) static void __exit ieee80211_crypto_wep_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
} }
module_init(ieee80211_crypto_wep_init); module_init(ieee80211_crypto_wep_init);
module_exit(ieee80211_crypto_wep_exit); module_exit(ieee80211_crypto_wep_exit);
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册