]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Make sure wpa_sm has correct PMK when PMKSA cache used by driver
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Thu, 13 Feb 2025 12:09:36 +0000 (17:39 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 13 Feb 2025 15:47:14 +0000 (17:47 +0200)
The PMK corresponding to the PMKSA cache entry used by the driver is
updated to wpa_sm only when the authorized flag set in the association
event data. In cases where the authorized flag is not set, i.e., initial
association or roam indication with 4-way handshake not completed by the
driver, the PMK is not updated and may be left at the default value
based on not yet known AKM and group. That would result in issues for
SAE-EXT-KEY cases where groups 20 or 21 are used since the Key MIC
length of the EAPOL-Key frames depends on the used PMK length. In
particular, wpa_sm needs to know the correct PMK length to determine the
Key MIC field length and the offset of the Key Data Length field
correctly in the EAPOL-Key msg 1/4. Otherwise, wpa_sm may fail to parse
the EAPOL-Key msg 1/4.

Fix this by always setting the PMK from the PMKSA entry corresponding to
the PMKID used by the driver in the (Re)Association Request frame to
wpa_sm.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
wpa_supplicant/events.c

index a6b25a86f2e67debd0303d6db98c7992879f1f72..cf8f0667cd036ad7007f02c68bbd1679f0de2188 100644 (file)
@@ -442,7 +442,7 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
 }
 
 
-static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s, bool authorized)
+static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s)
 {
        struct wpa_ie_data ie;
        int pmksa_set = -1;
@@ -467,8 +467,7 @@ static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s, bool authorized)
                                                    true);
                if (pmksa_set == 0) {
                        eapol_sm_notify_pmkid_attempt(wpa_s->eapol);
-                       if (authorized)
-                               wpa_sm_set_pmk_from_pmksa(wpa_s->wpa);
+                       wpa_sm_set_pmk_from_pmksa(wpa_s->wpa);
                        break;
                }
        }
@@ -3559,8 +3558,7 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
                        if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len))
                                break;
                        found = 1;
-                       wpa_find_assoc_pmkid(wpa_s,
-                                            data->assoc_info.authorized);
+                       wpa_find_assoc_pmkid(wpa_s);
                }
 #ifndef CONFIG_NO_WPA
                if (!found_x && p[0] == WLAN_EID_RSNX) {