aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-10 03:46:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-16 16:45:11 -0400
commit97359d1235eaf634fe706c9faa6e40181cc95fb8 (patch)
tree5799455c94622eaa6a4fb065bd3b5c350bb705e0 /drivers/net/wireless/iwlwifi/iwl-sta.c
parent915a824e30c503157c38115eb6a85f60bb653738 (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/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 7e0829be5e78..d5e8db37b86e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -818,7 +818,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
818 818
819 keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; 819 keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
820 keyconf->hw_key_idx = HW_KEY_DEFAULT; 820 keyconf->hw_key_idx = HW_KEY_DEFAULT;
821 priv->stations[IWL_AP_ID].keyinfo.alg = ALG_WEP; 821 priv->stations[IWL_AP_ID].keyinfo.cipher = keyconf->cipher;
822 822
823 priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; 823 priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen;
824 memcpy(&priv->wep_keys[keyconf->keyidx].key, &keyconf->key, 824 memcpy(&priv->wep_keys[keyconf->keyidx].key, &keyconf->key,
@@ -856,7 +856,7 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
856 856
857 spin_lock_irqsave(&priv->sta_lock, flags); 857 spin_lock_irqsave(&priv->sta_lock, flags);
858 858
859 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 859 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
860 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; 860 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
861 priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx; 861 priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
862 862
@@ -906,7 +906,7 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
906 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 906 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
907 907
908 spin_lock_irqsave(&priv->sta_lock, flags); 908 spin_lock_irqsave(&priv->sta_lock, flags);
909 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 909 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
910 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; 910 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
911 911
912 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 912 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key,
@@ -955,7 +955,7 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
955 955
956 spin_lock_irqsave(&priv->sta_lock, flags); 956 spin_lock_irqsave(&priv->sta_lock, flags);
957 957
958 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 958 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
959 priv->stations[sta_id].keyinfo.keylen = 16; 959 priv->stations[sta_id].keyinfo.keylen = 16;
960 960
961 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 961 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
@@ -1090,24 +1090,26 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
1090 priv->key_mapping_key++; 1090 priv->key_mapping_key++;
1091 keyconf->hw_key_idx = HW_KEY_DYNAMIC; 1091 keyconf->hw_key_idx = HW_KEY_DYNAMIC;
1092 1092
1093 switch (keyconf->alg) { 1093 switch (keyconf->cipher) {
1094 case ALG_CCMP: 1094 case WLAN_CIPHER_SUITE_CCMP:
1095 ret = iwl_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); 1095 ret = iwl_set_ccmp_dynamic_key_info(priv, keyconf, sta_id);
1096 break; 1096 break;
1097 case ALG_TKIP: 1097 case WLAN_CIPHER_SUITE_TKIP:
1098 ret = iwl_set_tkip_dynamic_key_info(priv, keyconf, sta_id); 1098 ret = iwl_set_tkip_dynamic_key_info(priv, keyconf, sta_id);
1099 break; 1099 break;
1100 case ALG_WEP: 1100 case WLAN_CIPHER_SUITE_WEP40:
1101 case WLAN_CIPHER_SUITE_WEP104:
1101 ret = iwl_set_wep_dynamic_key_info(priv, keyconf, sta_id); 1102 ret = iwl_set_wep_dynamic_key_info(priv, keyconf, sta_id);
1102 break; 1103 break;
1103 default: 1104 default:
1104 IWL_ERR(priv, 1105 IWL_ERR(priv,
1105 "Unknown alg: %s alg = %d\n", __func__, keyconf->alg); 1106 "Unknown alg: %s cipher = %x\n", __func__,
1107 keyconf->cipher);
1106 ret = -EINVAL; 1108 ret = -EINVAL;
1107 } 1109 }
1108 1110
1109 IWL_DEBUG_WEP(priv, "Set dynamic key: alg= %d len=%d idx=%d sta=%d ret=%d\n", 1111 IWL_DEBUG_WEP(priv, "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n",
1110 keyconf->alg, keyconf->keylen, keyconf->keyidx, 1112 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
1111 sta_id, ret); 1113 sta_id, ret);
1112 1114
1113 return ret; 1115 return ret;