Skip to content

Commit 500bc60

Browse files
committed
modules: wfa-qt: Add support for enterprise mode
Add changes to support connection handling in enterprise mode. Signed-off-by: Triveni Danda <[email protected]>
1 parent 64f9058 commit 500bc60

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

modules/wfa-qt/src/indigo_api_callback_dut.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
#include "hs2_profile.h"
3131
#include "common.h"
3232

33+
#ifdef CONFIG_WIFI_CERTIFICATE_LIB
34+
#include <zephyr/net/wifi_certs.h>
35+
36+
int process_certificates(void);
37+
#endif
38+
3339
struct interface_info *band_transmitter[16];
3440
struct interface_info *band_first_wlan[16];
3541
extern struct sockaddr_in *tool_addr;
@@ -1867,7 +1873,64 @@ static int configure_sta_handler(struct packet_wrapper *req, struct packet_wrapp
18671873
CHECK_RET();
18681874
ret = run_qt_command("SET_NETWORK 0 ieee80211w 2");
18691875
CHECK_RET();
1876+
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
1877+
} else if (strstr(tlv->value, "WPA-EAP")) {
1878+
/*
1879+
* Process Certificates
1880+
*/
1881+
1882+
process_certificates();
1883+
1884+
struct {
1885+
int tlv_id;
1886+
const char *cmd_fmt;
1887+
const char *default_val;
1888+
bool use_tlv_value;
1889+
} config_cmds[] = {
1890+
{ TLV_EAP,
1891+
"SET_NETWORK 0 eap %s",
1892+
NULL, true },
1893+
{ TLV_IDENTITY,
1894+
"SET_NETWORK 0 identity \"%s\"",
1895+
NULL, true },
1896+
{ TLV_CA_CERT,
1897+
"SET_NETWORK 0 ca_cert \"%s\"",
1898+
"blob://ca_cert", false },
1899+
{ TLV_CLIENT_CERT,
1900+
"SET_NETWORK 0 client_cert \"%s\"",
1901+
"blob://client_cert", false },
1902+
{ TLV_PRIVATE_KEY,
1903+
"SET_NETWORK 0 private_key \"%s\"",
1904+
"blob://private_key", false },
1905+
};
1906+
1907+
for (size_t i = 0; i < ARRAY_SIZE(config_cmds); i++) {
1908+
tlv = find_wrapper_tlv_by_id(req, config_cmds[i].tlv_id);
1909+
if (tlv) {
1910+
memset(buffer, 0, sizeof(buffer));
1911+
if (config_cmds[i].use_tlv_value) {
1912+
CHECK_SNPRINTF(buffer, sizeof(buffer), ret,
1913+
config_cmds[i].cmd_fmt, tlv->value);
1914+
} else {
1915+
CHECK_SNPRINTF(buffer, sizeof(buffer), ret,
1916+
config_cmds[i].cmd_fmt,
1917+
config_cmds[i].default_val);
1918+
}
1919+
ret = run_qt_command(buffer);
1920+
CHECK_RET();
1921+
}
1922+
}
1923+
1924+
CHECK_SNPRINTF(buffer, sizeof(buffer),
1925+
ret, "SET_NETWORK 0 private_key_passwd \"whatever\"");
1926+
ret = run_qt_command(buffer);
1927+
CHECK_RET();
1928+
ret = run_qt_command("SET_NETWORK 0 ieee80211w 1");
1929+
CHECK_RET();
1930+
}
1931+
#else
18701932
}
1933+
#endif
18711934
}
18721935

18731936
tlv = find_wrapper_tlv_by_id(req, TLV_PROTO);

0 commit comments

Comments
 (0)