diff options
| -rw-r--r-- | drivers/staging/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/staging/Makefile | 1 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/Makefile | 1 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/ieee80211.h | 6 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 35 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 62 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 272 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 114 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 82 | ||||
| -rw-r--r-- | drivers/staging/rtl8192u/r8192U_core.c | 110 |
10 files changed, 109 insertions, 576 deletions
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 5dccf6bfb0f9..6fbbedbc7fe7 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
| @@ -77,6 +77,8 @@ source "drivers/staging/rtl8187se/Kconfig" | |||
| 77 | 77 | ||
| 78 | source "drivers/staging/rtl8192su/Kconfig" | 78 | source "drivers/staging/rtl8192su/Kconfig" |
| 79 | 79 | ||
| 80 | source "drivers/staging/rtl8192u/Kconfig" | ||
| 81 | |||
| 80 | source "drivers/staging/rtl8192e/Kconfig" | 82 | source "drivers/staging/rtl8192e/Kconfig" |
| 81 | 83 | ||
| 82 | source "drivers/staging/mimio/Kconfig" | 84 | source "drivers/staging/mimio/Kconfig" |
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 2f228f99be93..61a81c148c9f 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile | |||
| @@ -21,6 +21,7 @@ obj-$(CONFIG_PANEL) += panel/ | |||
| 21 | obj-$(CONFIG_ALTERA_PCIE_CHDMA) += altpciechdma/ | 21 | obj-$(CONFIG_ALTERA_PCIE_CHDMA) += altpciechdma/ |
| 22 | obj-$(CONFIG_R8187SE) += rtl8187se/ | 22 | obj-$(CONFIG_R8187SE) += rtl8187se/ |
| 23 | obj-$(CONFIG_RTL8192SU) += rtl8192su/ | 23 | obj-$(CONFIG_RTL8192SU) += rtl8192su/ |
| 24 | obj-$(CONFIG_RTL8192U) += rtl8192u/ | ||
| 24 | obj-$(CONFIG_RTL8192E) += rtl8192e/ | 25 | obj-$(CONFIG_RTL8192E) += rtl8192e/ |
| 25 | obj-$(CONFIG_INPUT_MIMIO) += mimio/ | 26 | obj-$(CONFIG_INPUT_MIMIO) += mimio/ |
| 26 | obj-$(CONFIG_TRANZPORT) += frontier/ | 27 | obj-$(CONFIG_TRANZPORT) += frontier/ |
diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile index 99236903a9d5..2d59c4ef6c5b 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile | |||
| @@ -10,6 +10,7 @@ EXTRA_CFLAGS += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO | |||
| 10 | #EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT | 10 | #EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT |
| 11 | EXTRA_CFLAGS += -DUSE_ONE_PIPE | 11 | EXTRA_CFLAGS += -DUSE_ONE_PIPE |
| 12 | EXTRA_CFLAGS += -DENABLE_DOT11D | 12 | EXTRA_CFLAGS += -DENABLE_DOT11D |
| 13 | EXTRA_CFLAGS += -Idrivers/staging/rtl8192u/ieee80211 | ||
| 13 | 14 | ||
| 14 | r8192u_usb-objs := r8192U_core.o r8180_93cx6.o r8192U_wx.o \ | 15 | r8192u_usb-objs := r8192U_core.o r8180_93cx6.o r8192U_wx.o \ |
| 15 | r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \ | 16 | r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \ |
diff --git a/drivers/staging/rtl8192u/ieee80211.h b/drivers/staging/rtl8192u/ieee80211.h index c182e91b73c0..690d41c8cb62 100644 --- a/drivers/staging/rtl8192u/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211.h | |||
| @@ -39,9 +39,9 @@ | |||
| 39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
| 40 | #include <linux/wireless.h> | 40 | #include <linux/wireless.h> |
| 41 | 41 | ||
| 42 | #include "../../ieee80211/rtl819x_HT.h" | 42 | #include "ieee80211/rtl819x_HT.h" |
| 43 | #include "../../ieee80211/rtl819x_BA.h" | 43 | #include "ieee80211/rtl819x_BA.h" |
| 44 | #include "../../ieee80211/rtl819x_TS.h" | 44 | #include "ieee80211/rtl819x_TS.h" |
| 45 | 45 | ||
| 46 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) | 46 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) |
| 47 | #ifndef bool | 47 | #ifndef bool |
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 199ee1695ad3..521e7b989934 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | |||
| @@ -53,14 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, | |||
| 53 | 53 | ||
| 54 | list_del(ptr); | 54 | list_del(ptr); |
| 55 | 55 | ||
| 56 | if (entry->ops) { | 56 | if (entry->ops) |
| 57 | entry->ops->deinit(entry->priv); | 57 | entry->ops->deinit(entry->priv); |
| 58 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 59 | module_put(entry->ops->owner); | ||
| 60 | #else | ||
| 61 | __MOD_DEC_USE_COUNT(entry->ops->owner); | ||
| 62 | #endif | ||
| 63 | } | ||
| 64 | kfree(entry); | 58 | kfree(entry); |
| 65 | } | 59 | } |
| 66 | } | 60 | } |
| @@ -208,8 +202,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { | |||
| 208 | .owner = THIS_MODULE, | 202 | .owner = THIS_MODULE, |
| 209 | }; | 203 | }; |
| 210 | 204 | ||
| 211 | 205 | int __init ieee80211_crypto_init(void) | |
| 212 | static int __init ieee80211_crypto_init(void) | ||
| 213 | { | 206 | { |
| 214 | int ret = -ENOMEM; | 207 | int ret = -ENOMEM; |
| 215 | 208 | ||
| @@ -230,8 +223,7 @@ out: | |||
| 230 | return ret; | 223 | return ret; |
| 231 | } | 224 | } |
| 232 | 225 | ||
| 233 | 226 | void __exit ieee80211_crypto_deinit(void) | |
| 234 | static void __exit ieee80211_crypto_deinit(void) | ||
| 235 | { | 227 | { |
| 236 | struct list_head *ptr, *n; | 228 | struct list_head *ptr, *n; |
| 237 | 229 | ||
| @@ -250,24 +242,3 @@ static void __exit ieee80211_crypto_deinit(void) | |||
| 250 | 242 | ||
| 251 | kfree(hcrypt); | 243 | kfree(hcrypt); |
| 252 | } | 244 | } |
| 253 | |||
| 254 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 255 | EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); | ||
| 256 | EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); | ||
| 257 | EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); | ||
| 258 | |||
| 259 | EXPORT_SYMBOL(ieee80211_register_crypto_ops); | ||
| 260 | EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); | ||
| 261 | EXPORT_SYMBOL(ieee80211_get_crypto_ops); | ||
| 262 | #else | ||
| 263 | EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries); | ||
| 264 | EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler); | ||
| 265 | EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit); | ||
| 266 | |||
| 267 | EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops); | ||
| 268 | EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops); | ||
| 269 | EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops); | ||
| 270 | #endif | ||
| 271 | |||
| 272 | module_init(ieee80211_crypto_init); | ||
| 273 | module_exit(ieee80211_crypto_deinit); | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index a86c26eceb34..181edc46909e 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | |||
| @@ -24,27 +24,13 @@ | |||
| 24 | 24 | ||
| 25 | #include "ieee80211.h" | 25 | #include "ieee80211.h" |
| 26 | 26 | ||
| 27 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
| 28 | #include "rtl_crypto.h" | ||
| 29 | #else | ||
| 30 | #include <linux/crypto.h> | 27 | #include <linux/crypto.h> |
| 31 | #endif | ||
| 32 | |||
| 33 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) | ||
| 34 | #include <asm/scatterlist.h> | ||
| 35 | #else | ||
| 36 | #include <linux/scatterlist.h> | 28 | #include <linux/scatterlist.h> |
| 37 | #endif | ||
| 38 | //#include <asm/scatterlist.h> | ||
| 39 | 29 | ||
| 40 | MODULE_AUTHOR("Jouni Malinen"); | 30 | MODULE_AUTHOR("Jouni Malinen"); |
| 41 | MODULE_DESCRIPTION("Host AP crypt: CCMP"); | 31 | MODULE_DESCRIPTION("Host AP crypt: CCMP"); |
| 42 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
| 43 | 33 | ||
| 44 | #ifndef OPENSUSE_SLED | ||
| 45 | #define OPENSUSE_SLED 0 | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #define AES_BLOCK_LEN 16 | 34 | #define AES_BLOCK_LEN 16 |
| 49 | #define CCMP_HDR_LEN 8 | 35 | #define CCMP_HDR_LEN 8 |
| 50 | #define CCMP_MIC_LEN 8 | 36 | #define CCMP_MIC_LEN 8 |
| @@ -75,21 +61,7 @@ struct ieee80211_ccmp_data { | |||
| 75 | void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, | 61 | void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, |
| 76 | const u8 pt[16], u8 ct[16]) | 62 | const u8 pt[16], u8 ct[16]) |
| 77 | { | 63 | { |
| 78 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 79 | struct scatterlist src, dst; | ||
| 80 | |||
| 81 | src.page = virt_to_page(pt); | ||
| 82 | src.offset = offset_in_page(pt); | ||
| 83 | src.length = AES_BLOCK_LEN; | ||
| 84 | |||
| 85 | dst.page = virt_to_page(ct); | ||
| 86 | dst.offset = offset_in_page(ct); | ||
| 87 | dst.length = AES_BLOCK_LEN; | ||
| 88 | |||
| 89 | crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); | ||
| 90 | #else | ||
| 91 | crypto_cipher_encrypt_one((void*)tfm, ct, pt); | 64 | crypto_cipher_encrypt_one((void*)tfm, ct, pt); |
| 92 | #endif | ||
| 93 | } | 65 | } |
| 94 | 66 | ||
| 95 | static void * ieee80211_ccmp_init(int key_idx) | 67 | static void * ieee80211_ccmp_init(int key_idx) |
| @@ -102,14 +74,6 @@ static void * ieee80211_ccmp_init(int key_idx) | |||
| 102 | memset(priv, 0, sizeof(*priv)); | 74 | memset(priv, 0, sizeof(*priv)); |
| 103 | priv->key_idx = key_idx; | 75 | priv->key_idx = key_idx; |
| 104 | 76 | ||
| 105 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 106 | priv->tfm = crypto_alloc_tfm("aes", 0); | ||
| 107 | if (priv->tfm == NULL) { | ||
| 108 | printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " | ||
| 109 | "crypto API aes\n"); | ||
| 110 | goto fail; | ||
| 111 | } | ||
| 112 | #else | ||
| 113 | priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); | 77 | priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); |
| 114 | if (IS_ERR(priv->tfm)) { | 78 | if (IS_ERR(priv->tfm)) { |
| 115 | printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " | 79 | printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " |
| @@ -117,17 +81,13 @@ static void * ieee80211_ccmp_init(int key_idx) | |||
| 117 | priv->tfm = NULL; | 81 | priv->tfm = NULL; |
| 118 | goto fail; | 82 | goto fail; |
| 119 | } | 83 | } |
| 120 | #endif | 84 | |
| 121 | return priv; | 85 | return priv; |
| 122 | 86 | ||
| 123 | fail: | 87 | fail: |
| 124 | if (priv) { | 88 | if (priv) { |
| 125 | if (priv->tfm) | 89 | if (priv->tfm) |
| 126 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) | ||
| 127 | crypto_free_tfm(priv->tfm); | ||
| 128 | #else | ||
| 129 | crypto_free_cipher((void*)priv->tfm); | 90 | crypto_free_cipher((void*)priv->tfm); |
| 130 | #endif | ||
| 131 | kfree(priv); | 91 | kfree(priv); |
| 132 | } | 92 | } |
| 133 | 93 | ||
| @@ -138,12 +98,9 @@ fail: | |||
| 138 | static void ieee80211_ccmp_deinit(void *priv) | 98 | static void ieee80211_ccmp_deinit(void *priv) |
| 139 | { | 99 | { |
| 140 | struct ieee80211_ccmp_data *_priv = priv; | 100 | struct ieee80211_ccmp_data *_priv = priv; |
| 101 | |||
| 141 | if (_priv && _priv->tfm) | 102 | if (_priv && _priv->tfm) |
| 142 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) | ||
| 143 | crypto_free_tfm(_priv->tfm); | ||
| 144 | #else | ||
| 145 | crypto_free_cipher((void*)_priv->tfm); | 103 | crypto_free_cipher((void*)_priv->tfm); |
| 146 | #endif | ||
| 147 | kfree(priv); | 104 | kfree(priv); |
| 148 | } | 105 | } |
| 149 | 106 | ||
| @@ -512,23 +469,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { | |||
| 512 | .owner = THIS_MODULE, | 469 | .owner = THIS_MODULE, |
| 513 | }; | 470 | }; |
| 514 | 471 | ||
| 515 | 472 | int __init ieee80211_crypto_ccmp_init(void) | |
| 516 | static int __init ieee80211_crypto_ccmp_init(void) | ||
| 517 | { | 473 | { |
| 518 | return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); | 474 | return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); |
| 519 | } | 475 | } |
| 520 | 476 | ||
| 521 | 477 | void __exit ieee80211_crypto_ccmp_exit(void) | |
| 522 | static void __exit ieee80211_crypto_ccmp_exit(void) | ||
| 523 | { | 478 | { |
| 524 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); | 479 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); |
| 525 | } | 480 | } |
| 526 | |||
| 527 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 528 | EXPORT_SYMBOL(ieee80211_ccmp_null); | ||
| 529 | #else | ||
| 530 | EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null); | ||
| 531 | #endif | ||
| 532 | |||
| 533 | module_init(ieee80211_crypto_ccmp_init); | ||
| 534 | module_exit(ieee80211_crypto_ccmp_exit); | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index b031b6495247..58af7c83449b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | |||
| @@ -22,33 +22,15 @@ | |||
| 22 | #include <asm/string.h> | 22 | #include <asm/string.h> |
| 23 | 23 | ||
| 24 | #include "ieee80211.h" | 24 | #include "ieee80211.h" |
| 25 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)) | ||
| 26 | //#include "crypto_compat.h" | ||
| 27 | #endif | ||
| 28 | |||
| 29 | 25 | ||
| 30 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
| 31 | #include "rtl_crypto.h" | ||
| 32 | #else | ||
| 33 | #include <linux/crypto.h> | 26 | #include <linux/crypto.h> |
| 34 | #endif | ||
| 35 | //#include <asm/scatterlist.h> | ||
| 36 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) | ||
| 37 | #include <asm/scatterlist.h> | ||
| 38 | #else | ||
| 39 | #include <linux/scatterlist.h> | 27 | #include <linux/scatterlist.h> |
| 40 | #endif | ||
| 41 | |||
| 42 | #include <linux/crc32.h> | 28 | #include <linux/crc32.h> |
| 43 | 29 | ||
| 44 | MODULE_AUTHOR("Jouni Malinen"); | 30 | MODULE_AUTHOR("Jouni Malinen"); |
| 45 | MODULE_DESCRIPTION("Host AP crypt: TKIP"); | 31 | MODULE_DESCRIPTION("Host AP crypt: TKIP"); |
| 46 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
| 47 | 33 | ||
| 48 | #ifndef OPENSUSE_SLED | ||
| 49 | #define OPENSUSE_SLED 0 | ||
| 50 | #endif | ||
| 51 | |||
| 52 | struct ieee80211_tkip_data { | 34 | struct ieee80211_tkip_data { |
| 53 | #define TKIP_KEY_LEN 32 | 35 | #define TKIP_KEY_LEN 32 |
| 54 | u8 key[TKIP_KEY_LEN]; | 36 | u8 key[TKIP_KEY_LEN]; |
| @@ -71,17 +53,12 @@ struct ieee80211_tkip_data { | |||
| 71 | u32 dot11RSNAStatsTKIPLocalMICFailures; | 53 | u32 dot11RSNAStatsTKIPLocalMICFailures; |
| 72 | 54 | ||
| 73 | int key_idx; | 55 | int key_idx; |
| 74 | #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) | 56 | |
| 75 | struct crypto_blkcipher *rx_tfm_arc4; | 57 | struct crypto_blkcipher *rx_tfm_arc4; |
| 76 | struct crypto_hash *rx_tfm_michael; | 58 | struct crypto_hash *rx_tfm_michael; |
| 77 | struct crypto_blkcipher *tx_tfm_arc4; | 59 | struct crypto_blkcipher *tx_tfm_arc4; |
| 78 | struct crypto_hash *tx_tfm_michael; | 60 | struct crypto_hash *tx_tfm_michael; |
| 79 | #else | 61 | |
| 80 | struct crypto_tfm *tx_tfm_arc4; | ||
| 81 | struct crypto_tfm *tx_tfm_michael; | ||
| 82 | struct crypto_tfm *rx_tfm_arc4; | ||
| 83 | struct crypto_tfm *rx_tfm_michael; | ||
| 84 | #endif | ||
| 85 | /* scratch buffers for virt_to_page() (crypto API) */ | 62 | /* scratch buffers for virt_to_page() (crypto API) */ |
| 86 | u8 rx_hdr[16], tx_hdr[16]; | 63 | u8 rx_hdr[16], tx_hdr[16]; |
| 87 | }; | 64 | }; |
| @@ -95,35 +72,7 @@ static void * ieee80211_tkip_init(int key_idx) | |||
| 95 | goto fail; | 72 | goto fail; |
| 96 | memset(priv, 0, sizeof(*priv)); | 73 | memset(priv, 0, sizeof(*priv)); |
| 97 | priv->key_idx = key_idx; | 74 | priv->key_idx = key_idx; |
| 98 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 99 | priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); | ||
| 100 | if (priv->tx_tfm_arc4 == NULL) { | ||
| 101 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
| 102 | "crypto API arc4\n"); | ||
| 103 | goto fail; | ||
| 104 | } | ||
| 105 | |||
| 106 | priv->tx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); | ||
| 107 | if (priv->tx_tfm_michael == NULL) { | ||
| 108 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
| 109 | "crypto API michael_mic\n"); | ||
| 110 | goto fail; | ||
| 111 | } | ||
| 112 | |||
| 113 | priv->rx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); | ||
| 114 | if (priv->rx_tfm_arc4 == NULL) { | ||
| 115 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
| 116 | "crypto API arc4\n"); | ||
| 117 | goto fail; | ||
| 118 | } | ||
| 119 | 75 | ||
| 120 | priv->rx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); | ||
| 121 | if (priv->rx_tfm_michael == NULL) { | ||
| 122 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
| 123 | "crypto API michael_mic\n"); | ||
| 124 | goto fail; | ||
| 125 | } | ||
| 126 | #else | ||
| 127 | priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, | 76 | priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, |
| 128 | CRYPTO_ALG_ASYNC); | 77 | CRYPTO_ALG_ASYNC); |
| 129 | if (IS_ERR(priv->tx_tfm_arc4)) { | 78 | if (IS_ERR(priv->tx_tfm_arc4)) { |
| @@ -159,22 +108,11 @@ static void * ieee80211_tkip_init(int key_idx) | |||
| 159 | priv->rx_tfm_michael = NULL; | 108 | priv->rx_tfm_michael = NULL; |
| 160 | goto fail; | 109 | goto fail; |
| 161 | } | 110 | } |
| 162 | #endif | 111 | |
| 163 | return priv; | 112 | return priv; |
| 164 | 113 | ||
| 165 | fail: | 114 | fail: |
| 166 | if (priv) { | 115 | if (priv) { |
| 167 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 168 | if (priv->tx_tfm_michael) | ||
| 169 | crypto_free_tfm(priv->tx_tfm_michael); | ||
| 170 | if (priv->tx_tfm_arc4) | ||
| 171 | crypto_free_tfm(priv->tx_tfm_arc4); | ||
| 172 | if (priv->rx_tfm_michael) | ||
| 173 | crypto_free_tfm(priv->rx_tfm_michael); | ||
| 174 | if (priv->rx_tfm_arc4) | ||
| 175 | crypto_free_tfm(priv->rx_tfm_arc4); | ||
| 176 | |||
| 177 | #else | ||
| 178 | if (priv->tx_tfm_michael) | 116 | if (priv->tx_tfm_michael) |
| 179 | crypto_free_hash(priv->tx_tfm_michael); | 117 | crypto_free_hash(priv->tx_tfm_michael); |
| 180 | if (priv->tx_tfm_arc4) | 118 | if (priv->tx_tfm_arc4) |
| @@ -183,7 +121,6 @@ fail: | |||
| 183 | crypto_free_hash(priv->rx_tfm_michael); | 121 | crypto_free_hash(priv->rx_tfm_michael); |
| 184 | if (priv->rx_tfm_arc4) | 122 | if (priv->rx_tfm_arc4) |
| 185 | crypto_free_blkcipher(priv->rx_tfm_arc4); | 123 | crypto_free_blkcipher(priv->rx_tfm_arc4); |
| 186 | #endif | ||
| 187 | kfree(priv); | 124 | kfree(priv); |
| 188 | } | 125 | } |
| 189 | 126 | ||
| @@ -194,16 +131,7 @@ fail: | |||
| 194 | static void ieee80211_tkip_deinit(void *priv) | 131 | static void ieee80211_tkip_deinit(void *priv) |
| 195 | { | 132 | { |
| 196 | struct ieee80211_tkip_data *_priv = priv; | 133 | struct ieee80211_tkip_data *_priv = priv; |
| 197 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | 134 | |
| 198 | if (_priv->tx_tfm_michael) | ||
| 199 | crypto_free_tfm(_priv->tx_tfm_michael); | ||
| 200 | if (_priv->tx_tfm_arc4) | ||
| 201 | crypto_free_tfm(_priv->tx_tfm_arc4); | ||
| 202 | if (_priv->rx_tfm_michael) | ||
| 203 | crypto_free_tfm(_priv->rx_tfm_michael); | ||
| 204 | if (_priv->rx_tfm_arc4) | ||
| 205 | crypto_free_tfm(_priv->rx_tfm_arc4); | ||
| 206 | #else | ||
| 207 | if (_priv) { | 135 | if (_priv) { |
| 208 | if (_priv->tx_tfm_michael) | 136 | if (_priv->tx_tfm_michael) |
| 209 | crypto_free_hash(_priv->tx_tfm_michael); | 137 | crypto_free_hash(_priv->tx_tfm_michael); |
| @@ -214,7 +142,6 @@ static void ieee80211_tkip_deinit(void *priv) | |||
| 214 | if (_priv->rx_tfm_arc4) | 142 | if (_priv->rx_tfm_arc4) |
| 215 | crypto_free_blkcipher(_priv->rx_tfm_arc4); | 143 | crypto_free_blkcipher(_priv->rx_tfm_arc4); |
| 216 | } | 144 | } |
| 217 | #endif | ||
| 218 | kfree(priv); | 145 | kfree(priv); |
| 219 | } | 146 | } |
| 220 | 147 | ||
| @@ -384,11 +311,8 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 384 | u8 *pos; | 311 | u8 *pos; |
| 385 | struct ieee80211_hdr_4addr *hdr; | 312 | struct ieee80211_hdr_4addr *hdr; |
| 386 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); | 313 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); |
| 387 | |||
| 388 | #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) | ||
| 389 | struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; | 314 | struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; |
| 390 | int ret = 0; | 315 | int ret = 0; |
| 391 | #endif | ||
| 392 | u8 rc4key[16], *icv; | 316 | u8 rc4key[16], *icv; |
| 393 | u32 crc; | 317 | u32 crc; |
| 394 | struct scatterlist sg; | 318 | struct scatterlist sg; |
| @@ -399,18 +323,6 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 399 | 323 | ||
| 400 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 324 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
| 401 | 325 | ||
| 402 | #if 0 | ||
| 403 | printk("@@ tkey\n"); | ||
| 404 | printk("%x|", ((u32*)tkey->key)[0]); | ||
| 405 | printk("%x|", ((u32*)tkey->key)[1]); | ||
| 406 | printk("%x|", ((u32*)tkey->key)[2]); | ||
| 407 | printk("%x|", ((u32*)tkey->key)[3]); | ||
| 408 | printk("%x|", ((u32*)tkey->key)[4]); | ||
| 409 | printk("%x|", ((u32*)tkey->key)[5]); | ||
| 410 | printk("%x|", ((u32*)tkey->key)[6]); | ||
| 411 | printk("%x\n", ((u32*)tkey->key)[7]); | ||
| 412 | #endif | ||
| 413 | |||
| 414 | if (!tcb_desc->bHwSec) | 326 | if (!tcb_desc->bHwSec) |
| 415 | { | 327 | { |
| 416 | if (!tkey->tx_phase1_done) { | 328 | if (!tkey->tx_phase1_done) { |
| @@ -451,33 +363,14 @@ printk("%x\n", ((u32*)tkey->key)[7]); | |||
| 451 | if (!tcb_desc->bHwSec) | 363 | if (!tcb_desc->bHwSec) |
| 452 | { | 364 | { |
| 453 | icv = skb_put(skb, 4); | 365 | icv = skb_put(skb, 4); |
| 454 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 455 | crc = ~crc32_le(~0, pos, len); | 366 | crc = ~crc32_le(~0, pos, len); |
| 456 | #else | ||
| 457 | crc = ~ether_crc_le(len, pos); | ||
| 458 | #endif | ||
| 459 | icv[0] = crc; | 367 | icv[0] = crc; |
| 460 | icv[1] = crc >> 8; | 368 | icv[1] = crc >> 8; |
| 461 | icv[2] = crc >> 16; | 369 | icv[2] = crc >> 16; |
| 462 | icv[3] = crc >> 24; | 370 | icv[3] = crc >> 24; |
| 463 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 464 | crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); | ||
| 465 | sg.page = virt_to_page(pos); | ||
| 466 | sg.offset = offset_in_page(pos); | ||
| 467 | sg.length = len + 4; | ||
| 468 | crypto_cipher_encrypt(tkey->tx_tfm_arc4, &sg, &sg, len + 4); | ||
| 469 | #else | ||
| 470 | crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); | 371 | crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); |
| 471 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) | ||
| 472 | sg.page = virt_to_page(pos); | ||
| 473 | sg.offset = offset_in_page(pos); | ||
| 474 | sg.length = len + 4; | ||
| 475 | #else | ||
| 476 | sg_init_one(&sg, pos, len+4); | 372 | sg_init_one(&sg, pos, len+4); |
| 477 | #endif | ||
| 478 | ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); | 373 | ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); |
| 479 | #endif | ||
| 480 | |||
| 481 | } | 374 | } |
| 482 | 375 | ||
| 483 | tkey->tx_iv16++; | 376 | tkey->tx_iv16++; |
| @@ -487,11 +380,7 @@ printk("%x\n", ((u32*)tkey->key)[7]); | |||
| 487 | } | 380 | } |
| 488 | 381 | ||
| 489 | if (!tcb_desc->bHwSec) | 382 | if (!tcb_desc->bHwSec) |
| 490 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 491 | return 0; | ||
| 492 | #else | ||
| 493 | return ret; | 383 | return ret; |
| 494 | #endif | ||
| 495 | else | 384 | else |
| 496 | return 0; | 385 | return 0; |
| 497 | 386 | ||
| @@ -506,9 +395,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 506 | u16 iv16; | 395 | u16 iv16; |
| 507 | struct ieee80211_hdr_4addr *hdr; | 396 | struct ieee80211_hdr_4addr *hdr; |
| 508 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); | 397 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); |
| 509 | #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) | ||
| 510 | struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4}; | 398 | struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4}; |
| 511 | #endif | ||
| 512 | u8 rc4key[16]; | 399 | u8 rc4key[16]; |
| 513 | u8 icv[4]; | 400 | u8 icv[4]; |
| 514 | u32 crc; | 401 | u32 crc; |
| @@ -567,21 +454,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 567 | 454 | ||
| 568 | plen = skb->len - hdr_len - 12; | 455 | plen = skb->len - hdr_len - 12; |
| 569 | 456 | ||
| 570 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 571 | crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); | ||
| 572 | sg.page = virt_to_page(pos); | ||
| 573 | sg.offset = offset_in_page(pos); | ||
| 574 | sg.length = plen + 4; | ||
| 575 | crypto_cipher_decrypt(tkey->rx_tfm_arc4, &sg, &sg, plen + 4); | ||
| 576 | #else | ||
| 577 | crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); | 457 | crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); |
| 578 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) | ||
| 579 | sg.page = virt_to_page(pos); | ||
| 580 | sg.offset = offset_in_page(pos); | ||
| 581 | sg.length = plen + 4; | ||
| 582 | #else | ||
| 583 | sg_init_one(&sg, pos, plen+4); | 458 | sg_init_one(&sg, pos, plen+4); |
| 584 | #endif | 459 | |
| 585 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { | 460 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { |
| 586 | if (net_ratelimit()) { | 461 | if (net_ratelimit()) { |
| 587 | printk(KERN_DEBUG ": TKIP: failed to decrypt " | 462 | 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) | |||
| 590 | } | 465 | } |
| 591 | return -7; | 466 | return -7; |
| 592 | } | 467 | } |
| 593 | #endif | ||
| 594 | 468 | ||
| 595 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 596 | crc = ~crc32_le(~0, pos, plen); | 469 | crc = ~crc32_le(~0, pos, plen); |
| 597 | #else | ||
| 598 | crc = ~ether_crc_le(plen, pos); | ||
| 599 | #endif | ||
| 600 | icv[0] = crc; | 470 | icv[0] = crc; |
| 601 | icv[1] = crc >> 8; | 471 | icv[1] = crc >> 8; |
| 602 | icv[2] = crc >> 16; | 472 | icv[2] = crc >> 16; |
| @@ -628,63 +498,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 628 | skb_pull(skb, 8); | 498 | skb_pull(skb, 8); |
| 629 | skb_trim(skb, skb->len - 4); | 499 | skb_trim(skb, skb->len - 4); |
| 630 | 500 | ||
| 631 | //john's test | ||
| 632 | #ifdef JOHN_DUMP | ||
| 633 | if( ((u16*)skb->data)[0] & 0x4000){ | ||
| 634 | printk("@@ rx decrypted skb->data"); | ||
| 635 | int i; | ||
| 636 | for(i=0;i<skb->len;i++){ | ||
| 637 | if( (i%24)==0 ) printk("\n"); | ||
| 638 | printk("%2x ", ((u8*)skb->data)[i]); | ||
| 639 | } | ||
| 640 | printk("\n"); | ||
| 641 | } | ||
| 642 | #endif /*JOHN_DUMP*/ | ||
| 643 | return keyidx; | 501 | return keyidx; |
| 644 | } | 502 | } |
| 645 | 503 | ||
| 646 | |||
| 647 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 648 | static int michael_mic(struct crypto_tfm * tfm_michael, u8 *key, u8 *hdr, | ||
| 649 | u8 *data, size_t data_len, u8 *mic) | ||
| 650 | { | ||
| 651 | struct scatterlist sg[2]; | ||
| 652 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) | ||
| 653 | struct hash_desc desc; | ||
| 654 | int ret = 0; | ||
| 655 | #endif | ||
| 656 | |||
| 657 | if (tfm_michael == NULL){ | ||
| 658 | printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); | ||
| 659 | return -1; | ||
| 660 | } | ||
| 661 | sg[0].page = virt_to_page(hdr); | ||
| 662 | sg[0].offset = offset_in_page(hdr); | ||
| 663 | sg[0].length = 16; | ||
| 664 | |||
| 665 | sg[1].page = virt_to_page(data); | ||
| 666 | sg[1].offset = offset_in_page(data); | ||
| 667 | sg[1].length = data_len; | ||
| 668 | |||
| 669 | |||
| 670 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) | ||
| 671 | crypto_digest_init(tfm_michael); | ||
| 672 | crypto_digest_setkey(tfm_michael, key, 8); | ||
| 673 | crypto_digest_update(tfm_michael, sg, 2); | ||
| 674 | crypto_digest_final(tfm_michael, mic); | ||
| 675 | return 0; | ||
| 676 | #else | ||
| 677 | if (crypto_hash_setkey(tkey->tfm_michael, key, 8)) | ||
| 678 | return -1; | ||
| 679 | |||
| 680 | // return 0; | ||
| 681 | desc.tfm = tkey->tfm_michael; | ||
| 682 | desc.flags = 0; | ||
| 683 | ret = crypto_hash_digest(&desc, sg, data_len + 16, mic); | ||
| 684 | return ret; | ||
| 685 | #endif | ||
| 686 | } | ||
| 687 | #else | ||
| 688 | static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, | 504 | static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, |
| 689 | u8 * data, size_t data_len, u8 * mic) | 505 | u8 * data, size_t data_len, u8 * mic) |
| 690 | { | 506 | { |
| @@ -695,19 +511,10 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, | |||
| 695 | printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); | 511 | printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); |
| 696 | return -1; | 512 | return -1; |
| 697 | } | 513 | } |
| 698 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) | 514 | |
| 699 | sg[0].page = virt_to_page(hdr); | ||
| 700 | sg[0].offset = offset_in_page(hdr); | ||
| 701 | sg[0].length = 16; | ||
| 702 | |||
| 703 | sg[1].page = virt_to_page(data); | ||
| 704 | sg[1].offset = offset_in_page(data); | ||
| 705 | sg[1].length = data_len; | ||
| 706 | #else | ||
| 707 | sg_init_table(sg, 2); | 515 | sg_init_table(sg, 2); |
| 708 | sg_set_buf(&sg[0], hdr, 16); | 516 | sg_set_buf(&sg[0], hdr, 16); |
| 709 | sg_set_buf(&sg[1], data, data_len); | 517 | sg_set_buf(&sg[1], data, data_len); |
| 710 | #endif | ||
| 711 | 518 | ||
| 712 | if (crypto_hash_setkey(tfm_michael, key, 8)) | 519 | if (crypto_hash_setkey(tfm_michael, key, 8)) |
| 713 | return -1; | 520 | return -1; |
| @@ -716,9 +523,6 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, | |||
| 716 | desc.flags = 0; | 523 | desc.flags = 0; |
| 717 | return crypto_hash_digest(&desc, sg, data_len + 16, mic); | 524 | return crypto_hash_digest(&desc, sg, data_len + 16, mic); |
| 718 | } | 525 | } |
| 719 | #endif | ||
| 720 | |||
| 721 | |||
| 722 | 526 | ||
| 723 | static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) | 527 | static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) |
| 724 | { | 528 | { |
| @@ -775,20 +579,14 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri | |||
| 775 | } | 579 | } |
| 776 | // } | 580 | // } |
| 777 | pos = skb_put(skb, 8); | 581 | pos = skb_put(skb, 8); |
| 778 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | 582 | |
| 779 | if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, | ||
| 780 | skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) | ||
| 781 | #else | ||
| 782 | if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, | 583 | if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, |
| 783 | skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) | 584 | skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) |
| 784 | #endif | ||
| 785 | return -1; | 585 | return -1; |
| 786 | 586 | ||
| 787 | return 0; | 587 | return 0; |
| 788 | } | 588 | } |
| 789 | 589 | ||
| 790 | |||
| 791 | #if WIRELESS_EXT >= 18 | ||
| 792 | static void ieee80211_michael_mic_failure(struct net_device *dev, | 590 | static void ieee80211_michael_mic_failure(struct net_device *dev, |
| 793 | struct ieee80211_hdr_4addr *hdr, | 591 | struct ieee80211_hdr_4addr *hdr, |
| 794 | int keyidx) | 592 | int keyidx) |
| @@ -809,29 +607,6 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, | |||
| 809 | wrqu.data.length = sizeof(ev); | 607 | wrqu.data.length = sizeof(ev); |
| 810 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); | 608 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); |
| 811 | } | 609 | } |
| 812 | #elif WIRELESS_EXT >= 15 | ||
| 813 | static void ieee80211_michael_mic_failure(struct net_device *dev, | ||
| 814 | struct ieee80211_hdr_4addr *hdr, | ||
| 815 | int keyidx) | ||
| 816 | { | ||
| 817 | union iwreq_data wrqu; | ||
| 818 | char buf[128]; | ||
| 819 | |||
| 820 | /* TODO: needed parameters: count, keyid, key type, TSC */ | ||
| 821 | sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" | ||
| 822 | MAC_FMT ")", keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni", | ||
| 823 | MAC_ARG(hdr->addr2)); | ||
| 824 | memset(&wrqu, 0, sizeof(wrqu)); | ||
| 825 | wrqu.data.length = strlen(buf); | ||
| 826 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); | ||
| 827 | } | ||
| 828 | #else /* WIRELESS_EXT >= 15 */ | ||
| 829 | static inline void ieee80211_michael_mic_failure(struct net_device *dev, | ||
| 830 | struct ieee80211_hdr_4addr *hdr, | ||
| 831 | int keyidx) | ||
| 832 | { | ||
| 833 | } | ||
| 834 | #endif /* WIRELESS_EXT >= 15 */ | ||
| 835 | 610 | ||
| 836 | static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | 611 | static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, |
| 837 | int hdr_len, void *priv) | 612 | int hdr_len, void *priv) |
| @@ -853,13 +628,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | |||
| 853 | } | 628 | } |
| 854 | // } | 629 | // } |
| 855 | 630 | ||
| 856 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 857 | if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, | ||
| 858 | skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) | ||
| 859 | #else | ||
| 860 | if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, | 631 | if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, |
| 861 | skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) | 632 | skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) |
| 862 | #endif | ||
| 863 | return -1; | 633 | return -1; |
| 864 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { | 634 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { |
| 865 | struct ieee80211_hdr_4addr *hdr; | 635 | struct ieee80211_hdr_4addr *hdr; |
| @@ -889,32 +659,18 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) | |||
| 889 | { | 659 | { |
| 890 | struct ieee80211_tkip_data *tkey = priv; | 660 | struct ieee80211_tkip_data *tkey = priv; |
| 891 | int keyidx; | 661 | int keyidx; |
| 892 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 893 | struct crypto_tfm *tfm = tkey->tx_tfm_michael; | ||
| 894 | struct crypto_tfm *tfm2 = tkey->tx_tfm_arc4; | ||
| 895 | struct crypto_tfm *tfm3 = tkey->rx_tfm_michael; | ||
| 896 | struct crypto_tfm *tfm4 = tkey->rx_tfm_arc4; | ||
| 897 | #else | ||
| 898 | struct crypto_hash *tfm = tkey->tx_tfm_michael; | 662 | struct crypto_hash *tfm = tkey->tx_tfm_michael; |
| 899 | struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; | 663 | struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; |
| 900 | struct crypto_hash *tfm3 = tkey->rx_tfm_michael; | 664 | struct crypto_hash *tfm3 = tkey->rx_tfm_michael; |
| 901 | struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; | 665 | struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; |
| 902 | #endif | ||
| 903 | 666 | ||
| 904 | keyidx = tkey->key_idx; | 667 | keyidx = tkey->key_idx; |
| 905 | memset(tkey, 0, sizeof(*tkey)); | 668 | memset(tkey, 0, sizeof(*tkey)); |
| 906 | tkey->key_idx = keyidx; | 669 | tkey->key_idx = keyidx; |
| 907 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 908 | tkey->tx_tfm_michael = tfm; | ||
| 909 | tkey->tx_tfm_arc4 = tfm2; | ||
| 910 | tkey->rx_tfm_michael = tfm3; | ||
| 911 | tkey->rx_tfm_arc4 = tfm4; | ||
| 912 | #else | ||
| 913 | tkey->tx_tfm_michael = tfm; | 670 | tkey->tx_tfm_michael = tfm; |
| 914 | tkey->tx_tfm_arc4 = tfm2; | 671 | tkey->tx_tfm_arc4 = tfm2; |
| 915 | tkey->rx_tfm_michael = tfm3; | 672 | tkey->rx_tfm_michael = tfm3; |
| 916 | tkey->rx_tfm_arc4 = tfm4; | 673 | tkey->rx_tfm_arc4 = tfm4; |
| 917 | #endif | ||
| 918 | 674 | ||
| 919 | if (len == TKIP_KEY_LEN) { | 675 | if (len == TKIP_KEY_LEN) { |
| 920 | memcpy(tkey->key, key, TKIP_KEY_LEN); | 676 | memcpy(tkey->key, key, TKIP_KEY_LEN); |
| @@ -1007,14 +763,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { | |||
| 1007 | .owner = THIS_MODULE, | 763 | .owner = THIS_MODULE, |
| 1008 | }; | 764 | }; |
| 1009 | 765 | ||
| 1010 | 766 | int __init ieee80211_crypto_tkip_init(void) | |
| 1011 | static int __init ieee80211_crypto_tkip_init(void) | ||
| 1012 | { | 767 | { |
| 1013 | return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); | 768 | return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); |
| 1014 | } | 769 | } |
| 1015 | 770 | ||
| 1016 | 771 | void __exit ieee80211_crypto_tkip_exit(void) | |
| 1017 | static void __exit ieee80211_crypto_tkip_exit(void) | ||
| 1018 | { | 772 | { |
| 1019 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); | 773 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); |
| 1020 | } | 774 | } |
| @@ -1024,11 +778,3 @@ void ieee80211_tkip_null(void) | |||
| 1024 | // printk("============>%s()\n", __FUNCTION__); | 778 | // printk("============>%s()\n", __FUNCTION__); |
| 1025 | return; | 779 | return; |
| 1026 | } | 780 | } |
| 1027 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 1028 | EXPORT_SYMBOL(ieee80211_tkip_null); | ||
| 1029 | #else | ||
| 1030 | EXPORT_SYMBOL_NOVERS(ieee80211_tkip_null); | ||
| 1031 | #endif | ||
| 1032 | |||
| 1033 | module_init(ieee80211_crypto_tkip_init); | ||
| 1034 | module_exit(ieee80211_crypto_tkip_exit); | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 7e394328ec90..39c74d1533ce 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | |||
| @@ -20,41 +20,13 @@ | |||
| 20 | 20 | ||
| 21 | #include "ieee80211.h" | 21 | #include "ieee80211.h" |
| 22 | 22 | ||
| 23 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)) | ||
| 24 | //#include "crypto_compat.h" | ||
| 25 | #endif | ||
| 26 | |||
| 27 | |||
| 28 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
| 29 | #include "rtl_crypto.h" | ||
| 30 | #else | ||
| 31 | #include <linux/crypto.h> | 23 | #include <linux/crypto.h> |
| 32 | #endif | ||
| 33 | |||
| 34 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) | ||
| 35 | #include <asm/scatterlist.h> | ||
| 36 | #else | ||
| 37 | #include <linux/scatterlist.h> | 24 | #include <linux/scatterlist.h> |
| 38 | #endif | ||
| 39 | //#include <asm/scatterlist.h> | ||
| 40 | #include <linux/crc32.h> | 25 | #include <linux/crc32.h> |
| 41 | // | ||
| 42 | /* | ||
| 43 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
| 44 | #include "rtl_crypto.h" | ||
| 45 | #else | ||
| 46 | #include <linux/crypto.h> | ||
| 47 | #endif | ||
| 48 | 26 | ||
| 49 | #include <asm/scatterlist.h> | ||
| 50 | #include <linux/crc32.h> | ||
| 51 | */ | ||
| 52 | MODULE_AUTHOR("Jouni Malinen"); | 27 | MODULE_AUTHOR("Jouni Malinen"); |
| 53 | MODULE_DESCRIPTION("Host AP crypt: WEP"); | 28 | MODULE_DESCRIPTION("Host AP crypt: WEP"); |
| 54 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
| 55 | #ifndef OPENSUSE_SLED | ||
| 56 | #define OPENSUSE_SLED 0 | ||
| 57 | #endif | ||
| 58 | 30 | ||
| 59 | struct prism2_wep_data { | 31 | struct prism2_wep_data { |
| 60 | u32 iv; | 32 | u32 iv; |
| @@ -62,12 +34,8 @@ struct prism2_wep_data { | |||
| 62 | u8 key[WEP_KEY_LEN + 1]; | 34 | u8 key[WEP_KEY_LEN + 1]; |
| 63 | u8 key_len; | 35 | u8 key_len; |
| 64 | u8 key_idx; | 36 | u8 key_idx; |
| 65 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 66 | struct crypto_tfm *tfm; | ||
| 67 | #else | ||
| 68 | struct crypto_blkcipher *tx_tfm; | 37 | struct crypto_blkcipher *tx_tfm; |
| 69 | struct crypto_blkcipher *rx_tfm; | 38 | struct crypto_blkcipher *rx_tfm; |
| 70 | #endif | ||
| 71 | }; | 39 | }; |
| 72 | 40 | ||
| 73 | 41 | ||
| @@ -81,14 +49,6 @@ static void * prism2_wep_init(int keyidx) | |||
| 81 | memset(priv, 0, sizeof(*priv)); | 49 | memset(priv, 0, sizeof(*priv)); |
| 82 | priv->key_idx = keyidx; | 50 | priv->key_idx = keyidx; |
| 83 | 51 | ||
| 84 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 85 | priv->tfm = crypto_alloc_tfm("arc4", 0); | ||
| 86 | if (priv->tfm == NULL) { | ||
| 87 | printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " | ||
| 88 | "crypto API arc4\n"); | ||
| 89 | goto fail; | ||
| 90 | } | ||
| 91 | #else | ||
| 92 | priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | 52 | priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
| 93 | if (IS_ERR(priv->tx_tfm)) { | 53 | if (IS_ERR(priv->tx_tfm)) { |
| 94 | printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " | 54 | printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " |
| @@ -103,7 +63,6 @@ static void * prism2_wep_init(int keyidx) | |||
| 103 | priv->rx_tfm = NULL; | 63 | priv->rx_tfm = NULL; |
| 104 | goto fail; | 64 | goto fail; |
| 105 | } | 65 | } |
| 106 | #endif | ||
| 107 | 66 | ||
| 108 | /* start WEP IV from a random value */ | 67 | /* start WEP IV from a random value */ |
| 109 | get_random_bytes(&priv->iv, 4); | 68 | get_random_bytes(&priv->iv, 4); |
| @@ -111,13 +70,6 @@ static void * prism2_wep_init(int keyidx) | |||
| 111 | return priv; | 70 | return priv; |
| 112 | 71 | ||
| 113 | fail: | 72 | fail: |
| 114 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 115 | if (priv) { | ||
| 116 | if (priv->tfm) | ||
| 117 | crypto_free_tfm(priv->tfm); | ||
| 118 | kfree(priv); | ||
| 119 | } | ||
| 120 | #else | ||
| 121 | if (priv) { | 73 | if (priv) { |
| 122 | if (priv->tx_tfm) | 74 | if (priv->tx_tfm) |
| 123 | crypto_free_blkcipher(priv->tx_tfm); | 75 | crypto_free_blkcipher(priv->tx_tfm); |
| @@ -125,7 +77,7 @@ fail: | |||
| 125 | crypto_free_blkcipher(priv->rx_tfm); | 77 | crypto_free_blkcipher(priv->rx_tfm); |
| 126 | kfree(priv); | 78 | kfree(priv); |
| 127 | } | 79 | } |
| 128 | #endif | 80 | |
| 129 | return NULL; | 81 | return NULL; |
| 130 | } | 82 | } |
| 131 | 83 | ||
| @@ -133,17 +85,13 @@ fail: | |||
| 133 | static void prism2_wep_deinit(void *priv) | 85 | static void prism2_wep_deinit(void *priv) |
| 134 | { | 86 | { |
| 135 | struct prism2_wep_data *_priv = priv; | 87 | struct prism2_wep_data *_priv = priv; |
| 136 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | 88 | |
| 137 | if (_priv && _priv->tfm) | ||
| 138 | crypto_free_tfm(_priv->tfm); | ||
| 139 | #else | ||
| 140 | if (_priv) { | 89 | if (_priv) { |
| 141 | if (_priv->tx_tfm) | 90 | if (_priv->tx_tfm) |
| 142 | crypto_free_blkcipher(_priv->tx_tfm); | 91 | crypto_free_blkcipher(_priv->tx_tfm); |
| 143 | if (_priv->rx_tfm) | 92 | if (_priv->rx_tfm) |
| 144 | crypto_free_blkcipher(_priv->rx_tfm); | 93 | crypto_free_blkcipher(_priv->rx_tfm); |
| 145 | } | 94 | } |
| 146 | #endif | ||
| 147 | kfree(priv); | 95 | kfree(priv); |
| 148 | } | 96 | } |
| 149 | 97 | ||
| @@ -160,9 +108,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 160 | u8 key[WEP_KEY_LEN + 3]; | 108 | u8 key[WEP_KEY_LEN + 3]; |
| 161 | u8 *pos; | 109 | u8 *pos; |
| 162 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); | 110 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); |
| 163 | #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) | ||
| 164 | struct blkcipher_desc desc = {.tfm = wep->tx_tfm}; | 111 | struct blkcipher_desc desc = {.tfm = wep->tx_tfm}; |
| 165 | #endif | ||
| 166 | u32 crc; | 112 | u32 crc; |
| 167 | u8 *icv; | 113 | u8 *icv; |
| 168 | struct scatterlist sg; | 114 | struct scatterlist sg; |
| @@ -201,35 +147,17 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 201 | { | 147 | { |
| 202 | 148 | ||
| 203 | /* Append little-endian CRC32 and encrypt it to produce ICV */ | 149 | /* Append little-endian CRC32 and encrypt it to produce ICV */ |
| 204 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 205 | crc = ~crc32_le(~0, pos, len); | 150 | crc = ~crc32_le(~0, pos, len); |
| 206 | #else | ||
| 207 | crc = ~ether_crc_le(len, pos); | ||
| 208 | #endif | ||
| 209 | icv = skb_put(skb, 4); | 151 | icv = skb_put(skb, 4); |
| 210 | icv[0] = crc; | 152 | icv[0] = crc; |
| 211 | icv[1] = crc >> 8; | 153 | icv[1] = crc >> 8; |
| 212 | icv[2] = crc >> 16; | 154 | icv[2] = crc >> 16; |
| 213 | icv[3] = crc >> 24; | 155 | icv[3] = crc >> 24; |
| 214 | 156 | ||
| 215 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 216 | crypto_cipher_setkey(wep->tfm, key, klen); | ||
| 217 | sg.page = virt_to_page(pos); | ||
| 218 | sg.offset = offset_in_page(pos); | ||
| 219 | sg.length = len + 4; | ||
| 220 | crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); | ||
| 221 | return 0; | ||
| 222 | #else | ||
| 223 | crypto_blkcipher_setkey(wep->tx_tfm, key, klen); | 157 | crypto_blkcipher_setkey(wep->tx_tfm, key, klen); |
| 224 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) | ||
| 225 | sg.page = virt_to_page(pos); | ||
| 226 | sg.offset = offset_in_page(pos); | ||
| 227 | sg.length = len + 4; | ||
| 228 | #else | ||
| 229 | sg_init_one(&sg, pos, len+4); | 158 | sg_init_one(&sg, pos, len+4); |
| 230 | #endif | 159 | |
| 231 | return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); | 160 | return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); |
| 232 | #endif | ||
| 233 | } | 161 | } |
| 234 | 162 | ||
| 235 | return 0; | 163 | return 0; |
| @@ -250,9 +178,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 250 | u8 key[WEP_KEY_LEN + 3]; | 178 | u8 key[WEP_KEY_LEN + 3]; |
| 251 | u8 keyidx, *pos; | 179 | u8 keyidx, *pos; |
| 252 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); | 180 | cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); |
| 253 | #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) | ||
| 254 | struct blkcipher_desc desc = {.tfm = wep->rx_tfm}; | 181 | struct blkcipher_desc desc = {.tfm = wep->rx_tfm}; |
| 255 | #endif | ||
| 256 | u32 crc; | 182 | u32 crc; |
| 257 | u8 icv[4]; | 183 | u8 icv[4]; |
| 258 | struct scatterlist sg; | 184 | struct scatterlist sg; |
| @@ -277,29 +203,13 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
| 277 | 203 | ||
| 278 | if (!tcb_desc->bHwSec) | 204 | if (!tcb_desc->bHwSec) |
| 279 | { | 205 | { |
| 280 | #if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) | ||
| 281 | crypto_cipher_setkey(wep->tfm, key, klen); | ||
| 282 | sg.page = virt_to_page(pos); | ||
| 283 | sg.offset = offset_in_page(pos); | ||
| 284 | sg.length = plen + 4; | ||
| 285 | crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4); | ||
| 286 | #else | ||
| 287 | crypto_blkcipher_setkey(wep->rx_tfm, key, klen); | 206 | crypto_blkcipher_setkey(wep->rx_tfm, key, klen); |
| 288 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) | ||
| 289 | sg.page = virt_to_page(pos); | ||
| 290 | sg.offset = offset_in_page(pos); | ||
| 291 | sg.length = plen + 4; | ||
| 292 | #else | ||
| 293 | sg_init_one(&sg, pos, plen+4); | 207 | sg_init_one(&sg, pos, plen+4); |
| 294 | #endif | 208 | |
| 295 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) | 209 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) |
| 296 | return -7; | 210 | return -7; |
| 297 | #endif | 211 | |
| 298 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 299 | crc = ~crc32_le(~0, pos, plen); | 212 | crc = ~crc32_le(~0, pos, plen); |
| 300 | #else | ||
| 301 | crc = ~ether_crc_le(plen, pos); | ||
| 302 | #endif | ||
| 303 | icv[0] = crc; | 213 | icv[0] = crc; |
| 304 | icv[1] = crc >> 8; | 214 | icv[1] = crc >> 8; |
| 305 | icv[2] = crc >> 16; | 215 | icv[2] = crc >> 16; |
| @@ -370,14 +280,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | |||
| 370 | .owner = THIS_MODULE, | 280 | .owner = THIS_MODULE, |
| 371 | }; | 281 | }; |
| 372 | 282 | ||
| 373 | 283 | int __init ieee80211_crypto_wep_init(void) | |
| 374 | static int __init ieee80211_crypto_wep_init(void) | ||
| 375 | { | 284 | { |
| 376 | return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); | 285 | return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); |
| 377 | } | 286 | } |
| 378 | 287 | ||
| 379 | 288 | void __exit ieee80211_crypto_wep_exit(void) | |
| 380 | static void __exit ieee80211_crypto_wep_exit(void) | ||
| 381 | { | 289 | { |
| 382 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); | 290 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); |
| 383 | } | 291 | } |
| @@ -387,11 +295,3 @@ void ieee80211_wep_null(void) | |||
| 387 | // printk("============>%s()\n", __FUNCTION__); | 295 | // printk("============>%s()\n", __FUNCTION__); |
| 388 | return; | 296 | return; |
| 389 | } | 297 | } |
| 390 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 391 | EXPORT_SYMBOL(ieee80211_wep_null); | ||
| 392 | #else | ||
| 393 | EXPORT_SYMBOL_NOVERS(ieee80211_wep_null); | ||
| 394 | #endif | ||
| 395 | |||
| 396 | module_init(ieee80211_crypto_wep_init); | ||
| 397 | module_exit(ieee80211_crypto_wep_exit); | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index f408b4583b82..c3383bb8b760 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | |||
| @@ -113,13 +113,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
| 113 | goto failed; | 113 | goto failed; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) | ||
| 117 | ieee = netdev_priv(dev); | 116 | ieee = netdev_priv(dev); |
| 118 | #else | ||
| 119 | ieee = (struct ieee80211_device *)dev->priv; | ||
| 120 | #endif | ||
| 121 | dev->hard_start_xmit = ieee80211_xmit; | ||
| 122 | |||
| 123 | memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); | 117 | memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); |
| 124 | ieee->dev = dev; | 118 | ieee->dev = dev; |
| 125 | 119 | ||
| @@ -167,12 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
| 167 | 161 | ||
| 168 | ieee80211_softmac_init(ieee); | 162 | ieee80211_softmac_init(ieee); |
| 169 | 163 | ||
| 170 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) | ||
| 171 | ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); | 164 | ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); |
| 172 | #else | ||
| 173 | ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kmalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); | ||
| 174 | memset(ieee->pHTInfo,0,sizeof(RT_HIGH_THROUGHPUT)); | ||
| 175 | #endif | ||
| 176 | if (ieee->pHTInfo == NULL) | 165 | if (ieee->pHTInfo == NULL) |
| 177 | { | 166 | { |
| 178 | IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); | 167 | IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); |
| @@ -181,13 +170,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
| 181 | HTUpdateDefaultSetting(ieee); | 170 | HTUpdateDefaultSetting(ieee); |
| 182 | HTInitializeHTInfo(ieee); //may move to other place. | 171 | HTInitializeHTInfo(ieee); //may move to other place. |
| 183 | TSInitialize(ieee); | 172 | TSInitialize(ieee); |
| 184 | #if 0 | 173 | |
| 185 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) | ||
| 186 | INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq); | ||
| 187 | #else | ||
| 188 | INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq, ieee); | ||
| 189 | #endif | ||
| 190 | #endif | ||
| 191 | for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) | 174 | for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) |
| 192 | INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); | 175 | INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); |
| 193 | 176 | ||
| @@ -206,22 +189,15 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
| 206 | 189 | ||
| 207 | failed: | 190 | failed: |
| 208 | if (dev) | 191 | if (dev) |
| 209 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) | ||
| 210 | free_netdev(dev); | 192 | free_netdev(dev); |
| 211 | #else | 193 | |
| 212 | kfree(dev); | ||
| 213 | #endif | ||
| 214 | return NULL; | 194 | return NULL; |
| 215 | } | 195 | } |
| 216 | 196 | ||
| 217 | 197 | ||
| 218 | void free_ieee80211(struct net_device *dev) | 198 | void free_ieee80211(struct net_device *dev) |
| 219 | { | 199 | { |
| 220 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) | ||
| 221 | struct ieee80211_device *ieee = netdev_priv(dev); | 200 | struct ieee80211_device *ieee = netdev_priv(dev); |
| 222 | #else | ||
| 223 | struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; | ||
| 224 | #endif | ||
| 225 | int i; | 201 | int i; |
| 226 | //struct list_head *p, *q; | 202 | //struct list_head *p, *q; |
| 227 | // del_timer_sync(&ieee->SwBwTimer); | 203 | // del_timer_sync(&ieee->SwBwTimer); |
| @@ -240,34 +216,15 @@ void free_ieee80211(struct net_device *dev) | |||
| 240 | for (i = 0; i < WEP_KEYS; i++) { | 216 | for (i = 0; i < WEP_KEYS; i++) { |
| 241 | struct ieee80211_crypt_data *crypt = ieee->crypt[i]; | 217 | struct ieee80211_crypt_data *crypt = ieee->crypt[i]; |
| 242 | if (crypt) { | 218 | if (crypt) { |
| 243 | if (crypt->ops) { | 219 | if (crypt->ops) |
| 244 | crypt->ops->deinit(crypt->priv); | 220 | crypt->ops->deinit(crypt->priv); |
| 245 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 246 | module_put(crypt->ops->owner); | ||
| 247 | #else | ||
| 248 | __MOD_DEC_USE_COUNT(crypt->ops->owner); | ||
| 249 | #endif | ||
| 250 | } | ||
| 251 | kfree(crypt); | 221 | kfree(crypt); |
| 252 | ieee->crypt[i] = NULL; | 222 | ieee->crypt[i] = NULL; |
| 253 | } | 223 | } |
| 254 | } | 224 | } |
| 255 | 225 | ||
| 256 | ieee80211_networks_free(ieee); | 226 | ieee80211_networks_free(ieee); |
| 257 | #if 0 | ||
| 258 | for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) { | ||
| 259 | list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) { | ||
| 260 | kfree(list_entry(p, struct ieee_ibss_seq, list)); | ||
| 261 | list_del(p); | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 265 | #endif | ||
| 266 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) | ||
| 267 | free_netdev(dev); | 227 | free_netdev(dev); |
| 268 | #else | ||
| 269 | kfree(dev); | ||
| 270 | #endif | ||
| 271 | } | 228 | } |
| 272 | 229 | ||
| 273 | #ifdef CONFIG_IEEE80211_DEBUG | 230 | #ifdef CONFIG_IEEE80211_DEBUG |
| @@ -305,7 +262,7 @@ static int store_debug_level(struct file *file, const char *buffer, | |||
| 305 | unsigned long count, void *data) | 262 | unsigned long count, void *data) |
| 306 | { | 263 | { |
| 307 | char buf[] = "0x00000000"; | 264 | char buf[] = "0x00000000"; |
| 308 | unsigned long len = min(sizeof(buf) - 1, (u32)count); | 265 | unsigned long len = min(sizeof(buf) - 1, count); |
| 309 | char *p = (char *)buf; | 266 | char *p = (char *)buf; |
| 310 | unsigned long val; | 267 | unsigned long val; |
| 311 | 268 | ||
| @@ -328,16 +285,13 @@ static int store_debug_level(struct file *file, const char *buffer, | |||
| 328 | return strnlen(buf, count); | 285 | return strnlen(buf, count); |
| 329 | } | 286 | } |
| 330 | 287 | ||
| 331 | static int __init ieee80211_init(void) | 288 | int __init ieee80211_debug_init(void) |
| 332 | { | 289 | { |
| 333 | struct proc_dir_entry *e; | 290 | struct proc_dir_entry *e; |
| 334 | 291 | ||
| 335 | ieee80211_debug_level = debug; | 292 | ieee80211_debug_level = debug; |
| 336 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) | 293 | |
| 337 | ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net); | ||
| 338 | #else | ||
| 339 | ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); | 294 | ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); |
| 340 | #endif | ||
| 341 | if (ieee80211_proc == NULL) { | 295 | if (ieee80211_proc == NULL) { |
| 342 | IEEE80211_ERROR("Unable to create " DRV_NAME | 296 | IEEE80211_ERROR("Unable to create " DRV_NAME |
| 343 | " proc directory\n"); | 297 | " proc directory\n"); |
| @@ -346,11 +300,7 @@ static int __init ieee80211_init(void) | |||
| 346 | e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, | 300 | e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, |
| 347 | ieee80211_proc); | 301 | ieee80211_proc); |
| 348 | if (!e) { | 302 | if (!e) { |
| 349 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) | ||
| 350 | remove_proc_entry(DRV_NAME, proc_net); | ||
| 351 | #else | ||
| 352 | remove_proc_entry(DRV_NAME, init_net.proc_net); | 303 | remove_proc_entry(DRV_NAME, init_net.proc_net); |
| 353 | #endif | ||
| 354 | ieee80211_proc = NULL; | 304 | ieee80211_proc = NULL; |
| 355 | return -EIO; | 305 | return -EIO; |
| 356 | } | 306 | } |
| @@ -361,34 +311,16 @@ static int __init ieee80211_init(void) | |||
| 361 | return 0; | 311 | return 0; |
| 362 | } | 312 | } |
| 363 | 313 | ||
| 364 | static void __exit ieee80211_exit(void) | 314 | void __exit ieee80211_debug_exit(void) |
| 365 | { | 315 | { |
| 366 | if (ieee80211_proc) { | 316 | if (ieee80211_proc) { |
| 367 | remove_proc_entry("debug_level", ieee80211_proc); | 317 | remove_proc_entry("debug_level", ieee80211_proc); |
| 368 | #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) | ||
| 369 | remove_proc_entry(DRV_NAME, proc_net); | ||
| 370 | #else | ||
| 371 | remove_proc_entry(DRV_NAME, init_net.proc_net); | 318 | remove_proc_entry(DRV_NAME, init_net.proc_net); |
| 372 | #endif | ||
| 373 | ieee80211_proc = NULL; | 319 | ieee80211_proc = NULL; |
| 374 | } | 320 | } |
| 375 | } | 321 | } |
| 376 | 322 | ||
| 377 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 378 | #include <linux/moduleparam.h> | 323 | #include <linux/moduleparam.h> |
| 379 | module_param(debug, int, 0444); | 324 | module_param(debug, int, 0444); |
| 380 | MODULE_PARM_DESC(debug, "debug output mask"); | 325 | MODULE_PARM_DESC(debug, "debug output mask"); |
| 381 | |||
| 382 | |||
| 383 | module_exit(ieee80211_exit); | ||
| 384 | module_init(ieee80211_init); | ||
| 385 | #endif | ||
| 386 | #endif | ||
| 387 | |||
| 388 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
| 389 | EXPORT_SYMBOL(alloc_ieee80211); | ||
| 390 | EXPORT_SYMBOL(free_ieee80211); | ||
| 391 | #else | ||
| 392 | EXPORT_SYMBOL_NOVERS(alloc_ieee80211); | ||
| 393 | EXPORT_SYMBOL_NOVERS(free_ieee80211); | ||
| 394 | #endif | 326 | #endif |
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 6997e97fc850..15999e850b62 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c | |||
| @@ -1175,18 +1175,14 @@ static int rtl8192_rx_initiate(struct net_device*dev) | |||
| 1175 | } | 1175 | } |
| 1176 | // printk("nomal packet IN request!\n"); | 1176 | // printk("nomal packet IN request!\n"); |
| 1177 | usb_fill_bulk_urb(entry, priv->udev, | 1177 | usb_fill_bulk_urb(entry, priv->udev, |
| 1178 | usb_rcvbulkpipe(priv->udev, 3), skb->tail, | 1178 | usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb), |
| 1179 | RX_URB_SIZE, rtl8192_rx_isr, skb); | 1179 | RX_URB_SIZE, rtl8192_rx_isr, skb); |
| 1180 | info = (struct rtl8192_rx_info *) skb->cb; | 1180 | info = (struct rtl8192_rx_info *) skb->cb; |
| 1181 | info->urb = entry; | 1181 | info->urb = entry; |
| 1182 | info->dev = dev; | 1182 | info->dev = dev; |
| 1183 | info->out_pipe = 3; //denote rx normal packet queue | 1183 | info->out_pipe = 3; //denote rx normal packet queue |
| 1184 | skb_queue_tail(&priv->rx_queue, skb); | 1184 | skb_queue_tail(&priv->rx_queue, skb); |
| 1185 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) | ||
| 1186 | usb_submit_urb(entry, GFP_KERNEL); | 1185 | usb_submit_urb(entry, GFP_KERNEL); |
| 1187 | #else | ||
| 1188 | usb_submit_urb(entry); | ||
| 1189 | #endif | ||
| 1190 | } | 1186 | } |
| 1191 | 1187 | ||
| 1192 | /* command packet rx procedure */ | 1188 | /* command packet rx procedure */ |
| @@ -1205,18 +1201,14 @@ static int rtl8192_rx_initiate(struct net_device*dev) | |||
| 1205 | break; | 1201 | break; |
| 1206 | } | 1202 | } |
| 1207 | usb_fill_bulk_urb(entry, priv->udev, | 1203 | usb_fill_bulk_urb(entry, priv->udev, |
| 1208 | usb_rcvbulkpipe(priv->udev, 9), skb->tail, | 1204 | usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb), |
| 1209 | RX_URB_SIZE, rtl8192_rx_isr, skb); | 1205 | RX_URB_SIZE, rtl8192_rx_isr, skb); |
| 1210 | info = (struct rtl8192_rx_info *) skb->cb; | 1206 | info = (struct rtl8192_rx_info *) skb->cb; |
| 1211 | info->urb = entry; | 1207 | info->urb = entry; |
| 1212 | info->dev = dev; | 1208 | info->dev = dev; |
| 1213 | info->out_pipe = 9; //denote rx cmd packet queue | 1209 | info->out_pipe = 9; //denote rx cmd packet queue |
| 1214 | skb_queue_tail(&priv->rx_queue, skb); | 1210 | skb_queue_tail(&priv->rx_queue, skb); |
| 1215 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) | ||
| 1216 | usb_submit_urb(entry, GFP_KERNEL); | 1211 | usb_submit_urb(entry, GFP_KERNEL); |
| 1217 | #else | ||
| 1218 | usb_submit_urb(entry); | ||
| 1219 | #endif | ||
| 1220 | } | 1212 | } |
| 1221 | 1213 | ||
| 1222 | return 0; | 1214 | return 0; |
| @@ -1586,7 +1578,7 @@ static void rtl8192_rx_isr(struct urb *urb) | |||
| 1586 | } | 1578 | } |
| 1587 | 1579 | ||
| 1588 | usb_fill_bulk_urb(urb, priv->udev, | 1580 | usb_fill_bulk_urb(urb, priv->udev, |
| 1589 | usb_rcvbulkpipe(priv->udev, out_pipe), skb->tail, | 1581 | usb_rcvbulkpipe(priv->udev, out_pipe), skb_tail_pointer(skb), |
| 1590 | RX_URB_SIZE, rtl8192_rx_isr, skb); | 1582 | RX_URB_SIZE, rtl8192_rx_isr, skb); |
| 1591 | 1583 | ||
| 1592 | info = (struct rtl8192_rx_info *) skb->cb; | 1584 | info = (struct rtl8192_rx_info *) skb->cb; |
| @@ -1594,14 +1586,10 @@ static void rtl8192_rx_isr(struct urb *urb) | |||
| 1594 | info->dev = dev; | 1586 | info->dev = dev; |
| 1595 | info->out_pipe = out_pipe; | 1587 | info->out_pipe = out_pipe; |
| 1596 | 1588 | ||
| 1597 | urb->transfer_buffer = skb->tail; | 1589 | urb->transfer_buffer = skb_tail_pointer(skb); |
| 1598 | urb->context = skb; | 1590 | urb->context = skb; |
| 1599 | skb_queue_tail(&priv->rx_queue, skb); | 1591 | skb_queue_tail(&priv->rx_queue, skb); |
| 1600 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) | ||
| 1601 | err = usb_submit_urb(urb, GFP_ATOMIC); | 1592 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 1602 | #else | ||
| 1603 | err = usb_submit_urb(urb); | ||
| 1604 | #endif | ||
| 1605 | if(err && err != EPERM) | 1593 | if(err && err != EPERM) |
| 1606 | printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); | 1594 | printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); |
| 1607 | } | 1595 | } |
| @@ -2953,25 +2941,21 @@ short rtl8192_usb_initendpoints(struct net_device *dev) | |||
| 2953 | 2941 | ||
| 2954 | #ifdef THOMAS_BEACON | 2942 | #ifdef THOMAS_BEACON |
| 2955 | { | 2943 | { |
| 2956 | int align = 0; | 2944 | long align = 0; |
| 2957 | u32 oldaddr,newaddr; | 2945 | void *oldaddr, *newaddr; |
| 2958 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) | 2946 | |
| 2959 | priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); | 2947 | priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); |
| 2960 | #else | ||
| 2961 | priv->rx_urb[16] = usb_alloc_urb(0); | ||
| 2962 | #endif | ||
| 2963 | priv->oldaddr = kmalloc(16, GFP_KERNEL); | 2948 | priv->oldaddr = kmalloc(16, GFP_KERNEL); |
| 2964 | oldaddr = (u32)priv->oldaddr; | 2949 | oldaddr = priv->oldaddr; |
| 2965 | align = oldaddr&3; | 2950 | align = ((long)oldaddr) & 3; |
| 2966 | if(align != 0 ){ | 2951 | if (align) { |
| 2967 | newaddr = oldaddr + 4 - align; | 2952 | newaddr = oldaddr + 4 - align; |
| 2968 | priv->rx_urb[16]->transfer_buffer_length = 16-4+align; | 2953 | priv->rx_urb[16]->transfer_buffer_length = 16 - 4 + align; |
| 2969 | } | 2954 | } else { |
| 2970 | else{ | ||
| 2971 | newaddr = oldaddr; | 2955 | newaddr = oldaddr; |
| 2972 | priv->rx_urb[16]->transfer_buffer_length = 16; | 2956 | priv->rx_urb[16]->transfer_buffer_length = 16; |
| 2973 | } | 2957 | } |
| 2974 | priv->rx_urb[16]->transfer_buffer = (u32*)newaddr; | 2958 | priv->rx_urb[16]->transfer_buffer = newaddr; |
| 2975 | } | 2959 | } |
| 2976 | #endif | 2960 | #endif |
| 2977 | 2961 | ||
| @@ -6831,6 +6815,18 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) | |||
| 6831 | } | 6815 | } |
| 6832 | } | 6816 | } |
| 6833 | 6817 | ||
| 6818 | static const struct net_device_ops rtl8192_netdev_ops = { | ||
| 6819 | .ndo_open = rtl8192_open, | ||
| 6820 | .ndo_stop = rtl8192_close, | ||
| 6821 | .ndo_get_stats = rtl8192_stats, | ||
| 6822 | .ndo_tx_timeout = tx_timeout, | ||
| 6823 | .ndo_do_ioctl = rtl8192_ioctl, | ||
| 6824 | .ndo_set_multicast_list = r8192_set_multicast, | ||
| 6825 | .ndo_set_mac_address = r8192_set_mac_adr, | ||
| 6826 | .ndo_validate_addr = eth_validate_addr, | ||
| 6827 | .ndo_change_mtu = eth_change_mtu, | ||
| 6828 | .ndo_start_xmit = ieee80211_xmit, | ||
| 6829 | }; | ||
| 6834 | 6830 | ||
| 6835 | 6831 | ||
| 6836 | /**************************************************************************** | 6832 | /**************************************************************************** |
| @@ -6872,15 +6868,7 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, | |||
| 6872 | #endif | 6868 | #endif |
| 6873 | priv->udev=udev; | 6869 | priv->udev=udev; |
| 6874 | 6870 | ||
| 6875 | dev->open = rtl8192_open; | 6871 | dev->netdev_ops = &rtl8192_netdev_ops; |
| 6876 | dev->stop = rtl8192_close; | ||
| 6877 | //dev->hard_start_xmit = rtl8192_8023_hard_start_xmit; | ||
| 6878 | dev->tx_timeout = tx_timeout; | ||
| 6879 | //dev->wireless_handlers = &r8192_wx_handlers_def; | ||
| 6880 | dev->do_ioctl = rtl8192_ioctl; | ||
| 6881 | dev->set_multicast_list = r8192_set_multicast; | ||
| 6882 | dev->set_mac_address = r8192_set_mac_adr; | ||
| 6883 | dev->get_stats = rtl8192_stats; | ||
| 6884 | 6872 | ||
| 6885 | //DMESG("Oops: i'm coming\n"); | 6873 | //DMESG("Oops: i'm coming\n"); |
| 6886 | #if WIRELESS_EXT >= 12 | 6874 | #if WIRELESS_EXT >= 12 |
| @@ -7000,9 +6988,55 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr) | |||
| 7000 | RT_TRACE(COMP_DOWN, "wlan driver removed\n"); | 6988 | RT_TRACE(COMP_DOWN, "wlan driver removed\n"); |
| 7001 | } | 6989 | } |
| 7002 | 6990 | ||
| 6991 | /* fun with the built-in ieee80211 stack... */ | ||
| 6992 | extern int ieee80211_debug_init(void); | ||
| 6993 | extern void ieee80211_debug_exit(void); | ||
| 6994 | extern int ieee80211_crypto_init(void); | ||
| 6995 | extern void ieee80211_crypto_deinit(void); | ||
| 6996 | extern int ieee80211_crypto_tkip_init(void); | ||
| 6997 | extern void ieee80211_crypto_tkip_exit(void); | ||
| 6998 | extern int ieee80211_crypto_ccmp_init(void); | ||
| 6999 | extern void ieee80211_crypto_ccmp_exit(void); | ||
| 7000 | extern int ieee80211_crypto_wep_init(void); | ||
| 7001 | extern void ieee80211_crypto_wep_exit(void); | ||
| 7003 | 7002 | ||
| 7004 | static int __init rtl8192_usb_module_init(void) | 7003 | static int __init rtl8192_usb_module_init(void) |
| 7005 | { | 7004 | { |
| 7005 | int ret; | ||
| 7006 | |||
| 7007 | #ifdef CONFIG_IEEE80211_DEBUG | ||
| 7008 | ret = ieee80211_debug_init(); | ||
| 7009 | if (ret) { | ||
| 7010 | printk(KERN_ERR "ieee80211_debug_init() failed %d\n", ret); | ||
| 7011 | return ret; | ||
| 7012 | } | ||
| 7013 | #endif | ||
| 7014 | ret = ieee80211_crypto_init(); | ||
| 7015 | if (ret) { | ||
| 7016 | printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret); | ||
| 7017 | return ret; | ||
| 7018 | } | ||
| 7019 | |||
| 7020 | ret = ieee80211_crypto_tkip_init(); | ||
| 7021 | if (ret) { | ||
| 7022 | printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n", | ||
| 7023 | ret); | ||
| 7024 | return ret; | ||
| 7025 | } | ||
| 7026 | |||
| 7027 | ret = ieee80211_crypto_ccmp_init(); | ||
| 7028 | if (ret) { | ||
| 7029 | printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n", | ||
| 7030 | ret); | ||
| 7031 | return ret; | ||
| 7032 | } | ||
| 7033 | |||
| 7034 | ret = ieee80211_crypto_wep_init(); | ||
| 7035 | if (ret) { | ||
| 7036 | printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret); | ||
| 7037 | return ret; | ||
| 7038 | } | ||
| 7039 | |||
| 7006 | printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n"); | 7040 | printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n"); |
| 7007 | printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n"); | 7041 | printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n"); |
| 7008 | RT_TRACE(COMP_INIT, "Initializing module"); | 7042 | RT_TRACE(COMP_INIT, "Initializing module"); |
