|
@@ -22,33 +22,15 @@
|
|
|
#include <asm/string.h>
|
|
|
|
|
|
#include "ieee80211.h"
|
|
|
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
|
|
|
-//#include "crypto_compat.h"
|
|
|
-#endif
|
|
|
-
|
|
|
|
|
|
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
|
|
|
-#include "rtl_crypto.h"
|
|
|
-#else
|
|
|
#include <linux/crypto.h>
|
|
|
-#endif
|
|
|
-//#include <asm/scatterlist.h>
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
|
|
|
- #include <asm/scatterlist.h>
|
|
|
-#else
|
|
|
#include <linux/scatterlist.h>
|
|
|
-#endif
|
|
|
-
|
|
|
#include <linux/crc32.h>
|
|
|
|
|
|
MODULE_AUTHOR("Jouni Malinen");
|
|
|
MODULE_DESCRIPTION("Host AP crypt: TKIP");
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
-#ifndef OPENSUSE_SLED
|
|
|
-#define OPENSUSE_SLED 0
|
|
|
-#endif
|
|
|
-
|
|
|
struct ieee80211_tkip_data {
|
|
|
#define TKIP_KEY_LEN 32
|
|
|
u8 key[TKIP_KEY_LEN];
|
|
@@ -71,17 +53,12 @@ struct ieee80211_tkip_data {
|
|
|
u32 dot11RSNAStatsTKIPLocalMICFailures;
|
|
|
|
|
|
int key_idx;
|
|
|
-#if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
|
|
|
+
|
|
|
struct crypto_blkcipher *rx_tfm_arc4;
|
|
|
struct crypto_hash *rx_tfm_michael;
|
|
|
struct crypto_blkcipher *tx_tfm_arc4;
|
|
|
struct crypto_hash *tx_tfm_michael;
|
|
|
-#else
|
|
|
- struct crypto_tfm *tx_tfm_arc4;
|
|
|
- struct crypto_tfm *tx_tfm_michael;
|
|
|
- struct crypto_tfm *rx_tfm_arc4;
|
|
|
- struct crypto_tfm *rx_tfm_michael;
|
|
|
-#endif
|
|
|
+
|
|
|
/* scratch buffers for virt_to_page() (crypto API) */
|
|
|
u8 rx_hdr[16], tx_hdr[16];
|
|
|
};
|
|
@@ -95,35 +72,7 @@ static void * ieee80211_tkip_init(int key_idx)
|
|
|
goto fail;
|
|
|
memset(priv, 0, sizeof(*priv));
|
|
|
priv->key_idx = key_idx;
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
|
|
|
- if (priv->tx_tfm_arc4 == NULL) {
|
|
|
- printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
|
|
|
- "crypto API arc4\n");
|
|
|
- goto fail;
|
|
|
- }
|
|
|
-
|
|
|
- priv->tx_tfm_michael = crypto_alloc_tfm("michael_mic", 0);
|
|
|
- if (priv->tx_tfm_michael == NULL) {
|
|
|
- printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
|
|
|
- "crypto API michael_mic\n");
|
|
|
- goto fail;
|
|
|
- }
|
|
|
-
|
|
|
- priv->rx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
|
|
|
- if (priv->rx_tfm_arc4 == NULL) {
|
|
|
- printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
|
|
|
- "crypto API arc4\n");
|
|
|
- goto fail;
|
|
|
- }
|
|
|
|
|
|
- priv->rx_tfm_michael = crypto_alloc_tfm("michael_mic", 0);
|
|
|
- if (priv->rx_tfm_michael == NULL) {
|
|
|
- printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
|
|
|
- "crypto API michael_mic\n");
|
|
|
- goto fail;
|
|
|
- }
|
|
|
-#else
|
|
|
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
|
|
|
CRYPTO_ALG_ASYNC);
|
|
|
if (IS_ERR(priv->tx_tfm_arc4)) {
|
|
@@ -159,22 +108,11 @@ static void * ieee80211_tkip_init(int key_idx)
|
|
|
priv->rx_tfm_michael = NULL;
|
|
|
goto fail;
|
|
|
}
|
|
|
-#endif
|
|
|
+
|
|
|
return priv;
|
|
|
|
|
|
fail:
|
|
|
if (priv) {
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- if (priv->tx_tfm_michael)
|
|
|
- crypto_free_tfm(priv->tx_tfm_michael);
|
|
|
- if (priv->tx_tfm_arc4)
|
|
|
- crypto_free_tfm(priv->tx_tfm_arc4);
|
|
|
- if (priv->rx_tfm_michael)
|
|
|
- crypto_free_tfm(priv->rx_tfm_michael);
|
|
|
- if (priv->rx_tfm_arc4)
|
|
|
- crypto_free_tfm(priv->rx_tfm_arc4);
|
|
|
-
|
|
|
-#else
|
|
|
if (priv->tx_tfm_michael)
|
|
|
crypto_free_hash(priv->tx_tfm_michael);
|
|
|
if (priv->tx_tfm_arc4)
|
|
@@ -183,7 +121,6 @@ fail:
|
|
|
crypto_free_hash(priv->rx_tfm_michael);
|
|
|
if (priv->rx_tfm_arc4)
|
|
|
crypto_free_blkcipher(priv->rx_tfm_arc4);
|
|
|
-#endif
|
|
|
kfree(priv);
|
|
|
}
|
|
|
|
|
@@ -194,16 +131,7 @@ fail:
|
|
|
static void ieee80211_tkip_deinit(void *priv)
|
|
|
{
|
|
|
struct ieee80211_tkip_data *_priv = priv;
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- if (_priv->tx_tfm_michael)
|
|
|
- crypto_free_tfm(_priv->tx_tfm_michael);
|
|
|
- if (_priv->tx_tfm_arc4)
|
|
|
- crypto_free_tfm(_priv->tx_tfm_arc4);
|
|
|
- if (_priv->rx_tfm_michael)
|
|
|
- crypto_free_tfm(_priv->rx_tfm_michael);
|
|
|
- if (_priv->rx_tfm_arc4)
|
|
|
- crypto_free_tfm(_priv->rx_tfm_arc4);
|
|
|
-#else
|
|
|
+
|
|
|
if (_priv) {
|
|
|
if (_priv->tx_tfm_michael)
|
|
|
crypto_free_hash(_priv->tx_tfm_michael);
|
|
@@ -214,7 +142,6 @@ static void ieee80211_tkip_deinit(void *priv)
|
|
|
if (_priv->rx_tfm_arc4)
|
|
|
crypto_free_blkcipher(_priv->rx_tfm_arc4);
|
|
|
}
|
|
|
-#endif
|
|
|
kfree(priv);
|
|
|
}
|
|
|
|
|
@@ -384,11 +311,8 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
|
|
|
u8 *pos;
|
|
|
struct ieee80211_hdr_4addr *hdr;
|
|
|
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
|
|
|
-
|
|
|
- #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
|
|
|
struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4};
|
|
|
int ret = 0;
|
|
|
- #endif
|
|
|
u8 rc4key[16], *icv;
|
|
|
u32 crc;
|
|
|
struct scatterlist sg;
|
|
@@ -399,18 +323,6 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
|
|
|
|
|
|
hdr = (struct ieee80211_hdr_4addr *) skb->data;
|
|
|
|
|
|
-#if 0
|
|
|
-printk("@@ tkey\n");
|
|
|
-printk("%x|", ((u32*)tkey->key)[0]);
|
|
|
-printk("%x|", ((u32*)tkey->key)[1]);
|
|
|
-printk("%x|", ((u32*)tkey->key)[2]);
|
|
|
-printk("%x|", ((u32*)tkey->key)[3]);
|
|
|
-printk("%x|", ((u32*)tkey->key)[4]);
|
|
|
-printk("%x|", ((u32*)tkey->key)[5]);
|
|
|
-printk("%x|", ((u32*)tkey->key)[6]);
|
|
|
-printk("%x\n", ((u32*)tkey->key)[7]);
|
|
|
-#endif
|
|
|
-
|
|
|
if (!tcb_desc->bHwSec)
|
|
|
{
|
|
|
if (!tkey->tx_phase1_done) {
|
|
@@ -451,33 +363,14 @@ printk("%x\n", ((u32*)tkey->key)[7]);
|
|
|
if (!tcb_desc->bHwSec)
|
|
|
{
|
|
|
icv = skb_put(skb, 4);
|
|
|
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
|
|
|
crc = ~crc32_le(~0, pos, len);
|
|
|
-#else
|
|
|
- crc = ~ether_crc_le(len, pos);
|
|
|
-#endif
|
|
|
icv[0] = crc;
|
|
|
icv[1] = crc >> 8;
|
|
|
icv[2] = crc >> 16;
|
|
|
icv[3] = crc >> 24;
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
|
|
|
- sg.page = virt_to_page(pos);
|
|
|
- sg.offset = offset_in_page(pos);
|
|
|
- sg.length = len + 4;
|
|
|
- crypto_cipher_encrypt(tkey->tx_tfm_arc4, &sg, &sg, len + 4);
|
|
|
-#else
|
|
|
crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
|
|
|
-#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
|
|
|
- sg.page = virt_to_page(pos);
|
|
|
- sg.offset = offset_in_page(pos);
|
|
|
- sg.length = len + 4;
|
|
|
-#else
|
|
|
sg_init_one(&sg, pos, len+4);
|
|
|
-#endif
|
|
|
ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
|
|
|
-#endif
|
|
|
-
|
|
|
}
|
|
|
|
|
|
tkey->tx_iv16++;
|
|
@@ -487,11 +380,7 @@ printk("%x\n", ((u32*)tkey->key)[7]);
|
|
|
}
|
|
|
|
|
|
if (!tcb_desc->bHwSec)
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- return 0;
|
|
|
- #else
|
|
|
return ret;
|
|
|
- #endif
|
|
|
else
|
|
|
return 0;
|
|
|
|
|
@@ -506,9 +395,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
|
|
|
u16 iv16;
|
|
|
struct ieee80211_hdr_4addr *hdr;
|
|
|
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
|
|
|
- #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
|
|
|
struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4};
|
|
|
- #endif
|
|
|
u8 rc4key[16];
|
|
|
u8 icv[4];
|
|
|
u32 crc;
|
|
@@ -567,21 +454,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
|
|
|
|
|
|
plen = skb->len - hdr_len - 12;
|
|
|
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
|
|
|
- sg.page = virt_to_page(pos);
|
|
|
- sg.offset = offset_in_page(pos);
|
|
|
- sg.length = plen + 4;
|
|
|
- crypto_cipher_decrypt(tkey->rx_tfm_arc4, &sg, &sg, plen + 4);
|
|
|
-#else
|
|
|
crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
|
|
|
-#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
|
|
|
- sg.page = virt_to_page(pos);
|
|
|
- sg.offset = offset_in_page(pos);
|
|
|
- sg.length = plen + 4;
|
|
|
-#else
|
|
|
sg_init_one(&sg, pos, plen+4);
|
|
|
-#endif
|
|
|
+
|
|
|
if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
|
|
|
if (net_ratelimit()) {
|
|
|
printk(KERN_DEBUG ": TKIP: failed to decrypt "
|
|
@@ -590,13 +465,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
|
|
|
}
|
|
|
return -7;
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
|
|
|
crc = ~crc32_le(~0, pos, plen);
|
|
|
- #else
|
|
|
- crc = ~ether_crc_le(plen, pos);
|
|
|
- #endif
|
|
|
icv[0] = crc;
|
|
|
icv[1] = crc >> 8;
|
|
|
icv[2] = crc >> 16;
|
|
@@ -628,63 +498,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
|
|
|
skb_pull(skb, 8);
|
|
|
skb_trim(skb, skb->len - 4);
|
|
|
|
|
|
-//john's test
|
|
|
-#ifdef JOHN_DUMP
|
|
|
-if( ((u16*)skb->data)[0] & 0x4000){
|
|
|
- printk("@@ rx decrypted skb->data");
|
|
|
- int i;
|
|
|
- for(i=0;i<skb->len;i++){
|
|
|
- if( (i%24)==0 ) printk("\n");
|
|
|
- printk("%2x ", ((u8*)skb->data)[i]);
|
|
|
- }
|
|
|
- printk("\n");
|
|
|
-}
|
|
|
-#endif /*JOHN_DUMP*/
|
|
|
return keyidx;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
-static int michael_mic(struct crypto_tfm * tfm_michael, u8 *key, u8 *hdr,
|
|
|
- u8 *data, size_t data_len, u8 *mic)
|
|
|
-{
|
|
|
- struct scatterlist sg[2];
|
|
|
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
|
|
|
- struct hash_desc desc;
|
|
|
- int ret = 0;
|
|
|
-#endif
|
|
|
-
|
|
|
- if (tfm_michael == NULL){
|
|
|
- printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
|
|
|
- return -1;
|
|
|
- }
|
|
|
- sg[0].page = virt_to_page(hdr);
|
|
|
- sg[0].offset = offset_in_page(hdr);
|
|
|
- sg[0].length = 16;
|
|
|
-
|
|
|
- sg[1].page = virt_to_page(data);
|
|
|
- sg[1].offset = offset_in_page(data);
|
|
|
- sg[1].length = data_len;
|
|
|
-
|
|
|
-
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
|
|
|
- crypto_digest_init(tfm_michael);
|
|
|
- crypto_digest_setkey(tfm_michael, key, 8);
|
|
|
- crypto_digest_update(tfm_michael, sg, 2);
|
|
|
- crypto_digest_final(tfm_michael, mic);
|
|
|
- return 0;
|
|
|
-#else
|
|
|
-if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
|
|
|
- return -1;
|
|
|
-
|
|
|
-// return 0;
|
|
|
- desc.tfm = tkey->tfm_michael;
|
|
|
- desc.flags = 0;
|
|
|
- ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
|
|
|
- return ret;
|
|
|
-#endif
|
|
|
-}
|
|
|
-#else
|
|
|
static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
|
|
|
u8 * data, size_t data_len, u8 * mic)
|
|
|
{
|
|
@@ -695,19 +511,10 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
|
|
|
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
|
|
|
return -1;
|
|
|
}
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
|
|
|
- sg[0].page = virt_to_page(hdr);
|
|
|
- sg[0].offset = offset_in_page(hdr);
|
|
|
- sg[0].length = 16;
|
|
|
-
|
|
|
- sg[1].page = virt_to_page(data);
|
|
|
- sg[1].offset = offset_in_page(data);
|
|
|
- sg[1].length = data_len;
|
|
|
-#else
|
|
|
+
|
|
|
sg_init_table(sg, 2);
|
|
|
sg_set_buf(&sg[0], hdr, 16);
|
|
|
sg_set_buf(&sg[1], data, data_len);
|
|
|
-#endif
|
|
|
|
|
|
if (crypto_hash_setkey(tfm_michael, key, 8))
|
|
|
return -1;
|
|
@@ -716,9 +523,6 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
|
|
|
desc.flags = 0;
|
|
|
return crypto_hash_digest(&desc, sg, data_len + 16, mic);
|
|
|
}
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
|
|
|
static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
|
|
|
{
|
|
@@ -775,20 +579,14 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri
|
|
|
}
|
|
|
// }
|
|
|
pos = skb_put(skb, 8);
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
|
|
|
- skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
|
|
|
-#else
|
|
|
+
|
|
|
if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
|
|
|
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
|
|
|
-#endif
|
|
|
return -1;
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-#if WIRELESS_EXT >= 18
|
|
|
static void ieee80211_michael_mic_failure(struct net_device *dev,
|
|
|
struct ieee80211_hdr_4addr *hdr,
|
|
|
int keyidx)
|
|
@@ -809,29 +607,6 @@ static void ieee80211_michael_mic_failure(struct net_device *dev,
|
|
|
wrqu.data.length = sizeof(ev);
|
|
|
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
|
|
|
}
|
|
|
-#elif WIRELESS_EXT >= 15
|
|
|
-static void ieee80211_michael_mic_failure(struct net_device *dev,
|
|
|
- struct ieee80211_hdr_4addr *hdr,
|
|
|
- int keyidx)
|
|
|
-{
|
|
|
- union iwreq_data wrqu;
|
|
|
- char buf[128];
|
|
|
-
|
|
|
- /* TODO: needed parameters: count, keyid, key type, TSC */
|
|
|
- sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr="
|
|
|
- MAC_FMT ")", keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni",
|
|
|
- MAC_ARG(hdr->addr2));
|
|
|
- memset(&wrqu, 0, sizeof(wrqu));
|
|
|
- wrqu.data.length = strlen(buf);
|
|
|
- wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
|
|
|
-}
|
|
|
-#else /* WIRELESS_EXT >= 15 */
|
|
|
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
|
|
|
- struct ieee80211_hdr_4addr *hdr,
|
|
|
- int keyidx)
|
|
|
-{
|
|
|
-}
|
|
|
-#endif /* WIRELESS_EXT >= 15 */
|
|
|
|
|
|
static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
|
|
|
int hdr_len, void *priv)
|
|
@@ -853,13 +628,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
|
|
|
}
|
|
|
// }
|
|
|
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
|
|
|
- skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
|
|
|
-#else
|
|
|
if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
|
|
|
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
|
|
|
-#endif
|
|
|
return -1;
|
|
|
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
|
|
|
struct ieee80211_hdr_4addr *hdr;
|
|
@@ -889,32 +659,18 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
|
|
|
{
|
|
|
struct ieee80211_tkip_data *tkey = priv;
|
|
|
int keyidx;
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- struct crypto_tfm *tfm = tkey->tx_tfm_michael;
|
|
|
- struct crypto_tfm *tfm2 = tkey->tx_tfm_arc4;
|
|
|
- struct crypto_tfm *tfm3 = tkey->rx_tfm_michael;
|
|
|
- struct crypto_tfm *tfm4 = tkey->rx_tfm_arc4;
|
|
|
-#else
|
|
|
struct crypto_hash *tfm = tkey->tx_tfm_michael;
|
|
|
struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
|
|
|
struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
|
|
|
struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
|
|
|
-#endif
|
|
|
|
|
|
keyidx = tkey->key_idx;
|
|
|
memset(tkey, 0, sizeof(*tkey));
|
|
|
tkey->key_idx = keyidx;
|
|
|
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
|
|
- tkey->tx_tfm_michael = tfm;
|
|
|
- tkey->tx_tfm_arc4 = tfm2;
|
|
|
- tkey->rx_tfm_michael = tfm3;
|
|
|
- tkey->rx_tfm_arc4 = tfm4;
|
|
|
-#else
|
|
|
tkey->tx_tfm_michael = tfm;
|
|
|
tkey->tx_tfm_arc4 = tfm2;
|
|
|
tkey->rx_tfm_michael = tfm3;
|
|
|
tkey->rx_tfm_arc4 = tfm4;
|
|
|
-#endif
|
|
|
|
|
|
if (len == TKIP_KEY_LEN) {
|
|
|
memcpy(tkey->key, key, TKIP_KEY_LEN);
|
|
@@ -1007,14 +763,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
|
|
|
.owner = THIS_MODULE,
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-static int __init ieee80211_crypto_tkip_init(void)
|
|
|
+int __init ieee80211_crypto_tkip_init(void)
|
|
|
{
|
|
|
return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-static void __exit ieee80211_crypto_tkip_exit(void)
|
|
|
+void __exit ieee80211_crypto_tkip_exit(void)
|
|
|
{
|
|
|
ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
|
|
|
}
|
|
@@ -1024,11 +778,3 @@ void ieee80211_tkip_null(void)
|
|
|
// printk("============>%s()\n", __FUNCTION__);
|
|
|
return;
|
|
|
}
|
|
|
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
|
|
|
-EXPORT_SYMBOL(ieee80211_tkip_null);
|
|
|
-#else
|
|
|
-EXPORT_SYMBOL_NOVERS(ieee80211_tkip_null);
|
|
|
-#endif
|
|
|
-
|
|
|
-module_init(ieee80211_crypto_tkip_init);
|
|
|
-module_exit(ieee80211_crypto_tkip_exit);
|