diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 605d40863..22dd542f3 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -737,7 +737,8 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm, kde_buf = os_malloc(kde_len + 2 + RSN_SELECTOR_LEN + 3 + sm->assoc_rsnxe_len + - 2 + RSN_SELECTOR_LEN + 1); + 2 + RSN_SELECTOR_LEN + 1 + + 2 + RSN_SELECTOR_LEN + 2); if (!kde_buf) goto failed; os_memcpy(kde_buf, kde, kde_len); @@ -782,6 +783,27 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm, } #endif /* CONFIG_P2P */ +#ifdef CONFIG_DPP2 + if (sm->key_mgmt == WPA_KEY_MGMT_DPP) { + u8 *pos; + + wpa_printf(MSG_DEBUG, "DPP: Add DPP KDE into EAPOL-Key 2/4"); + pos = kde + kde_len; + *pos++ = WLAN_EID_VENDOR_SPECIFIC; + *pos++ = RSN_SELECTOR_LEN + 2; + RSN_SELECTOR_PUT(pos, WFA_KEY_DATA_DPP); + pos += RSN_SELECTOR_LEN; + *pos++ = 2; /* Protocol Version */ + *pos = 0; /* Flags */ + if (sm->dpp_pfs == 0) + *pos |= DPP_KDE_PFS_ALLOWED; + else if (sm->dpp_pfs == 1) + *pos |= DPP_KDE_PFS_ALLOWED | DPP_KDE_PFS_REQUIRED; + pos++; + kde_len = pos - kde; + } +#endif /* CONFIG_DPP2 */ + if (wpa_supplicant_send_2_of_4(sm, sm->bssid, key, ver, sm->snonce, kde, kde_len, ptk) < 0) goto failed; @@ -3255,6 +3277,11 @@ int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param, sm->ft_rsnxe_used = value; break; #endif /* CONFIG_TESTING_OPTIONS */ +#ifdef CONFIG_DPP2 + case WPA_PARAM_DPP_PFS: + sm->dpp_pfs = value; + break; +#endif /* CONFIG_DPP2 */ default: break; } diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index 0986c6c61..dfc156b55 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -107,6 +107,7 @@ enum wpa_sm_conf_params { WPA_PARAM_EXT_KEY_ID, WPA_PARAM_USE_EXT_KEY_ID, WPA_PARAM_FT_RSNXE_USED, + WPA_PARAM_DPP_PFS, }; struct rsn_supp_config { diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h index 497d12885..f7d9f6255 100644 --- a/src/rsn_supp/wpa_i.h +++ b/src/rsn_supp/wpa_i.h @@ -183,6 +183,7 @@ struct wpa_sm { #ifdef CONFIG_DPP2 struct wpabuf *dpp_z; + int dpp_pfs; #endif /* CONFIG_DPP2 */ }; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index bac3d9796..53f8c9466 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1685,6 +1685,9 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s, } else if (wpa_s->key_mgmt == WPA_KEY_MGMT_DPP) { /* Use PMK from DPP network introduction (PMKSA entry) */ wpa_sm_set_pmk_from_pmksa(wpa_s->wpa); +#ifdef CONFIG_DPP2 + wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_DPP_PFS, ssid->dpp_pfs); +#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP */ } else if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt)) { int psk_set = 0;