Skip to content

Commit b1c4fb5

Browse files
committed
cipher freedom
1 parent 91cff1a commit b1c4fb5

1 file changed

Lines changed: 44 additions & 35 deletions

File tree

  • package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi

package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/iface.uc

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export function parse_encryption(config, dev_config) {
2727
if (wildcard(dev_config?.htmode, 'EHT*') || wildcard(dev_config?.htmode, 'HE*'))
2828
wpa3_pairwise = 'GCMP-256 ' + wpa3_pairwise;
2929

30+
let defaultcipher="CCMP";
3031
switch(config.auth_type) {
3132
case 'owe':
3233
config.auth_type = 'owe';
@@ -78,50 +79,58 @@ export function parse_encryption(config, dev_config) {
7879
break;
7980
}
8081

81-
switch(encryption[1]){
82-
case 'tkip+aes':
83-
case 'tkip+ccmp':
84-
case 'aes+tkip':
85-
case 'ccmp+tkip':
86-
config.wpa_pairwise = 'CCMP TKIP';
87-
break;
82+
let cipher_map = {
83+
"tkip": "TKIP",
84+
"TKIP": "TKIP",
8885

89-
case 'ccmp256':
90-
config.wpa_pairwise = 'CCMP-256';
91-
break;
86+
"aes": "CCMP",
87+
"AES": "CCMP",
9288

93-
case 'aes':
94-
case 'ccmp':
95-
config.wpa_pairwise = 'CCMP';
96-
break;
89+
"ccmp": "CCMP",
90+
"CCMP": "CCMP",
9791

98-
case 'tkip':
99-
config.wpa_pairwise = 'TKIP';
100-
break;
92+
"ccmp256": "CCMP-256",
93+
"CCMP256": "CCMP-256",
10194

102-
case 'gcmp256':
103-
config.wpa_pairwise = 'GCMP-256';
104-
break;
95+
"gcmp": "GCMP",
96+
"GCMP": "GCMP",
10597

106-
case 'gcmp':
107-
config.wpa_pairwise = 'GCMP';
108-
break;
98+
"gcmp256": "GCMP-256",
99+
"GCMP256": "GCMP-256"
100+
};
109101

110-
default:
111-
if (config.encryption == 'wpa3-192') {
112-
config.wpa_pairwise = 'GCMP-256';
113-
break;
114-
}
115102

116-
if (!wpa3_pairwise)
117-
break;
103+
let parts = split(encryption[1], "+");
104+
let result = "";
105+
106+
for (let key in parts) {
107+
108+
let mapped = cipher_map[key];
109+
110+
if (mapped) {
111+
if (result != "")
112+
result += " ";
113+
result += mapped;
114+
}
115+
}
118116

119-
if (config.rsn_override && wpa3_pairwise != config.wpa_pairwise)
120-
config.rsn_override_pairwise = wpa3_pairwise;
121-
else
122-
config.wpa_pairwise = wpa3_pairwise;
117+
if (!result) {
118+
if (config.encryption == 'wpa3-192') {
119+
result = 'GCMP-256';
120+
121+
} else
122+
if (wpa3_pairwise) {
123+
if (config.rsn_override && wpa3_pairwise != result)
124+
config.rsn_override_pairwise = wpa3_pairwise;
125+
else
126+
result = wpa3_pairwise;
127+
}
123128
break;
124-
}
129+
}
130+
if (!result) {
131+
result=defaultcipher;
132+
}
133+
config.wpa_pairwise = result;
125134

126135
};
127136

0 commit comments

Comments
 (0)