]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Merge get_seqnum_igtk() driver op with get_seqnum()
authorJouni Malinen <j@w1.fi>
Thu, 10 Dec 2009 22:15:54 +0000 (00:15 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 10 Dec 2009 22:15:54 +0000 (00:15 +0200)
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.

hostapd/driver_i.h
hostapd/hostapd.c
hostapd/wpa.c
hostapd/wpa.h
hostapd/wpa_ft.c
src/drivers/driver.h
src/drivers/driver_ndis.c

index 77ad1242e107ea4ddc0e5cbab315ea1cbe6f8416..d684cf7b0a19634bba2e79b202515722ff45b8bb 100644 (file)
@@ -103,16 +103,6 @@ hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
                                        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
 hostapd_flush(struct hostapd_data *hapd)
 {
index 6b69a2b9d5992adc3cd3778a9f6bbc2549070da2..53f3a3b30baeda2ea44461b4fb66af9f1673bd85 100644 (file)
@@ -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,
                                       const u8 *data, size_t data_len,
                                       int encrypt)
@@ -894,7 +885,6 @@ static int hostapd_setup_wpa(struct hostapd_data *hapd)
        cb.get_msk = hostapd_wpa_auth_get_msk;
        cb.set_key = hostapd_wpa_auth_set_key;
        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.for_each_sta = hostapd_wpa_auth_for_each_sta;
        cb.for_each_auth = hostapd_wpa_auth_for_each_auth;
index 73425e660f78758678b94db622bb5a8b4ec7c2fa..4af26e9cf962e93a6149cc9316547af72fd8e3a1 100644 (file)
@@ -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
 wpa_auth_send_eapol(struct wpa_authenticator *wpa_auth, const u8 *addr,
                    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[1] = 0;
-       if (wpa_auth_get_seqnum_igtk(sm->wpa_auth, NULL, gsm->GN_igtk, igtk.pn)
-           < 0)
+       if (wpa_auth_get_seqnum(sm->wpa_auth, NULL, gsm->GN_igtk, igtk.pn) < 0)
                os_memset(igtk.pn, 0, sizeof(igtk.pn));
        os_memcpy(igtk.igtk, gsm->IGTK[gsm->GN_igtk - 4], WPA_IGTK_LEN);
        pos = wpa_add_kde(pos, RSN_KEY_DATA_IGTK,
index 760818a25611bcf88caa6275bd574557d180f221..55d4ec2a192e4bf6de4560a00778540ef759b781 100644 (file)
@@ -187,7 +187,6 @@ struct wpa_auth_callbacks {
        int (*set_key)(void *ctx, int vlan_id, wpa_alg alg, const u8 *addr,
                       int idx, u8 *key, size_t key_len);
        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,
                          size_t data_len, int encrypt);
        int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm,
index 495f27f11df452400f929008e2d013974fe41b83..65d673ade2d066570773753cee0adad0dfd70934 100644 (file)
@@ -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)
 {
        u8 *subelem;
@@ -478,7 +467,7 @@ static u8 * wpa_ft_igtk_subelem(struct wpa_state_machine *sm, size_t *len)
        *pos++ = subelem_len - 2;
        WPA_PUT_LE16(pos, gsm->GN_igtk);
        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++ = WPA_IGTK_LEN;
        if (aes_wrap(sm->PTK.kek, WPA_IGTK_LEN / 8,
index 153a27b120b99fb9da2add0dd9a4988773de1dbb..c4e7b73fa70c918d94e64ba283cb45be132ecb4a 100644 (file)
@@ -1117,26 +1117,13 @@ struct wpa_driver_ops {
         * Returns: 0 on success, -1 on failure
         *
         * 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 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)
         * @priv: Private driver interface data
index 1c71d7830918abcca73a386e71bb7b97bbe3cdd7..bec1e8d8c5e4e004918dcf7194ece455dd074106 100644 (file)
@@ -3211,7 +3211,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
        NULL /* set_ieee8021x */,
        NULL /* set_privacy */,
        NULL /* get_seqnum */,
-       NULL /* get_seqnum_igtk */,
        NULL /* flush */,
        NULL /* set_generic_elem */,
        NULL /* read_sta_data */,