Skip to content

Commit 82c7248

Browse files
ajaykathatnoglitch
authored andcommitted
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 1b1b5bb commit 82c7248

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
@@ -371,9 +371,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
371371
PRINT_D(vif->ndev, CFG80211_DBG, "Required SSID= %s\n, AuthType= %d\n",
372372
sme->ssid, sme->auth_type);
373373

374-
memset(priv->wep_key, 0, sizeof(priv->wep_key));
375-
memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));
376-
377374
PRINT_D(vif->ndev, CFG80211_DBG, "sme->crypto.wpa_versions=%x\n",
378375
sme->crypto.wpa_versions);
379376
PRINT_D(vif->ndev, CFG80211_DBG, "sme->crypto.cipher_group=%x\n",
@@ -390,34 +387,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
390387
PRINT_INFO(vif->ndev, CORECONFIG_DBG,
391388
">> sme->crypto.wpa_versions: %x\n",
392389
sme->crypto.wpa_versions);
393-
if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
394-
security = WILC_FW_SEC_WEP;
395-
PRINT_D(vif->ndev, CFG80211_DBG,
396-
"WEP Default Key Idx = %d\n", sme->key_idx);
397-
398-
for (i = 0; i < sme->key_len; i++)
399-
PRINT_D(vif->ndev, CORECONFIG_DBG,
400-
"WEP Key Value[%d] = %d\n", i,
401-
sme->key[i]);
402-
403-
priv->wep_key_len[sme->key_idx] = sme->key_len;
404-
memcpy(priv->wep_key[sme->key_idx], sme->key,
405-
sme->key_len);
406-
407-
wilc_set_wep_default_keyid(vif, sme->key_idx);
408-
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
409-
sme->key_idx);
410-
} else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
411-
security = WILC_FW_SEC_WEP_EXTENDED;
412-
413-
priv->wep_key_len[sme->key_idx] = sme->key_len;
414-
memcpy(priv->wep_key[sme->key_idx], sme->key,
415-
sme->key_len);
416-
417-
wilc_set_wep_default_keyid(vif, sme->key_idx);
418-
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
419-
sme->key_idx);
420-
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
390+
if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
421391
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
422392
security = WILC_FW_SEC_WPA2_TKIP;
423393
else
@@ -458,11 +428,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
458428
auth_type = WILC_FW_AUTH_OPEN_SYSTEM;
459429
break;
460430

461-
case NL80211_AUTHTYPE_SHARED_KEY:
462-
auth_type = WILC_FW_AUTH_SHARED_KEY;
463-
PRINT_INFO(vif->ndev, CFG80211_DBG, "In SHARED KEY\n");
464-
break;
465-
466431
default:
467432
PRINT_INFO(vif->ndev, CFG80211_DBG,
468433
"Automatic Authentication type= %d\n",
@@ -574,14 +539,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
574539
return ret;
575540
}
576541

