Merge get_seqnum_igtk() driver op with get_seqnum()
IEEE 802.11w uses distinct key indexes (4 and 5) so the same get_seqnum() handler can be used to fetch packet number for both TKIP/CCMP and BIP(using IGTK). Since the new get_seqnum_igtk() handler was not actually implemented by any driver wrapper, this may also fix BIP/IGTK sequence number reporting with driver_nl80211.c.
This commit is contained in:
parent
90b8c4c5f8
commit
9008a3e44d
7 changed files with 5 additions and 61 deletions
|
@ -103,16 +103,6 @@ hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
|
||||||
seq);
|
seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_get_seqnum_igtk(const char *ifname, struct hostapd_data *hapd,
|
|
||||||
const u8 *addr, int idx, u8 *seq)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->get_seqnum_igtk == NULL)
|
|
||||||
return -1;
|
|
||||||
return hapd->driver->get_seqnum_igtk(ifname, hapd->drv_priv, addr, idx,
|
|
||||||
seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
hostapd_flush(struct hostapd_data *hapd)
|
hostapd_flush(struct hostapd_data *hapd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -614,15 +614,6 @@ static int hostapd_wpa_auth_get_seqnum(void *ctx, const u8 *addr, int idx,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hostapd_wpa_auth_get_seqnum_igtk(void *ctx, const u8 *addr, int idx,
|
|
||||||
u8 *seq)
|
|
||||||
{
|
|
||||||
struct hostapd_data *hapd = ctx;
|
|
||||||
return hostapd_get_seqnum_igtk(hapd->conf->iface, hapd, addr, idx,
|
|
||||||
seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr,
|
static int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr,
|
||||||
const u8 *data, size_t data_len,
|
const u8 *data, size_t data_len,
|
||||||
int encrypt)
|
int encrypt)
|
||||||
|
@ -894,7 +885,6 @@ static int hostapd_setup_wpa(struct hostapd_data *hapd)
|
||||||
cb.get_msk = hostapd_wpa_auth_get_msk;
|
cb.get_msk = hostapd_wpa_auth_get_msk;
|
||||||
cb.set_key = hostapd_wpa_auth_set_key;
|
cb.set_key = hostapd_wpa_auth_set_key;
|
||||||
cb.get_seqnum = hostapd_wpa_auth_get_seqnum;
|
cb.get_seqnum = hostapd_wpa_auth_get_seqnum;
|
||||||
cb.get_seqnum_igtk = hostapd_wpa_auth_get_seqnum_igtk;
|
|
||||||
cb.send_eapol = hostapd_wpa_auth_send_eapol;
|
cb.send_eapol = hostapd_wpa_auth_send_eapol;
|
||||||
cb.for_each_sta = hostapd_wpa_auth_for_each_sta;
|
cb.for_each_sta = hostapd_wpa_auth_for_each_sta;
|
||||||
cb.for_each_auth = hostapd_wpa_auth_for_each_auth;
|
cb.for_each_auth = hostapd_wpa_auth_for_each_auth;
|
||||||
|
|
|
@ -122,15 +122,6 @@ static inline int wpa_auth_get_seqnum(struct wpa_authenticator *wpa_auth,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline int wpa_auth_get_seqnum_igtk(struct wpa_authenticator *wpa_auth,
|
|
||||||
const u8 *addr, int idx, u8 *seq)
|
|
||||||
{
|
|
||||||
if (wpa_auth->cb.get_seqnum_igtk == NULL)
|
|
||||||
return -1;
|
|
||||||
return wpa_auth->cb.get_seqnum_igtk(wpa_auth->cb.ctx, addr, idx, seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
wpa_auth_send_eapol(struct wpa_authenticator *wpa_auth, const u8 *addr,
|
wpa_auth_send_eapol(struct wpa_authenticator *wpa_auth, const u8 *addr,
|
||||||
const u8 *data, size_t data_len, int encrypt)
|
const u8 *data, size_t data_len, int encrypt)
|
||||||
|
@ -1538,8 +1529,7 @@ static u8 * ieee80211w_kde_add(struct wpa_state_machine *sm, u8 *pos)
|
||||||
|
|
||||||
igtk.keyid[0] = gsm->GN_igtk;
|
igtk.keyid[0] = gsm->GN_igtk;
|
||||||
igtk.keyid[1] = 0;
|
igtk.keyid[1] = 0;
|
||||||
if (wpa_auth_get_seqnum_igtk(sm->wpa_auth, NULL, gsm->GN_igtk, igtk.pn)
|
if (wpa_auth_get_seqnum(sm->wpa_auth, NULL, gsm->GN_igtk, igtk.pn) < 0)
|
||||||
< 0)
|
|
||||||
os_memset(igtk.pn, 0, sizeof(igtk.pn));
|
os_memset(igtk.pn, 0, sizeof(igtk.pn));
|
||||||
os_memcpy(igtk.igtk, gsm->IGTK[gsm->GN_igtk - 4], WPA_IGTK_LEN);
|
os_memcpy(igtk.igtk, gsm->IGTK[gsm->GN_igtk - 4], WPA_IGTK_LEN);
|
||||||
pos = wpa_add_kde(pos, RSN_KEY_DATA_IGTK,
|
pos = wpa_add_kde(pos, RSN_KEY_DATA_IGTK,
|
||||||
|
|
|
@ -187,7 +187,6 @@ struct wpa_auth_callbacks {
|
||||||
int (*set_key)(void *ctx, int vlan_id, wpa_alg alg, const u8 *addr,
|
int (*set_key)(void *ctx, int vlan_id, wpa_alg alg, const u8 *addr,
|
||||||
int idx, u8 *key, size_t key_len);
|
int idx, u8 *key, size_t key_len);
|
||||||
int (*get_seqnum)(void *ctx, const u8 *addr, int idx, u8 *seq);
|
int (*get_seqnum)(void *ctx, const u8 *addr, int idx, u8 *seq);
|
||||||
int (*get_seqnum_igtk)(void *ctx, const u8 *addr, int idx, u8 *seq);
|
|
||||||
int (*send_eapol)(void *ctx, const u8 *addr, const u8 *data,
|
int (*send_eapol)(void *ctx, const u8 *addr, const u8 *data,
|
||||||
size_t data_len, int encrypt);
|
size_t data_len, int encrypt);
|
||||||
int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm,
|
int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm,
|
||||||
|
|
|
@ -393,17 +393,6 @@ static inline int wpa_auth_get_seqnum(struct wpa_authenticator *wpa_auth,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211W
|
|
||||||
static inline int wpa_auth_get_seqnum_igtk(struct wpa_authenticator *wpa_auth,
|
|
||||||
const u8 *addr, int idx, u8 *seq)
|
|
||||||
{
|
|
||||||
if (wpa_auth->cb.get_seqnum_igtk == NULL)
|
|
||||||
return -1;
|
|
||||||
return wpa_auth->cb.get_seqnum_igtk(wpa_auth->cb.ctx, addr, idx, seq);
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_IEEE80211W */
|
|
||||||
|
|
||||||
|
|
||||||
static u8 * wpa_ft_gtk_subelem(struct wpa_state_machine *sm, size_t *len)
|
static u8 * wpa_ft_gtk_subelem(struct wpa_state_machine *sm, size_t *len)
|
||||||
{
|
{
|
||||||
u8 *subelem;
|
u8 *subelem;
|
||||||
|
@ -478,7 +467,7 @@ static u8 * wpa_ft_igtk_subelem(struct wpa_state_machine *sm, size_t *len)
|
||||||
*pos++ = subelem_len - 2;
|
*pos++ = subelem_len - 2;
|
||||||
WPA_PUT_LE16(pos, gsm->GN_igtk);
|
WPA_PUT_LE16(pos, gsm->GN_igtk);
|
||||||
pos += 2;
|
pos += 2;
|
||||||
wpa_auth_get_seqnum_igtk(sm->wpa_auth, NULL, gsm->GN_igtk, pos);
|
wpa_auth_get_seqnum(sm->wpa_auth, NULL, gsm->GN_igtk, pos);
|
||||||
pos += 6;
|
pos += 6;
|
||||||
*pos++ = WPA_IGTK_LEN;
|
*pos++ = WPA_IGTK_LEN;
|
||||||
if (aes_wrap(sm->PTK.kek, WPA_IGTK_LEN / 8,
|
if (aes_wrap(sm->PTK.kek, WPA_IGTK_LEN / 8,
|
||||||
|
|
|
@ -1117,26 +1117,13 @@ struct wpa_driver_ops {
|
||||||
* Returns: 0 on success, -1 on failure
|
* Returns: 0 on success, -1 on failure
|
||||||
*
|
*
|
||||||
* This function is used to fetch the last used TSC/packet number for
|
* This function is used to fetch the last used TSC/packet number for
|
||||||
* a TKIP or CCMP key.
|
* a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
|
||||||
|
* there is no strict requirement on implementing support for unicast
|
||||||
|
* keys (i.e., addr != %NULL).
|
||||||
*/
|
*/
|
||||||
int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
|
int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
|
||||||
int idx, u8 *seq);
|
int idx, u8 *seq);
|
||||||
|
|
||||||
/**
|
|
||||||
* get_seqnum_igtk - Fetch the IGTK packet number (AP only)
|
|
||||||
* @ifname: The interface name (main or virtual)
|
|
||||||
* @priv: Private driver interface data
|
|
||||||
* @addr: %NULL for group keys
|
|
||||||
* @idx: Key index
|
|
||||||
* @seq: Buffer for returning the last used packet number
|
|
||||||
* Returns: 0 on success, -1 on failure
|
|
||||||
*
|
|
||||||
* This function is used to fetch the last used packet number for an
|
|
||||||
* IGTK key.
|
|
||||||
*/
|
|
||||||
int (*get_seqnum_igtk)(const char *ifname, void *priv, const u8 *addr,
|
|
||||||
int idx, u8 *seq);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* flush - Flush all association stations (AP only)
|
* flush - Flush all association stations (AP only)
|
||||||
* @priv: Private driver interface data
|
* @priv: Private driver interface data
|
||||||
|
|
|
@ -3211,7 +3211,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
|
||||||
NULL /* set_ieee8021x */,
|
NULL /* set_ieee8021x */,
|
||||||
NULL /* set_privacy */,
|
NULL /* set_privacy */,
|
||||||
NULL /* get_seqnum */,
|
NULL /* get_seqnum */,
|
||||||
NULL /* get_seqnum_igtk */,
|
|
||||||
NULL /* flush */,
|
NULL /* flush */,
|
||||||
NULL /* set_generic_elem */,
|
NULL /* set_generic_elem */,
|
||||||
NULL /* read_sta_data */,
|
NULL /* read_sta_data */,
|
||||||
|
|
Loading…
Reference in a new issue