diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 86adf18e5..29dc38aba 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -3959,6 +3959,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, if (os_snprintf_error(reply_size, reply_len)) reply_len = -1; } + } else if (os_strncmp(buf, "DPP_CONFIGURATOR_SET ", 21) == 0) { + if (dpp_configurator_set(hapd->iface->interfaces->dpp, + buf + 20) < 0) + reply_len = -1; } else if (os_strncmp(buf, "DPP_CONFIGURATOR_REMOVE ", 24) == 0) { if (dpp_configurator_remove(hapd->iface->interfaces->dpp, buf + 24) < 0) diff --git a/src/common/dpp.c b/src/common/dpp.c index a9497f58c..a5165b9b3 100644 --- a/src/common/dpp.c +++ b/src/common/dpp.c @@ -4512,6 +4512,32 @@ fail: } +int dpp_configurator_set(struct dpp_global *dpp, const char *cmd) +{ + unsigned int id; + struct dpp_configurator *conf; + char *curve; + + id = atoi(cmd); + conf = dpp_configurator_get_id(dpp, id); + if (!conf) + return -1; + + curve = get_param(cmd, " net_access_key_curve="); + if (curve) { + const struct dpp_curve_params *net_access_key_curve; + + net_access_key_curve = dpp_get_curve_name(curve); + os_free(curve); + if (!net_access_key_curve) + return -1; + conf->net_access_key_curve = net_access_key_curve; + } + + return 0; +} + + static int dpp_configurator_del(struct dpp_global *dpp, unsigned int id) { struct dpp_configurator *conf, *tmp; diff --git a/src/common/dpp.h b/src/common/dpp.h index 3aca92f7f..16d3ca71f 100644 --- a/src/common/dpp.h +++ b/src/common/dpp.h @@ -691,6 +691,7 @@ void dpp_bootstrap_find_pair(struct dpp_global *dpp, const u8 *i_bootstrap, struct dpp_bootstrap_info * dpp_bootstrap_find_chirp(struct dpp_global *dpp, const u8 *hash); int dpp_configurator_add(struct dpp_global *dpp, const char *cmd); +int dpp_configurator_set(struct dpp_global *dpp, const char *cmd); int dpp_configurator_remove(struct dpp_global *dpp, const char *id); int dpp_configurator_get_key_id(struct dpp_global *dpp, unsigned int id, char *buf, size_t buflen); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index ef87c8645..f7ca929fe 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -12312,6 +12312,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, if (os_snprintf_error(reply_size, reply_len)) reply_len = -1; } + } else if (os_strncmp(buf, "DPP_CONFIGURATOR_SET ", 21) == 0) { + if (dpp_configurator_set(wpa_s->dpp, buf + 20) < 0) + reply_len = -1; } else if (os_strncmp(buf, "DPP_CONFIGURATOR_REMOVE ", 24) == 0) { if (dpp_configurator_remove(wpa_s->dpp, buf + 24) < 0) reply_len = -1;