]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Fix PMK length and passphrase-based key derivation for FT
authorJouni Malinen <jouni@codeaurora.org>
Thu, 14 Oct 2021 13:28:02 +0000 (16:28 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 14 Oct 2021 13:28:02 +0000 (16:28 +0300)
The change to support variable length PMK in wlantest missed couple of
places where the PMK length did not get used or set properly. In
particular, this ended up breaking FT key derivation for the case where
a passphrase was used to derive a potential per-BSS PMK. Fix this by
setting and using the PMK length properly.

Fixes: 6c29d95a9062 ("wlantest: Support variable length PMK")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wlantest/bss.c
wlantest/rx_eapol.c

index 1834aecba199a58d1f139951c111bdbe7466fece..4fc0b17a7bdde7751faee4e8d0a0f7cdf672ee49 100644 (file)
@@ -102,6 +102,7 @@ int bss_add_pmk_from_passphrase(struct wlantest_bss *bss,
                   " based on passphrase '%s'",
                   MAC2STR(bss->bssid), passphrase);
        wpa_hexdump(MSG_DEBUG, "Possible PMK", pmk->pmk, PMK_LEN);
+       pmk->pmk_len = PMK_LEN;
        dl_list_add(&bss->pmk, &pmk->list);
 
        return 0;
index e754f5ff928e12c0e7734ee4df346967003aa9af..967d52199561bb994f85f5b68d505380af0a82a7 100644 (file)
@@ -124,7 +124,7 @@ static int try_pmk(struct wlantest *wt, struct wlantest_bss *bss,
                    check_mic(ptk.kck, ptk.kck_len, sta->key_mgmt, ver, data,
                              len) < 0)
                        return -1;
-       } else if (wpa_pmk_to_ptk(pmk->pmk, PMK_LEN,
+       } else if (wpa_pmk_to_ptk(pmk->pmk, pmk->pmk_len,
                                  "Pairwise key expansion",
                                  bss->bssid, sta->addr, sta->anonce,
                                  sta->snonce, &ptk, sta->key_mgmt,