wpa_i.h

Go to the documentation of this file.
00001 
00016 #ifndef WPA_I_H
00017 #define WPA_I_H
00018 
00019 struct rsn_pmksa_candidate;
00020 struct wpa_peerkey;
00021 struct wpa_eapol_key;
00022 
00027 struct wpa_sm {
00028         u8 pmk[PMK_LEN];
00029         size_t pmk_len;
00030         struct wpa_ptk ptk, tptk;
00031         int ptk_set, tptk_set;
00032         u8 snonce[WPA_NONCE_LEN];
00033         u8 anonce[WPA_NONCE_LEN]; /* ANonce from the last 1/4 msg */
00034         int renew_snonce;
00035         u8 rx_replay_counter[WPA_REPLAY_COUNTER_LEN];
00036         int rx_replay_counter_set;
00037         u8 request_counter[WPA_REPLAY_COUNTER_LEN];
00038 
00039         struct eapol_sm *eapol; /* EAPOL state machine from upper level code */
00040 
00041         struct rsn_pmksa_cache *pmksa; /* PMKSA cache */
00042         struct rsn_pmksa_cache_entry *cur_pmksa; /* current PMKSA entry */
00043         struct rsn_pmksa_candidate *pmksa_candidates;
00044 
00045         struct l2_packet_data *l2_preauth;
00046         struct l2_packet_data *l2_preauth_br;
00047         u8 preauth_bssid[ETH_ALEN]; /* current RSN pre-auth peer or
00048                                      * 00:00:00:00:00:00 if no pre-auth is
00049                                      * in progress */
00050         struct eapol_sm *preauth_eapol;
00051 
00052         struct wpa_sm_ctx *ctx;
00053 
00054         void *scard_ctx; /* context for smartcard callbacks */
00055         int fast_reauth; /* whether EAP fast re-authentication is enabled */
00056 
00057         void *network_ctx;
00058         int peerkey_enabled;
00059         int allowed_pairwise_cipher; /* bitfield of WPA_CIPHER_* */
00060         int proactive_key_caching;
00061         int eap_workaround;
00062         void *eap_conf_ctx;
00063         u8 ssid[32];
00064         size_t ssid_len;
00065         int wpa_ptk_rekey;
00066 
00067         u8 own_addr[ETH_ALEN];
00068         const char *ifname;
00069         const char *bridge_ifname;
00070         u8 bssid[ETH_ALEN];
00071 
00072         unsigned int dot11RSNAConfigPMKLifetime;
00073         unsigned int dot11RSNAConfigPMKReauthThreshold;
00074         unsigned int dot11RSNAConfigSATimeout;
00075 
00076         unsigned int dot11RSNA4WayHandshakeFailures;
00077 
00078         /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
00079         unsigned int proto;
00080         unsigned int pairwise_cipher;
00081         unsigned int group_cipher;
00082         unsigned int key_mgmt;
00083         unsigned int mgmt_group_cipher;
00084 
00085         int rsn_enabled; /* Whether RSN is enabled in configuration */
00086 
00087         u8 *assoc_wpa_ie; /* Own WPA/RSN IE from (Re)AssocReq */
00088         size_t assoc_wpa_ie_len;
00089         u8 *ap_wpa_ie, *ap_rsn_ie;
00090         size_t ap_wpa_ie_len, ap_rsn_ie_len;
00091 
00092 #ifdef CONFIG_PEERKEY
00093         struct wpa_peerkey *peerkey;
00094 #endif /* CONFIG_PEERKEY */
00095 
00096 #ifdef CONFIG_IEEE80211R
00097         u8 xxkey[PMK_LEN]; /* PSK or the second 256 bits of MSK */
00098         size_t xxkey_len;
00099         u8 pmk_r0[PMK_LEN];
00100         u8 pmk_r0_name[WPA_PMK_NAME_LEN];
00101         u8 pmk_r1[PMK_LEN];
00102         u8 pmk_r1_name[WPA_PMK_NAME_LEN];
00103         u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
00104         u8 r0kh_id[FT_R0KH_ID_MAX_LEN];
00105         size_t r0kh_id_len;
00106         u8 r1kh_id[FT_R1KH_ID_LEN];
00107         int ft_completed;
00108         int over_the_ds_in_progress;
00109         u8 target_ap[ETH_ALEN]; /* over-the-DS target AP */
00110 #endif /* CONFIG_IEEE80211R */
00111 };
00112 
00113 
00114 static inline void wpa_sm_set_state(struct wpa_sm *sm, wpa_states state)
00115 {
00116         WPA_ASSERT(sm->ctx->set_state);
00117         sm->ctx->set_state(sm->ctx->ctx, state);
00118 }
00119 
00120 static inline wpa_states wpa_sm_get_state(struct wpa_sm *sm)
00121 {
00122         WPA_ASSERT(sm->ctx->get_state);
00123         return sm->ctx->get_state(sm->ctx->ctx);
00124 }
00125 
00126 static inline void wpa_sm_deauthenticate(struct wpa_sm *sm, int reason_code)
00127 {
00128         WPA_ASSERT(sm->ctx->deauthenticate);
00129         sm->ctx->deauthenticate(sm->ctx->ctx, reason_code);
00130 }
00131 
00132 static inline void wpa_sm_disassociate(struct wpa_sm *sm, int reason_code)
00133 {
00134         WPA_ASSERT(sm->ctx->disassociate);
00135         sm->ctx->disassociate(sm->ctx->ctx, reason_code);
00136 }
00137 
00138 static inline int wpa_sm_set_key(struct wpa_sm *sm, wpa_alg alg,
00139                                  const u8 *addr, int key_idx, int set_tx,
00140                                  const u8 *seq, size_t seq_len,
00141                                  const u8 *key, size_t key_len)
00142 {
00143         WPA_ASSERT(sm->ctx->set_key);
00144         return sm->ctx->set_key(sm->ctx->ctx, alg, addr, key_idx, set_tx,
00145                                 seq, seq_len, key, key_len);
00146 }
00147 
00148 static inline void * wpa_sm_get_network_ctx(struct wpa_sm *sm)
00149 {
00150         WPA_ASSERT(sm->ctx->get_network_ctx);
00151         return sm->ctx->get_network_ctx(sm->ctx->ctx);
00152 }
00153 
00154 static inline int wpa_sm_get_bssid(struct wpa_sm *sm, u8 *bssid)
00155 {
00156         WPA_ASSERT(sm->ctx->get_bssid);
00157         return sm->ctx->get_bssid(sm->ctx->ctx, bssid);
00158 }
00159 
00160 static inline int wpa_sm_ether_send(struct wpa_sm *sm, const u8 *dest,
00161                                     u16 proto, const u8 *buf, size_t len)
00162 {
00163         WPA_ASSERT(sm->ctx->ether_send);
00164         return sm->ctx->ether_send(sm->ctx->ctx, dest, proto, buf, len);
00165 }
00166 
00167 static inline int wpa_sm_get_beacon_ie(struct wpa_sm *sm)
00168 {
00169         WPA_ASSERT(sm->ctx->get_beacon_ie);
00170         return sm->ctx->get_beacon_ie(sm->ctx->ctx);
00171 }
00172 
00173 static inline void wpa_sm_cancel_auth_timeout(struct wpa_sm *sm)
00174 {
00175         WPA_ASSERT(sm->ctx->cancel_auth_timeout);
00176         sm->ctx->cancel_auth_timeout(sm->ctx->ctx);
00177 }
00178 
00179 static inline u8 * wpa_sm_alloc_eapol(struct wpa_sm *sm, u8 type,
00180                                       const void *data, u16 data_len,
00181                                       size_t *msg_len, void **data_pos)
00182 {
00183         WPA_ASSERT(sm->ctx->alloc_eapol);
00184         return sm->ctx->alloc_eapol(sm->ctx->ctx, type, data, data_len,
00185                                     msg_len, data_pos);
00186 }
00187 
00188 static inline int wpa_sm_add_pmkid(struct wpa_sm *sm, const u8 *bssid,
00189                                    const u8 *pmkid)
00190 {
00191         WPA_ASSERT(sm->ctx->add_pmkid);
00192         return sm->ctx->add_pmkid(sm->ctx->ctx, bssid, pmkid);
00193 }
00194 
00195 static inline int wpa_sm_remove_pmkid(struct wpa_sm *sm, const u8 *bssid,
00196                                       const u8 *pmkid)
00197 {
00198         WPA_ASSERT(sm->ctx->remove_pmkid);
00199         return sm->ctx->remove_pmkid(sm->ctx->ctx, bssid, pmkid);
00200 }
00201 
00202 static inline int wpa_sm_mlme_setprotection(struct wpa_sm *sm, const u8 *addr,
00203                                             int protect_type, int key_type)
00204 {
00205         WPA_ASSERT(sm->ctx->mlme_setprotection);
00206         return sm->ctx->mlme_setprotection(sm->ctx->ctx, addr, protect_type,
00207                                            key_type);
00208 }
00209 
00210 static inline int wpa_sm_update_ft_ies(struct wpa_sm *sm, const u8 *md,
00211                                        const u8 *ies, size_t ies_len)
00212 {
00213         if (sm->ctx->update_ft_ies)
00214                 return sm->ctx->update_ft_ies(sm->ctx->ctx, md, ies, ies_len);
00215         return -1;
00216 }
00217 
00218 static inline int wpa_sm_send_ft_action(struct wpa_sm *sm, u8 action,
00219                                         const u8 *target_ap,
00220                                         const u8 *ies, size_t ies_len)
00221 {
00222         if (sm->ctx->send_ft_action)
00223                 return sm->ctx->send_ft_action(sm->ctx->ctx, action, target_ap,
00224                                                ies, ies_len);
00225         return -1;
00226 }
00227 
00228 
00229 void wpa_eapol_key_send(struct wpa_sm *sm, const u8 *kck,
00230                         int ver, const u8 *dest, u16 proto,
00231                         u8 *msg, size_t msg_len, u8 *key_mic);
00232 int wpa_supplicant_send_2_of_4(struct wpa_sm *sm, const unsigned char *dst,
00233                                const struct wpa_eapol_key *key,
00234                                int ver, const u8 *nonce,
00235                                const u8 *wpa_ie, size_t wpa_ie_len,
00236                                struct wpa_ptk *ptk);
00237 int wpa_supplicant_send_4_of_4(struct wpa_sm *sm, const unsigned char *dst,
00238                                const struct wpa_eapol_key *key,
00239                                u16 ver, u16 key_info,
00240                                const u8 *kde, size_t kde_len,
00241                                struct wpa_ptk *ptk);
00242 
00243 int wpa_derive_ptk_ft(struct wpa_sm *sm, const unsigned char *src_addr,
00244                       const struct wpa_eapol_key *key,
00245                       struct wpa_ptk *ptk, size_t ptk_len);
00246 
00247 #endif /* WPA_I_H */
00248 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 21 23:16:53 2009 for hostapd by  doxygen 1.6.1