]> Pileus Git - ~andy/linux/commitdiff
staging/rtl8192e: Register against lib80211
authorSean MacLennan <seanm@seanm.ca>
Tue, 20 Dec 2011 04:23:08 +0000 (23:23 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Dec 2011 21:48:59 +0000 (13:48 -0800)
Convert rtllib from registering the crypt drivers against rtllib_crypt
and instead register the against lib80211. The crypto functions have
R- prepended (R-CCMP, R-TKIP, R-WEP) so they will not clash with the
lib80211 versions.

We cannot use the lib80211 crypt drivers since the rtl8192e has some
hardware support that is not handled by the lib80211 crypt drivers.

Signed-off-by: Sean MacLennan <seanm@seanm.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192e/Kconfig
drivers/staging/rtl8192e/Makefile
drivers/staging/rtl8192e/rtllib.h
drivers/staging/rtl8192e/rtllib_crypt.c
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
drivers/staging/rtl8192e/rtllib_crypt_tkip.c
drivers/staging/rtl8192e/rtllib_crypt_wep.c
drivers/staging/rtl8192e/rtllib_module.c
drivers/staging/rtl8192e/rtllib_softmac.c
drivers/staging/rtl8192e/rtllib_wx.c

index 878f384c0aabf9e95f984ed8ca7eb9e66b6a809e..f87e211018579a1d43124adea963c01bbbd0e2bd 100644 (file)
@@ -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.
index 729cb7b936670c76d96f35fb1bdd1e1e1972f5ca..cb18db74d78cf82957cd9d6e1cef4bb49b7b3fb6 100644 (file)
@@ -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
index a8133d4a1541e03f9fb3029b6b2ef6c42d7af80f..e26aec86a5c827964564e4bfb59a5ee8fb5b27db 100644 (file)
@@ -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 */
index 606a2f5158fde3be568c42629452aeb28f020c6c..86152d0e6b5dba3515dd5ba7d75ec351d16d0f6c 100644 (file)
@@ -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;
index f4e52b9223f3d6e9ad5a146648fa6b40cd4fe228..4217b88e6fc3e211d82000eefa9a98baa95f2dca 100644 (file)
@@ -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);
index 90e71d8acdaead58c511e433512d98e511da56d9..800925053fb0df48e50a17e97cc32b593e9c6e8d 100644 (file)
@@ -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);
index 34e2d0abfd4e62a63164c94a8194108d0445ada2..8cdf38913a330717444248fee3841b018a8fb491 100644 (file)
@@ -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);
index 35ea93de3682cb5935066bc2337c63c80d2cd302..f9dae958a5d437f6a51e6d826be5552826646b5d 100644 (file)
@@ -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);
index 80d147693490734b0fe2bee8666546801f1f3f8b..1637f1110991fa8003e831daea9c525b32588fb8 100644 (file)
@@ -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)) {
index 1328dbc92f102e03a76eef905e832a8a9f60d6a5..c27ff7edbaf285d9b1d3889c82428db189009100 100644 (file)
@@ -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;