mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
ft: break up FT action parsing into two steps
This is to prepare for multiple concurrent FT-over-DS action frames. A list will be kept in netdev and for lookup reasons it needs to parse the start of the frame to grab the aa/spa addresses. In this call the IEs are also returned and passed to the new ft_over_ds_parse_action_response. For now the address checks have been moved into netdev, but this will eventually turn into a queue lookup.
This commit is contained in:
parent
80712face4
commit
ff333a112b
30
src/ft.c
30
src/ft.c
@ -452,7 +452,7 @@ static bool mde_equal(const uint8_t *mde1, const uint8_t *mde2)
|
|||||||
return memcmp(mde1, mde1, mde1[1] + 2) == 0;
|
return memcmp(mde1, mde1, mde1[1] + 2) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ft_over_ds_process_ies(struct ft_ds_info *info,
|
bool ft_over_ds_parse_action_ies(struct ft_ds_info *info,
|
||||||
struct handshake_state *hs,
|
struct handshake_state *hs,
|
||||||
const uint8_t *ies,
|
const uint8_t *ies,
|
||||||
size_t ies_len)
|
size_t ies_len)
|
||||||
@ -523,11 +523,15 @@ ft_error:
|
|||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_over_ds_parse_action_response(struct ft_ds_info *info,
|
int ft_over_ds_parse_action_response(const uint8_t *frame, size_t frame_len,
|
||||||
struct handshake_state *hs,
|
const uint8_t **spa_out,
|
||||||
const uint8_t *frame, size_t frame_len)
|
const uint8_t **aa_out,
|
||||||
|
const uint8_t **ies_out,
|
||||||
|
size_t *ies_len)
|
||||||
{
|
{
|
||||||
uint16_t status;
|
uint16_t status;
|
||||||
|
const uint8_t *aa;
|
||||||
|
const uint8_t *spa;
|
||||||
|
|
||||||
if (frame_len < 16)
|
if (frame_len < 16)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -540,17 +544,23 @@ int ft_over_ds_parse_action_response(struct ft_ds_info *info,
|
|||||||
if (frame[1] != 2)
|
if (frame[1] != 2)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (memcmp(frame + 2, info->spa, 6))
|
spa = frame + 2;
|
||||||
return -ENOENT;
|
aa = frame + 8;
|
||||||
if (memcmp(frame + 8, info->aa, 6))
|
|
||||||
return -ENOENT;
|
|
||||||
|
|
||||||
status = l_get_le16(frame + 14);
|
status = l_get_le16(frame + 14);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
return (int)status;
|
return (int)status;
|
||||||
|
|
||||||
if (!ft_over_ds_process_ies(info, hs, frame + 16, frame_len - 16))
|
if (spa_out)
|
||||||
return -EBADMSG;
|
*spa_out = spa;
|
||||||
|
|
||||||
|
if (aa_out)
|
||||||
|
*aa_out = aa;
|
||||||
|
|
||||||
|
if (ies_out && ies_len) {
|
||||||
|
*ies_out = frame + 16;
|
||||||
|
*ies_len = frame_len - 16;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
10
src/ft.h
10
src/ft.h
@ -47,9 +47,15 @@ bool ft_build_authenticate_ies(struct handshake_state *hs,
|
|||||||
const uint8_t *new_snonce, uint8_t *buf,
|
const uint8_t *new_snonce, uint8_t *buf,
|
||||||
size_t *len);
|
size_t *len);
|
||||||
|
|
||||||
int ft_over_ds_parse_action_response(struct ft_ds_info *info,
|
int ft_over_ds_parse_action_response(const uint8_t *frame, size_t frame_len,
|
||||||
|
const uint8_t **spa_out,
|
||||||
|
const uint8_t **aa_out,
|
||||||
|
const uint8_t **ies_out,
|
||||||
|
size_t *ies_len);
|
||||||
|
bool ft_over_ds_parse_action_ies(struct ft_ds_info *info,
|
||||||
struct handshake_state *hs,
|
struct handshake_state *hs,
|
||||||
const uint8_t *frame, size_t frame_len);
|
const uint8_t *ies,
|
||||||
|
size_t ies_len);
|
||||||
|
|
||||||
struct auth_proto *ft_over_air_sm_new(struct handshake_state *hs,
|
struct auth_proto *ft_over_air_sm_new(struct handshake_state *hs,
|
||||||
ft_tx_authenticate_func_t tx_auth,
|
ft_tx_authenticate_func_t tx_auth,
|
||||||
|
18
src/netdev.c
18
src/netdev.c
@ -3774,12 +3774,26 @@ static void netdev_ft_response_frame_event(const struct mmpdu_header *hdr,
|
|||||||
struct netdev_ft_over_ds_info *info = netdev->ft_ds_info;
|
struct netdev_ft_over_ds_info *info = netdev->ft_ds_info;
|
||||||
int ret;
|
int ret;
|
||||||
uint16_t status_code = MMPDU_STATUS_CODE_UNSPECIFIED;
|
uint16_t status_code = MMPDU_STATUS_CODE_UNSPECIFIED;
|
||||||
|
const uint8_t *aa;
|
||||||
|
const uint8_t *spa;
|
||||||
|
const uint8_t *ies;
|
||||||
|
size_t ies_len;
|
||||||
|
|
||||||
if (!info)
|
if (!info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ret = ft_over_ds_parse_action_response(&info->super, netdev->handshake,
|
ret = ft_over_ds_parse_action_response(body, body_len, &spa, &aa,
|
||||||
body, body_len);
|
&ies, &ies_len);
|
||||||
|
if (ret != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (memcmp(spa, info->super.spa, 6))
|
||||||
|
return;
|
||||||
|
if (memcmp(aa, info->super.aa, 6))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ret = ft_over_ds_parse_action_ies(&info->super, netdev->handshake,
|
||||||
|
ies, ies_len);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user