]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Do not allow password identifier to be used without H2E
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 1 Nov 2024 10:06:10 +0000 (12:06 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 1 Nov 2024 10:36:09 +0000 (12:36 +0200)
When the concept of SAE password identifiers was introduced in IEEE
P802.11REVme/D1.0, there was no requirement to use H2E with them.
However, this was changed for the published IEEE Std 802.11-2020 to
require H2E to avoid certain cases where the password identifier could
not have been parsed robustly.

Commit e36a5894d0c0 ("SAE: Use H2E whenever Password Identifier is
used") started forcing H2E to be used when password identifiers were in
use with SAE. However, it did not enforce rejection of cases where H2E
was not enabled by a non-compliant implementation. Add that explicit
check during parsing of SAE commit messages.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/common/sae.c

index 6b06473e1e96e810cb188e8c48ade437d9845c71..ce282db6b535d2e4639abd658a6d9f75aee896f7 100644 (file)
@@ -2049,7 +2049,7 @@ static u16 sae_parse_commit_element(struct sae_data *sae, const u8 **pos,
 }
 
 
-static int sae_parse_password_identifier(struct sae_data *sae,
+static int sae_parse_password_identifier(struct sae_data *sae, bool h2e,
                                         const u8 **pos, const u8 *end)
 {
        const u8 *epos;
@@ -2075,6 +2075,12 @@ static int sae_parse_password_identifier(struct sae_data *sae,
        epos++; /* skip ext ID */
        len--;
 
+       if (!h2e) {
+               wpa_printf(MSG_DEBUG,
+                          "SAE: Password Identifier included, but H2E is not used");
+               return WLAN_STATUS_UNKNOWN_PASSWORD_IDENTIFIER;
+       }
+
        if (sae->no_pw_id) {
                wpa_printf(MSG_DEBUG,
                           "SAE: Password Identifier included, but none has been enabled");
@@ -2205,7 +2211,7 @@ u16 sae_parse_commit(struct sae_data *sae, const u8 *data, size_t len,
                            pos, end - pos);
 
        /* Optional Password Identifier element */
-       res = sae_parse_password_identifier(sae, &pos, end);
+       res = sae_parse_password_identifier(sae, h2e, &pos, end);
        if (res != WLAN_STATUS_SUCCESS)
                return res;