577-
static inline void wilc_wfi_cfg_copy_wep_info(struct wilc_priv *priv,
578-
u8 key_index,
579-
struct key_params *params)
580-
{
581-
priv->wep_key_len[key_index] = params->key_len;
582-
memcpy(priv->wep_key[key_index], params->key, params->key_len);
583-
}
584-
585542
static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx)
586543
{
587544
if (!priv->wilc_gtk[idx]) {
@@ -635,7 +592,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
635592
const u8 *tx_mic = NULL;
636593
u8 mode = WILC_FW_SEC_NO;
637594
u8 op_mode;
638-
int i;
639595
struct wilc_vif *vif = netdev_priv(netdev);
640596
struct wilc_priv *priv = &vif->priv;
641597

@@ -647,51 +603,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
647603
params->key[1],
648604
params->key[2]);
649605
switch (params->cipher) {
650-
case WLAN_CIPHER_SUITE_WEP40:
651-
case WLAN_CIPHER_SUITE_WEP104:
652-
if (priv->wdev.iftype == NL80211_IFTYPE_AP) {
653-
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
654-
655-
PRINT_INFO(vif->ndev, CFG80211_DBG,
656-
"Adding AP WEP Default key Idx = %d\n",
657-
key_index);
658-
PRINT_INFO(vif->ndev, CFG80211_DBG,
659-
"Adding AP WEP Key len= %d\n",
660-
params->key_len);
661-
662-
for (i = 0; i < params->key_len; i++)
663-
PRINT_INFO(vif->ndev, CFG80211_DBG,
664-
"WEP AP key val[%d] = %x\n", i,
665-
params->key[i]);
666-
667-
if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
668-
mode = WILC_FW_SEC_WEP;
669-
else
670-
mode = WILC_FW_SEC_WEP_EXTENDED;
671-
672-
ret = wilc_add_wep_key_bss_ap(vif, params->key,
673-
params->key_len,
674-
key_index, mode,
675-
WILC_FW_AUTH_OPEN_SYSTEM);
676-
break;
677-
}
678-
if (memcmp(params->key, priv->wep_key[key_index],
679-
params->key_len)) {
680-
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
681-
682-
PRINT_INFO(vif->ndev, CFG80211_DBG,
683-
"Adding WEP Default key Idx = %d\n",
684-
key_index);
685-
PRINT_INFO(vif->ndev, CFG80211_DBG,
686-
"Adding WEP Key length = %d\n",
687-
params->key_len);
688-
ret = wilc_add_wep_key_bss_sta(vif, params->key,
689-
params->key_len,
690-
key_index);
691-
}
692-
693-
break;
694-
695606
case WLAN_CIPHER_SUITE_TKIP:
696607
case WLAN_CIPHER_SUITE_CCMP:
697608
if (priv->wdev.iftype == NL80211_IFTYPE_AP ||
@@ -794,15 +705,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
794705
priv->wilc_ptk[key_index] = NULL;
795706
}
796707

797-
if (key_index <= 3 && priv->wep_key_len[key_index]) {
798-
memset(priv->wep_key[key_index], 0,
799-
priv->wep_key_len[key_index]);
800-
priv->wep_key_len[key_index] = 0;
801-
pr_info("%s: Removing WEP key with index = %d\n", __func__,
802-
key_index);
803-
ret = wilc_remove_wep_key(vif, key_index);
804-
}
805-
806708
return ret;
807709
}
808710

@@ -836,13 +738,10 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
836738
return 0;
837739
}
838740

741+
/* wiphy_new() will WARN if not present*/
839742
static int set_default_key(struct wiphy *wiphy, struct net_device *netdev,
840743
u8 key_index, bool unicast, bool multicast)
841744
{
842-
struct wilc_vif *vif = netdev_priv(netdev);
843-
844-
wilc_set_wep_default_keyid(vif, key_index);
845-
846745
return 0;
847746
}
848747

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
@@ -1345,114 +1345,6 @@ signed int wilc_send_buffered_eap(struct wilc_vif *vif,
13451345
return result;
13461346
}
13471347

