From f5ad97245501a66f1072074731f75434663bd5ee Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 7 Apr 2022 00:44:46 +0300 Subject: [PATCH] PASN: Fix build without CONFIG_TESTING_OPTIONS=y force_kdk_derivation is defined within CONFIG_TESTING_OPTIONS, so need to use matching condition when accessing it. Signed-off-by: Jouni Malinen --- src/ap/ieee802_11.c | 13 +++++++++---- wpa_supplicant/pasn_supplicant.c | 12 +++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 15fdcbd62..d2b718974 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -3121,6 +3121,7 @@ static void handle_auth_pasn_1(struct hostapd_data *hapd, struct sta_info *sta, int ret, inc_y; bool derive_keys; u32 i; + bool derive_kdk; if (!groups) groups = default_groups; @@ -3160,10 +3161,14 @@ static void handle_auth_pasn_1(struct hostapd_data *hapd, struct sta_info *sta, sta->pasn->akmp = rsn_data.key_mgmt; sta->pasn->cipher = rsn_data.pairwise_cipher; - if (hapd->conf->force_kdk_derivation || - ((hapd->iface->drv_flags2 & WPA_DRIVER_FLAGS2_SEC_LTF) && - ieee802_11_rsnx_capab_len(elems.rsnxe, elems.rsnxe_len, - WLAN_RSNX_CAPAB_SECURE_LTF))) + derive_kdk = (hapd->iface->drv_flags2 & WPA_DRIVER_FLAGS2_SEC_LTF) && + ieee802_11_rsnx_capab_len(elems.rsnxe, elems.rsnxe_len, + WLAN_RSNX_CAPAB_SECURE_LTF); +#ifdef CONFIG_TESTING_OPTIONS + if (!derive_kdk) + derive_kdk = hapd->conf->force_kdk_derivation; +#endif /* CONFIG_TESTING_OPTIONS */ + if (derive_kdk) sta->pasn->kdk_len = WPA_KDK_MAX_LEN; else sta->pasn->kdk_len = 0; diff --git a/wpa_supplicant/pasn_supplicant.c b/wpa_supplicant/pasn_supplicant.c index baf4c2643..dc21b6a3c 100644 --- a/wpa_supplicant/pasn_supplicant.c +++ b/wpa_supplicant/pasn_supplicant.c @@ -1000,6 +1000,7 @@ static int wpas_pasn_start(struct wpa_supplicant *wpa_s, const u8 *bssid, struct wpa_ssid *ssid = NULL; struct wpabuf *frame; int ret; + bool derive_kdk; /* TODO: Currently support only ECC groups */ if (!dragonfly_suitable_group(group, 1)) { @@ -1079,9 +1080,14 @@ static int wpas_pasn_start(struct wpa_supplicant *wpa_s, const u8 *bssid, pasn->group = group; pasn->freq = freq; - if (wpa_s->conf->force_kdk_derivation || - (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SEC_LTF && - ieee802_11_rsnx_capab(beacon_rsnxe, WLAN_RSNX_CAPAB_SECURE_LTF))) + derive_kdk = (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SEC_LTF) && + ieee802_11_rsnx_capab(beacon_rsnxe, + WLAN_RSNX_CAPAB_SECURE_LTF); +#ifdef CONFIG_TESTING_OPTIONS + if (!derive_kdk) + derive_kdk = wpa_s->conf->force_kdk_derivation; +#endif /* CONFIG_TESTING_OPTIONS */ + if (derive_kdk) pasn->kdk_len = WPA_KDK_MAX_LEN; else pasn->kdk_len = 0;