|
30 | 30 | #include "hs2_profile.h" |
31 | 31 | #include "common.h" |
32 | 32 |
|
| 33 | +#ifdef CONFIG_WIFI_CERTIFICATE_LIB |
| 34 | +#include <zephyr/net/wifi_certs.h> |
| 35 | + |
| 36 | +int process_certificates(void); |
| 37 | +#endif |
| 38 | + |
33 | 39 | struct interface_info *band_transmitter[16]; |
34 | 40 | struct interface_info *band_first_wlan[16]; |
35 | 41 | extern struct sockaddr_in *tool_addr; |
@@ -1867,7 +1873,64 @@ static int configure_sta_handler(struct packet_wrapper *req, struct packet_wrapp |
1867 | 1873 | CHECK_RET(); |
1868 | 1874 | ret = run_qt_command("SET_NETWORK 0 ieee80211w 2"); |
1869 | 1875 | 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 |
1870 | 1932 | } |
| 1933 | +#endif |
1871 | 1934 | } |
1872 | 1935 |
|
1873 | 1936 | tlv = find_wrapper_tlv_by_id(req, TLV_PROTO); |
|
0 commit comments