Skip to contentSkip to conversation

fils: support OCI in reassociation

PATCH In review James Prestwood 2 participants 10 messages Sep 28, 2021

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/9 fils: support OCI in reassociation

---
 src/fils.c   | 35 +++++++++++++++++++++++++++++++++--
 src/fils.h   |  2 ++
 src/netdev.c |  1 +
 3 files changed, 36 insertions(+), 2 deletions(-)
src/fils.c +33 -2
index f661f1bf..c05281bb 100644
@@ -37,6 +37,7 @@
 #include "src/missing.h"
 #include "src/erp.h"
 #include "src/auth-proto.h"
+#include "src/band.h"
 
 #define FILS_NONCE_LEN		16
 #define FILS_SESSION_LEN	8
@@ -49,6 +50,7 @@ struct fils_sm {
 
 	fils_tx_authenticate_func_t auth;
 	fils_tx_associate_func_t assoc;
+	fils_get_oci_func_t get_oci;
 
 	uint8_t nonce[FILS_NONCE_LEN];
 	uint8_t anonce[FILS_NONCE_LEN];
@@ -148,12 +150,13 @@ static int fils_derive_key_data(struct fils_sm *fils)
 	uint8_t data[44];
 	uint8_t *ptr = data;
 	size_t hash_len;
-	struct iovec iov[4];
+	struct iovec iov[5];
 	size_t iov_elems = 0;
 	size_t fils_ft_len = 0;
 	bool sha384;
 	size_t ie_len;
 	uint8_t *rsne = NULL;
+	uint8_t oci[6];
 
 	rmsk = erp_get_rmsk(fils->erp, &rmsk_len);
 
@@ -302,6 +305,23 @@ static int fils_derive_key_data(struct fils_sm *fils)
 		iov_elems += 1;
 	}
 
+	/*
+	 * IEEE 802.11 Section 12.11.2.6.2
+	 * "If dot11RSNAOperatingChannelValidationActivated is true and AP
+	 * indicates OCVC capability, the STA shall include OCI element in the
+	 * request"
+	 */
+	if (fils->hs->supplicant_ocvc && fils->hs->chandef) {
+		oci[0] = IE_TYPE_EXTENSION;
+		oci[1] = 4;
+		oci[2] = IE_TYPE_OCI & 0xff;
+		oci_from_chandef(fils->hs->chandef, oci + 3);
+
+		iov[iov_elems].iov_base = oci;
+		iov[iov_elems].iov_len = 6;
+		iov_elems++;
+	}
+
 	memcpy(data, fils->nonce, sizeof(fils->nonce));
 	memcpy(data + sizeof(fils->nonce), fils->anonce, sizeof(fils->anonce));
 
@@ -436,12 +456,20 @@ static int fils_rx_authenticate(struct auth_proto *driver, const uint8_t *frame,
 	if (erp_rx_packet(fils->erp, wrapped, wrapped_len) < 0)
 		goto invalid_ies;
 
-	return fils_derive_key_data(fils);
+	return fils->get_oci(fils->user_data);
+
 
 invalid_ies:
 	return MMPDU_STATUS_CODE_INVALID_ELEMENT;
 }
 
