aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/staging/vt6656/key.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-06-07 10:45:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-06-07 10:45:08 -0700
commit80ef846e9909f22ccdc2a4a6d931266cecce8b2c (patch)
tree0dd29cff6e6b4ee38452fb73ad292203c3ddeabf /drivers/staging/vt6656/key.c
parentMerge tag 'tty-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty (diff)
parentstaging: rtl8723bs: Use common packet header constants (diff)
downloadwireguard-linux-80ef846e9909f22ccdc2a4a6d931266cecce8b2c.tar.xz
wireguard-linux-80ef846e9909f22ccdc2a4a6d931266cecce8b2c.zip
Merge tag 'staging-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO driver updates from Greg KH: "Here is the large set of staging and IIO driver changes for 5.8-rc1 Nothing major, but a lot of new IIO drivers are included in here, along with other core iio cleanups and changes. On the staging driver front, again, nothing noticable. No new deletions or additions, just a ton of tiny cleanups all over the tree done by a lot of different people. Most coding style, but many actual real fixes and cleanups that are nice to see. All of these have been in linux-next for a while with no reported issues" * tag 'staging-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (618 commits) staging: rtl8723bs: Use common packet header constants staging: sm750fb: Add names to proc_setBLANK args staging: most: usb: init return value in default path of switch/case expression staging: vchiq: Get rid of VCHIQ_SERVICE_OPENEND callback reason staging: vchiq: move vchiq_release_message() into vchiq staging: vchi: Get rid of C++ guards staging: vchi: Get rid of not implemented function declarations staging: vchi: Get rid of vchiq_status_to_vchi() staging: vchi: Get rid of vchi_service_set_option() staging: vchi: Merge vchi_msg_queue() into vchi_queue_kernel_message() staging: vchiq: Move copy callback handling into vchiq staging: vchi: Get rid of vchi_queue_user_message() staging: vchi: Get rid of vchi_service_destroy() staging: most: usb: use function sysfs_streq staging: most: usb: add missing put_device calls staging: most: usb: use correct error codes staging: most: usb: replace code to calculate array index staging: most: usb: don't use error path to exit function on success staging: most: usb: move allocation of URB out of critical section staging: most: usb: return 0 instead of variable ...
Diffstat (limited to 'drivers/staging/vt6656/key.c')
-rw-r--r--drivers/staging/vt6656/key.c47
1 files changed, 15 insertions, 32 deletions
diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c
index ac3b188984d0..c66cb53cfc09 100644
--- a/drivers/staging/vt6656/key.c
+++ b/drivers/staging/vt6656/key.c
@@ -35,7 +35,7 @@ int vnt_key_init_table(struct vnt_private *priv)
static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
struct ieee80211_key_conf *key, u32 key_type,
- u32 mode, bool onfly_latch)
+ u32 mode)
{
struct vnt_private *priv = hw->priv;
u8 broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
@@ -68,17 +68,11 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
entry = MAX_KEY_TABLE - 1;
key->hw_key_idx = entry;
/* fall through */
- case VNT_KEY_ALLGROUP:
- key_mode |= VNT_KEY_ALLGROUP;
- if (onfly_latch)
- key_mode |= VNT_KEY_ONFLY_ALL;
- /* fall through */
case VNT_KEY_GROUP_ADDRESS:
- key_mode |= mode;
- /* fall through */
+ key_mode = mode | (mode << 4);
+ break;
case VNT_KEY_GROUP:
- key_mode |= (mode << 4);
- key_mode |= VNT_KEY_GROUP;
+ key_mode = mode << 4;
break;
case VNT_KEY_PAIRWISE:
key_mode |= mode;
@@ -88,8 +82,7 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
return -EINVAL;
}
- if (onfly_latch)
- key_mode |= VNT_KEY_ONFLY;
+ key_mode |= key_type;
if (mode == KEY_CTL_WEP) {
if (key->keylen == WLAN_KEY_LEN_WEP40)
@@ -98,9 +91,8 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
key->key[15] |= 0x80;
}
- vnt_mac_set_keyentry(priv, key_mode, entry, key_inx, bssid, key->key);
-
- return 0;
+ return vnt_mac_set_keyentry(priv, key_mode, entry,
+ key_inx, bssid, key->key);
}
int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
@@ -109,28 +101,21 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
struct vnt_private *priv = hw->priv;
u8 *mac_addr = NULL;
u8 key_dec_mode = 0;
- int ret = 0, u;
if (sta)
mac_addr = &sta->addr[0];
switch (key->cipher) {
- case 0:
- for (u = 0 ; u < MAX_KEY_TABLE; u++)
- vnt_mac_disable_keyentry(priv, u);
- return ret;
-
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
- for (u = 0; u < MAX_KEY_TABLE; u++)
- vnt_mac_disable_keyentry(priv, u);
-
vnt_set_keymode(hw, mac_addr, key, VNT_KEY_DEFAULTKEY,
- KEY_CTL_WEP, true);
+ KEY_CTL_WEP);
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
- return ret;
+ return vnt_set_keymode(hw, mac_addr, key, VNT_KEY_DEFAULTKEY,
+ KEY_CTL_WEP);
+
case WLAN_CIPHER_SUITE_TKIP:
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
@@ -151,11 +136,9 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
}
if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE)
- vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE,
- key_dec_mode, true);
- else
- vnt_set_keymode(hw, mac_addr, key, VNT_KEY_GROUP_ADDRESS,
- key_dec_mode, true);
+ return vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE,
+ key_dec_mode);
- return 0;
+ return vnt_set_keymode(hw, mac_addr, key,
+ VNT_KEY_GROUP_ADDRESS, key_dec_mode);
}