Commit 3c76ec88 authored by Ajay Singh's avatar Ajay Singh Committed by Kalle Valo

wifi: wilc1000: remove WEP security support

Deprecated WEP security for WILC driver as well as in firmware from
15.6 FW release onwards. After WEP security removal, freeup some codespace
which helped to add new features like WPA3 etc.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220524120606.9675-2-ajay.kathat@microchip.com
parent fcf690b0
...@@ -313,32 +313,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -313,32 +313,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
vif->connecting = true; vif->connecting = true;
memset(priv->wep_key, 0, sizeof(priv->wep_key));
memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));
cipher_group = sme->crypto.cipher_group; cipher_group = sme->crypto.cipher_group;
if (cipher_group != 0) { if (cipher_group != 0) {
if (cipher_group == WLAN_CIPHER_SUITE_WEP40) { if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
security = WILC_FW_SEC_WEP;
priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
sme->key_len);
wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
sme->key_idx);
} else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
security = WILC_FW_SEC_WEP_EXTENDED;
priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
sme->key_len);
wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (cipher_group == WLAN_CIPHER_SUITE_TKIP) if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
security = WILC_FW_SEC_WPA2_TKIP; security = WILC_FW_SEC_WPA2_TKIP;
else else
...@@ -373,10 +350,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -373,10 +350,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
auth_type = WILC_FW_AUTH_OPEN_SYSTEM; auth_type = WILC_FW_AUTH_OPEN_SYSTEM;
break; break;
case NL80211_AUTHTYPE_SHARED_KEY:
auth_type = WILC_FW_AUTH_SHARED_KEY;
break;
default: default:
break; break;
} }
...@@ -487,14 +460,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, ...@@ -487,14 +460,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
return ret; return ret;
} }
static inline void wilc_wfi_cfg_copy_wep_info(struct wilc_priv *priv,
u8 key_index,
struct key_params *params)
{
priv->wep_key_len[key_index] = params->key_len;
memcpy(priv->wep_key[key_index], params->key, params->key_len);
}
static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx) static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx)
{ {
if (!priv->wilc_gtk[idx]) { if (!priv->wilc_gtk[idx]) {
...@@ -552,33 +517,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -552,33 +517,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
struct wilc_priv *priv = &vif->priv; struct wilc_priv *priv = &vif->priv;
switch (params->cipher) { switch (params->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
if (priv->wdev.iftype == NL80211_IFTYPE_AP) {
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
mode = WILC_FW_SEC_WEP;
else
mode = WILC_FW_SEC_WEP_EXTENDED;
ret = wilc_add_wep_key_bss_ap(vif, params->key,
params->key_len,
key_index, mode,
WILC_FW_AUTH_OPEN_SYSTEM);
break;
}
if (memcmp(params->key, priv->wep_key[key_index],
params->key_len)) {
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
ret = wilc_add_wep_key_bss_sta(vif, params->key,
params->key_len,
key_index);
}
break;
case WLAN_CIPHER_SUITE_TKIP: case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP: case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev.iftype == NL80211_IFTYPE_AP || if (priv->wdev.iftype == NL80211_IFTYPE_AP ||
...@@ -676,13 +614,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, ...@@ -676,13 +614,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv->wilc_ptk[key_index] = NULL; priv->wilc_ptk[key_index] = NULL;
} }
if (key_index <= 3 && priv->wep_key_len[key_index]) {
memset(priv->wep_key[key_index], 0,
priv->wep_key_len[key_index]);
priv->wep_key_len[key_index] = 0;
wilc_remove_wep_key(vif, key_index);
}
return 0; return 0;
} }
...@@ -713,13 +644,10 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -713,13 +644,10 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
return 0; return 0;
} }
/* wiphy_new_nm() will WARNON if not present */
static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, static int set_default_key(struct wiphy *wiphy, struct net_device *netdev,
u8 key_index, bool unicast, bool multicast) u8 key_index, bool unicast, bool multicast)
{ {
struct wilc_vif *vif = netdev_priv(netdev);
wilc_set_wep_default_keyid(vif, key_index);
return 0; return 0;
} }
......
...@@ -41,12 +41,6 @@ struct wilc_drv_handler { ...@@ -41,12 +41,6 @@ struct wilc_drv_handler {
u8 mode; u8 mode;
} __packed; } __packed;
struct wilc_wep_key {
u8 index;
u8 key_len;
u8 key[];
} __packed;
struct wilc_sta_wpa_ptk { struct wilc_sta_wpa_ptk {
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u8 key_len; u8 key_len;
......
...@@ -1038,108 +1038,6 @@ static void timer_connect_cb(struct timer_list *t) ...@@ -1038,108 +1038,6 @@ static void timer_connect_cb(struct timer_list *t)
kfree(msg); kfree(msg);
} }
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
{
struct wid wid;
int result;
wid.id = WID_REMOVE_WEP_KEY;
wid.type = WID_STR;
wid.size = sizeof(char);
wid.val = &index;
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
if (result)
netdev_err(vif->ndev,
"Failed to send remove wep key config packet\n");
return result;
}
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
{
struct wid wid;
int result;
wid.id = WID_KEY_ID;
wid.type = WID_CHAR;
wid.size = sizeof(char);
wid.val = &index;
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
if (result)
netdev_err(vif->ndev,
"Failed to send wep default key config packet\n");
return result;
}
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
u8 index)
{
struct wid wid;
int result;
struct wilc_wep_key *wep_key;
wid.id = WID_ADD_WEP_KEY;
wid.type = WID_STR;
wid.size = sizeof(*wep_key) + len;
wep_key = kzalloc(wid.size, GFP_KERNEL);
if (!wep_key)
return -ENOMEM;
wid.val = (u8 *)wep_key;
wep_key->index = index;
wep_key->key_len = len;
memcpy(wep_key->key, key, len);
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
if (result)
netdev_err(vif->ndev,
"Failed to add wep key config packet\n");
kfree(wep_key);
return result;
}
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
u8 index, u8 mode, enum authtype auth_type)
{
struct wid wid_list[3];
int result;
struct wilc_wep_key *wep_key;
wid_list[0].id = WID_11I_MODE;
wid_list[0].type = WID_CHAR;
wid_list[0].size = sizeof(char);
wid_list[0].val = &mode;
wid_list[1].id = WID_AUTH_TYPE;
wid_list[1].type = WID_CHAR;
wid_list[1].size = sizeof(char);
wid_list[1].val = (s8 *)&auth_type;
wid_list[2].id = WID_WEP_KEY_VALUE;
wid_list[2].type = WID_STR;
wid_list[2].size = sizeof(*wep_key) + len;
wep_key = kzalloc(wid_list[2].size, GFP_KERNEL);
if (!wep_key)
return -ENOMEM;
wid_list[2].val = (u8 *)wep_key;
wep_key->index = index;
wep_key->key_len = len;
memcpy(wep_key->key, key, len);
result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
ARRAY_SIZE(wid_list));
if (result)
netdev_err(vif->ndev,
"Failed to add wep ap key config packet\n");
kfree(wep_key);
return result;
}
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
u8 mode, u8 cipher_mode, u8 index) u8 mode, u8 cipher_mode, u8 index)
......
...@@ -151,12 +151,6 @@ struct host_if_drv { ...@@ -151,12 +151,6 @@ struct host_if_drv {
}; };
struct wilc_vif; struct wilc_vif;
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
u8 index);
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
u8 index, u8 mode, enum authtype auth_type);
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
u8 mode, u8 cipher_mode, u8 index); u8 mode, u8 cipher_mode, u8 index);
......
...@@ -45,12 +45,6 @@ struct wilc_wfi_key { ...@@ -45,12 +45,6 @@ struct wilc_wfi_key {
u32 cipher; u32 cipher;
}; };
struct wilc_wfi_wep_key {
u8 *key;
u8 key_len;
u8 key_idx;
};
struct sta_info { struct sta_info {
u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN]; u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN];
}; };
...@@ -63,8 +57,6 @@ struct wilc_wfi_p2p_listen_params { ...@@ -63,8 +57,6 @@ struct wilc_wfi_p2p_listen_params {
}; };
static const u32 wilc_cipher_suites[] = { static const u32 wilc_cipher_suites[] = {
WLAN_CIPHER_SUITE_WEP40,
WLAN_CIPHER_SUITE_WEP104,
WLAN_CIPHER_SUITE_TKIP, WLAN_CIPHER_SUITE_TKIP,
WLAN_CIPHER_SUITE_CCMP, WLAN_CIPHER_SUITE_CCMP,
WLAN_CIPHER_SUITE_AES_CMAC WLAN_CIPHER_SUITE_AES_CMAC
...@@ -132,8 +124,6 @@ struct wilc_priv { ...@@ -132,8 +124,6 @@ struct wilc_priv {
struct net_device *dev; struct net_device *dev;
struct host_if_drv *hif_drv; struct host_if_drv *hif_drv;
struct wilc_pmkid_attr pmkid_list; struct wilc_pmkid_attr pmkid_list;
u8 wep_key[4][WLAN_KEY_LEN_WEP104];
u8 wep_key_len[4];
/* The real interface that the monitor is on */ /* The real interface that the monitor is on */
struct net_device *real_ndev; struct net_device *real_ndev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment