Skip to content

Commit 4d178f6

Browse files
LiLongNXPkartben
authored andcommitted
modules: hostap: add tls_cipher param
Add tls_cipher param for client WPA3 enterprise suiteb-192. Add parameter "-T" to specify tls_cipher: Specify "-T 1": client use ECC P384. Specify "-T 2": client use RSA 3K. Signed-off-by: Li Long <[email protected]>
1 parent 3703506 commit 4d178f6

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

include/zephyr/net/wifi.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ enum wifi_suiteb_type {
118118
WIFI_SUITEB_192,
119119
};
120120

121+
enum wifi_eap_tls_cipher_type {
122+
/** EAP TLS with NONE */
123+
WIFI_EAP_TLS_NONE,
124+
/** EAP TLS with ECDH & ECDSA with p384 */
125+
WIFI_EAP_TLS_ECC_P384,
126+
/** EAP TLS with ECDH & RSA with > 3K */
127+
WIFI_EAP_TLS_RSA_3K,
128+
};
129+
121130
/** @brief Group cipher and pairwise cipher types. */
122131
enum wifi_cipher_type {
123132
/** AES in counter mode with CBC-MAC (CCMP-128). */

include/zephyr/net/wifi_mgmt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@ struct wifi_connect_req_params {
540540
uint8_t key2_passwd_length;
541541
/** suiteb or suiteb-192 */
542542
uint8_t suiteb_type;
543+
/** TLS cipher */
544+
uint8_t TLS_cipher;
543545
/** eap version */
544546
int eap_ver;
545547
/** Identity for EAP */

modules/hostap/src/supp_api.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,20 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
10451045
goto out;
10461046
}
10471047

1048+
if (params->suiteb_type == WIFI_SUITEB_192) {
1049+
if (params->TLS_cipher == WIFI_EAP_TLS_ECC_P384) {
1050+
if (!wpa_cli_cmd_v("set_network %d openssl_ciphers \"%s\"",
1051+
resp.network_id,
1052+
cipher_config.openssl_ciphers))
1053+
goto out;
1054+
} else if (params->TLS_cipher == WIFI_EAP_TLS_RSA_3K) {
1055+
snprintf(phase1, sizeof(phase1), "tls_suiteb=1");
1056+
if (!wpa_cli_cmd_v("set_network %d phase1 \"%s\"",
1057+
resp.network_id, &phase1[0]))
1058+
goto out;
1059+
}
1060+
}
1061+
10481062
if (!wpa_cli_cmd_v("set_network %d key_mgmt %s", resp.network_id,
10491063
cipher_config.key_mgmt)) {
10501064
goto out;

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv
580580
{"key1-pwd", required_argument, 0, 'K'},
581581
{"key2-pwd", required_argument, 0, 'K'},
582582
{"suiteb-type", required_argument, 0, 'S'},
583+
{"TLS-cipher", required_argument, 0, 'T'},
583584
{"eap-version", required_argument, 0, 'V'},
584585
{"eap-id1", required_argument, 0, 'I'},
585586
{"eap-id2", required_argument, 0, 'I'},
@@ -626,7 +627,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv
626627
params->ignore_broadcast_ssid = 0;
627628
params->bandwidth = WIFI_FREQ_BANDWIDTH_20MHZ;
628629

629-
while ((opt = getopt_long(argc, argv, "s:p:k:e:w:b:c:m:t:a:B:K:S:V:I:P:i:Rh",
630+
while ((opt = getopt_long(argc, argv, "s:p:k:e:w:b:c:m:t:a:B:K:S:T:V:I:P:i:Rh",
630631
long_options, &opt_index)) != -1) {
631632
state = getopt_state_get();
632633
switch (opt) {
@@ -785,6 +786,9 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv
785786
case 'S':
786787
params->suiteb_type = atoi(state->optarg);
787788
break;
789+
case 'T':
790+
params->TLS_cipher = atoi(state->optarg);
791+
break;
788792
case 'V':
789793
params->eap_ver = atoi(state->optarg);
790794
if (params->eap_ver != 0U && params->eap_ver != 1U) {
@@ -3406,6 +3410,7 @@ SHELL_SUBCMD_ADD((wifi), connect, NULL,
34063410
"[-K, --key1-pwd for eap phase1 or --key2-pwd for eap phase2]:\n"
34073411
"Private key passwd for enterprise mode. Default no password for private key.\n"
34083412
"[-S, --suiteb-type]: 1:suiteb, 2:suiteb-192. Default 0: not suiteb mode.\n"
3413+
"[-T, --TLS-cipher]: 0:TLS-NONE, 1:TLS-ECC-P384, 2:TLS-RSA-3K.\n"
34093414
"[-V, --eap-version]: 0 or 1. Default 1: eap version 1.\n"
34103415
"[-I, --eap-id1]: Client Identity. Default no eap identity.\n"
34113416
"[-P, --eap-pwd1]: Client Password.\n"

0 commit comments

Comments
 (0)