Use a shared helper function for RSN supplicant capabilities
Avoid practically copy-pasted code for determining local RSN capabilities. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
b17b7a8e53
commit
8b63a58166
3 changed files with 20 additions and 22 deletions
|
@ -178,7 +178,6 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len,
|
|||
u8 *buf, *pos, *ftie_len, *ftie_pos, *fte_mic, *elem_count;
|
||||
struct rsn_mdie *mdie;
|
||||
struct rsn_ie_hdr *rsnie;
|
||||
u16 capab;
|
||||
int mdie_len;
|
||||
u8 rsnxe[10];
|
||||
size_t rsnxe_len;
|
||||
|
@ -258,16 +257,7 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len,
|
|||
pos += RSN_SELECTOR_LEN;
|
||||
|
||||
/* RSN Capabilities */
|
||||
capab = 0;
|
||||
if (sm->mfp)
|
||||
capab |= WPA_CAPABILITY_MFPC;
|
||||
if (sm->mfp == 2)
|
||||
capab |= WPA_CAPABILITY_MFPR;
|
||||
if (sm->ocv)
|
||||
capab |= WPA_CAPABILITY_OCVC;
|
||||
if (sm->ext_key_id)
|
||||
capab |= WPA_CAPABILITY_EXT_KEY_ID_FOR_UNICAST;
|
||||
WPA_PUT_LE16(pos, capab);
|
||||
WPA_PUT_LE16(pos, rsn_supp_capab(sm));
|
||||
pos += 2;
|
||||
|
||||
/* PMKID Count */
|
||||
|
|
|
@ -105,6 +105,23 @@ static int wpa_gen_wpa_ie_wpa(u8 *wpa_ie, size_t wpa_ie_len,
|
|||
}
|
||||
|
||||
|
||||
u16 rsn_supp_capab(struct wpa_sm *sm)
|
||||
{
|
||||
u16 capab = 0;
|
||||
|
||||
if (sm->mfp)
|
||||
capab |= WPA_CAPABILITY_MFPC;
|
||||
if (sm->mfp == 2)
|
||||
capab |= WPA_CAPABILITY_MFPR;
|
||||
if (sm->ocv)
|
||||
capab |= WPA_CAPABILITY_OCVC;
|
||||
if (sm->ext_key_id)
|
||||
capab |= WPA_CAPABILITY_EXT_KEY_ID_FOR_UNICAST;
|
||||
|
||||
return capab;
|
||||
}
|
||||
|
||||
|
||||
static int wpa_gen_wpa_ie_rsn(u8 *rsn_ie, size_t rsn_ie_len,
|
||||
int pairwise_cipher, int group_cipher,
|
||||
int key_mgmt, int mgmt_group_cipher,
|
||||
|
@ -112,7 +129,6 @@ static int wpa_gen_wpa_ie_rsn(u8 *rsn_ie, size_t rsn_ie_len,
|
|||
{
|
||||
u8 *pos;
|
||||
struct rsn_ie_hdr *hdr;
|
||||
u16 capab;
|
||||
u32 suite;
|
||||
|
||||
if (rsn_ie_len < sizeof(*hdr) + RSN_SELECTOR_LEN +
|
||||
|
@ -214,16 +230,7 @@ static int wpa_gen_wpa_ie_rsn(u8 *rsn_ie, size_t rsn_ie_len,
|
|||
pos += RSN_SELECTOR_LEN;
|
||||
|
||||
/* RSN Capabilities */
|
||||
capab = 0;
|
||||
if (sm->mfp)
|
||||
capab |= WPA_CAPABILITY_MFPC;
|
||||
if (sm->mfp == 2)
|
||||
capab |= WPA_CAPABILITY_MFPR;
|
||||
if (sm->ocv)
|
||||
capab |= WPA_CAPABILITY_OCVC;
|
||||
if (sm->ext_key_id)
|
||||
capab |= WPA_CAPABILITY_EXT_KEY_ID_FOR_UNICAST;
|
||||
WPA_PUT_LE16(pos, capab);
|
||||
WPA_PUT_LE16(pos, rsn_supp_capab(sm));
|
||||
pos += 2;
|
||||
|
||||
if (sm->cur_pmksa) {
|
||||
|
|
|
@ -13,5 +13,6 @@ struct wpa_sm;
|
|||
|
||||
int wpa_gen_wpa_ie(struct wpa_sm *sm, u8 *wpa_ie, size_t wpa_ie_len);
|
||||
int wpa_gen_rsnxe(struct wpa_sm *sm, u8 *rsnxe, size_t rsnxe_len);
|
||||
u16 rsn_supp_capab(struct wpa_sm *sm);
|
||||
|
||||
#endif /* WPA_IE_H */
|
||||
|
|
Loading…
Reference in a new issue