[PATCH 4/7] wpa_supplicant: Configure groups for 802.1X in Authentication frames
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Nov 24 06:30:25 PST 2026
From: Ilan Peer <ilan.peer at intel.com>
The station always used group 19 for the Diffie-Hellman Parameter
element of IEEE 802.1X authentication utilizing Authentication frames
with non-PQC AKMs.
Add the ieee8021x_auth_groups global and network block configuration
options, with the network block one taking precedence, and use the first
group. Only the ECC groups 19, 20 and 21 are accepted, and the default
remains group 19. With PQC AKMs the group is defined by the PQC security
profile, so the option is not used.
Parsing and writing the groups are similar to those of the PASN groups
so add a few helper functions and use them in both cases.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
wpa_supplicant/config.c | 77 +++++++++++++++++++++++++++---
wpa_supplicant/config.h | 12 +++++
wpa_supplicant/config_file.c | 49 +++++++++++++++----
wpa_supplicant/config_ssid.h | 10 ++++
wpa_supplicant/sme.c | 18 ++++++-
wpa_supplicant/wpa_supplicant.conf | 8 ++++
6 files changed, 155 insertions(+), 19 deletions(-)
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 64eb01a0d7..6b30e3b13b 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2581,25 +2581,65 @@ static char * wpa_config_write_mac_value(const struct parse_data *data,
#endif /* NO_CONFIG_WRITE */
-#ifdef CONFIG_PASN
-static int wpa_config_parse_pasn_groups(const struct parse_data *data,
- struct wpa_ssid *ssid, int line,
- const char *value)
+#if defined(CONFIG_IEEE8021X_AUTH) || defined(CONFIG_PASN)
+static int wpa_config_parse_groups(const char *name, int line,
+ const char *value, int **dst,
+ bool (*valid)(const int *groups))
{
int *groups;
groups = wpa_config_parse_int_array(value);
if (!groups)
return -1;
- if (groups[0] == 0) {
+
+ if (!groups[0]) {
os_free(groups);
groups = NULL;
+ } else if (valid && !valid(groups)) {
+ wpa_printf(MSG_ERROR, "Line %d: Invalid %s '%s'",
+ line, name, value);
+ os_free(groups);
+ return -1;
}
- os_free(ssid->pasn_groups);
- ssid->pasn_groups = groups;
+
+ os_free(*dst);
+ *dst = groups;
return 0;
}
+#endif /* CONFIG_IEEE8021X_AUTH || CONFIG_PASN */
+
+
+#ifdef CONFIG_IEEE8021X_AUTH
+static int wpa_config_parse_ieee8021x_auth_groups(const struct parse_data *data,
+ struct wpa_ssid *ssid,
+ int line, const char *value)
+{
+ return wpa_config_parse_groups(data->name, line, value,
+ &ssid->ieee8021x_auth_groups,
+ wpa_802_1x_auth_groups_valid);
+}
+
+
+#ifndef NO_CONFIG_WRITE
+static char *
+wpa_config_write_ieee8021x_auth_groups(const struct parse_data *data,
+ struct wpa_ssid *ssid)
+{
+ return wpa_config_write_int_array(data, ssid->ieee8021x_auth_groups, 0);
+}
+#endif /* NO_CONFIG_WRITE */
+#endif /* CONFIG_IEEE8021X_AUTH */
+
+
+#ifdef CONFIG_PASN
+static int wpa_config_parse_pasn_groups(const struct parse_data *data,
+ struct wpa_ssid *ssid, int line,
+ const char *value)
+{
+ return wpa_config_parse_groups(data->name, line, value,
+ &ssid->pasn_groups, NULL);
+}
#ifndef NO_CONFIG_WRITE
@@ -3010,6 +3050,7 @@ static const struct parse_data ssid_fields[] = {
#endif /* CONFIG_PMKSA_PRIVACY */
#ifdef CONFIG_IEEE8021X_AUTH
{ INT_RANGE(eap_over_auth_frame, 0, 1)},
+ { FUNC(ieee8021x_auth_groups) },
#endif /* CONFIG_IEEE8021X_AUTH */
{ BOOL(drop_unicast_ip_in_l2_multicast)},
{ INT_RANGE(always_use_proxy_arp, 0, 2)},
@@ -3229,6 +3270,9 @@ void wpa_config_free_ssid(struct wpa_ssid *ssid)
#ifdef CONFIG_SAE
sae_deinit_pt(ssid->pt);
#endif /* CONFIG_SAE */
+#ifdef CONFIG_IEEE8021X_AUTH
+ os_free(ssid->ieee8021x_auth_groups);
+#endif /* CONFIG_IEEE8021X_AUTH */
#ifdef CONFIG_PASN
os_free(ssid->pasn_groups);
#endif /* CONFIG_PASN */
@@ -3363,6 +3407,9 @@ void wpa_config_free(struct wpa_config *config)
wpabuf_free(config->wps_nfc_dev_pw);
os_free(config->ext_password_backend);
os_free(config->sae_groups);
+#ifdef CONFIG_IEEE8021X_AUTH
+ os_free(config->ieee8021x_auth_groups);
+#endif /* CONFIG_IEEE8021X_AUTH */
#ifdef CONFIG_PASN
os_free(config->pasn_groups);
#endif /* CONFIG_PASN */
@@ -5597,6 +5644,19 @@ static int wpa_config_process_sae_groups(
}
+#ifdef CONFIG_IEEE8021X_AUTH
+static int
+wpa_config_process_ieee8021x_auth_groups(const struct global_parse_data *data,
+ struct wpa_config *config,
+ int line, const char *pos)
+{
+ return wpa_config_parse_groups(data->name, line, pos,
+ &config->ieee8021x_auth_groups,
+ wpa_802_1x_auth_groups_valid);
+}
+#endif /* CONFIG_IEEE8021X_AUTH */
+
+
#ifdef CONFIG_PASN
static int wpa_config_process_pasn_groups(
const struct global_parse_data *data,
@@ -6064,6 +6124,9 @@ static const struct global_parse_data global_fields[] = {
#endif /* CONFIG_WNM */
{ INT_RANGE(wowlan_disconnect_on_deinit, 0, 1), 0},
{ INT_RANGE(rsn_overriding, 0, 2), 0},
+#ifdef CONFIG_IEEE8021X_AUTH
+ { FUNC(ieee8021x_auth_groups), 0 },
+#endif /* CONFIG_IEEE8021X_AUTH */
#ifdef CONFIG_PASN
{ FUNC(pasn_groups), 0 },
#ifdef CONFIG_TESTING_OPTIONS
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index abc7d74b39..d45bb9b444 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1833,6 +1833,18 @@ struct wpa_config {
*/
enum wpas_rsn_overriding rsn_overriding;
+#ifdef CONFIG_IEEE8021X_AUTH
+ /**
+ * ieee8021x_auth_groups - Preference list of groups for IEEE 802.1X
+ * authentication utilizing Authentication frames. This is a
+ * zero-terminated array.
+ *
+ * The first group is used. If not set, group 19 is used. The
+ * per-network parameter takes precedence. Not used with PQC AKMs.
+ */
+ int *ieee8021x_auth_groups;
+#endif /* CONFIG_IEEE8021X_AUTH */
+
#ifdef CONFIG_PASN
/**
* pasn_groups - Preference list of enabled groups for PASN
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index b01134945e..9c4d4aba67 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -771,6 +771,22 @@ static void write_mka_ckn(FILE *f, struct wpa_ssid *ssid)
#endif /* CONFIG_MACSEC */
+#ifdef CONFIG_IEEE8021X_AUTH
+
+static void write_ieee8021x_auth_groups(FILE *f, struct wpa_ssid *ssid)
+{
+ char *value = wpa_config_get(ssid, "ieee8021x_auth_groups");
+
+ if (!value)
+ return;
+
+ fprintf(f, "\tieee8021x_auth_groups=%s\n", value);
+ os_free(value);
+}
+
+#endif /* CONFIG_IEEE8021X_AUTH */
+
+
#ifdef CONFIG_PASN
static void write_pasn_groups(FILE *f, struct wpa_ssid *ssid)
{
@@ -1069,6 +1085,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid,
#endif /* CONFIG_PMKSA_PRIVACY */
#ifdef CONFIG_IEEE8021X_AUTH
INT(eap_over_auth_frame);
+ write_ieee8021x_auth_groups(f, ssid);
#endif /* CONFIG_IEEE8021X_AUTH */
INT_DEF(drop_unicast_ip_in_l2_multicast, 1);
INT_DEF(always_use_proxy_arp, 0);
@@ -1289,6 +1306,22 @@ static void write_global_bin(FILE *f, const char *field,
}
+#if defined(CONFIG_IEEE8021X_AUTH) || defined(CONFIG_PASN)
+static void write_global_groups(FILE *f, const char *field, const int *groups)
+{
+ int i;
+
+ if (!groups)
+ return;
+
+ fprintf(f, "%s=", field);
+ for (i = 0; groups[i] > 0; i++)
+ fprintf(f, "%s%d", i > 0 ? " " : "", groups[i]);
+ fprintf(f, "\n");
+}
+#endif /* CONFIG_IEEE8021X_AUTH || CONFIG_PASN */
+
+
static void wpa_config_write_global(FILE *f, struct wpa_config *config)
{
#ifdef CONFIG_CTRL_IFACE
@@ -1846,17 +1879,13 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
if (config->security_profiles != DEFAULT_SECURITY_PROFILES)
fprintf(f, "security_profiles=%d\n", config->security_profiles);
-#ifdef CONFIG_PASN
- if (config->pasn_groups) {
- int i;
+#ifdef CONFIG_IEEE8021X_AUTH
+ write_global_groups(f, "ieee8021x_auth_groups",
+ config->ieee8021x_auth_groups);
+#endif /* CONFIG_IEEE8021X_AUTH */
- fprintf(f, "pasn_groups=");
- for (i = 0; config->pasn_groups[i] > 0; i++) {
- fprintf(f, "%s%d", i > 0 ? " " : "",
- config->pasn_groups[i]);
- }
- fprintf(f, "\n");
- }
+#ifdef CONFIG_PASN
+ write_global_groups(f, "pasn_groups", config->pasn_groups);
#endif /* CONFIG_PASN */
}
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 86bd8d6172..b4a450352d 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -1390,6 +1390,16 @@ struct wpa_ssid {
*/
int always_use_proxy_arp;
+#ifdef CONFIG_IEEE8021X_AUTH
+ /**
+ * ieee8021x_auth_groups - Preference list of groups for IEEE 802.1X
+ * authentication utilizing Authentication frames
+ *
+ * If not set, the global ieee8021x_auth_groups parameter is used.
+ */
+ int *ieee8021x_auth_groups;
+#endif /* CONFIG_IEEE8021X_AUTH */
+
#ifdef CONFIG_PASN
/**
* pasn_groups - Preference list of enabled groups for PASN
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index d50a4ecbc6..d7d4407c1b 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -536,6 +536,21 @@ static void sme_802_1x_auth_data_free(struct wpa_supplicant *wpa_s)
}
+static int sme_802_1x_dh_group(struct wpa_supplicant *wpa_s, bool external)
+{
+ struct wpa_ssid *ssid = external ? wpa_s->sme.ext_auth_wpa_ssid :
+ wpa_s->current_ssid;
+ const int *groups = ssid && ssid->ieee8021x_auth_groups ?
+ ssid->ieee8021x_auth_groups :
+ wpa_s->conf->ieee8021x_auth_groups;
+
+ if (groups && groups[0] > 0)
+ return groups[0];
+
+ return 19;
+}
+
+
static int sme_init_802_1x_for_ptk(struct wpa_supplicant *wpa_s, bool external)
{
struct auth_802_1x_data *auth_1x = wpa_s->auth_1x;
@@ -584,8 +599,7 @@ static int sme_init_802_1x_for_ptk(struct wpa_supplicant *wpa_s, bool external)
goto fail;
#endif /* CONFIG_PQC */
} else {
- /* TODO: Add support for other groups */
- auth_1x->dh_group = 19;
+ auth_1x->dh_group = sme_802_1x_dh_group(wpa_s, external);
}
/* Initialize ECDH for Diffie-Hellman Parameter element.
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index 4fc3cca529..4032f9c9da 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -509,6 +509,14 @@ fast_reauth=1
# regardless of the sae_pwe parameter value.
#sae_pwe=0
+# Finite cyclic groups for IEEE 802.1X authentication utilizing Authentication
+# frames as a space separated list in order of preference. The first group is
+# used for the Diffie-Hellman Parameter element. The default is group 19.
+# A network block parameter with the same name takes precedence.
+# Only the ECC groups 19, 20 and 21 are supported. Not used with PQC AKMs, for
+# which the PQC security profile defines the group.
+#ieee8021x_auth_groups=19
+
# Default value for DTIM period (if not overridden in network block)
#dtim_period=2
--
2.56.1
More information about the Hostap
mailing list