[RFC PATCH 31/34] Control iface support to set and clear PR device identity context
Peddolla Harshavardhan Reddy
peddolla at qti.qualcomm.com
Thu May 15 00:17:54 PDT 2025
Signed-off-by: Peddolla Harshavardhan Reddy <peddolla at qti.qualcomm.com>
---
wpa_supplicant/ctrl_iface.c | 55 +++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 60a798842..dd30a08f5 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -11507,6 +11507,56 @@ static int wpas_ctrl_iface_pr_pasn_start(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_TESTING_OPTIONS
+static int wpas_ctrl_iface_pr_set_dik_ctx(struct wpa_supplicant *wpa_s,
+ char *cmd)
+{
+ int ret = -1;
+ bool own = false;
+ char *token, *context = NULL;
+ const char *password = NULL;
+ const u8 *pmk = NULL, *dik = NULL;
+ struct wpabuf *pmk_buf = NULL, *dik_buf = NULL;
+
+ while ((token = str_token(cmd, " ", &context))) {
+ if (os_strncmp(token, "self", 4) == 0) {
+ own = 1;
+ continue;
+ }
+
+ if (os_strncmp(token, "dik=", 4) == 0) {
+ dik_buf = wpabuf_parse_bin(token + 4);
+ if (!dik_buf)
+ goto fail;
+ dik = wpabuf_head_u8(dik_buf);
+ continue;
+ }
+
+ if (os_strncmp(token, "password=", 9) == 0) {
+ password = token + 9;
+ continue;
+ }
+
+ if (os_strncmp(token, "pmk=", 4) == 0) {
+ pmk_buf = wpabuf_parse_bin(token + 4);
+ if (!pmk_buf)
+ goto fail;
+ pmk = wpabuf_head_u8(pmk_buf);
+ continue;
+ }
+ }
+
+ if (!dik)
+ goto fail;
+
+ wpas_pr_set_dev_ik(wpa_s, dik, password, pmk, own);
+ ret = 0;
+fail:
+ wpabuf_free(dik_buf);
+ wpabuf_free(pmk_buf);
+ return ret;
+}
+
+
static int wpas_ctrl_iface_pasn_driver(struct wpa_supplicant *wpa_s,
const char *cmd)
{
@@ -13890,6 +13940,11 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
if (wpas_ctrl_iface_pr_pasn_start(wpa_s, buf + 14) < 0)
reply_len = -1;
#ifdef CONFIG_TESTING_OPTIONS
+ } else if (os_strncmp(buf, "PR_SET_DIK_CONTEXT ", 19) == 0) {
+ if (wpas_ctrl_iface_pr_set_dik_ctx(wpa_s, buf + 19) < 0)
+ reply_len = -1;
+ } else if (os_strcmp(buf, "PR_CLEAR_DIK_CONTEXT") == 0) {
+ wpas_pr_clear_dev_iks(wpa_s);
} else if (os_strncmp(buf, "PASN_DRIVER ", 12) == 0) {
if (wpas_ctrl_iface_pasn_driver(wpa_s, buf + 12) < 0)
reply_len = -1;
--
2.34.1
More information about the Hostap
mailing list