Commit 3b148be0df8e45a0259d7e84001cf02e897af614

Authored by Sean MacLennan
Committed by Greg Kroah-Hartman
1 parent 0ddcf5fdfa

staging/rtl8192e: Register against lib80211

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>

Showing 10 changed files with 51 additions and 96 deletions Side-by-side Diff

drivers/staging/rtl8192e/Kconfig
... ... @@ -2,7 +2,7 @@
2 2 tristate "Support for rtllib wireless devices"
3 3 depends on WLAN && m
4 4 default n
5   - select RTLLIB_CRYPTO
  5 + select LIB80211
6 6 ---help---
7 7 If you have a wireless card that uses rtllib, say
8 8 Y. Currently the only card is the rtl8192e.
9 9  
... ... @@ -11,14 +11,9 @@
11 11  
12 12 if RTLLIB
13 13  
14   -config RTLLIB_CRYPTO
15   - tristate "Support for rtllib crypto support"
16   - ---help---
17   - Base crypto driver for rtllib.
18   -
19 14 config RTLLIB_CRYPTO_CCMP
20 15 tristate "Support for rtllib CCMP crypto"
21   - depends on RTLLIB_CRYPTO
  16 + depends on RTLLIB
22 17 default y
23 18 ---help---
24 19 CCMP crypto driver for rtllib.
... ... @@ -27,7 +22,7 @@
27 22  
28 23 config RTLLIB_CRYPTO_TKIP
29 24 tristate "Support for rtllib TKIP crypto"
30   - depends on RTLLIB_CRYPTO
  25 + depends on RTLLIB
31 26 default y
32 27 ---help---
33 28 TKIP crypto driver for rtllib.
... ... @@ -36,7 +31,7 @@
36 31  
37 32 config RTLLIB_CRYPTO_WEP
38 33 tristate "Support for rtllib WEP crypto"
39   - depends on RTLLIB_CRYPTO
  34 + depends on RTLLIB
40 35 default y
41 36 ---help---
42 37 TKIP crypto driver for rtllib.
drivers/staging/rtl8192e/Makefile
... ... @@ -12,7 +12,6 @@
12 12  
13 13 obj-$(CONFIG_RTLLIB) += rtllib.o
14 14  
15   -obj-$(CONFIG_RTLLIB_CRYPTO) += rtllib_crypt.o
16 15 obj-$(CONFIG_RTLLIB_CRYPTO_CCMP) += rtllib_crypt_ccmp.o
17 16 obj-$(CONFIG_RTLLIB_CRYPTO_TKIP) += rtllib_crypt_tkip.o
18 17 obj-$(CONFIG_RTLLIB_CRYPTO_WEP) += rtllib_crypt_wep.o
drivers/staging/rtl8192e/rtllib.h
... ... @@ -1060,8 +1060,6 @@
1060 1060  
1061 1061 struct rtllib_device;
1062 1062  
1063   -#include "rtllib_crypt.h"
1064   -
1065 1063 #define SEC_KEY_1 (1<<0)
1066 1064 #define SEC_KEY_2 (1<<1)
1067 1065 #define SEC_KEY_3 (1<<2)
... ... @@ -2985,21 +2983,6 @@
2985 2983 (HTMcsToDataRate(_ieee, (u8)_MGN_RATE)))
2986 2984  
2987 2985 /* fun with the built-in rtllib stack... */
2988   -int rtllib_init(void);
2989   -void rtllib_exit(void);
2990   -int rtllib_crypto_init(void);
2991   -void rtllib_crypto_deinit(void);
2992   -int rtllib_crypto_tkip_init(void);
2993   -void rtllib_crypto_tkip_exit(void);
2994   -int rtllib_crypto_ccmp_init(void);
2995   -void rtllib_crypto_ccmp_exit(void);
2996   -int rtllib_crypto_wep_init(void);
2997   -void rtllib_crypto_wep_exit(void);
2998   -
2999   -void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib);
3000   -void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta,
3001   - u8 asRsn);
3002   -void rtllib_MgntDisconnectAP(struct rtllib_device *rtllib, u8 asRsn);
3003 2986 bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn);
3004 2987  
3005 2988  
... ... @@ -3066,13 +3049,6 @@
3066 3049 #define MUTEX_LOCK_PRIV(pmutex) mutex_lock(pmutex)
3067 3050 #define MUTEX_UNLOCK_PRIV(pmutex) mutex_unlock(pmutex)
3068 3051 #endif
3069   -static inline void dump_buf(u8 *buf, u32 len)
3070   -{
3071   - u32 i;
3072   - printk(KERN_INFO "-----------------Len %d----------------\n", len);
3073   - for (i = 0; i < len; i++)
3074   - printk("%2.2x-", *(buf+i));
3075   - printk("\n");
3076   -}
  3052 +
3077 3053 #endif /* RTLLIB_H */
drivers/staging/rtl8192e/rtllib_crypt.c
... ... @@ -215,7 +215,7 @@
215 215 INIT_LIST_HEAD(&hcrypt->algs);
216 216 spin_lock_init(&hcrypt->lock);
217 217  
218   - ret = rtllib_register_crypto_ops(&rtllib_crypt_null);
  218 + ret = lib80211_register_crypto_ops(&rtllib_crypt_null);
219 219 if (ret < 0) {
220 220 kfree(hcrypt);
221 221 hcrypt = NULL;
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
... ... @@ -428,7 +428,7 @@
428 428 }
429 429  
430 430 static struct lib80211_crypto_ops rtllib_crypt_ccmp = {
431   - .name = "CCMP",
  431 + .name = "R-CCMP",
432 432 .init = rtllib_ccmp_init,
433 433 .deinit = rtllib_ccmp_deinit,
434 434 .encrypt_mpdu = rtllib_ccmp_encrypt,
435 435  
... ... @@ -446,13 +446,13 @@
446 446  
447 447 int __init rtllib_crypto_ccmp_init(void)
448 448 {
449   - return rtllib_register_crypto_ops(&rtllib_crypt_ccmp);
  449 + return lib80211_register_crypto_ops(&rtllib_crypt_ccmp);
450 450 }
451 451  
452 452  
453 453 void __exit rtllib_crypto_ccmp_exit(void)
454 454 {
455   - rtllib_unregister_crypto_ops(&rtllib_crypt_ccmp);
  455 + lib80211_unregister_crypto_ops(&rtllib_crypt_ccmp);
456 456 }
457 457  
458 458 module_init(rtllib_crypto_ccmp_init);
drivers/staging/rtl8192e/rtllib_crypt_tkip.c
... ... @@ -735,7 +735,7 @@
735 735 }
736 736  
737 737 static struct lib80211_crypto_ops rtllib_crypt_tkip = {
738   - .name = "TKIP",
  738 + .name = "R-TKIP",
739 739 .init = rtllib_tkip_init,
740 740 .deinit = rtllib_tkip_deinit,
741 741 .encrypt_mpdu = rtllib_tkip_encrypt,
742 742  
... ... @@ -754,13 +754,13 @@
754 754  
755 755 int __init rtllib_crypto_tkip_init(void)
756 756 {
757   - return rtllib_register_crypto_ops(&rtllib_crypt_tkip);
  757 + return lib80211_register_crypto_ops(&rtllib_crypt_tkip);
758 758 }
759 759  
760 760  
761 761 void __exit rtllib_crypto_tkip_exit(void)
762 762 {
763   - rtllib_unregister_crypto_ops(&rtllib_crypt_tkip);
  763 + lib80211_unregister_crypto_ops(&rtllib_crypt_tkip);
764 764 }
765 765  
766 766 module_init(rtllib_crypto_tkip_init);
drivers/staging/rtl8192e/rtllib_crypt_wep.c
... ... @@ -256,7 +256,7 @@
256 256 }
257 257  
258 258 static struct lib80211_crypto_ops rtllib_crypt_wep = {
259   - .name = "WEP",
  259 + .name = "R-WEP",
260 260 .init = prism2_wep_init,
261 261 .deinit = prism2_wep_deinit,
262 262 .encrypt_mpdu = prism2_wep_encrypt,
263 263  
... ... @@ -274,13 +274,13 @@
274 274  
275 275 int __init rtllib_crypto_wep_init(void)
276 276 {
277   - return rtllib_register_crypto_ops(&rtllib_crypt_wep);
  277 + return lib80211_register_crypto_ops(&rtllib_crypt_wep);
278 278 }
279 279  
280 280  
281 281 void __exit rtllib_crypto_wep_exit(void)
282 282 {
283   - rtllib_unregister_crypto_ops(&rtllib_crypt_wep);
  283 + lib80211_unregister_crypto_ops(&rtllib_crypt_wep);
284 284 }
285 285  
286 286 module_init(rtllib_crypto_wep_init);
drivers/staging/rtl8192e/rtllib_module.c
... ... @@ -136,11 +136,6 @@
136 136 ieee->host_decrypt = 1;
137 137 ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
138 138  
139   - /* SAM Init here */
140   - INIT_LIST_HEAD(&ieee->crypt_info.crypt_deinit_list);
141   - _setup_timer(&ieee->crypt_info.crypt_deinit_timer,
142   - rtllib_crypt_deinit_handler,
143   - (unsigned long)&ieee->crypt_info);
144 139 ieee->rtllib_ap_sec_type = rtllib_ap_sec_type;
145 140  
146 141 spin_lock_init(&ieee->lock);
... ... @@ -150,6 +145,9 @@
150 145 atomic_set(&(ieee->atm_chnlop), 0);
151 146 atomic_set(&(ieee->atm_swbw), 0);
152 147  
  148 + /* SAM FIXME */
  149 + lib80211_crypt_info_init(&ieee->crypt_info, "RTLLIB", &ieee->lock);
  150 +
153 151 ieee->bHalfNMode = false;
154 152 ieee->wpa_enabled = 0;
155 153 ieee->tkip_countermeasures = 0;
156 154  
... ... @@ -192,25 +190,12 @@
192 190 {
193 191 struct rtllib_device *ieee = (struct rtllib_device *)
194 192 netdev_priv_rsl(dev);
195   - int i;
196 193  
197 194 kfree(ieee->pHTInfo);
198 195 ieee->pHTInfo = NULL;
199 196 rtllib_softmac_free(ieee);
200 197  
201   - /* SAM cleanup */
202   - del_timer_sync(&ieee->crypt_info.crypt_deinit_timer);
203   - rtllib_crypt_deinit_entries(&ieee->crypt_info, 1);
204   -
205   - for (i = 0; i < NUM_WEP_KEYS; i++) {
206   - struct lib80211_crypt_data *crypt = ieee->crypt_info.crypt[i];
207   - if (crypt) {
208   - if (crypt->ops)
209   - crypt->ops->deinit(crypt->priv);
210   - kfree(crypt);
211   - ieee->crypt_info.crypt[i] = NULL;
212   - }
213   - }
  198 + lib80211_crypt_info_free(&ieee->crypt_info);
214 199  
215 200 rtllib_networks_free(ieee);
216 201 free_netdev(dev);
drivers/staging/rtl8192e/rtllib_softmac.c
... ... @@ -873,7 +873,7 @@
873 873  
874 874 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
875 875 encrypt = ieee->host_encrypt && crypt && crypt->ops &&
876   - ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len));
  876 + ((0 == strcmp(crypt->ops->name, "R-WEP") || wpa_ie_len));
