mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
DPP: Set group id through DPP_AUTH_INIT or dpp_configurator_params
This enhances DPP_AUTH_INIT, DPP_CONFIGURATOR_SIGN, and SET dpp_configurator_params to allow optional setting of the DPP groupId string for a Connector. If the value is not set, the previously wildcard value ("*") is used by default. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
495aebd39f
commit
20f612d998
@ -518,6 +518,7 @@ static void hostapd_dpp_set_configurator(struct hostapd_data *hapd,
|
||||
size_t pass_len = 0;
|
||||
u8 psk[PMK_LEN];
|
||||
int psk_set = 0;
|
||||
char *group_id = NULL;
|
||||
|
||||
if (!cmd)
|
||||
return;
|
||||
@ -553,6 +554,20 @@ static void hostapd_dpp_set_configurator(struct hostapd_data *hapd,
|
||||
psk_set = 1;
|
||||
}
|
||||
|
||||
pos = os_strstr(cmd, " group_id=");
|
||||
if (pos) {
|
||||
size_t group_id_len;
|
||||
|
||||
pos += 10;
|
||||
end = os_strchr(pos, ' ');
|
||||
group_id_len = end ? (size_t) (end - pos) : os_strlen(pos);
|
||||
group_id = os_malloc(group_id_len + 1);
|
||||
if (!group_id)
|
||||
goto fail;
|
||||
os_memcpy(group_id, pos, group_id_len);
|
||||
group_id[group_id_len] = '\0';
|
||||
}
|
||||
|
||||
if (os_strstr(cmd, " conf=sta-")) {
|
||||
conf_sta = os_zalloc(sizeof(struct dpp_configuration));
|
||||
if (!conf_sta)
|
||||
@ -580,6 +595,10 @@ static void hostapd_dpp_set_configurator(struct hostapd_data *hapd,
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
if (os_strstr(cmd, " group_id=")) {
|
||||
conf_sta->group_id = group_id;
|
||||
group_id = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (os_strstr(cmd, " conf=ap-")) {
|
||||
@ -609,6 +628,10 @@ static void hostapd_dpp_set_configurator(struct hostapd_data *hapd,
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
if (os_strstr(cmd, " group_id=")) {
|
||||
conf_ap->group_id = group_id;
|
||||
group_id = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
pos = os_strstr(cmd, " expiry=");
|
||||
@ -639,12 +662,14 @@ static void hostapd_dpp_set_configurator(struct hostapd_data *hapd,
|
||||
auth->conf_sta = conf_sta;
|
||||
auth->conf_ap = conf_ap;
|
||||
auth->conf = conf;
|
||||
os_free(group_id);
|
||||
return;
|
||||
|
||||
fail:
|
||||
wpa_printf(MSG_DEBUG, "DPP: Failed to set configurator parameters");
|
||||
dpp_configuration_free(conf_sta);
|
||||
dpp_configuration_free(conf_ap);
|
||||
os_free(group_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3988,6 +3988,7 @@ void dpp_configuration_free(struct dpp_configuration *conf)
|
||||
if (!conf)
|
||||
return;
|
||||
str_clear_free(conf->passphrase);
|
||||
os_free(conf->group_id);
|
||||
bin_clear_free(conf, sizeof(*conf));
|
||||
}
|
||||
|
||||
@ -4134,6 +4135,9 @@ dpp_build_conf_obj_dpp(struct dpp_authentication *auth, int ap,
|
||||
extra_len += os_strlen(auth->groups_override);
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
if (conf->group_id)
|
||||
extra_len += os_strlen(conf->group_id);
|
||||
|
||||
/* Connector (JSON dppCon object) */
|
||||
dppcon = wpabuf_alloc(extra_len + 2 * auth->curve->prime_len * 4 / 3);
|
||||
if (!dppcon)
|
||||
@ -4152,7 +4156,8 @@ dpp_build_conf_obj_dpp(struct dpp_authentication *auth, int ap,
|
||||
goto skip_groups;
|
||||
}
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
wpabuf_put_str(dppcon, "{\"groups\":[{\"groupId\":\"*\",");
|
||||
wpabuf_printf(dppcon, "{\"groups\":[{\"groupId\":\"%s\",",
|
||||
conf->group_id ? conf->group_id : "*");
|
||||
wpabuf_printf(dppcon, "\"netRole\":\"%s\"}],", ap ? "ap" : "sta");
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
skip_groups:
|
||||
|
@ -153,6 +153,7 @@ struct dpp_configuration {
|
||||
os_time_t netaccesskey_expiry;
|
||||
|
||||
/* TODO: groups */
|
||||
char *group_id;
|
||||
|
||||
/* For legacy configuration */
|
||||
char *passphrase;
|
||||
|
@ -540,6 +540,7 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
|
||||
size_t pass_len = 0;
|
||||
u8 psk[PMK_LEN];
|
||||
int psk_set = 0;
|
||||
char *group_id = NULL;
|
||||
|
||||
if (!cmd)
|
||||
return;
|
||||
@ -575,6 +576,20 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
|
||||
psk_set = 1;
|
||||
}
|
||||
|
||||
pos = os_strstr(cmd, " group_id=");
|
||||
if (pos) {
|
||||
size_t group_id_len;
|
||||
|
||||
pos += 10;
|
||||
end = os_strchr(pos, ' ');
|
||||
group_id_len = end ? (size_t) (end - pos) : os_strlen(pos);
|
||||
group_id = os_malloc(group_id_len + 1);
|
||||
if (!group_id)
|
||||
goto fail;
|
||||
os_memcpy(group_id, pos, group_id_len);
|
||||
group_id[group_id_len] = '\0';
|
||||
}
|
||||
|
||||
if (os_strstr(cmd, " conf=sta-")) {
|
||||
conf_sta = os_zalloc(sizeof(struct dpp_configuration));
|
||||
if (!conf_sta)
|
||||
@ -602,6 +617,10 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
if (os_strstr(cmd, " group_id=")) {
|
||||
conf_sta->group_id = group_id;
|
||||
group_id = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (os_strstr(cmd, " conf=ap-")) {
|
||||
@ -631,6 +650,10 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
if (os_strstr(cmd, " group_id=")) {
|
||||
conf_ap->group_id = group_id;
|
||||
group_id = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
pos = os_strstr(cmd, " expiry=");
|
||||
@ -660,12 +683,14 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
|
||||
auth->conf_sta = conf_sta;
|
||||
auth->conf_ap = conf_ap;
|
||||
auth->conf = conf;
|
||||
os_free(group_id);
|
||||
return;
|
||||
|
||||
fail:
|
||||
wpa_printf(MSG_DEBUG, "DPP: Failed to set configurator parameters");
|
||||
dpp_configuration_free(conf_sta);
|
||||
dpp_configuration_free(conf_ap);
|
||||
os_free(group_id);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user