]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FT: Derive PTK properly for rekeying with FT protocol
authorJouni Malinen <jouni@codeaurora.org>
Thu, 18 Apr 2019 15:17:07 +0000 (18:17 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 19 Apr 2019 08:45:13 +0000 (11:45 +0300)
Do not try to derive a PMK-R0 and PMK-R1 again for the case where an
association was started with FT protocol and PTK is rekeyed using 4-way
handshake. Instead, use the previously derived PMK-R1 to allow a new PTK
to be derived.

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

index 54ad2a4b892461d6c449fa3f16c4b7a5ef54a2e3..f2e028c1599e847474448e6152606ab149ddaff0 100644 (file)
@@ -2211,8 +2211,20 @@ static int wpa_derive_ptk(struct wpa_state_machine *sm, const u8 *snonce,
        size_t z_len = 0;
 
 #ifdef CONFIG_IEEE80211R_AP
-       if (wpa_key_mgmt_ft(sm->wpa_key_mgmt))
+       if (wpa_key_mgmt_ft(sm->wpa_key_mgmt)) {
+               if (sm->ft_completed) {
+                       u8 ptk_name[WPA_PMK_NAME_LEN];
+
+                       return wpa_pmk_r1_to_ptk(sm->pmk_r1, sm->pmk_r1_len,
+                                                sm->SNonce, sm->ANonce,
+                                                sm->addr, sm->wpa_auth->addr,
+                                                sm->pmk_r1_name,
+                                                ptk, ptk_name,
+                                                sm->wpa_key_mgmt,
+                                                sm->pairwise);
+               }
                return wpa_auth_derive_ptk_ft(sm, ptk);
+       }
 #endif /* CONFIG_IEEE80211R_AP */
 
 #ifdef CONFIG_DPP2