Updated through tag hostap_2_5 from git://w1.fi/hostap.git
[mech_eap.git] / libeap / src / ap / wpa_auth.h
index d0136c7..fd04f16 100644 (file)
@@ -1,15 +1,9 @@
 /*
  * hostapd - IEEE 802.11i-2004 / WPA Authenticator
- * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 #ifndef WPA_AUTH_H
@@ -18,6 +12,9 @@
 #include "common/defs.h"
 #include "common/eapol_common.h"
 #include "common/wpa_common.h"
+#include "common/ieee802_11_defs.h"
+
+#define MAX_OWN_IE_OVERRIDE 256
 
 #ifdef _MSC_VER
 #pragma pack(push, 1)
@@ -48,6 +45,7 @@ struct ft_rrb_frame {
 #define FT_R0KH_R1KH_PULL_DATA_LEN 44
 #define FT_R0KH_R1KH_RESP_DATA_LEN 76
 #define FT_R0KH_R1KH_PUSH_DATA_LEN 88
+#define FT_R0KH_R1KH_PULL_NONCE_LEN 16
 
 struct ft_r0kh_r1kh_pull_frame {
        u8 frame_type; /* RSN_REMOTE_FRAME_TYPE_FT_RRB */
@@ -55,7 +53,7 @@ struct ft_r0kh_r1kh_pull_frame {
        le16 data_length; /* little endian length of data (44) */
        u8 ap_address[ETH_ALEN];
 
-       u8 nonce[16];
+       u8 nonce[FT_R0KH_R1KH_PULL_NONCE_LEN];
        u8 pmk_r0_name[WPA_PMK_NAME_LEN];
        u8 r1kh_id[FT_R1KH_ID_LEN];
        u8 s1kh_id[ETH_ALEN];
@@ -69,7 +67,7 @@ struct ft_r0kh_r1kh_resp_frame {
        le16 data_length; /* little endian length of data (76) */
        u8 ap_address[ETH_ALEN];
 
-       u8 nonce[16]; /* copied from pull */
+       u8 nonce[FT_R0KH_R1KH_PULL_NONCE_LEN]; /* copied from pull */
        u8 r1kh_id[FT_R1KH_ID_LEN]; /* copied from pull */
        u8 s1kh_id[ETH_ALEN]; /* copied from pull */
        u8 pmk_r1[PMK_LEN];
@@ -143,13 +141,15 @@ struct wpa_auth_config {
        int peerkey;
        int wmm_enabled;
        int wmm_uapsd;
+       int disable_pmksa_caching;
        int okc;
+       int tx_status;
 #ifdef CONFIG_IEEE80211W
        enum mfp_options ieee80211w;
+       int group_mgmt_cipher;
 #endif /* CONFIG_IEEE80211W */
 #ifdef CONFIG_IEEE80211R
-#define SSID_LEN 32
-       u8 ssid[SSID_LEN];
+       u8 ssid[SSID_MAX_LEN];
        size_t ssid_len;
        u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
        u8 r0_key_holder[FT_R0KH_ID_MAX_LEN];
@@ -160,7 +160,21 @@ struct wpa_auth_config {
        struct ft_remote_r0kh *r0kh_list;
        struct ft_remote_r1kh *r1kh_list;
        int pmk_r1_push;
+       int ft_over_ds;
 #endif /* CONFIG_IEEE80211R */
+       int disable_gtk;
+       int ap_mlme;
+#ifdef CONFIG_TESTING_OPTIONS
+       double corrupt_gtk_rekey_mic_probability;
+       u8 own_ie_override[MAX_OWN_IE_OVERRIDE];
+       size_t own_ie_override_len;
+#endif /* CONFIG_TESTING_OPTIONS */
+#ifdef CONFIG_P2P
+       u8 ip_addr_go[4];
+       u8 ip_addr_mask[4];
+       u8 ip_addr_start[4];
+       u8 ip_addr_end[4];
+#endif /* CONFIG_P2P */
 };
 
 typedef enum {
@@ -178,11 +192,13 @@ struct wpa_auth_callbacks {
        void (*logger)(void *ctx, const u8 *addr, logger_level level,
                       const char *txt);
        void (*disconnect)(void *ctx, const u8 *addr, u16 reason);
-       void (*mic_failure_report)(void *ctx, const u8 *addr);
+       int (*mic_failure_report)(void *ctx, const u8 *addr);
+       void (*psk_failure_report)(void *ctx, const u8 *addr);
        void (*set_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var,
                          int value);
        int (*get_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var);
-       const u8 * (*get_psk)(void *ctx, const u8 *addr, const u8 *prev_psk);
+       const u8 * (*get_psk)(void *ctx, const u8 *addr, const u8 *p2p_dev_addr,
+                             const u8 *prev_psk);
        int (*get_msk)(void *ctx, const u8 *addr, u8 *msk, size_t *len);
        int (*set_key)(void *ctx, int vlan_id, enum wpa_alg alg,
                       const u8 *addr, int idx, u8 *key, size_t key_len);
@@ -199,12 +215,18 @@ struct wpa_auth_callbacks {
        struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
        int (*send_ft_action)(void *ctx, const u8 *dst,
                              const u8 *data, size_t data_len);
+       int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie,
+                        size_t tspec_ielen);
 #endif /* CONFIG_IEEE80211R */
+#ifdef CONFIG_MESH
+       int (*start_ampe)(void *ctx, const u8 *sta_addr);
+#endif /* CONFIG_MESH */
 };
 
 struct wpa_authenticator * wpa_init(const u8 *addr,
                                    struct wpa_auth_config *conf,
                                    struct wpa_auth_callbacks *cb);
+int wpa_init_keys(struct wpa_authenticator *wpa_auth);
 void wpa_deinit(struct wpa_authenticator *wpa_auth);
 int wpa_reconfig(struct wpa_authenticator *wpa_auth,
                 struct wpa_auth_config *conf);
@@ -220,9 +242,13 @@ int wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
                        struct wpa_state_machine *sm,
                        const u8 *wpa_ie, size_t wpa_ie_len,
                        const u8 *mdie, size_t mdie_len);
+int wpa_validate_osen(struct wpa_authenticator *wpa_auth,
+                     struct wpa_state_machine *sm,
+                     const u8 *osen_ie, size_t osen_ie_len);
 int wpa_auth_uses_mfp(struct wpa_state_machine *sm);
 struct wpa_state_machine *
-wpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr);
+wpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr,
+                 const u8 *p2p_dev_addr);
 int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
                            struct wpa_state_machine *sm);
 void wpa_auth_sta_no_wpa(struct wpa_state_machine *sm);