+static int fils_rx_oci(struct auth_proto *driver)
+{
+	struct fils_sm *fils = l_container_of(driver, struct fils_sm, ap);
+
+	return fils_derive_key_data(fils);
+}
+
 static int fils_rx_associate(struct auth_proto *driver, const uint8_t *frame,
 				size_t len)
 {
@@ -564,6 +592,7 @@ invalid_ies:
 struct auth_proto *fils_sm_new(struct handshake_state *hs,
 				fils_tx_authenticate_func_t auth,
 				fils_tx_associate_func_t assoc,
+				fils_get_oci_func_t get_oci,
 				void *user_data)
 {
 	struct fils_sm *fils;
@@ -572,11 +601,13 @@ struct auth_proto *fils_sm_new(struct handshake_state *hs,
 
 	fils->auth = auth;
 	fils->assoc = assoc;
+	fils->get_oci = get_oci;
 	fils->user_data = user_data;
 	fils->hs = hs;
 
 	fils->ap.start = fils_start;
 	fils->ap.free = fils_free;
+	fils->ap.rx_oci = fils_rx_oci;
 	fils->ap.rx_authenticate = fils_rx_authenticate;
 	fils->ap.rx_associate = fils_rx_associate;
 
src/fils.h +2 -0
index f9e83d94..3da4ee4e 100644
@@ -30,8 +30,10 @@ typedef void (*fils_tx_associate_func_t)(struct iovec *iov, size_t iov_len,
 					const uint8_t *kek, size_t kek_len,
 					const uint8_t *nonces, size_t nonces_len,
 					void *user_data);
+typedef int (*fils_get_oci_func_t)(void *user_data);
 
 struct auth_proto *fils_sm_new(struct handshake_state *hs,
 				fils_tx_authenticate_func_t auth,
 				fils_tx_associate_func_t assoc,
+				fils_get_oci_func_t get_oci,
 				void *user_data);
src/netdev.c +1 -0
index 91fffeb3..38598259 100644
@@ -3689,6 +3689,7 @@ static void netdev_connect_common(struct netdev *netdev,
 	case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
 		netdev->ap = fils_sm_new(hs, netdev_fils_tx_authenticate,
 						netdev_fils_tx_associate,
+						netdev_get_oci,
 						netdev);
 		break;
 	default:
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/9 station: start FT-over-DS actions after roaming

Once roamed IWD never sent out any FT Request frames. This prevented FT-over-DS from being used after an initial roam.

---
 src/station.c | 149 +++++++++++++++++++++++++-------------------------
 1 file changed, 74 insertions(+), 75 deletions(-)
src/station.c +74 -75
index 2e7fd0f9..f12cdde5 100644
@@ -1729,6 +1729,77 @@ static void station_early_neighbor_report_cb(struct netdev *netdev, int err,
 				&station->roam_freqs);
 }
 
+static bool station_can_fast_transition(struct handshake_state *hs,
+					struct scan_bss *bss)
+{
+	uint16_t mdid;
+
+	if (!hs->mde)
+		return false;
+
+	if (ie_parse_mobility_domain_from_data(hs->mde, hs->mde[1] + 2,
+						&mdid, NULL, NULL) < 0)
+		return false;
+
+	if (!(bss->mde_present && l_get_le16(bss->mde) == mdid))
+		return false;
+
+	if (hs->supplicant_ie != NULL) {
+		struct ie_rsn_info rsn_info;
+
+		if (!IE_AKM_IS_FT(hs->akm_suite))
+			return false;
+
+		if (scan_bss_get_rsn_info(bss, &rsn_info) < 0)
+			return false;
+
+		if (!IE_AKM_IS_FT(rsn_info.akm_suites))
+			return false;
+	}
+
+	return true;
+}
+
+static void station_ft_ds_action_start(struct station *station)
+{
+	struct handshake_state *hs = netdev_get_handshake(station->netdev);
+	uint16_t mdid;
+	const struct l_queue_entry *entry;
+	struct scan_bss *bss;
+	struct ie_rsn_info rsn_info;
+
+	if (!station_can_fast_transition(hs, station->connected_bss) ||
+						!(hs->mde[4] & 1))
+		return;
+
+	if (ie_parse_mobility_domain_from_data(hs->mde, hs->mde[1] + 2,
+						&mdid, NULL, NULL) < 0)
+		return;
+
+	for (entry = network_bss_list_get_entries(station->connected_network);
+						entry; entry = entry->next) {
+		bss = entry->data;
+
+		if (bss == station->connected_bss)
+			continue;
+
+		if (mdid != l_get_le16(bss->mde))
+			continue;
+
+		if (scan_bss_get_rsn_info(bss, &rsn_info) < 0)
+			continue;
+
+		if (!IE_AKM_IS_FT(rsn_info.akm_suites))
+			continue;
+
+		/*
+		* Fire and forget. Netdev will maintain a cache of responses and
+		* when the time comes these can be referenced for a roam
+		*/
+		netdev_fast_transition_over_ds_action(station->netdev, bss);
+	}
+}
+
 static void station_roamed(struct station *station)
 {
 	station->roam_scan_full = false;
@@ -1754,6 +1825,8 @@ static void station_roamed(struct station *station)
 			l_warn("Could not request neighbor report");
 	}
 
+	station_ft_ds_action_start(station);
+
 	station_enter_state(station, STATION_STATE_CONNECTED);
 }
 
@@ -1957,37 +2030,6 @@ static void station_preauthenticate_cb(struct netdev *netdev,
 	station_transition_reassociate(station, bss, new_hs);
 }
 
-static bool station_can_fast_transition(struct handshake_state *hs,
-					struct scan_bss *bss)
-{
-	uint16_t mdid;
-
-	if (!hs->mde)
-		return false;
-
-	if (ie_parse_mobility_domain_from_data(hs->mde, hs->mde[1] + 2,
-						&mdid, NULL, NULL) < 0)
-		return false;
-
-	if (!(bss->mde_present && l_get_le16(bss->mde) == mdid))
-		return false;
-
-	if (hs->supplicant_ie != NULL) {
-		struct ie_rsn_info rsn_info;
-
-		if (!IE_AKM_IS_FT(hs->akm_suite))
-			return false;
-
-		if (scan_bss_get_rsn_info(bss, &rsn_info) < 0)
-			return false;
-
-		if (!IE_AKM_IS_FT(rsn_info.akm_suites))
-			return false;
-	}
-
-	return true;
-}
-
 static void station_transition_start(struct station *station,
 							struct scan_bss *bss)
 {
@@ -2624,36 +2666,6 @@ static bool station_retry_with_status(struct station *station,
 	return station_try_next_bss(station);
 }
 
-static void station_ft_ds_action_start(struct station *station, uint16_t mdid)
-{
-	const struct l_queue_entry *entry;
-	struct scan_bss *bss;
-	struct ie_rsn_info rsn_info;
-
-	for (entry = network_bss_list_get_entries(station->connected_network);
-						entry; entry = entry->next) {
-		bss = entry->data;
-
-		if (bss == station->connected_bss)
-			continue;
-
-		if (mdid != l_get_le16(bss->mde))
-			continue;
-
-		if (scan_bss_get_rsn_info(bss, &rsn_info) < 0)
-			continue;
-
-		if (!IE_AKM_IS_FT(rsn_info.akm_suites))
-			continue;
-
-		/*
-		* Fire and forget. Netdev will maintain a cache of responses and
-		* when the time comes these can be referenced for a roam
-		*/
-		netdev_fast_transition_over_ds_action(station->netdev, bss);
-	}
-}
-
 static void station_connect_ok(struct station *station)
 {
 	struct handshake_state *hs = netdev_get_handshake(station->netdev);
@@ -2677,20 +2689,7 @@ static void station_connect_ok(struct station *station)
 			l_warn("Could not request neighbor report");
 	}
 
-	/*
-	 * If this network supports FT-over-DS send initial action frames now
-	 * to prepare for future roams.
-	 */
-	if (station_can_fast_transition(hs, station->connected_bss) &&
-						(hs->mde[4] & 1)) {
-		uint16_t mdid;
-
-		if (ie_parse_mobility_domain_from_data(hs->mde, hs->mde[1] + 2,
-						&mdid, NULL, NULL) < 0)
-			return;
-
-		station_ft_ds_action_start(station, mdid);
-	}
+	station_ft_ds_action_start(station);
 
 	network_connected(station->connected_network);
 
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH 3/9 netdev: set result/status for deauth path

In reply to James Prestwood

If the deauth path was triggered IWD would deauth but end up calling the connect callback with whatever result netdev had set, e.g. 'NETDEV_RESULT_OK'. This, of course, caused station some confusion.

---
 src/netdev.c | 2 ++
 1 file changed, 2 insertions(+)
src/netdev.c +2 -0
index 38598259..bedc8377 100644
@@ -2621,6 +2621,8 @@ error:
 	return;
 
 deauth:
+	netdev->result = NETDEV_RESULT_ASSOCIATION_FAILED;
+	netdev->last_code = MMPDU_STATUS_CODE_UNSPECIFIED;
 	msg = netdev_build_cmd_deauthenticate(netdev,
 						MMPDU_REASON_CODE_UNSPECIFIED);
 	netdev->disconnect_cmd_id = l_genl_family_send(nl80211,
Signature · 1 line
2.31.1
author
#3 lore raw

PATCH 4/9 ft: netdev: store FT-over-DS target RSNE/WPA

In reply to James Prestwood

Keep track of the target BSS's authenticator IE for verification. It should not be assumed that the target BSS and original RSNE/WPA IE matches.

---
 src/ft.c     |  3 +++
 src/ft.h     |  1 +
 src/netdev.c | 10 ++++++++++
 3 files changed, 14 insertions(+)
src/ft.c +3 -0
index db09aacf..fecb4c0e 100644
@@ -616,6 +616,9 @@ void ft_ds_info_free(struct ft_ds_info *info)
 	if (info->fte)
 		l_free(info->fte);
 
+	if (info->authenticator_ie)
+		l_free(info->authenticator_ie);
+
 	if (destroy)
 		destroy(info);
 }
src/ft.h +1 -0
index a2fa8946..f90fc1b2 100644
@@ -36,6 +36,7 @@ struct ft_ds_info {
 	uint8_t snonce[32];
 	uint8_t mde[3];
 	uint8_t *fte;
+	uint8_t *authenticator_ie;
 
 	struct ie_ft_info ft_info;
 
src/netdev.c +10 -0
index bedc8377..603c339d 100644
@@ -4375,6 +4375,7 @@ int netdev_fast_transition_over_ds_action(struct netdev *netdev,
 	struct iovec iovs[5];
 	uint8_t buf[512];
 	size_t len;
+	const uint8_t *ap_ie = NULL;
 
 	if (!netdev->operational)
 		return -ENOTCONN;
@@ -4392,6 +4393,15 @@ int netdev_fast_transition_over_ds_action(struct netdev *netdev,
 	memcpy(info->super.spa, hs->spa, ETH_ALEN);
 	memcpy(info->super.aa, target_bss->addr, ETH_ALEN);
 	memcpy(info->super.mde, target_bss->mde, sizeof(info->super.mde));
+
+	if (target_bss->rsne)
+		ap_ie = target_bss->rsne;
+	else if (target_bss->wpa)
+		ap_ie = target_bss->wpa;
+
+	if (ap_ie)
+		info->super.authenticator_ie = l_memdup(ap_ie, ap_ie[1] + 2);
+
 	l_getrandom(info->super.snonce, 32);
 	info->super.free = netdev_ft_ds_info_free;
 
Signature · 1 line
2.31.1
#4 lore raw

Re: [PATCH 4/9] ft: netdev: store FT-over-DS target RSNE/WPA

Hi James,

Quoted 9 lines · James Prestwood

Keep track of the target BSS's authenticator IE for verification. It should not be assumed that the target BSS and original RSNE/WPA IE matches.

---
  src/ft.c     |  3 +++
  src/ft.h     |  1 +
  src/netdev.c | 10 ++++++++++
  3 files changed, 14 insertions(+)

<snip>

Quoted 7 lines
src/netdev.c +2 -0
@@ -4392,6 +4393,15 @@ int netdev_fast_transition_over_ds_action(struct netdev *netdev,
  	memcpy(info->super.spa, hs->spa, ETH_ALEN);
  	memcpy(info->super.aa, target_bss->addr, ETH_ALEN);
  	memcpy(info->super.mde, target_bss->mde, sizeof(info->super.mde));
+
+	if (target_bss->rsne)

src/netdev.c int netdev_fast_transition_over_ds_action(struct netdev *netdev, · line 4407

Quoted 10 lines
src/netdev.c +7 -0
+		ap_ie = target_bss->rsne;
+	else if (target_bss->wpa)
+		ap_ie = target_bss->wpa;
+
+	if (ap_ie)
+		info->super.authenticator_ie = l_memdup(ap_ie, ap_ie[1] + 2);
+
  	l_getrandom(info->super.snonce, 32);
  	info->super.free = netdev_ft_ds_info_free;
 

There's no FT in WPA, so the only way we get here is with RSNE or possibly Open.
So I simplified this slightly.

Patches 1-4 applied, thanks.

Regards,
-Denis

author
#5 lore raw

PATCH 5/9 ft: check authenticator_ie from ft_ds_info, not handshake

In reply to James Prestwood

The handshake contains the current BSS's RSNE/WPA which may differ from the FT-over-DS target. When verifying the target BSS's RSNE/WPA IE needs to be checked, not the current BSS.

---
 src/ft.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
src/ft.c +6 -4
index fecb4c0e..7a4b16f3 100644
@@ -354,6 +354,7 @@ static bool ft_verify_rsne(const uint8_t *rsne, const uint8_t *pmk_r0_name,
 }
 
 static int ft_parse_ies(struct handshake_state *hs,
+			const uint8_t *authenticator_ie,
 			const uint8_t *ies, size_t ies_len,
 			const uint8_t **mde_out,
 			const uint8_t **fte_out)
@@ -394,8 +395,7 @@ static int ft_parse_ies(struct handshake_state *hs,
 	is_rsn = hs->supplicant_ie != NULL;
 
 	if (is_rsn) {
-		if (!ft_verify_rsne(rsne, hs->pmk_r0_name,
-					hs->authenticator_ie))
+		if (!ft_verify_rsne(rsne, hs->pmk_r0_name, authenticator_ie))
 			goto ft_error;
 	} else if (rsne)
 		goto ft_error;
@@ -485,7 +485,8 @@ bool ft_over_ds_parse_action_ies(struct ft_ds_info *info,
 	const uint8_t *fte = NULL;
 	bool is_rsn = hs->supplicant_ie != NULL;
 
-	if (ft_parse_ies(hs, ies, ies_len, &mde, &fte) < 0)
+	if (ft_parse_ies(hs, info->authenticator_ie, ies, ies_len,
+				&mde, &fte) < 0)
 		return false;
 
 	if (!mde_equal(info->mde, mde))
@@ -516,7 +517,8 @@ static int ft_process_ies(struct handshake_state *hs, const uint8_t *ies,
 	if (!ies)
 		goto ft_error;
 
-	if (ft_parse_ies(hs, ies, ies_len, &mde, &fte) < 0)
+	if (ft_parse_ies(hs, hs->authenticator_ie, ies, ies_len,
+				&mde, &fte) < 0)
 		goto ft_error;
 
 	if (!mde_equal(hs->mde, mde))
Signature · 1 line
2.31.1
author
#6 lore raw

PATCH 6/9 eapol: include OCI in GTK 2/2

In reply to James Prestwood
---
 src/eapol.c | 32 +++++++++++++++++++++++++++-----
 src/eapol.h |  2 ++
 2 files changed, 29 insertions(+), 5 deletions(-)
src/eapol.c +27 -5
index 3127e066..85718ed1 100644
@@ -762,6 +762,8 @@ struct eapol_key *eapol_create_gtk_2_of_2(
 				enum eapol_protocol_version protocol,
 				enum eapol_key_descriptor_version version,
 				uint64_t key_replay_counter,
+				size_t extra_len,
+				const uint8_t *extra_data,
 				bool is_wpa, uint8_t wpa_key_id, size_t mic_len)
 {
 	uint8_t snonce[32];
@@ -770,7 +772,8 @@ struct eapol_key *eapol_create_gtk_2_of_2(
 	memset(snonce, 0, sizeof(snonce));
 	step2 = eapol_create_common(protocol, version, true,
 					key_replay_counter, snonce,
-					0, NULL, 0, is_wpa, mic_len);
+					extra_len, extra_data, 0, is_wpa,
+					mic_len);
 
 	if (!step2)
 		return step2;
@@ -1246,10 +1249,13 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,
 	}
 
 	/*
-	 * IEEE 802.11-2020 Section 12.7.6.3
-	 * "Additionally, contains an OCI KDE when
-	 *  dot11RSNAOperatingChannelValidationActivated is true on the
-	 *  Supplicant."
+	 * IEEE 802.11-2020 Section 12.7.7.3
+	 * "If dot11RSNAOperatingChannelValidationActivated is true and
+	 * Supplicant RSNE indicates OCVC capability, the Authenticator silently
+	 * discards message 2 if any of the following are true:
+	 *     - OCI KDE is missing in the message
+	 *     - Channel information in the OCI KDE does not match current
+	 *       operating channel parameters (see 12.2.9)"
 	 */
 	if (sm->handshake->supplicant_ocvc && sm->handshake->chandef) {
 		ies[ies_len++] = IE_TYPE_VENDOR_SPECIFIC;
@@ -2010,6 +2016,8 @@ static void eapol_handle_gtk_1_of_2(struct eapol_sm *sm,
 	uint16_t igtk_key_index;
 	const uint8_t *oci = NULL;
 	size_t oci_len;
+	uint8_t oci_out[9];
+
 
 	l_debug("ifindex=%u", hs->ifindex);
 
@@ -2068,6 +2076,19 @@ static void eapol_handle_gtk_1_of_2(struct eapol_sm *sm,
 	} else
 		igtk = NULL;
 
+	/*
+	 * IEEE 802.11-2020 Section 12.7.6.3
+	 * "Additionally, contains an OCI KDE when
+	 *  dot11RSNAOperatingChannelValidationActivated is true on the
+	 *  Supplicant."
+	 */
+	if (sm->handshake->supplicant_ocvc && sm->handshake->chandef) {
+		oci_out[0] = IE_TYPE_VENDOR_SPECIFIC;
+		oci_out[1] = 4 + 3;
+		l_put_be32(HANDSHAKE_KDE_OCI, oci_out + 2);
+		oci_from_chandef(sm->handshake->chandef, oci_out + 6);
+	}
+
 	/*
 	 * 802.11-2016, Section 12.7.7.2:
 	 * "
@@ -2089,6 +2110,7 @@ static void eapol_handle_gtk_1_of_2(struct eapol_sm *sm,
 	step2 = eapol_create_gtk_2_of_2(sm->protocol_version,
 					ek->key_descriptor_version,
 					sm->replay_counter,
+					oci_out[1] + 2, oci_out,
 					hs->wpa_ie, ek->wpa_key_id,
 					sm->mic_len);
 
src/eapol.h +2 -0
index a948c018..53ae6e8f 100644
@@ -95,6 +95,8 @@ struct eapol_key *eapol_create_gtk_2_of_2(
 				enum eapol_protocol_version protocol,
 				enum eapol_key_descriptor_version version,
 				uint64_t key_replay_counter,
+				size_t extra_len,
+				const uint8_t *extra_data,
 				bool is_wpa, uint8_t wpa_key_id,
 				size_t mic_len);
 
Signature · 1 line
2.31.1
author
#7 lore raw

PATCH 7/9 unit: update test-eapol with GTK API change

In reply to James Prestwood
---
 unit/test-eapol.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
unit/test-eapol.c +3 -2
index 470e0e9f..e1b6c96e 100644
@@ -1940,6 +1940,7 @@ static void eapol_wpa2_handshake_test(const void *data)
 	frame = eapol_create_gtk_2_of_2(EAPOL_PROTOCOL_VERSION_2004,
 				EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_SHA1_AES,
 				eapol_key_test_12.key_replay_counter,
+				0, NULL,
 				false, 0, 16);
 	assert(frame);
 	assert(eapol_calculate_mic(IE_RSN_AKM_SUITE_PSK, ptk, frame,
@@ -2061,8 +2062,8 @@ static void eapol_wpa_handshake_test(const void *data)
 
 	frame = eapol_create_gtk_2_of_2(EAPOL_PROTOCOL_VERSION_2004,
 				EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_MD5_ARC4,
-				eapol_key_test_18.key_replay_counter, true,
-				gtk_step1->wpa_key_id, 16);
+				eapol_key_test_18.key_replay_counter, 0, NULL,
+				true, gtk_step1->wpa_key_id, 16);
 	assert(frame);
 	assert(eapol_calculate_mic(IE_RSN_AKM_SUITE_PSK, ptk, frame,
 					mic, 16));
Signature · 1 line
2.31.1
author
#8 lore raw

PATCH 8/9 eapol: don't enforce PMKID on 1/4 if require_handshake is false

In reply to James Prestwood

FT/FILS handle their own PMK derivation but rekeys still require using the 4-way handshake. There is some ambiguity in the spec whether or not the PMKID needs to be included in message 1/4 and it appears that when rekeying after FT/FILS hostapd does not include a PMKID.

---
 src/eapol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/eapol.c +2 -1
index 85718ed1..f0b26ea0 100644
@@ -1147,7 +1147,8 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,
 	 * send no PMKID KDE.
 	 */
 	if (!sm->eap_exchanged && !sm->handshake->wpa_ie &&
-			rsn_info.num_pmkids) {
+			rsn_info.num_pmkids &&
+			sm->require_handshake) {
 		bool found = false;
 		int i;
 
Signature · 1 line
2.31.1
author
#9 lore raw

PATCH 9/9 eapol: netdev: allow rekeys using FT-FILS

In reply to James Prestwood

Rekeying was overlooked when implementing FT-FILS and there were many places where the AKM was never checked and the rekey was failing.

---
 src/eapol.c  | 16 ++++++++++++++--
 src/netdev.c |  5 +----
 2 files changed, 15 insertions(+), 6 deletions(-)
src/eapol.c +14 -2
index f0b26ea0..721ffc8d 100644
@@ -231,6 +231,11 @@ static size_t eapol_get_mic_length(enum ie_rsn_akm_suite akm, size_t pmk_len)
 			l_error("Invalid PMK length of %zu for OWE", pmk_len);
 			return 0;
 		}
+	case IE_RSN_AKM_SUITE_FILS_SHA256:
+	case IE_RSN_AKM_SUITE_FILS_SHA384:
+	case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
+	case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
+		return 0;
 	default:
 		return 16;
 	}
@@ -254,6 +259,8 @@ uint8_t *eapol_decrypt_key_data(enum ie_rsn_akm_suite akm, const uint8_t *kek,
 		switch (akm) {
 		case IE_RSN_AKM_SUITE_FILS_SHA256:
 		case IE_RSN_AKM_SUITE_FILS_SHA384:
+		case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
+		case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
 			if (key_data_len < 16)
 				return NULL;
 
@@ -329,13 +336,16 @@ uint8_t *eapol_decrypt_key_data(enum ie_rsn_akm_suite akm, const uint8_t *kek,
 			break;
 		case IE_RSN_AKM_SUITE_FILS_SHA256:
 		case IE_RSN_AKM_SUITE_FILS_SHA384:
+		case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
+		case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
 		{
 			struct iovec ad[1];
 
 			ad[0].iov_base = (void *)frame;
 			ad[0].iov_len = key_data - (const uint8_t *)frame;
 
-			if (akm == IE_RSN_AKM_SUITE_FILS_SHA256)
+			if (akm == IE_RSN_AKM_SUITE_FILS_SHA256 || akm ==
+					IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256)
 				kek_len = 32;
 			else
 				kek_len = 64;
@@ -1223,7 +1233,9 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,
 	if (sm->handshake->akm_suite &
 			(IE_RSN_AKM_SUITE_FT_OVER_8021X |
 			 IE_RSN_AKM_SUITE_FT_USING_PSK |
-			 IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256)) {
+			 IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256 |
+			 IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256 |
+			 IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384)) {
 		/*
 		 * Rebuild the RSNE to include the PMKR1Name and append
 		 * MDE + FTE.
src/netdev.c +1 -4
index 603c339d..01cc8477 100644
@@ -2565,10 +2565,7 @@ process_resp_ies:
 			netdev->owe_sm = NULL;
 		}
 
-		/* FILS handles its own FT key derivation */
-		if (fte && !(netdev->handshake->akm_suite &
-				(IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256 |
-				IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384))) {
+		if (fte) {
 			uint32_t kck_len =
 				handshake_state_get_kck_len(netdev->handshake);
 			/*
Signature · 1 line
2.31.1