Skip to content

Commit 718b41e

Browse files
committed
wilc1000: remove WEP security support
Remove the WEP security as its insecure and vulnerable for attacks. This also helped in freeing up some FW memory which can be utilize for new feature support. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
1 parent 32e7037 commit 718b41e

5 files changed

Lines changed: 2 additions & 233 deletions

File tree

drivers/net/wireless/microchip/wilc1000/cfg80211.c

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
401401
PRINT_D(vif->ndev, CFG80211_DBG, "Required SSID= %s\n, AuthType= %d\n",
402402
sme->ssid, sme->auth_type);
403403

404-
memset(priv->wep_key, 0, sizeof(priv->wep_key));
405-
memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));
406-
407404
PRINT_D(vif->ndev, CFG80211_DBG, "sme->crypto.wpa_versions=%x\n",
408405
sme->crypto.wpa_versions);
409406
PRINT_D(vif->ndev, CFG80211_DBG, "sme->crypto.cipher_group=%x\n",
@@ -420,34 +417,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
420417
PRINT_INFO(vif->ndev, CORECONFIG_DBG,
421418
">> sme->crypto.wpa_versions: %x\n",
422419
sme->crypto.wpa_versions);
423-
if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
424-
security = WILC_FW_SEC_WEP;
425-
PRINT_D(vif->ndev, CFG80211_DBG,
426-
"WEP Default Key Idx = %d\n", sme->key_idx);
427-
428-
for (i = 0; i < sme->key_len; i++)
429-
PRINT_D(vif->ndev, CORECONFIG_DBG,
430-
"WEP Key Value[%d] = %d\n", i,
431-
sme->key[i]);
432-
433-
priv->wep_key_len[sme->key_idx] = sme->key_len;
434-
memcpy(priv->wep_key[sme->key_idx], sme->key,
435-
sme->key_len);
436-
437-
wilc_set_wep_default_keyid(vif, sme->key_idx);
438-
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
439-
sme->key_idx);
440-
} else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
441-
security = WILC_FW_SEC_WEP_EXTENDED;
442-
443-
priv->wep_key_len[sme->key_idx] = sme->key_len;
444-
memcpy(priv->wep_key[sme->key_idx], sme->key,
445-
sme->key_len);
446-
447-
wilc_set_wep_default_keyid(vif, sme->key_idx);
448-
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
449-
sme->key_idx);
450-
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
420+
if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
451421
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
452422
security = WILC_FW_SEC_WPA2_TKIP;
453423
else
@@ -488,11 +458,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
488458
auth_type = WILC_FW_AUTH_OPEN_SYSTEM;
489459
break;
490460

491-
case NL80211_AUTHTYPE_SHARED_KEY:
492-
auth_type = WILC_FW_AUTH_SHARED_KEY;
493-
PRINT_INFO(vif->ndev, CFG80211_DBG, "In SHARED KEY\n");
494-
break;
495-
496461
default:
497462
PRINT_INFO(vif->ndev, CFG80211_DBG,
498463
"Automatic Authentication type= %d\n",
@@ -610,14 +575,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
610575
return ret;
611576
}
612577