@@ -230,12 +256,12 @@ void wpa_auth_sta_deinit(struct wpa_state_machine *sm);
 void wpa_receive(struct wpa_authenticator *wpa_auth,
                 struct wpa_state_machine *sm,
                 u8 *data, size_t data_len);
-typedef enum {
+enum wpa_event {
        WPA_AUTH, WPA_ASSOC, WPA_DISASSOC, WPA_DEAUTH, WPA_REAUTH,
        WPA_REAUTH_EAPOL, WPA_ASSOC_FT
-} wpa_event;
+};
 void wpa_remove_ptk(struct wpa_state_machine *sm);
-int wpa_auth_sm_event(struct wpa_state_machine *sm, wpa_event event);
+int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event);
 void wpa_auth_sm_notify(struct wpa_state_machine *sm);
 void wpa_gtk_rekey(struct wpa_authenticator *wpa_auth);
 int wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen);
@@ -258,7 +284,13 @@ int wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth,
                               const u8 *pmk, size_t len, const u8 *sta_addr,
                               int session_timeout,
                               struct eapol_state_machine *eapol);
+int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr,
+                          const u8 *pmk);
+void wpa_auth_pmksa_remove(struct wpa_authenticator *wpa_auth,
+                          const u8 *sta_addr);
 int wpa_auth_sta_set_vlan(struct wpa_state_machine *sm, int vlan_id);
+void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth,
+                                 struct wpa_state_machine *sm, int ack);
 
 #ifdef CONFIG_IEEE80211R
 u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
@@ -278,4 +310,19 @@ int wpa_ft_rrb_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr,
 void wpa_ft_push_pmk_r1(struct wpa_authenticator *wpa_auth, const u8 *addr);
 #endif /* CONFIG_IEEE80211R */
 
+void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm);
+void wpa_set_wnmsleep(struct wpa_state_machine *sm, int flag);
+int wpa_wnmsleep_gtk_subelem(struct wpa_state_machine *sm, u8 *pos);
+int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos);
+
+int wpa_auth_uses_sae(struct wpa_state_machine *sm);
+int wpa_auth_uses_ft_sae(struct wpa_state_machine *sm);
+
+int wpa_auth_get_ip_addr(struct wpa_state_machine *sm, u8 *addr);
+
+struct radius_das_attrs;
+int wpa_auth_radius_das_disconnect_pmksa(struct wpa_authenticator *wpa_auth,
+                                        struct radius_das_attrs *attr);
+void wpa_auth_reconfig_group_keys(struct wpa_authenticator *wpa_auth);
+
 #endif /* WPA_AUTH_H */