From 21ac680eac0f60896a2713a662f352a3eae8cdeb Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 9 Oct 2023 08:55:55 +0530 Subject: [PATCH] feat(wifi): Pull in wpa_supplicant upstream code for SAE EXT key SAE: Internal WPA_KEY_MGMT_* defines for extended key AKMs Define new WPA_KEY_MGMT_* values for the new SAE AKM suite selectors with variable length keys. This includes updates to various mapping and checking of the SAE key_mgmt values. Signed-off-by: Jouni Malinen --- components/wpa_supplicant/src/common/defs.h | 8 ++++++++ components/wpa_supplicant/src/common/wpa_common.c | 4 ++++ components/wpa_supplicant/src/rsn_supp/wpa_ie.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/components/wpa_supplicant/src/common/defs.h b/components/wpa_supplicant/src/common/defs.h index 6799370dec..36d37d6e6a 100644 --- a/components/wpa_supplicant/src/common/defs.h +++ b/components/wpa_supplicant/src/common/defs.h @@ -48,6 +48,7 @@ typedef enum { FALSE = 0, TRUE = 1 } Boolean; #define WPA_KEY_MGMT_IEEE8021X_SUITE_B BIT(16) #define WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 BIT(17) #define WPA_KEY_MGMT_OWE BIT(22) +#define WPA_KEY_MGMT_SAE_EXT_KEY BIT(26) static inline int wpa_key_mgmt_wpa_ieee8021x(int akm) { @@ -70,6 +71,7 @@ static inline int wpa_key_mgmt_wpa_psk(int akm) WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_PSK_SHA256 | WPA_KEY_MGMT_SAE | + WPA_KEY_MGMT_SAE_EXT_KEY | WPA_KEY_MGMT_FT_SAE)); } @@ -83,9 +85,15 @@ static inline int wpa_key_mgmt_ft(int akm) static inline int wpa_key_mgmt_sae(int akm) { return !!(akm & (WPA_KEY_MGMT_SAE | + WPA_KEY_MGMT_SAE_EXT_KEY | WPA_KEY_MGMT_FT_SAE)); } +static inline int wpa_key_mgmt_sae_ext_key(int akm) +{ + return !!(akm & (WPA_KEY_MGMT_SAE_EXT_KEY)); +} + static inline int wpa_key_mgmt_sha256(int akm) { return !!(akm & (WPA_KEY_MGMT_PSK_SHA256 | diff --git a/components/wpa_supplicant/src/common/wpa_common.c b/components/wpa_supplicant/src/common/wpa_common.c index cbf1fa630f..f1b302191b 100644 --- a/components/wpa_supplicant/src/common/wpa_common.c +++ b/components/wpa_supplicant/src/common/wpa_common.c @@ -335,6 +335,8 @@ static int rsn_key_mgmt_to_bitfield(const u8 *s) #ifdef CONFIG_WPA3_SAE if (RSN_SELECTOR_GET(s) == RSN_AUTH_KEY_MGMT_SAE) return WPA_KEY_MGMT_SAE; + if (RSN_SELECTOR_GET(s) == RSN_AUTH_KEY_MGMT_SAE_EXT_KEY) + return WPA_KEY_MGMT_SAE_EXT_KEY; #endif /* CONFIG_WPA3_SAE */ #ifdef CONFIG_OWE_STA if(RSN_SELECTOR_GET(s) == RSN_AUTH_KEY_MGMT_OWE) @@ -969,6 +971,8 @@ u32 wpa_akm_to_suite(int akm) return RSN_AUTH_KEY_MGMT_802_1X_SUITE_B_192; if (akm & WPA_KEY_MGMT_SAE) return RSN_AUTH_KEY_MGMT_SAE; + if (akm & WPA_KEY_MGMT_SAE_EXT_KEY) + return RSN_AUTH_KEY_MGMT_SAE_EXT_KEY; if (akm & WPA_KEY_MGMT_FT_SAE) return RSN_AUTH_KEY_MGMT_FT_SAE; if (akm & WPA_KEY_MGMT_OWE) diff --git a/components/wpa_supplicant/src/rsn_supp/wpa_ie.c b/components/wpa_supplicant/src/rsn_supp/wpa_ie.c index 2fc2307d71..34969aee6c 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa_ie.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa_ie.c @@ -191,6 +191,8 @@ static int wpa_gen_wpa_ie_rsn(u8 *rsn_ie, size_t rsn_ie_len, #ifdef CONFIG_WPA3_SAE } else if (key_mgmt == WPA_KEY_MGMT_SAE) { RSN_SELECTOR_PUT(pos, RSN_AUTH_KEY_MGMT_SAE); + } else if (key_mgmt == WPA_KEY_MGMT_SAE_EXT_KEY) { + RSN_SELECTOR_PUT(pos, RSN_AUTH_KEY_MGMT_SAE_EXT_KEY); #endif /* CONFIG_WPA3_SAE */ #ifdef CONFIG_OWE_STA } else if (key_mgmt == WPA_KEY_MGMT_OWE) {