diff options
author | Ying Luo <luoy@marvell.com> | 2012-08-03 21:06:13 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-06 15:12:58 -0400 |
commit | 53b112315c015c50e4c092474adb6729269b0fc4 (patch) | |
tree | b6c4cb455d9fc32996dff910a063c6e9aefde32e /drivers/net | |
parent | 9d7aba63c8630c1fdd7cb321d979c757a1abd20f (diff) |
mwifiex: pass key_params pointer in mwifiex_set_encode
'cipher' and 'seq' coming from cfg80211 add_key handler will be
parsed in mwifiex_set_encode() to handle AES_CMAC cipher suite.
Signed-off-by: Ying Luo <luoy@marvell.com>
Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/ioctl.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 12 |
4 files changed, 22 insertions, 12 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 1f80f7e13ba8..e57f543413de 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -99,7 +99,7 @@ mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, | |||
99 | const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | 99 | const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
100 | const u8 *peer_mac = pairwise ? mac_addr : bc_mac; | 100 | const u8 *peer_mac = pairwise ? mac_addr : bc_mac; |
101 | 101 | ||
102 | if (mwifiex_set_encode(priv, NULL, 0, key_index, peer_mac, 1)) { | 102 | if (mwifiex_set_encode(priv, NULL, NULL, 0, key_index, peer_mac, 1)) { |
103 | wiphy_err(wiphy, "deleting the crypto keys\n"); | 103 | wiphy_err(wiphy, "deleting the crypto keys\n"); |
104 | return -EFAULT; | 104 | return -EFAULT; |
105 | } | 105 | } |
@@ -171,7 +171,8 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev, | |||
171 | 171 | ||
172 | if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { | 172 | if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { |
173 | priv->wep_key_curr_index = key_index; | 173 | priv->wep_key_curr_index = key_index; |
174 | } else if (mwifiex_set_encode(priv, NULL, 0, key_index, NULL, 0)) { | 174 | } else if (mwifiex_set_encode(priv, NULL, NULL, 0, key_index, |
175 | NULL, 0)) { | ||
175 | wiphy_err(wiphy, "set default Tx key index\n"); | 176 | wiphy_err(wiphy, "set default Tx key index\n"); |
176 | return -EFAULT; | 177 | return -EFAULT; |
177 | } | 178 | } |
@@ -207,7 +208,7 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, | |||
207 | return 0; | 208 | return 0; |
208 | } | 209 | } |
209 | 210 | ||
210 | if (mwifiex_set_encode(priv, params->key, params->key_len, | 211 | if (mwifiex_set_encode(priv, params, params->key, params->key_len, |
211 | key_index, peer_mac, 0)) { | 212 | key_index, peer_mac, 0)) { |
212 | wiphy_err(wiphy, "crypto keys added\n"); | 213 | wiphy_err(wiphy, "crypto keys added\n"); |
213 | return -EFAULT; | 214 | return -EFAULT; |
@@ -748,6 +749,7 @@ static const u32 mwifiex_cipher_suites[] = { | |||
748 | WLAN_CIPHER_SUITE_WEP104, | 749 | WLAN_CIPHER_SUITE_WEP104, |
749 | WLAN_CIPHER_SUITE_TKIP, | 750 | WLAN_CIPHER_SUITE_TKIP, |
750 | WLAN_CIPHER_SUITE_CCMP, | 751 | WLAN_CIPHER_SUITE_CCMP, |
752 | WLAN_CIPHER_SUITE_AES_CMAC, | ||
751 | }; | 753 | }; |
752 | 754 | ||
753 | /* | 755 | /* |
@@ -1161,7 +1163,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1161 | priv->wep_key_curr_index = 0; | 1163 | priv->wep_key_curr_index = 0; |
1162 | priv->sec_info.encryption_mode = 0; | 1164 | priv->sec_info.encryption_mode = 0; |
1163 | priv->sec_info.is_authtype_auto = 0; | 1165 | priv->sec_info.is_authtype_auto = 0; |
1164 | ret = mwifiex_set_encode(priv, NULL, 0, 0, NULL, 1); | 1166 | ret = mwifiex_set_encode(priv, NULL, NULL, 0, 0, NULL, 1); |
1165 | 1167 | ||
1166 | if (mode == NL80211_IFTYPE_ADHOC) { | 1168 | if (mode == NL80211_IFTYPE_ADHOC) { |
1167 | /* "privacy" is set only for ad-hoc mode */ | 1169 | /* "privacy" is set only for ad-hoc mode */ |
@@ -1208,8 +1210,9 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1208 | "info: setting wep encryption" | 1210 | "info: setting wep encryption" |
1209 | " with key len %d\n", sme->key_len); | 1211 | " with key len %d\n", sme->key_len); |
1210 | priv->wep_key_curr_index = sme->key_idx; | 1212 | priv->wep_key_curr_index = sme->key_idx; |
1211 | ret = mwifiex_set_encode(priv, sme->key, sme->key_len, | 1213 | ret = mwifiex_set_encode(priv, NULL, sme->key, |
1212 | sme->key_idx, NULL, 0); | 1214 | sme->key_len, sme->key_idx, |
1215 | NULL, 0); | ||
1213 | } | 1216 | } |
1214 | } | 1217 | } |
1215 | done: | 1218 | done: |
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index f2865b51d5d8..6a5eded3be10 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h | |||
@@ -223,6 +223,7 @@ struct mwifiex_ds_encrypt_key { | |||
223 | u8 mac_addr[ETH_ALEN]; | 223 | u8 mac_addr[ETH_ALEN]; |
224 | u32 is_wapi_key; | 224 | u32 is_wapi_key; |
225 | u8 pn[PN_LEN]; /* packet number */ | 225 | u8 pn[PN_LEN]; /* packet number */ |
226 | u8 is_igtk_key; | ||
226 | }; | 227 | }; |
227 | 228 | ||
228 | struct mwifiex_power_cfg { | 229 | struct mwifiex_power_cfg { |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index c39cd8e50f9f..994bc4fc263e 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -981,9 +981,9 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
981 | const struct mwifiex_user_scan_cfg *user_scan_in); | 981 | const struct mwifiex_user_scan_cfg *user_scan_in); |
982 | int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); | 982 | int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); |
983 | 983 | ||
984 | int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, | 984 | int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp, |
985 | int key_len, u8 key_index, const u8 *mac_addr, | 985 | const u8 *key, int key_len, u8 key_index, |
986 | int disable); | 986 | const u8 *mac_addr, int disable); |
987 | 987 | ||
988 | int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len); | 988 | int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len); |
989 | 989 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index fb2136089a22..3f025976f79a 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -942,20 +942,26 @@ mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version, | |||
942 | * This function allocates the IOCTL request buffer, fills it | 942 | * This function allocates the IOCTL request buffer, fills it |
943 | * with requisite parameters and calls the IOCTL handler. | 943 | * with requisite parameters and calls the IOCTL handler. |
944 | */ | 944 | */ |
945 | int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, | 945 | int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp, |
946 | int key_len, u8 key_index, | 946 | const u8 *key, int key_len, u8 key_index, |
947 | const u8 *mac_addr, int disable) | 947 | const u8 *mac_addr, int disable) |
948 | { | 948 | { |
949 | struct mwifiex_ds_encrypt_key encrypt_key; | 949 | struct mwifiex_ds_encrypt_key encrypt_key; |
950 | 950 | ||
951 | memset(&encrypt_key, 0, sizeof(struct mwifiex_ds_encrypt_key)); | 951 | memset(&encrypt_key, 0, sizeof(struct mwifiex_ds_encrypt_key)); |
952 | encrypt_key.key_len = key_len; | 952 | encrypt_key.key_len = key_len; |
953 | |||
954 | if (kp && kp->cipher == WLAN_CIPHER_SUITE_AES_CMAC) | ||
955 | encrypt_key.is_igtk_key = true; | ||
956 | |||
953 | if (!disable) { | 957 | if (!disable) { |
954 | encrypt_key.key_index = key_index; | 958 | encrypt_key.key_index = key_index; |
955 | if (key_len) | 959 | if (key_len) |
956 | memcpy(encrypt_key.key_material, key, key_len); | 960 | memcpy(encrypt_key.key_material, key, key_len); |
957 | if (mac_addr) | 961 | if (mac_addr) |
958 | memcpy(encrypt_key.mac_addr, mac_addr, ETH_ALEN); | 962 | memcpy(encrypt_key.mac_addr, mac_addr, ETH_ALEN); |
963 | if (kp && kp->seq && kp->seq_len) | ||
964 | memcpy(encrypt_key.pn, kp->seq, kp->seq_len); | ||
959 | } else { | 965 | } else { |
960 | encrypt_key.key_disable = true; | 966 | encrypt_key.key_disable = true; |
961 | if (mac_addr) | 967 | if (mac_addr) |