613-
static inline void wilc_wfi_cfg_copy_wep_info(struct wilc_priv *priv,
614-
u8 key_index,
615-
struct key_params *params)
616-
{
617-
priv->wep_key_len[key_index] = params->key_len;
618-
memcpy(priv->wep_key[key_index], params->key, params->key_len);
619-
}
620-
621578
static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx)
622579
{
623580
if (!priv->wilc_gtk[idx]) {
@@ -671,7 +628,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
671628
const u8 *tx_mic = NULL;
672629
u8 mode = WILC_FW_SEC_NO;
673630
u8 op_mode;
674-
int i;
675631
struct wilc_vif *vif = netdev_priv(netdev);
676632
struct wilc_priv *priv = &vif->priv;
677633

@@ -683,51 +639,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
683639
params->key[1],
684640
params->key[2]);
685641
switch (params->cipher) {
686-
case WLAN_CIPHER_SUITE_WEP40:
687-
case WLAN_CIPHER_SUITE_WEP104:
688-
if (priv->wdev.iftype == NL80211_IFTYPE_AP) {
689-
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
690-
691-
PRINT_INFO(vif->ndev, CFG80211_DBG,
692-
"Adding AP WEP Default key Idx = %d\n",
693-
key_index);
694-
PRINT_INFO(vif->ndev, CFG80211_DBG,
695-
"Adding AP WEP Key len= %d\n",
696-
params->key_len);
697-
698-
for (i = 0; i < params->key_len; i++)
699-
PRINT_INFO(vif->ndev, CFG80211_DBG,
700-
"WEP AP key val[%d] = %x\n", i,
701-
params->key[i]);
702-
703-
if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
704-
mode = WILC_FW_SEC_WEP;
705-
else
706-
mode = WILC_FW_SEC_WEP_EXTENDED;
707-
708-
ret = wilc_add_wep_key_bss_ap(vif, params->key,
709-
params->key_len,
710-
key_index, mode,
711-
WILC_FW_AUTH_OPEN_SYSTEM);
712-
break;
713-
}
714-
if (memcmp(params->key, priv->wep_key[key_index],
715-
params->key_len)) {
716-
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
717-
718-
PRINT_INFO(vif->ndev, CFG80211_DBG,
719-
"Adding WEP Default key Idx = %d\n",
720-
key_index);
721-
PRINT_INFO(vif->ndev, CFG80211_DBG,
722-
"Adding WEP Key length = %d\n",
723-
params->key_len);
724-
ret = wilc_add_wep_key_bss_sta(vif, params->key,
725-
params->key_len,
726-
key_index);
727-
}
728-
729-
break;
730-
731642
case WLAN_CIPHER_SUITE_TKIP:
732643
case WLAN_CIPHER_SUITE_CCMP:
733644
if (priv->wdev.iftype == NL80211_IFTYPE_AP ||
@@ -830,15 +741,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
830741
priv->wilc_ptk[key_index] = NULL;
831742
}
832743

833-
if (key_index <= 3 && priv->wep_key_len[key_index]) {
834-
memset(priv->wep_key[key_index], 0,
835-
priv->wep_key_len[key_index]);
836-
priv->wep_key_len[key_index] = 0;
837-
pr_info("%s: Removing WEP key with index = %d\n", __func__,
838-
key_index);
839-
ret = wilc_remove_wep_key(vif, key_index);
840-
}
841-
842744
return ret;
843745
}
844746

@@ -872,13 +774,10 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
872774
return 0;
873775
}
874776

777+
/* wiphy_new() will WARN if not present*/
875778
static int set_default_key(struct wiphy *wiphy, struct net_device *netdev,
876779
u8 key_index, bool unicast, bool multicast)
877780
{
878-
struct wilc_vif *vif = netdev_priv(netdev);
879-
880-
wilc_set_wep_default_keyid(vif, key_index);
881-
882781
return 0;
883782
}
884783

drivers/net/wireless/microchip/wilc1000/fw.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ struct wilc_drv_handler {
4141
u8 mode;
4242
} __packed;
4343