877 877 if (ieee->pHTInfo->bCurrentHTSupport) {
878 878 tmp_ht_cap_buf = (u8 *) &(ieee->pHTInfo->SelfHTCap);
879 879 tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap);
... ... @@ -1194,7 +1194,7 @@
1194 1194 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
1195 1195 if (crypt != NULL)
1196 1196 encrypt = ieee->host_encrypt && crypt && crypt->ops &&
1197   - ((0 == strcmp(crypt->ops->name, "WEP") ||
  1197 + ((0 == strcmp(crypt->ops->name, "R-WEP") ||
1198 1198 wpa_ie_len));
1199 1199 else
1200 1200 encrypt = 0;
... ... @@ -3377,7 +3377,7 @@
3377 3377 sec.enabled = 0;
3378 3378 sec.level = SEC_LEVEL_0;
3379 3379 sec.flags |= SEC_ENABLED | SEC_LEVEL;
3380   - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
  3380 + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
3381 3381 }
3382 3382 goto done;
3383 3383 }
3384 3384  
3385 3385  
3386 3386  
3387 3387  
... ... @@ -3386,19 +3386,19 @@
3386 3386  
3387 3387 /* IPW HW cannot build TKIP MIC, host decryption still needed. */
3388 3388 if (!(ieee->host_encrypt || ieee->host_decrypt) &&
3389   - strcmp(param->u.crypt.alg, "TKIP"))
  3389 + strcmp(param->u.crypt.alg, "R-TKIP"))
