From 3134bb13a8bd54975a514a6e46755234ec5831a2 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 5 Sep 2019 12:05:58 +0300 Subject: [PATCH] SAE: Advertise Extended RSN Capabilities when H2E is enabled Signed-off-by: Jouni Malinen --- src/ap/wpa_auth_i.h | 1 + src/ap/wpa_auth_ie.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/ap/wpa_auth_i.h b/src/ap/wpa_auth_i.h index 0d3ab27a2..f568a90c8 100644 --- a/src/ap/wpa_auth_i.h +++ b/src/ap/wpa_auth_i.h @@ -267,6 +267,7 @@ struct ft_remote_seq { int wpa_write_rsn_ie(struct wpa_auth_config *conf, u8 *buf, size_t len, const u8 *pmkid); +int wpa_write_rsnxe(struct wpa_auth_config *conf, u8 *buf, size_t len); void wpa_auth_logger(struct wpa_authenticator *wpa_auth, const u8 *addr, logger_level level, const char *txt); void wpa_auth_vlogger(struct wpa_authenticator *wpa_auth, const u8 *addr, diff --git a/src/ap/wpa_auth_ie.c b/src/ap/wpa_auth_ie.c index a285e2594..4b0e279dc 100644 --- a/src/ap/wpa_auth_ie.c +++ b/src/ap/wpa_auth_ie.c @@ -372,6 +372,26 @@ int wpa_write_rsn_ie(struct wpa_auth_config *conf, u8 *buf, size_t len, } +int wpa_write_rsnxe(struct wpa_auth_config *conf, u8 *buf, size_t len) +{ + u8 *pos = buf; + + if (conf->sae_pwe != 1 && conf->sae_pwe != 2) + return 0; /* no supported extended RSN capabilities */ + + if (len < 3) + return -1; + + *pos++ = WLAN_EID_RSNX; + *pos++ = 1; + /* bits 0-3 = 0 since only one octet of Extended RSN Capabilities is + * used for now */ + *pos++ = BIT(WLAN_RSNX_CAPAB_SAE_H2E); + + return pos - buf; +} + + static u8 * wpa_write_osen(struct wpa_auth_config *conf, u8 *eid) { u8 *len; @@ -456,6 +476,11 @@ int wpa_auth_gen_wpa_ie(struct wpa_authenticator *wpa_auth) if (res < 0) return res; pos += res; + res = wpa_write_rsnxe(&wpa_auth->conf, pos, + buf + sizeof(buf) - pos); + if (res < 0) + return res; + pos += res; } #ifdef CONFIG_IEEE80211R_AP if (wpa_key_mgmt_ft(wpa_auth->conf.wpa_key_mgmt)) {