DPP: Allow Configurator net_access_key_curve to be changed

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>
This commit is contained in:
Jouni Malinen 2022-03-10 00:55:05 +02:00 committed by Jouni Malinen
parent 9638452a62
commit de5939ef52
4 changed files with 34 additions and 0 deletions

View 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)

View 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;

View 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);

View 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;