3390 3390 goto skip_host_crypt;
3391 3391  
3392   - ops = rtllib_get_crypto_ops(param->u.crypt.alg);
3393   - if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
  3392 + ops = lib80211_get_crypto_ops(param->u.crypt.alg);
  3393 + if (ops == NULL && strcmp(param->u.crypt.alg, "R-WEP") == 0) {
3394 3394 request_module("rtllib_crypt_wep");
3395   - ops = rtllib_get_crypto_ops(param->u.crypt.alg);
3396   - } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
  3395 + ops = lib80211_get_crypto_ops(param->u.crypt.alg);
  3396 + } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-TKIP") == 0) {
3397 3397 request_module("rtllib_crypt_tkip");
3398   - ops = rtllib_get_crypto_ops(param->u.crypt.alg);
3399   - } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
  3398 + ops = lib80211_get_crypto_ops(param->u.crypt.alg);
  3399 + } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-CCMP") == 0) {
3400 3400 request_module("rtllib_crypt_ccmp");
3401   - ops = rtllib_get_crypto_ops(param->u.crypt.alg);
  3401 + ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3402 3402 }
3403 3403 if (ops == NULL) {
3404 3404 printk(KERN_INFO "unknown crypto alg '%s'\n",
... ... @@ -3410,7 +3410,7 @@
3410 3410 if (*crypt == NULL || (*crypt)->ops != ops) {
3411 3411 struct lib80211_crypt_data *new_crypt;
3412 3412  
3413   - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
  3413 + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
3414 3414  
3415 3415 new_crypt = (struct lib80211_crypt_data *)
3416 3416 kmalloc(sizeof(*new_crypt), GFP_KERNEL);
3417 3417  
3418 3418  
... ... @@ -3459,13 +3459,13 @@
3459 3459 sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len;
3460 3460 sec.flags |= (1 << param->u.crypt.idx);
3461 3461  
3462   - if (strcmp(param->u.crypt.alg, "WEP") == 0) {
  3462 + if (strcmp(param->u.crypt.alg, "R-WEP") == 0) {
3463 3463 sec.flags |= SEC_LEVEL;
3464 3464 sec.level = SEC_LEVEL_1;
3465   - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
  3465 + } else if (strcmp(param->u.crypt.alg, "R-TKIP") == 0) {
3466 3466 sec.flags |= SEC_LEVEL;
3467 3467 sec.level = SEC_LEVEL_2;
3468   - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
  3468 + } else if (strcmp(param->u.crypt.alg, "R-CCMP") == 0) {
3469 3469 sec.flags |= SEC_LEVEL;
3470 3470 sec.level = SEC_LEVEL_3;
3471 3471 }
... ... @@ -3568,7 +3568,7 @@
3568 3568 crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
3569 3569 encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY)
3570 3570 || (ieee->host_encrypt && crypt && crypt->ops &&
3571   - (0 == strcmp(crypt->ops->name, "WEP")));
  3571 + (0 == strcmp(crypt->ops->name, "R-WEP")));
3572 3572  
3573 3573 /* simply judge */
3574 3574 if (encrypt && (wpa_ie_len == 0)) {
drivers/staging/rtl8192e/rtllib_wx.c
... ... @@ -328,7 +328,7 @@
328 328 if (key_provided && *crypt) {
329 329 RTLLIB_DEBUG_WX("Disabling encryption on key %d.\n",
330 330 key);
331   - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
  331 + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
332 332 } else
333 333 RTLLIB_DEBUG_WX("Disabling encryption.\n");
334 334  
... ... @@ -338,7 +338,7 @@
338 338 if (ieee->crypt_info.crypt[i] != NULL) {
339 339 if (key_provided)
340 340 break;
341   - rtllib_crypt_delayed_deinit(&ieee->crypt_info,
  341 + lib80211_crypt_delayed_deinit(&ieee->crypt_info,
342 342 &ieee->crypt_info.crypt[i]);
343 343 }
344 344 }
345 345  
... ... @@ -358,10 +358,10 @@
358 358 sec.flags |= SEC_ENABLED;
359 359  
360 360 if (*crypt != NULL && (*crypt)->ops != NULL &&
361   - strcmp((*crypt)->ops->name, "WEP") != 0) {
  361 + strcmp((*crypt)->ops->name, "R-WEP") != 0) {
362 362 /* changing to use WEP; deinit previously used algorithm
363 363 * on this key */
364   - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
  364 + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
365 365 }
366 366  
367 367 if (*crypt == NULL) {
368 368  
... ... @@ -372,10 +372,10 @@
372 372 GFP_KERNEL);
373 373 if (new_crypt == NULL)
374 374 return -ENOMEM;
375   - new_crypt->ops = rtllib_get_crypto_ops("WEP");
  375 + new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
376 376 if (!new_crypt->ops) {
377 377 request_module("rtllib_crypt_wep");
378   - new_crypt->ops = rtllib_get_crypto_ops("WEP");
  378 + new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
379 379 }
380 380  
381 381 if (new_crypt->ops)
... ... @@ -557,7 +557,7 @@
557 557 if ((encoding->flags & IW_ENCODE_DISABLED) ||
558 558 ext->alg == IW_ENCODE_ALG_NONE) {
559 559 if (*crypt)
560   - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
  560 + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
561 561  
562 562 for (i = 0; i < NUM_WEP_KEYS; i++) {
563 563 if (ieee->crypt_info.crypt[i] != NULL)
564 564  
565 565  
... ... @@ -574,15 +574,15 @@
574 574 sec.enabled = 1;
575 575 switch (ext->alg) {
576 576 case IW_ENCODE_ALG_WEP:
577   - alg = "WEP";
  577 + alg = "R-WEP";
578 578 module = "rtllib_crypt_wep";
579 579 break;
580 580 case IW_ENCODE_ALG_TKIP:
581   - alg = "TKIP";
  581 + alg = "R-TKIP";
582 582 module = "rtllib_crypt_tkip";
583 583 break;
584 584 case IW_ENCODE_ALG_CCMP:
585   - alg = "CCMP";
  585 + alg = "R-CCMP";
586 586 module = "rtllib_crypt_ccmp";
587 587 break;
588 588 default:
589 589  
... ... @@ -593,14 +593,14 @@
593 593 }
594 594 printk(KERN_INFO "alg name:%s\n", alg);
595 595  
596   - ops = rtllib_get_crypto_ops(alg);
  596 + ops = lib80211_get_crypto_ops(alg);
597 597 if (ops == NULL) {
598 598 char tempbuf[100];
599 599  
600 600 memset(tempbuf, 0x00, 100);
601 601 sprintf(tempbuf, "%s", module);
602 602 request_module("%s", tempbuf);
603   - ops = rtllib_get_crypto_ops(alg);
  603 + ops = lib80211_get_crypto_ops(alg);
604 604 }
605 605 if (ops == NULL) {
606 606 RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n",
... ... @@ -613,7 +613,7 @@
613 613 if (*crypt == NULL || (*crypt)->ops != ops) {
614 614 struct lib80211_crypt_data *new_crypt;
615 615  
616   - rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt);
  616 + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
617 617  
618 618 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
619 619 if (new_crypt == NULL) {
620 620  
621 621  
... ... @@ -713,11 +713,11 @@
713 713 ext->key_len = 0;
714 714 encoding->flags |= IW_ENCODE_DISABLED;
715 715 } else {
716   - if (strcmp(crypt->ops->name, "WEP") == 0)
  716 + if (strcmp(crypt->ops->name, "R-WEP") == 0)
717 717 ext->alg = IW_ENCODE_ALG_WEP;
718   - else if (strcmp(crypt->ops->name, "TKIP"))
  718 + else if (strcmp(crypt->ops->name, "R-TKIP"))
719 719 ext->alg = IW_ENCODE_ALG_TKIP;
720   - else if (strcmp(crypt->ops->name, "CCMP"))
  720 + else if (strcmp(crypt->ops->name, "R-CCMP"))
721 721 ext->alg = IW_ENCODE_ALG_CCMP;
722 722 else
723 723 return -EINVAL;