public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: James Prestwood <prestwoj@gmail.com>, iwd@lists.linux.dev
Subject: Re: [PATCH v2 4/9] ft: add FTE/RSNE building to ft_prepare_handshake
Date: Wed, 6 Dec 2023 10:36:37 -0600	[thread overview]
Message-ID: <620a779d-e694-4057-846d-23e6eea35252@gmail.com> (raw)
In-Reply-To: <20231206150708.2080336-5-prestwoj@gmail.com>

Hi James,

On 12/6/23 09:07, James Prestwood wrote:
> In preparation to remove ft_associate build the FTE/RSNE in
> ft_prepare_handshake and set into the handshake object directly.
> ---
>   src/ft.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 82 insertions(+), 2 deletions(-)
> 

<snip>

> @@ -931,6 +937,80 @@ static void ft_prepare_handshake(struct ft_info *info,
>   						info->ft_info.r1khid);
>   
>   	handshake_state_derive_ptk(hs);
> +
> +	/*
> +	 * Rebuild the RSNE to include the PMKR1Name and append
> +	 * MDE + FTE.
> +	 *
> +	 * 12.8.4: "If present, the RSNE shall be set as follows:
> +	 * - Version field shall be set to 1.
> +	 * - PMKID Count field shall be set to 1.
> +	 * - PMKID field shall contain the PMKR1Name.
> +	 * - All other fields shall be as specified in 8.4.2.27
> +	 *   and 11.5.3."
> +	 */
> +	if (ie_parse_rsne_from_data(hs->supplicant_ie,
> +					hs->supplicant_ie[1] + 2,
> +					&rsn_info) < 0)
> +		return false;
> +
> +	rsn_info.num_pmkids = 1;
> +	rsn_info.pmkids = hs->pmk_r1_name;
> +	/* Always set OCVC false for FT for now */
> +	rsn_info.ocvc = false;
> +	rsne = alloca(256);
> +
> +	ie_build_rsne(&rsn_info, rsne);
> +	handshake_state_set_supplicant_ie(hs, rsne);

This is probably safe since we over-write the supplicant ie in 
netdev_connect_event() -> parse_request_ies()

> +
> +	/*
> +	 * 12.8.4: "If present, the FTE shall be set as follows:
> +	 * - ANonce, SNonce, R0KH-ID, and R1KH-ID shall be set to
> +	 *   the values contained in the second message of this
> +	 *   sequence.
> +	 * - The Element Count field of the MIC Control field shall
> +	 *   be set to the number of elements protected in this
> +	 *   frame (variable).
> +	 * [...]
> +	 * - All other fields shall be set to 0."
> +	 */
> +	memset(&ft_info, 0, sizeof(ft_info));
> +	ft_info.mic_element_count = 3;
> +	memcpy(ft_info.r0khid, hs->r0khid, hs->r0khid_len);
> +	ft_info.r0khid_len = hs->r0khid_len;
> +	memcpy(ft_info.r1khid, hs->r1khid, 6);
> +	ft_info.r1khid_present = true;
> +	memcpy(ft_info.anonce, hs->anonce, 32);
> +	memcpy(ft_info.snonce, hs->snonce, 32);
> +
> +	/*
> +	 * IEEE 802.11-2020 Section 13.7.1 FT reassociation in an RSN
> +	 *
> +	 * "If dot11RSNAOperatingChannelValidationActivated is true and
> +	 *  the FTO indicates OCVC capability, the target AP shall
> +	 *  ensure that OCI subelement of the FTE matches by ensuring
> +	 *  that all of the following are true:
> +	 *      - OCI subelement is present
> +	 *      - Channel information in the OCI matches current
> +	 *        operating channel parameters (see 12.2.9)"
> +	 */
> +	if (hs->supplicant_ocvc && hs->chandef) {
> +		oci_from_chandef(hs->chandef, ft_info.oci);
> +		ft_info.oci_present = true;
> +	}
> +
> +	fte = alloca(256);
> +	ie_build_fast_bss_transition(&ft_info, kck_len, fte);
> +
> +	if (!ft_calculate_fte_mic(hs, 5, rsne, fte, NULL, ft_info.mic))
> +		return false;
> +
> +	/* Rebuild the FT IE now with the MIC included */
> +	ie_build_fast_bss_transition(&ft_info, kck_len, fte);
> +
> +	handshake_state_set_fte(hs, fte);

However, this is less clear to me.  Looking at how FILS and FT uses this API, it 
seems that set_fte is meant for the authenticator FTE element?  So I think 
rekeying after FT would be broken by this change.

> +
> +	return true;
>   }
>   
>   static bool ft_send_action(struct wiphy_radio_work_item *work)

Regards,
-Denis

  reply	other threads:[~2023-12-06 16:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 15:06 [PATCH v2 0/9] Reassoc/FT roaming unification James Prestwood
2023-12-06 15:07 ` [PATCH v2 1/9] auto-t: add explicit stop() to IWD class James Prestwood
2023-12-06 15:07 ` [PATCH v2 2/9] auto-t: add association timeout test James Prestwood
2023-12-06 15:07 ` [PATCH v2 3/9] auto-t: only call set_value for changed values in default() James Prestwood
2023-12-06 15:07 ` [PATCH v2 4/9] ft: add FTE/RSNE building to ft_prepare_handshake James Prestwood
2023-12-06 16:36   ` Denis Kenzior [this message]
2023-12-06 17:08     ` James Prestwood
2023-12-06 17:14       ` Denis Kenzior
2023-12-06 17:59         ` James Prestwood
2023-12-06 15:07 ` [PATCH v2 5/9] ft: add ft_handshake_setup James Prestwood
2023-12-06 16:38   ` Denis Kenzior
2023-12-06 16:46     ` James Prestwood
2023-12-06 15:07 ` [PATCH v2 6/9] netdev: add netdev_ft_reassociate James Prestwood
2023-12-06 16:40   ` Denis Kenzior
2023-12-06 16:49     ` James Prestwood
2023-12-06 15:07 ` [PATCH v2 7/9] station: use netdev_ft_reassociate James Prestwood
2023-12-06 15:07 ` [PATCH v2 8/9] ft: remove ft_associate and helpers James Prestwood
2023-12-06 15:07 ` [PATCH v2 9/9] netdev: station: remove NETDEV_EVENT_FT_ROAMED James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=620a779d-e694-4057-846d-23e6eea35252@gmail.com \
    --to=denkenz@gmail.com \
    --cc=iwd@lists.linux.dev \
    --cc=prestwoj@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox