diff options
author | Yogesh Ashok Powar <yogeshp@marvell.com> | 2011-04-06 19:46:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-12 16:57:35 -0400 |
commit | 6a35a0ac5771fa962c45926678d1f194cbc98c4e (patch) | |
tree | 888cc79ebc18b52ead4804a0f1bd332bfd561ee3 /drivers | |
parent | 18bf965702058f5f8039e6a46bb5ebaa18d38ebd (diff) |
mwifiex: use common keyinfo bitmap for different key types
Instead of having separate key information definitions for
each type of key, a common key information bitmap is used.
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mwifiex/fw.h | 27 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmd.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmdresp.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 3 |
4 files changed, 18 insertions, 42 deletions
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 2b938115b26a..f8c008f8f476 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -72,33 +72,12 @@ enum KEY_TYPE_ID { | |||
72 | KEY_TYPE_ID_AES, | 72 | KEY_TYPE_ID_AES, |
73 | KEY_TYPE_ID_WAPI, | 73 | KEY_TYPE_ID_WAPI, |
74 | }; | 74 | }; |
75 | 75 | #define KEY_MCAST BIT(0) | |
76 | enum KEY_INFO_WEP { | 76 | #define KEY_UNICAST BIT(1) |
77 | KEY_INFO_WEP_MCAST = 0x01, | 77 | #define KEY_ENABLED BIT(2) |
78 | KEY_INFO_WEP_UNICAST = 0x02, | ||
79 | KEY_INFO_WEP_ENABLED = 0x04 | ||
80 | }; | ||
81 | |||
82 | enum KEY_INFO_TKIP { | ||
83 | KEY_INFO_TKIP_MCAST = 0x01, | ||
84 | KEY_INFO_TKIP_UNICAST = 0x02, | ||
85 | KEY_INFO_TKIP_ENABLED = 0x04 | ||
86 | }; | ||
87 | |||
88 | enum KEY_INFO_AES { | ||
89 | KEY_INFO_AES_MCAST = 0x01, | ||
90 | KEY_INFO_AES_UNICAST = 0x02, | ||
91 | KEY_INFO_AES_ENABLED = 0x04 | ||
92 | }; | ||
93 | 78 | ||
94 | #define WAPI_KEY_LEN 50 | 79 | #define WAPI_KEY_LEN 50 |
95 | 80 | ||
96 | enum KEY_INFO_WAPI { | ||
97 | KEY_INFO_WAPI_MCAST = 0x01, | ||
98 | KEY_INFO_WAPI_UNICAST = 0x02, | ||
99 | KEY_INFO_WAPI_ENABLED = 0x04 | ||
100 | }; | ||
101 | |||
102 | #define MAX_POLL_TRIES 100 | 81 | #define MAX_POLL_TRIES 100 |
103 | 82 | ||
104 | #define MAX_MULTI_INTERFACE_POLL_TRIES 1000 | 83 | #define MAX_MULTI_INTERFACE_POLL_TRIES 1000 |
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index 6fff26153e26..19de6524d428 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -500,9 +500,8 @@ mwifiex_set_keyparamset_wep(struct mwifiex_private *priv, | |||
500 | key_param_set->key_type_id = | 500 | key_param_set->key_type_id = |
501 | cpu_to_le16(KEY_TYPE_ID_WEP); | 501 | cpu_to_le16(KEY_TYPE_ID_WEP); |
502 | key_param_set->key_info = | 502 | key_param_set->key_info = |
503 | cpu_to_le16(KEY_INFO_WEP_ENABLED | | 503 | cpu_to_le16(KEY_ENABLED | KEY_UNICAST | |
504 | KEY_INFO_WEP_UNICAST | | 504 | KEY_MCAST); |
505 | KEY_INFO_WEP_MCAST); | ||
506 | key_param_set->key_len = | 505 | key_param_set->key_len = |
507 | cpu_to_le16(priv->wep_key[i].key_length); | 506 | cpu_to_le16(priv->wep_key[i].key_length); |
508 | /* Set WEP key index */ | 507 | /* Set WEP key index */ |
@@ -589,10 +588,10 @@ static int mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv, | |||
589 | cpu_to_le16(KEY_TYPE_ID_WAPI); | 588 | cpu_to_le16(KEY_TYPE_ID_WAPI); |
590 | if (cmd_oid == KEY_INFO_ENABLED) | 589 | if (cmd_oid == KEY_INFO_ENABLED) |
591 | key_material->key_param_set.key_info = | 590 | key_material->key_param_set.key_info = |
592 | cpu_to_le16(KEY_INFO_WAPI_ENABLED); | 591 | cpu_to_le16(KEY_ENABLED); |
593 | else | 592 | else |
594 | key_material->key_param_set.key_info = | 593 | key_material->key_param_set.key_info = |
595 | cpu_to_le16(!KEY_INFO_WAPI_ENABLED); | 594 | cpu_to_le16(!KEY_ENABLED); |
596 | 595 | ||
597 | key_material->key_param_set.key[0] = enc_key->key_index; | 596 | key_material->key_param_set.key[0] = enc_key->key_index; |
598 | if (!priv->sec_info.wapi_key_on) | 597 | if (!priv->sec_info.wapi_key_on) |
@@ -604,10 +603,10 @@ static int mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv, | |||
604 | if (0 != memcmp(enc_key->mac_addr, bc_mac, sizeof(bc_mac))) { | 603 | if (0 != memcmp(enc_key->mac_addr, bc_mac, sizeof(bc_mac))) { |
605 | /* WAPI pairwise key: unicast */ | 604 | /* WAPI pairwise key: unicast */ |
606 | key_material->key_param_set.key_info |= | 605 | key_material->key_param_set.key_info |= |
607 | cpu_to_le16(KEY_INFO_WAPI_UNICAST); | 606 | cpu_to_le16(KEY_UNICAST); |
608 | } else { /* WAPI group key: multicast */ | 607 | } else { /* WAPI group key: multicast */ |
609 | key_material->key_param_set.key_info |= | 608 | key_material->key_param_set.key_info |= |
610 | cpu_to_le16(KEY_INFO_WAPI_MCAST); | 609 | cpu_to_le16(KEY_MCAST); |
611 | priv->sec_info.wapi_key_on = true; | 610 | priv->sec_info.wapi_key_on = true; |
612 | } | 611 | } |
613 | 612 | ||
@@ -634,32 +633,32 @@ static int mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv, | |||
634 | cpu_to_le16(KEY_TYPE_ID_AES); | 633 | cpu_to_le16(KEY_TYPE_ID_AES); |
635 | if (cmd_oid == KEY_INFO_ENABLED) | 634 | if (cmd_oid == KEY_INFO_ENABLED) |
636 | key_material->key_param_set.key_info = | 635 | key_material->key_param_set.key_info = |
637 | cpu_to_le16(KEY_INFO_AES_ENABLED); | 636 | cpu_to_le16(KEY_ENABLED); |
638 | else | 637 | else |
639 | key_material->key_param_set.key_info = | 638 | key_material->key_param_set.key_info = |
640 | cpu_to_le16(!KEY_INFO_AES_ENABLED); | 639 | cpu_to_le16(!KEY_ENABLED); |
641 | 640 | ||
642 | if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) | 641 | if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) |
643 | /* AES pairwise key: unicast */ | 642 | /* AES pairwise key: unicast */ |
644 | key_material->key_param_set.key_info |= | 643 | key_material->key_param_set.key_info |= |
645 | cpu_to_le16(KEY_INFO_AES_UNICAST); | 644 | cpu_to_le16(KEY_UNICAST); |
646 | else /* AES group key: multicast */ | 645 | else /* AES group key: multicast */ |
647 | key_material->key_param_set.key_info |= | 646 | key_material->key_param_set.key_info |= |
648 | cpu_to_le16(KEY_INFO_AES_MCAST); | 647 | cpu_to_le16(KEY_MCAST); |
649 | } else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) { | 648 | } else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) { |
650 | dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n"); | 649 | dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n"); |
651 | key_material->key_param_set.key_type_id = | 650 | key_material->key_param_set.key_type_id = |
652 | cpu_to_le16(KEY_TYPE_ID_TKIP); | 651 | cpu_to_le16(KEY_TYPE_ID_TKIP); |
653 | key_material->key_param_set.key_info = | 652 | key_material->key_param_set.key_info = |
654 | cpu_to_le16(KEY_INFO_TKIP_ENABLED); | 653 | cpu_to_le16(KEY_ENABLED); |
655 | 654 | ||
656 | if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) | 655 | if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) |
657 | /* TKIP pairwise key: unicast */ | 656 | /* TKIP pairwise key: unicast */ |
658 | key_material->key_param_set.key_info |= | 657 | key_material->key_param_set.key_info |= |
659 | cpu_to_le16(KEY_INFO_TKIP_UNICAST); | 658 | cpu_to_le16(KEY_UNICAST); |
660 | else /* TKIP group key: multicast */ | 659 | else /* TKIP group key: multicast */ |
661 | key_material->key_param_set.key_info |= | 660 | key_material->key_param_set.key_info |= |
662 | cpu_to_le16(KEY_INFO_TKIP_MCAST); | 661 | cpu_to_le16(KEY_MCAST); |
663 | } | 662 | } |
664 | 663 | ||
665 | if (key_material->key_param_set.key_type_id) { | 664 | if (key_material->key_param_set.key_type_id) { |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index 74add45b99b6..648df690f5d1 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -574,8 +574,7 @@ static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv, | |||
574 | &resp->params.key_material; | 574 | &resp->params.key_material; |
575 | 575 | ||
576 | if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { | 576 | if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { |
577 | if ((le16_to_cpu(key->key_param_set.key_info) & | 577 | if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { |
578 | KEY_INFO_TKIP_MCAST)) { | ||
579 | dev_dbg(priv->adapter->dev, "info: key: GTK is set\n"); | 578 | dev_dbg(priv->adapter->dev, "info: key: GTK is set\n"); |
580 | priv->wpa_is_gtk_set = true; | 579 | priv->wpa_is_gtk_set = true; |
581 | priv->scan_block = false; | 580 | priv->scan_block = false; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index b163507b1fe0..2fcdbc224e08 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -1729,8 +1729,7 @@ static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_adapter *adapter, | |||
1729 | sizeof(ibss_key->key_param_set.key_len)); | 1729 | sizeof(ibss_key->key_param_set.key_len)); |
1730 | ibss_key->key_param_set.key_type_id | 1730 | ibss_key->key_param_set.key_type_id |
1731 | = cpu_to_le16(KEY_TYPE_ID_TKIP); | 1731 | = cpu_to_le16(KEY_TYPE_ID_TKIP); |
1732 | ibss_key->key_param_set.key_info | 1732 | ibss_key->key_param_set.key_info = cpu_to_le16(KEY_ENABLED); |
1733 | = cpu_to_le16(KEY_INFO_TKIP_ENABLED); | ||
1734 | 1733 | ||
1735 | /* Send the key as GTK to firmware */ | 1734 | /* Send the key as GTK to firmware */ |
1736 | encrypt_key->key_index = ~MWIFIEX_KEY_INDEX_UNICAST; | 1735 | encrypt_key->key_index = ~MWIFIEX_KEY_INDEX_UNICAST; |