]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE-PK: Fix password validation check for Sec
authorJouni Malinen <jouni@codeaurora.org>
Wed, 24 Jun 2020 22:18:30 +0000 (01:18 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 24 Jun 2020 22:39:45 +0000 (01:39 +0300)
The 0..3 value decoded from the password was not incremented to the
actual 2..5 range for Sec. This resulted in not properly detecting the
minimum password length.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/sae_pk.c

index b294312efde642d431da45c626a5feb006e82675..b1c35d100a7cdb4ff82092804bb6f6da87a8f610 100644 (file)
@@ -38,7 +38,7 @@ bool sae_pk_valid_password(const char *pw)
        idx = os_strchr(sae_pk_base32_table, pw[0]);
        if (!idx)
                return false;
-       sec = ((u8) ((idx - sae_pk_base32_table) & 0x1f)) >> 3;
+       sec = (((u8) ((idx - sae_pk_base32_table) & 0x1f)) >> 3) + 2;
        if ((sec == 2 && pw_len < 14) ||
            (sec == 3 && pw_len < 13) ||
            (sec == 4 && pw_len < 11) ||