44-
struct wilc_wep_key {
45-
u8 index;
46-
u8 key_len;
47-
u8 key[];
48-
} __packed;
49-
5044
struct wilc_sta_wpa_ptk {
5145
u8 mac_addr[ETH_ALEN];
5246
u8 key_len;

drivers/net/wireless/microchip/wilc1000/hif.c

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,114 +1396,6 @@ signed int wilc_send_buffered_eap(struct wilc_vif *vif,
13961396
return result;
13971397
}
13981398

1399-
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
1400-
{
1401-
struct wid wid;
1402-
int result;
1403-
1404-
wid.id = WID_REMOVE_WEP_KEY;
1405-
wid.type = WID_STR;
1406-
wid.size = sizeof(char);
1407-
wid.val = &index;
1408-
1409-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1410-
if (result)
1411-
netdev_err(vif->ndev,
1412-
"Failed to send remove wep key config packet\n");
1413-
return result;
1414-
}
1415-
1416-
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
1417-
{
1418-
struct wid wid;
1419-
int result;
1420-
1421-
wid.id = WID_KEY_ID;
1422-
wid.type = WID_CHAR;
1423-
wid.size = sizeof(char);
1424-
wid.val = &index;
1425-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1426-
if (result)
1427-
netdev_err(vif->ndev,
1428-
"Failed to send wep default key config packet\n");
1429-
1430-
return result;
1431-
}
1432-
1433-
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
1434-
u8 index)
1435-
{
1436-
struct wid wid;
1437-
int result;
1438-
struct wilc_wep_key *wep_key;
1439-
1440-
PRINT_INFO(vif->ndev, HOSTINF_DBG, "Handling WEP key\n");
1441-
wid.id = WID_ADD_WEP_KEY;
1442-
wid.type = WID_STR;
1443-
wid.size = sizeof(*wep_key) + len;
1444-
wep_key = kzalloc(wid.size, GFP_KERNEL);
1445-
if (!wep_key) {
1446-
PRINT_ER(vif->ndev, "No buffer to send Key\n");
1447-
return -ENOMEM;
1448-
}
1449-
wid.val = (u8 *)wep_key;
1450-
1451-
wep_key->index = index;
1452-
wep_key->key_len = len;
1453-
memcpy(wep_key->key, key, len);
1454-
1455-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1456-
if (result)
1457-
netdev_err(vif->ndev,
1458-
"Failed to add wep key config packet\n");
1459-
1460-
kfree(wep_key);
1461-
return result;
1462-
}
1463-
1464-
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
1465-
u8 index, u8 mode, enum authtype auth_type)
1466-
{
1467-
struct wid wid_list[3];
1468-
int result;
1469-
struct wilc_wep_key *wep_key;
1470-
1471-
PRINT_INFO(vif->ndev, HOSTINF_DBG, "Handling WEP key index: %d\n",
1472-
index);
1473-
wid_list[0].id = WID_11I_MODE;
1474-
wid_list[0].type = WID_CHAR;
1475-
wid_list[0].size = sizeof(char);
1476-
wid_list[0].val = &mode;
1477-
1478-
wid_list[1].id = WID_AUTH_TYPE;
1479-
wid_list[1].type = WID_CHAR;
1480-
wid_list[1].size = sizeof(char);
1481-
wid_list[1].val = (s8 *)&auth_type;
1482-
1483-
wid_list[2].id = WID_WEP_KEY_VALUE;
1484-
wid_list[2].type = WID_STR;
1485-
wid_list[2].size = sizeof(*wep_key) + len;
1486-
wep_key = kzalloc(wid_list[2].size, GFP_KERNEL);
1487-
if (!wep_key) {
1488-
PRINT_ER(vif->ndev, "No buffer to send Key\n");
1489-
return -ENOMEM;
1490-
}
1491-
1492-
wid_list[2].val = (u8 *)wep_key;
1493-
1494-
wep_key->index = index;
1495-
wep_key->key_len = len;
1496-
memcpy(wep_key->key, key, len);
1497-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
1498-
ARRAY_SIZE(wid_list));
1499-
if (result)
1500-
netdev_err(vif->ndev,
1501-
"Failed to add wep ap key config packet\n");
1502-
1503-
kfree(wep_key);
1504-
return result;
1505-
}
1506-
15071399
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
15081400
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
15091401
u8 mode, u8 cipher_mode, u8 index)

drivers/net/wireless/microchip/wilc1000/hif.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,6 @@ signed int wilc_send_buffered_eap(struct wilc_vif *vif,
161161
void (*eap_buf_param)(void *), u8 *buff,
162162
unsigned int size, unsigned int pkt_offset,
163163
void *user_arg);
164-
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
165-
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
166-
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
167-
u8 index);
168-
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
169-
u8 index, u8 mode, enum authtype auth_type);
170164
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
171165
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
172166
u8 mode, u8 cipher_mode, u8 index);

drivers/net/wireless/microchip/wilc1000/netdev.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,6 @@ struct wilc_wfi_key {
174174
u32 cipher;
175175
};
176176

177-
struct wilc_wfi_wep_key {
178-
u8 *key;
179-
u8 key_len;
180-
u8 key_idx;
181-
};
182-
183177
struct sta_info {
184178
u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN];
185179
};
@@ -205,8 +199,6 @@ struct wilc_p2p_var {
205199
};
206200

207201
static const u32 wilc_cipher_suites[] = {
208-
WLAN_CIPHER_SUITE_WEP40,
209-
WLAN_CIPHER_SUITE_WEP104,
210202
WLAN_CIPHER_SUITE_TKIP,
211203
WLAN_CIPHER_SUITE_CCMP,
212204
WLAN_CIPHER_SUITE_AES_CMAC
@@ -285,8 +277,6 @@ struct wilc_priv {
285277
struct net_device *dev;
286278
struct host_if_drv *hif_drv;
287279
struct wilc_pmkid_attr pmkid_list;
288-
u8 wep_key[4][WLAN_KEY_LEN_WEP104];
289-
u8 wep_key_len[4];
290280

291281
/* The real interface that the monitor is on */
292282
struct net_device *real_ndev;

0 commit comments

Comments
 (0)