1348-
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
1349-
{
1350-
struct wid wid;
1351-
int result;
1352-
1353-
wid.id = WID_REMOVE_WEP_KEY;
1354-
wid.type = WID_STR;
1355-
wid.size = sizeof(char);
1356-
wid.val = &index;
1357-
1358-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1359-
if (result)
1360-
netdev_err(vif->ndev,
1361-
"Failed to send remove wep key config packet\n");
1362-
return result;
1363-
}
1364-
1365-
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
1366-
{
1367-
struct wid wid;
1368-
int result;
1369-
1370-
wid.id = WID_KEY_ID;
1371-
wid.type = WID_CHAR;
1372-
wid.size = sizeof(char);
1373-
wid.val = &index;
1374-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1375-
if (result)
1376-
netdev_err(vif->ndev,
1377-
"Failed to send wep default key config packet\n");
1378-
1379-
return result;
1380-
}
1381-
1382-
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
1383-
u8 index)
1384-
{
1385-
struct wid wid;
1386-
int result;
1387-
struct wilc_wep_key *wep_key;
1388-
1389-
PRINT_INFO(vif->ndev, HOSTINF_DBG, "Handling WEP key\n");
1390-
wid.id = WID_ADD_WEP_KEY;
1391-
wid.type = WID_STR;
1392-
wid.size = sizeof(*wep_key) + len;
1393-
wep_key = kzalloc(wid.size, GFP_KERNEL);
1394-
if (!wep_key) {
1395-
PRINT_ER(vif->ndev, "No buffer to send Key\n");
1396-
return -ENOMEM;
1397-
}
1398-
wid.val = (u8 *)wep_key;
1399-
1400-
wep_key->index = index;
1401-
wep_key->key_len = len;
1402-
memcpy(wep_key->key, key, len);
1403-
1404-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
1405-
if (result)
1406-
netdev_err(vif->ndev,
1407-
"Failed to add wep key config packet\n");
1408-
1409-
kfree(wep_key);
1410-
return result;
1411-
}
1412-
1413-
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
1414-
u8 index, u8 mode, enum authtype auth_type)
1415-
{
1416-
struct wid wid_list[3];
1417-
int result;
1418-
struct wilc_wep_key *wep_key;
1419-
1420-
PRINT_INFO(vif->ndev, HOSTINF_DBG, "Handling WEP key index: %d\n",
1421-
index);
1422-
wid_list[0].id = WID_11I_MODE;
1423-
wid_list[0].type = WID_CHAR;
1424-
wid_list[0].size = sizeof(char);
1425-
wid_list[0].val = &mode;
1426-
1427-
wid_list[1].id = WID_AUTH_TYPE;
1428-
wid_list[1].type = WID_CHAR;
1429-
wid_list[1].size = sizeof(char);
1430-
wid_list[1].val = (s8 *)&auth_type;
1431-
1432-
wid_list[2].id = WID_WEP_KEY_VALUE;
1433-
wid_list[2].type = WID_STR;
1434-
wid_list[2].size = sizeof(*wep_key) + len;
1435-
wep_key = kzalloc(wid_list[2].size, GFP_KERNEL);
1436-
if (!wep_key) {
1437-
PRINT_ER(vif->ndev, "No buffer to send Key\n");
1438-
return -ENOMEM;
1439-
}
1440-
1441-
wid_list[2].val = (u8 *)wep_key;
1442-
1443-
wep_key->index = index;
1444-
wep_key->key_len = len;
1445-
memcpy(wep_key->key, key, len);
1446-
result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
1447-
ARRAY_SIZE(wid_list));
1448-
if (result)
1449-
netdev_err(vif->ndev,
1450-
"Failed to add wep ap key config packet\n");
1451-
1452-
kfree(wep_key);
1453-
return result;
1454-
}
1455-
14561348
int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
14571349
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
14581350
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
@@ -51,12 +51,6 @@ struct wilc_wfi_key {
5151
u32 cipher;
5252
};
5353

54-
struct wilc_wfi_wep_key {
55-
u8 *key;
56-
u8 key_len;
57-
u8 key_idx;
58-
};
59-
6054
struct sta_info {
6155
u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN];
6256
};
@@ -82,8 +76,6 @@ struct wilc_p2p_var {
8276
};
8377

8478
static const u32 wilc_cipher_suites[] = {
85-
WLAN_CIPHER_SUITE_WEP40,
86-
WLAN_CIPHER_SUITE_WEP104,
8779
WLAN_CIPHER_SUITE_TKIP,
8880
WLAN_CIPHER_SUITE_CCMP,
8981
WLAN_CIPHER_SUITE_AES_CMAC
@@ -151,8 +143,6 @@ struct wilc_priv {
151143
struct net_device *dev;
152144
struct host_if_drv *hif_drv;
153145
struct wilc_pmkid_attr pmkid_list;
154-
u8 wep_key[4][WLAN_KEY_LEN_WEP104];
155-
u8 wep_key_len[4];
156146

157147
/* The real interface that the monitor is on */
158148
struct net_device *real_ndev;

0 commit comments

Comments
 (0)