wpa_auth_i.h
Go to the documentation of this file.
00001 /*
00002  * hostapd - IEEE 802.11i-2004 / WPA Authenticator: Internal definitions
00003  * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #ifndef WPA_AUTH_I_H
00016 #define WPA_AUTH_I_H
00017 
00018 /* max(dot11RSNAConfigGroupUpdateCount,dot11RSNAConfigPairwiseUpdateCount) */
00019 #define RSNA_MAX_EAPOL_RETRIES 4
00020 
00021 struct wpa_group;
00022 
00023 struct wpa_stsl_negotiation {
00024         struct wpa_stsl_negotiation *next;
00025         u8 initiator[ETH_ALEN];
00026         u8 peer[ETH_ALEN];
00027 };
00028 
00029 
00030 struct wpa_state_machine {
00031         struct wpa_authenticator *wpa_auth;
00032         struct wpa_group *group;
00033 
00034         u8 addr[ETH_ALEN];
00035 
00036         enum {
00037                 WPA_PTK_INITIALIZE, WPA_PTK_DISCONNECT, WPA_PTK_DISCONNECTED,
00038                 WPA_PTK_AUTHENTICATION, WPA_PTK_AUTHENTICATION2,
00039                 WPA_PTK_INITPMK, WPA_PTK_INITPSK, WPA_PTK_PTKSTART,
00040                 WPA_PTK_PTKCALCNEGOTIATING, WPA_PTK_PTKCALCNEGOTIATING2,
00041                 WPA_PTK_PTKINITNEGOTIATING, WPA_PTK_PTKINITDONE
00042         } wpa_ptk_state;
00043 
00044         enum {
00045                 WPA_PTK_GROUP_IDLE = 0,
00046                 WPA_PTK_GROUP_REKEYNEGOTIATING,
00047                 WPA_PTK_GROUP_REKEYESTABLISHED,
00048                 WPA_PTK_GROUP_KEYERROR
00049         } wpa_ptk_group_state;
00050 
00051         Boolean Init;
00052         Boolean DeauthenticationRequest;
00053         Boolean AuthenticationRequest;
00054         Boolean ReAuthenticationRequest;
00055         Boolean Disconnect;
00056         int TimeoutCtr;
00057         int GTimeoutCtr;
00058         Boolean TimeoutEvt;
00059         Boolean EAPOLKeyReceived;
00060         Boolean EAPOLKeyPairwise;
00061         Boolean EAPOLKeyRequest;
00062         Boolean MICVerified;
00063         Boolean GUpdateStationKeys;
00064         u8 ANonce[WPA_NONCE_LEN];
00065         u8 SNonce[WPA_NONCE_LEN];
00066         u8 PMK[PMK_LEN];
00067         struct wpa_ptk PTK;
00068         Boolean PTK_valid;
00069         Boolean pairwise_set;
00070         int keycount;
00071         Boolean Pair;
00072         struct {
00073                 u8 counter[WPA_REPLAY_COUNTER_LEN];
00074                 Boolean valid;
00075         } key_replay[RSNA_MAX_EAPOL_RETRIES];
00076         Boolean PInitAKeys; /* WPA only, not in IEEE 802.11i */
00077         Boolean PTKRequest; /* not in IEEE 802.11i state machine */
00078         Boolean has_GTK;
00079         Boolean PtkGroupInit; /* init request for PTK Group state machine */
00080 
00081         u8 *last_rx_eapol_key; /* starting from IEEE 802.1X header */
00082         size_t last_rx_eapol_key_len;
00083 
00084         unsigned int changed:1;
00085         unsigned int in_step_loop:1;
00086         unsigned int pending_deinit:1;
00087         unsigned int started:1;
00088         unsigned int mgmt_frame_prot:1;
00089 #ifdef CONFIG_IEEE80211R
00090         unsigned int ft_completed:1;
00091         unsigned int pmk_r1_name_valid:1;
00092 #endif /* CONFIG_IEEE80211R */
00093 
00094         u8 req_replay_counter[WPA_REPLAY_COUNTER_LEN];
00095         int req_replay_counter_used;
00096 
00097         u8 *wpa_ie;
00098         size_t wpa_ie_len;
00099 
00100         enum {
00101                 WPA_VERSION_NO_WPA = 0 /* WPA not used */,
00102                 WPA_VERSION_WPA = 1 /* WPA / IEEE 802.11i/D3.0 */,
00103                 WPA_VERSION_WPA2 = 2 /* WPA2 / IEEE 802.11i */
00104         } wpa;
00105         int pairwise; /* Pairwise cipher suite, WPA_CIPHER_* */
00106         int wpa_key_mgmt; /* the selected WPA_KEY_MGMT_* */
00107         struct rsn_pmksa_cache_entry *pmksa;
00108 
00109         u32 dot11RSNAStatsTKIPLocalMICFailures;
00110         u32 dot11RSNAStatsTKIPRemoteMICFailures;
00111 
00112 #ifdef CONFIG_IEEE80211R
00113         u8 xxkey[PMK_LEN]; /* PSK or the second 256 bits of MSK */
00114         size_t xxkey_len;
00115         u8 pmk_r1_name[WPA_PMK_NAME_LEN]; /* PMKR1Name derived from FT Auth
00116                                            * Request */
00117         u8 r0kh_id[FT_R0KH_ID_MAX_LEN]; /* R0KH-ID from FT Auth Request */
00118         size_t r0kh_id_len;
00119         u8 sup_pmk_r1_name[WPA_PMK_NAME_LEN]; /* PMKR1Name from EAPOL-Key
00120                                                * message 2/4 */
00121         u8 *assoc_resp_ftie;
00122 #endif /* CONFIG_IEEE80211R */
00123 };
00124 
00125 
00126 /* per group key state machine data */
00127 struct wpa_group {
00128         struct wpa_group *next;
00129         int vlan_id;
00130 
00131         Boolean GInit;
00132         int GKeyDoneStations;
00133         Boolean GTKReKey;
00134         int GTK_len;
00135         int GN, GM;
00136         Boolean GTKAuthenticator;
00137         u8 Counter[WPA_NONCE_LEN];
00138 
00139         enum {
00140                 WPA_GROUP_GTK_INIT = 0,
00141                 WPA_GROUP_SETKEYS, WPA_GROUP_SETKEYSDONE
00142         } wpa_group_state;
00143 
00144         u8 GMK[WPA_GMK_LEN];
00145         u8 GTK[2][WPA_GTK_MAX_LEN];
00146         u8 GNonce[WPA_NONCE_LEN];
00147         Boolean changed;
00148 #ifdef CONFIG_IEEE80211W
00149         u8 IGTK[2][WPA_IGTK_LEN];
00150         int GN_igtk, GM_igtk;
00151 #endif /* CONFIG_IEEE80211W */
00152 };
00153 
00154 
00155 struct wpa_ft_pmk_cache;
00156 
00157 /* per authenticator data */
00158 struct wpa_authenticator {
00159         struct wpa_group *group;
00160 
00161         unsigned int dot11RSNAStatsTKIPRemoteMICFailures;
00162         u32 dot11RSNAAuthenticationSuiteSelected;
00163         u32 dot11RSNAPairwiseCipherSelected;
00164         u32 dot11RSNAGroupCipherSelected;
00165         u8 dot11RSNAPMKIDUsed[PMKID_LEN];
00166         u32 dot11RSNAAuthenticationSuiteRequested; /* FIX: update */
00167         u32 dot11RSNAPairwiseCipherRequested; /* FIX: update */
00168         u32 dot11RSNAGroupCipherRequested; /* FIX: update */
00169         unsigned int dot11RSNATKIPCounterMeasuresInvoked;
00170         unsigned int dot11RSNA4WayHandshakeFailures;
00171 
00172         struct wpa_stsl_negotiation *stsl_negotiations;
00173 
00174         struct wpa_auth_config conf;
00175         struct wpa_auth_callbacks cb;
00176 
00177         u8 *wpa_ie;
00178         size_t wpa_ie_len;
00179 
00180         u8 addr[ETH_ALEN];
00181 
00182         struct rsn_pmksa_cache *pmksa;
00183         struct wpa_ft_pmk_cache *ft_pmk_cache;
00184 };
00185 
00186 
00187 int wpa_write_rsn_ie(struct wpa_auth_config *conf, u8 *buf, size_t len,
00188                      const u8 *pmkid);
00189 void wpa_auth_logger(struct wpa_authenticator *wpa_auth, const u8 *addr,
00190                      logger_level level, const char *txt);
00191 void wpa_auth_vlogger(struct wpa_authenticator *wpa_auth, const u8 *addr,
00192                       logger_level level, const char *fmt, ...);
00193 void __wpa_send_eapol(struct wpa_authenticator *wpa_auth,
00194                       struct wpa_state_machine *sm, int key_info,
00195                       const u8 *key_rsc, const u8 *nonce,
00196                       const u8 *kde, size_t kde_len,
00197                       int keyidx, int encr, int force_version);
00198 int wpa_auth_for_each_sta(struct wpa_authenticator *wpa_auth,
00199                           int (*cb)(struct wpa_state_machine *sm, void *ctx),
00200                           void *cb_ctx);
00201 int wpa_auth_for_each_auth(struct wpa_authenticator *wpa_auth,
00202                            int (*cb)(struct wpa_authenticator *a, void *ctx),
00203                            void *cb_ctx);
00204 
00205 #ifdef CONFIG_PEERKEY
00206 int wpa_stsl_remove(struct wpa_authenticator *wpa_auth,
00207                     struct wpa_stsl_negotiation *neg);
00208 void wpa_smk_error(struct wpa_authenticator *wpa_auth,
00209                    struct wpa_state_machine *sm, struct wpa_eapol_key *key);
00210 void wpa_smk_m1(struct wpa_authenticator *wpa_auth,
00211                 struct wpa_state_machine *sm, struct wpa_eapol_key *key);
00212 void wpa_smk_m3(struct wpa_authenticator *wpa_auth,
00213                 struct wpa_state_machine *sm, struct wpa_eapol_key *key);
00214 #endif /* CONFIG_PEERKEY */
00215 
00216 #ifdef CONFIG_IEEE80211R
00217 int wpa_write_mdie(struct wpa_auth_config *conf, u8 *buf, size_t len);
00218 int wpa_write_ftie(struct wpa_auth_config *conf, const u8 *r0kh_id,
00219                    size_t r0kh_id_len,
00220                    const u8 *anonce, const u8 *snonce,
00221                    u8 *buf, size_t len, const u8 *subelem,
00222                    size_t subelem_len);
00223 int wpa_auth_derive_ptk_ft(struct wpa_state_machine *sm, const u8 *pmk,
00224                            struct wpa_ptk *ptk, size_t ptk_len);
00225 struct wpa_ft_pmk_cache * wpa_ft_pmk_cache_init(void);
00226 void wpa_ft_pmk_cache_deinit(struct wpa_ft_pmk_cache *cache);
00227 void wpa_ft_install_ptk(struct wpa_state_machine *sm);
00228 #endif /* CONFIG_IEEE80211R */
00229 
00230 #endif /* WPA_AUTH_I_H */


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:36