diff --git a/drivers/staging/rtl8192e/Kconfig b/drivers/staging/rtl8192e/Kconfig index 878f384c0aab..f87e21101857 100644 --- a/drivers/staging/rtl8192e/Kconfig +++ b/drivers/staging/rtl8192e/Kconfig @@ -2,7 +2,7 @@ config RTLLIB tristate "Support for rtllib wireless devices" depends on WLAN && m default n - select RTLLIB_CRYPTO + select LIB80211 ---help--- If you have a wireless card that uses rtllib, say Y. Currently the only card is the rtl8192e. @@ -11,14 +11,9 @@ config RTLLIB if RTLLIB -config RTLLIB_CRYPTO - tristate "Support for rtllib crypto support" - ---help--- - Base crypto driver for rtllib. - config RTLLIB_CRYPTO_CCMP tristate "Support for rtllib CCMP crypto" - depends on RTLLIB_CRYPTO + depends on RTLLIB default y ---help--- CCMP crypto driver for rtllib. @@ -27,7 +22,7 @@ config RTLLIB_CRYPTO_CCMP config RTLLIB_CRYPTO_TKIP tristate "Support for rtllib TKIP crypto" - depends on RTLLIB_CRYPTO + depends on RTLLIB default y ---help--- TKIP crypto driver for rtllib. @@ -36,7 +31,7 @@ config RTLLIB_CRYPTO_TKIP config RTLLIB_CRYPTO_WEP tristate "Support for rtllib WEP crypto" - depends on RTLLIB_CRYPTO + depends on RTLLIB default y ---help--- TKIP crypto driver for rtllib. diff --git a/drivers/staging/rtl8192e/Makefile b/drivers/staging/rtl8192e/Makefile index 729cb7b93667..cb18db74d78c 100644 --- a/drivers/staging/rtl8192e/Makefile +++ b/drivers/staging/rtl8192e/Makefile @@ -12,7 +12,6 @@ rtllib-objs := \ obj-$(CONFIG_RTLLIB) += rtllib.o -obj-$(CONFIG_RTLLIB_CRYPTO) += rtllib_crypt.o obj-$(CONFIG_RTLLIB_CRYPTO_CCMP) += rtllib_crypt_ccmp.o obj-$(CONFIG_RTLLIB_CRYPTO_TKIP) += rtllib_crypt_tkip.o obj-$(CONFIG_RTLLIB_CRYPTO_WEP) += rtllib_crypt_wep.o diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index a8133d4a1541..e26aec86a5c8 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1060,8 +1060,6 @@ struct rtllib_stats { struct rtllib_device; -#include "rtllib_crypt.h" - #define SEC_KEY_1 (1<<0) #define SEC_KEY_2 (1<<1) #define SEC_KEY_3 (1<<2) @@ -2985,21 +2983,6 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) (HTMcsToDataRate(_ieee, (u8)_MGN_RATE))) /* fun with the built-in rtllib stack... */ -int rtllib_init(void); -void rtllib_exit(void); -int rtllib_crypto_init(void); -void rtllib_crypto_deinit(void); -int rtllib_crypto_tkip_init(void); -void rtllib_crypto_tkip_exit(void); -int rtllib_crypto_ccmp_init(void); -void rtllib_crypto_ccmp_exit(void); -int rtllib_crypto_wep_init(void); -void rtllib_crypto_wep_exit(void); - -void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib); -void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta, - u8 asRsn); -void rtllib_MgntDisconnectAP(struct rtllib_device *rtllib, u8 asRsn); bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); @@ -3066,12 +3049,5 @@ extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p); #define MUTEX_LOCK_PRIV(pmutex) mutex_lock(pmutex) #define MUTEX_UNLOCK_PRIV(pmutex) mutex_unlock(pmutex) #endif -static inline void dump_buf(u8 *buf, u32 len) -{ - u32 i; - printk(KERN_INFO "-----------------Len %d----------------\n", len); - for (i = 0; i < len; i++) - printk("%2.2x-", *(buf+i)); - printk("\n"); -} + #endif /* RTLLIB_H */ diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c index 606a2f5158fd..86152d0e6b5d 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.c +++ b/drivers/staging/rtl8192e/rtllib_crypt.c @@ -215,7 +215,7 @@ int __init rtllib_crypto_init(void) INIT_LIST_HEAD(&hcrypt->algs); spin_lock_init(&hcrypt->lock); - ret = rtllib_register_crypto_ops(&rtllib_crypt_null); + ret = lib80211_register_crypto_ops(&rtllib_crypt_null); if (ret < 0) { kfree(hcrypt); hcrypt = NULL; diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index f4e52b9223f3..4217b88e6fc3 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -428,7 +428,7 @@ static char *rtllib_ccmp_print_stats(char *p, void *priv) } static struct lib80211_crypto_ops rtllib_crypt_ccmp = { - .name = "CCMP", + .name = "R-CCMP", .init = rtllib_ccmp_init, .deinit = rtllib_ccmp_deinit, .encrypt_mpdu = rtllib_ccmp_encrypt, @@ -446,13 +446,13 @@ static struct lib80211_crypto_ops rtllib_crypt_ccmp = { int __init rtllib_crypto_ccmp_init(void) { - return rtllib_register_crypto_ops(&rtllib_crypt_ccmp); + return lib80211_register_crypto_ops(&rtllib_crypt_ccmp); } void __exit rtllib_crypto_ccmp_exit(void) { - rtllib_unregister_crypto_ops(&rtllib_crypt_ccmp); + lib80211_unregister_crypto_ops(&rtllib_crypt_ccmp); } module_init(rtllib_crypto_ccmp_init); diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 90e71d8acdae..800925053fb0 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -735,7 +735,7 @@ static char *rtllib_tkip_print_stats(char *p, void *priv) } static struct lib80211_crypto_ops rtllib_crypt_tkip = { - .name = "TKIP", + .name = "R-TKIP", .init = rtllib_tkip_init, .deinit = rtllib_tkip_deinit, .encrypt_mpdu = rtllib_tkip_encrypt, @@ -754,13 +754,13 @@ static struct lib80211_crypto_ops rtllib_crypt_tkip = { int __init rtllib_crypto_tkip_init(void) { - return rtllib_register_crypto_ops(&rtllib_crypt_tkip); + return lib80211_register_crypto_ops(&rtllib_crypt_tkip); } void __exit rtllib_crypto_tkip_exit(void) { - rtllib_unregister_crypto_ops(&rtllib_crypt_tkip); + lib80211_unregister_crypto_ops(&rtllib_crypt_tkip); } module_init(rtllib_crypto_tkip_init); diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index 34e2d0abfd4e..8cdf38913a33 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -256,7 +256,7 @@ static char *prism2_wep_print_stats(char *p, void *priv) } static struct lib80211_crypto_ops rtllib_crypt_wep = { - .name = "WEP", + .name = "R-WEP", .init = prism2_wep_init, .deinit = prism2_wep_deinit, .encrypt_mpdu = prism2_wep_encrypt, @@ -274,13 +274,13 @@ static struct lib80211_crypto_ops rtllib_crypt_wep = { int __init rtllib_crypto_wep_init(void) { - return rtllib_register_crypto_ops(&rtllib_crypt_wep); + return lib80211_register_crypto_ops(&rtllib_crypt_wep); } void __exit rtllib_crypto_wep_exit(void) { - rtllib_unregister_crypto_ops(&rtllib_crypt_wep); + lib80211_unregister_crypto_ops(&rtllib_crypt_wep); } module_init(rtllib_crypto_wep_init); diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index 35ea93de3682..f9dae958a5d4 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -136,11 +136,6 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->host_decrypt = 1; ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ - /* SAM Init here */ - INIT_LIST_HEAD(&ieee->crypt_info.crypt_deinit_list); - _setup_timer(&ieee->crypt_info.crypt_deinit_timer, - rtllib_crypt_deinit_handler, - (unsigned long)&ieee->crypt_info); ieee->rtllib_ap_sec_type = rtllib_ap_sec_type; spin_lock_init(&ieee->lock); @@ -150,6 +145,9 @@ struct net_device *alloc_rtllib(int sizeof_priv) atomic_set(&(ieee->atm_chnlop), 0); atomic_set(&(ieee->atm_swbw), 0); + /* SAM FIXME */ + lib80211_crypt_info_init(&ieee->crypt_info, "RTLLIB", &ieee->lock); + ieee->bHalfNMode = false; ieee->wpa_enabled = 0; ieee->tkip_countermeasures = 0; @@ -192,25 +190,12 @@ void free_rtllib(struct net_device *dev) { struct rtllib_device *ieee = (struct rtllib_device *) netdev_priv_rsl(dev); - int i; kfree(ieee->pHTInfo); ieee->pHTInfo = NULL; rtllib_softmac_free(ieee); - /* SAM cleanup */ - del_timer_sync(&ieee->crypt_info.crypt_deinit_timer); - rtllib_crypt_deinit_entries(&ieee->crypt_info, 1); - - for (i = 0; i < NUM_WEP_KEYS; i++) { - struct lib80211_crypt_data *crypt = ieee->crypt_info.crypt[i]; - if (crypt) { - if (crypt->ops) - crypt->ops->deinit(crypt->priv); - kfree(crypt); - ieee->crypt_info.crypt[i] = NULL; - } - } + lib80211_crypt_info_free(&ieee->crypt_info); rtllib_networks_free(ieee); free_netdev(dev); diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 80d147693490..1637f1110991 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -873,7 +873,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = ieee->host_encrypt && crypt && crypt->ops && - ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); + ((0 == strcmp(crypt->ops->name, "R-WEP") || wpa_ie_len)); if (ieee->pHTInfo->bCurrentHTSupport) { tmp_ht_cap_buf = (u8 *) &(ieee->pHTInfo->SelfHTCap); tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); @@ -1194,7 +1194,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (crypt != NULL) encrypt = ieee->host_encrypt && crypt && crypt->ops && - ((0 == strcmp(crypt->ops->name, "WEP") || + ((0 == strcmp(crypt->ops->name, "R-WEP") || wpa_ie_len)); else encrypt = 0; @@ -3377,7 +3377,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, sec.enabled = 0; sec.level = SEC_LEVEL_0; sec.flags |= SEC_ENABLED | SEC_LEVEL; - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } goto done; } @@ -3386,19 +3386,19 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, /* IPW HW cannot build TKIP MIC, host decryption still needed. */ if (!(ieee->host_encrypt || ieee->host_decrypt) && - strcmp(param->u.crypt.alg, "TKIP")) + strcmp(param->u.crypt.alg, "R-TKIP")) goto skip_host_crypt; - ops = rtllib_get_crypto_ops(param->u.crypt.alg); - if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { + ops = lib80211_get_crypto_ops(param->u.crypt.alg); + if (ops == NULL && strcmp(param->u.crypt.alg, "R-WEP") == 0) { request_module("rtllib_crypt_wep"); - ops = rtllib_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { + ops = lib80211_get_crypto_ops(param->u.crypt.alg); + } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-TKIP") == 0) { request_module("rtllib_crypt_tkip"); - ops = rtllib_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { + ops = lib80211_get_crypto_ops(param->u.crypt.alg); + } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-CCMP") == 0) { request_module("rtllib_crypt_ccmp"); - ops = rtllib_get_crypto_ops(param->u.crypt.alg); + ops = lib80211_get_crypto_ops(param->u.crypt.alg); } if (ops == NULL) { printk(KERN_INFO "unknown crypto alg '%s'\n", @@ -3410,7 +3410,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, if (*crypt == NULL || (*crypt)->ops != ops) { struct lib80211_crypt_data *new_crypt; - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); new_crypt = (struct lib80211_crypt_data *) kmalloc(sizeof(*new_crypt), GFP_KERNEL); @@ -3459,13 +3459,13 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; sec.flags |= (1 << param->u.crypt.idx); - if (strcmp(param->u.crypt.alg, "WEP") == 0) { + if (strcmp(param->u.crypt.alg, "R-WEP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_1; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { + } else if (strcmp(param->u.crypt.alg, "R-TKIP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_2; - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { + } else if (strcmp(param->u.crypt.alg, "R-CCMP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_3; } @@ -3568,7 +3568,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee) crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && - (0 == strcmp(crypt->ops->name, "WEP"))); + (0 == strcmp(crypt->ops->name, "R-WEP"))); /* simply judge */ if (encrypt && (wpa_ie_len == 0)) { diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 1328dbc92f10..c27ff7edbaf2 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -328,7 +328,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (key_provided && *crypt) { RTLLIB_DEBUG_WX("Disabling encryption on key %d.\n", key); - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } else RTLLIB_DEBUG_WX("Disabling encryption.\n"); @@ -338,7 +338,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (ieee->crypt_info.crypt[i] != NULL) { if (key_provided) break; - rtllib_crypt_delayed_deinit(&ieee->crypt_info, + lib80211_crypt_delayed_deinit(&ieee->crypt_info, &ieee->crypt_info.crypt[i]); } } @@ -358,10 +358,10 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, sec.flags |= SEC_ENABLED; if (*crypt != NULL && (*crypt)->ops != NULL && - strcmp((*crypt)->ops->name, "WEP") != 0) { + strcmp((*crypt)->ops->name, "R-WEP") != 0) { /* changing to use WEP; deinit previously used algorithm * on this key */ - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } if (*crypt == NULL) { @@ -372,10 +372,10 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, GFP_KERNEL); if (new_crypt == NULL) return -ENOMEM; - new_crypt->ops = rtllib_get_crypto_ops("WEP"); + new_crypt->ops = lib80211_get_crypto_ops("R-WEP"); if (!new_crypt->ops) { request_module("rtllib_crypt_wep"); - new_crypt->ops = rtllib_get_crypto_ops("WEP"); + new_crypt->ops = lib80211_get_crypto_ops("R-WEP"); } if (new_crypt->ops) @@ -557,7 +557,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE) { if (*crypt) - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); for (i = 0; i < NUM_WEP_KEYS; i++) { if (ieee->crypt_info.crypt[i] != NULL) @@ -574,15 +574,15 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, sec.enabled = 1; switch (ext->alg) { case IW_ENCODE_ALG_WEP: - alg = "WEP"; + alg = "R-WEP"; module = "rtllib_crypt_wep"; break; case IW_ENCODE_ALG_TKIP: - alg = "TKIP"; + alg = "R-TKIP"; module = "rtllib_crypt_tkip"; break; case IW_ENCODE_ALG_CCMP: - alg = "CCMP"; + alg = "R-CCMP"; module = "rtllib_crypt_ccmp"; break; default: @@ -593,14 +593,14 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, } printk(KERN_INFO "alg name:%s\n", alg); - ops = rtllib_get_crypto_ops(alg); + ops = lib80211_get_crypto_ops(alg); if (ops == NULL) { char tempbuf[100]; memset(tempbuf, 0x00, 100); sprintf(tempbuf, "%s", module); request_module("%s", tempbuf); - ops = rtllib_get_crypto_ops(alg); + ops = lib80211_get_crypto_ops(alg); } if (ops == NULL) { RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n", @@ -613,7 +613,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if (*crypt == NULL || (*crypt)->ops != ops) { struct lib80211_crypt_data *new_crypt; - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { @@ -713,11 +713,11 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee, ext->key_len = 0; encoding->flags |= IW_ENCODE_DISABLED; } else { - if (strcmp(crypt->ops->name, "WEP") == 0) + if (strcmp(crypt->ops->name, "R-WEP") == 0) ext->alg = IW_ENCODE_ALG_WEP; - else if (strcmp(crypt->ops->name, "TKIP")) + else if (strcmp(crypt->ops->name, "R-TKIP")) ext->alg = IW_ENCODE_ALG_TKIP; - else if (strcmp(crypt->ops->name, "CCMP")) + else if (strcmp(crypt->ops->name, "R-CCMP")) ext->alg = IW_ENCODE_ALG_CCMP; else return -EINVAL;