aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54
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/p54
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/p54')
-rw-r--r--drivers/net/wireless/p54/main.c9
-rw-r--r--drivers/net/wireless/p54/txrx.c17
2 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c
index 47db439b63bf..622d27b6d8f2 100644
--- a/drivers/net/wireless/p54/main.c
+++ b/drivers/net/wireless/p54/main.c
@@ -429,8 +429,8 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
429 429
430 mutex_lock(&priv->conf_mutex); 430 mutex_lock(&priv->conf_mutex);
431 if (cmd == SET_KEY) { 431 if (cmd == SET_KEY) {
432 switch (key->alg) { 432 switch (key->cipher) {
433 case ALG_TKIP: 433 case WLAN_CIPHER_SUITE_TKIP:
434 if (!(priv->privacy_caps & (BR_DESC_PRIV_CAP_MICHAEL | 434 if (!(priv->privacy_caps & (BR_DESC_PRIV_CAP_MICHAEL |
435 BR_DESC_PRIV_CAP_TKIP))) { 435 BR_DESC_PRIV_CAP_TKIP))) {
436 ret = -EOPNOTSUPP; 436 ret = -EOPNOTSUPP;
@@ -439,7 +439,8 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
439 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 439 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
440 algo = P54_CRYPTO_TKIPMICHAEL; 440 algo = P54_CRYPTO_TKIPMICHAEL;
441 break; 441 break;
442 case ALG_WEP: 442 case WLAN_CIPHER_SUITE_WEP40:
443 case WLAN_CIPHER_SUITE_WEP104:
443 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_WEP)) { 444 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_WEP)) {
444 ret = -EOPNOTSUPP; 445 ret = -EOPNOTSUPP;
445 goto out_unlock; 446 goto out_unlock;
@@ -447,7 +448,7 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
447 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 448 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
448 algo = P54_CRYPTO_WEP; 449 algo = P54_CRYPTO_WEP;
449 break; 450 break;
450 case ALG_CCMP: 451 case WLAN_CIPHER_SUITE_CCMP:
451 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP)) { 452 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP)) {
452 ret = -EOPNOTSUPP; 453 ret = -EOPNOTSUPP;
453 goto out_unlock; 454 goto out_unlock;
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index 427b46f558ed..e53f8cec7798 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -683,14 +683,15 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb,
683 } 683 }
684} 684}
685 685
686static u8 p54_convert_algo(enum ieee80211_key_alg alg) 686static u8 p54_convert_algo(u32 cipher)
687{ 687{
688 switch (alg) { 688 switch (cipher) {
689 case ALG_WEP: 689 case WLAN_CIPHER_SUITE_WEP40:
690 case WLAN_CIPHER_SUITE_WEP104:
690 return P54_CRYPTO_WEP; 691 return P54_CRYPTO_WEP;
691 case ALG_TKIP: 692 case WLAN_CIPHER_SUITE_TKIP:
692 return P54_CRYPTO_TKIPMICHAEL; 693 return P54_CRYPTO_TKIPMICHAEL;
693 case ALG_CCMP: 694 case WLAN_CIPHER_SUITE_CCMP:
694 return P54_CRYPTO_AESCCMP; 695 return P54_CRYPTO_AESCCMP;
695 default: 696 default:
696 return 0; 697 return 0;
@@ -731,7 +732,7 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb)
731 732
732 if (info->control.hw_key) { 733 if (info->control.hw_key) {
733 crypt_offset = ieee80211_get_hdrlen_from_skb(skb); 734 crypt_offset = ieee80211_get_hdrlen_from_skb(skb);
734 if (info->control.hw_key->alg == ALG_TKIP) { 735 if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) {
735 u8 *iv = (u8 *)(skb->data + crypt_offset); 736 u8 *iv = (u8 *)(skb->data + crypt_offset);
736 /* 737 /*
737 * The firmware excepts that the IV has to have 738 * The firmware excepts that the IV has to have
@@ -827,10 +828,10 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb)
827 hdr->tries = ridx; 828 hdr->tries = ridx;
828 txhdr->rts_rate_idx = 0; 829 txhdr->rts_rate_idx = 0;
829 if (info->control.hw_key) { 830 if (info->control.hw_key) {
830 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); 831 txhdr->key_type = p54_convert_algo(info->control.hw_key->cipher);
831 txhdr->key_len = min((u8)16, info->control.hw_key->keylen); 832 txhdr->key_len = min((u8)16, info->control.hw_key->keylen);
832 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); 833 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len);
833 if (info->control.hw_key->alg == ALG_TKIP) { 834 if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) {
834 /* reserve space for the MIC key */ 835 /* reserve space for the MIC key */
835 len += 8; 836 len += 8;
836 memcpy(skb_put(skb, 8), &(info->control.hw_key->key 837 memcpy(skb_put(skb, 8), &(info->control.hw_key->key