]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Allow Configurator net_access_key_curve to be changed
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 9 Mar 2022 22:55:05 +0000 (00:55 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 9 Mar 2022 23:30:33 +0000 (01:30 +0200)
This is mainly for testing purposes to allow a Configurator to the curve
between provisioning cases. This would not work for real deployement
cases unless every Enrollee were reconfigured.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
hostapd/ctrl_iface.c
src/common/dpp.c
src/common/dpp.h
wpa_supplicant/ctrl_iface.c

index 86adf18e5fe374d52f1e7d4ed1483690608737c8..29dc38aba274e641f0709c29ab8f9e8cd579cfd9 100644 (file)
@@ -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)
index a9497f58c777f6e2e5d1de5210b4122bb171030e..a5165b9b3701f25494b074f1e2701e2df27ad14a 100644 (file)
@@ -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;
index 3aca92f7f818eb6cb2e1aa80ca66e243322ae284..16d3ca71fb3a1d1ebff78bf71255f319bd763513 100644 (file)
@@ -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);
index ef87c8645cb041d94a1a1556275682a330941345..f7ca929fed40bd452a638811edb916beed1b901c 100644 (file)
@@ -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;