diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-08-10 03:46:38 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-08-16 16:45:11 -0400 |
commit | 97359d1235eaf634fe706c9faa6e40181cc95fb8 (patch) | |
tree | 5799455c94622eaa6a4fb065bd3b5c350bb705e0 /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | 915a824e30c503157c38115eb6a85f60bb653738 (diff) |
mac80211: use cipher suite selectors
Currently, mac80211 translates the cfg80211
cipher suite selectors into ALG_* values.
That isn't all too useful, and some drivers
benefit from the distinction between WEP40
and WEP104 as well. Therefore, convert it
all to use the cipher suite selectors.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b14eaf91c7c2..faa2e0037e10 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -152,7 +152,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, | |||
152 | key_flags &= ~STA_KEY_FLG_INVALID; | 152 | key_flags &= ~STA_KEY_FLG_INVALID; |
153 | 153 | ||
154 | spin_lock_irqsave(&priv->sta_lock, flags); | 154 | spin_lock_irqsave(&priv->sta_lock, flags); |
155 | priv->stations[sta_id].keyinfo.alg = keyconf->alg; | 155 | priv->stations[sta_id].keyinfo.cipher = keyconf->cipher; |
156 | priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; | 156 | priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; |
157 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, | 157 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, |
158 | keyconf->keylen); | 158 | keyconf->keylen); |
@@ -223,23 +223,25 @@ static int iwl3945_set_dynamic_key(struct iwl_priv *priv, | |||
223 | 223 | ||
224 | keyconf->hw_key_idx = HW_KEY_DYNAMIC; | 224 | keyconf->hw_key_idx = HW_KEY_DYNAMIC; |
225 | 225 | ||
226 | switch (keyconf->alg) { | 226 | switch (keyconf->cipher) { |
227 | case ALG_CCMP: | 227 | case WLAN_CIPHER_SUITE_CCMP: |
228 | ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); | 228 | ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); |
229 | break; | 229 | break; |
230 | case ALG_TKIP: | 230 | case WLAN_CIPHER_SUITE_TKIP: |
231 | ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); | 231 | ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); |
232 | break; | 232 | break; |
233 | case ALG_WEP: | 233 | case WLAN_CIPHER_SUITE_WEP40: |
234 | case WLAN_CIPHER_SUITE_WEP104: | ||
234 | ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); | 235 | ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); |
235 | break; | 236 | break; |
236 | default: | 237 | default: |
237 | IWL_ERR(priv, "Unknown alg: %s alg = %d\n", __func__, keyconf->alg); | 238 | IWL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__, |
239 | keyconf->cipher); | ||
238 | ret = -EINVAL; | 240 | ret = -EINVAL; |
239 | } | 241 | } |
240 | 242 | ||
241 | IWL_DEBUG_WEP(priv, "Set dynamic key: alg= %d len=%d idx=%d sta=%d ret=%d\n", | 243 | IWL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", |
242 | keyconf->alg, keyconf->keylen, keyconf->keyidx, | 244 | keyconf->cipher, keyconf->keylen, keyconf->keyidx, |
243 | sta_id, ret); | 245 | sta_id, ret); |
244 | 246 | ||
245 | return ret; | 247 | return ret; |
@@ -255,10 +257,11 @@ static int iwl3945_remove_static_key(struct iwl_priv *priv) | |||
255 | static int iwl3945_set_static_key(struct iwl_priv *priv, | 257 | static int iwl3945_set_static_key(struct iwl_priv *priv, |
256 | struct ieee80211_key_conf *key) | 258 | struct ieee80211_key_conf *key) |
257 | { | 259 | { |
258 | if (key->alg == ALG_WEP) | 260 | if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || |
261 | key->cipher == WLAN_CIPHER_SUITE_WEP104) | ||
259 | return -EOPNOTSUPP; | 262 | return -EOPNOTSUPP; |
260 | 263 | ||
261 | IWL_ERR(priv, "Static key invalid: alg %d\n", key->alg); | 264 | IWL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); |
262 | return -EINVAL; | 265 | return -EINVAL; |
263 | } | 266 | } |
264 | 267 | ||
@@ -370,23 +373,25 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | |||
370 | struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; | 373 | struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; |
371 | struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; | 374 | struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; |
372 | 375 | ||
373 | switch (keyinfo->alg) { | 376 | tx_cmd->sec_ctl = 0; |
374 | case ALG_CCMP: | 377 | |
378 | switch (keyinfo->cipher) { | ||
379 | case WLAN_CIPHER_SUITE_CCMP: | ||
375 | tx_cmd->sec_ctl = TX_CMD_SEC_CCM; | 380 | tx_cmd->sec_ctl = TX_CMD_SEC_CCM; |
376 | memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); | 381 | memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); |
377 | IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); | 382 | IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); |
378 | break; | 383 | break; |
379 | 384 | ||
380 | case ALG_TKIP: | 385 | case WLAN_CIPHER_SUITE_TKIP: |
381 | break; | 386 | break; |
382 | 387 | ||
383 | case ALG_WEP: | 388 | case WLAN_CIPHER_SUITE_WEP104: |
384 | tx_cmd->sec_ctl = TX_CMD_SEC_WEP | | 389 | tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128; |
390 | /* fall through */ | ||
391 | case WLAN_CIPHER_SUITE_WEP40: | ||
392 | tx_cmd->sec_ctl |= TX_CMD_SEC_WEP | | ||
385 | (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; | 393 | (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; |
386 | 394 | ||
387 | if (keyinfo->keylen == 13) | ||
388 | tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128; | ||
389 | |||
390 | memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); | 395 | memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); |
391 | 396 | ||
392 | IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " | 397 | IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " |
@@ -394,7 +399,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | |||
394 | break; | 399 | break; |
395 | 400 | ||
396 | default: | 401 | default: |
397 | IWL_ERR(priv, "Unknown encode alg %d\n", keyinfo->alg); | 402 | IWL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher); |
398 | break; | 403 | break; |
399 | } | 404 | } |
400 | } | 405 | } |