]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FILS: Add FILS AEAD parameters for sta_auth() calls
authorJeffin Mammen <jmammen@qti.qualcomm.com>
Fri, 21 Apr 2017 17:43:57 +0000 (20:43 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 23 Apr 2017 14:47:15 +0000 (17:47 +0300)
This is used with partial AP SME in driver cases to enable FILS
association (AES-SIV) processing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/ap/ap_drv_ops.c
src/ap/wpa_auth.c
src/ap/wpa_auth.h

index b60f77001adfe2d258bfd140c90a5dca5ce441ef..c1861cb8ba10cd65aab4279c5bf033086b613c7a 100644 (file)
@@ -19,6 +19,7 @@
 #include "ap_config.h"
 #include "p2p_hostapd.h"
 #include "hs20.h"
+#include "wpa_auth.h"
 #include "ap_drv_ops.h"
 
 
@@ -348,12 +349,35 @@ int hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
                     u16 seq, u16 status, const u8 *ie, size_t len)
 {
        struct wpa_driver_sta_auth_params params;
+#ifdef CONFIG_FILS
+       struct sta_info *sta;
+#endif /* CONFIG_FILS */
 
        if (hapd->driver == NULL || hapd->driver->sta_auth == NULL)
                return 0;
 
        os_memset(&params, 0, sizeof(params));
 
+#ifdef CONFIG_FILS
+       sta = ap_get_sta(hapd, addr);
+       if (!sta) {
+               wpa_printf(MSG_DEBUG, "Station " MACSTR
+                          " not found for sta_auth processing",
+                          MAC2STR(addr));
+               return 0;
+       }
+
+       if (sta->auth_alg == WLAN_AUTH_FILS_SK ||
+           sta->auth_alg == WLAN_AUTH_FILS_SK_PFS ||
+           sta->auth_alg == WLAN_AUTH_FILS_PK) {
+               params.fils_auth = 1;
+               wpa_auth_get_fils_aead_params(sta->wpa_sm, params.fils_anonce,
+                                             params.fils_snonce,
+                                             params.fils_kek,
+                                             &params.fils_kek_len);
+       }
+#endif /* CONFIG_FILS */
+
        params.own_addr = hapd->own_addr;
        params.addr = addr;
        params.seq = seq;
index d7e3d2238c1edb43de65e30f9bc123b82f525b85..24b1241e14333c2fa510c417172457382ccc5d16 100644 (file)
@@ -4284,4 +4284,15 @@ int wpa_auth_write_fte(struct wpa_authenticator *wpa_auth, u8 *buf, size_t len)
 }
 #endif /* CONFIG_IEEE80211R_AP */
 
+
+void wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm,
+                                  u8 *fils_anonce, u8 *fils_snonce,
+                                  u8 *fils_kek, size_t *fils_kek_len)
+{
+       os_memcpy(fils_anonce, sm->ANonce, WPA_NONCE_LEN);
+       os_memcpy(fils_snonce, sm->SNonce, WPA_NONCE_LEN);
+       os_memcpy(fils_kek, sm->PTK.kek, WPA_KEK_MAX_LEN);
+       *fils_kek_len = sm->PTK.kek_len;
+}
+
 #endif /* CONFIG_FILS */
index 6793fecc0c214566767841cc6369b84d21ac756e..9a1d9d70fb16a9883296092c08778af470c3633f 100644 (file)
@@ -376,5 +376,8 @@ int fils_encrypt_assoc(struct wpa_state_machine *sm, u8 *buf,
 int fils_set_tk(struct wpa_state_machine *sm);
 
 int wpa_auth_write_fte(struct wpa_authenticator *wpa_auth, u8 *buf, size_t len);
+void wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm,
+                                  u8 *fils_anonce, u8 *fils_snonce,
+                                  u8 *fils_kek, size_t *fils_kek_len);
 
 #endif /* WPA_AUTH_H */