wpa_i.h

Go to the documentation of this file.
00001 
00016 #ifndef WPA_I_H
00017 #define WPA_I_H
00018 
00019 #define WPA_NONCE_LEN 32
00020 #define WPA_REPLAY_COUNTER_LEN 8
00021 
00022 
00023 struct rsn_pmksa_candidate;
00024 
00030 struct wpa_ptk {
00031         u8 kck[16]; /* EAPOL-Key Key Confirmation Key (KCK) */
00032         u8 kek[16]; /* EAPOL-Key Key Encryption Key (KEK) */
00033         u8 tk1[16]; /* Temporal Key 1 (TK1) */
00034         union {
00035                 u8 tk2[16]; /* Temporal Key 2 (TK2) */
00036                 struct {
00037                         u8 tx_mic_key[8];
00038                         u8 rx_mic_key[8];
00039                 } auth;
00040         } u;
00041 } __attribute__ ((packed));
00042 
00043 
00048 struct rsn_pmksa_cache {
00049         struct rsn_pmksa_cache *next;
00050         u8 pmkid[PMKID_LEN];
00051         u8 pmk[PMK_LEN];
00052         size_t pmk_len;
00053         time_t expiration;
00054         time_t reauth_time;
00055         int akmp; /* WPA_KEY_MGMT_* */
00056         u8 aa[ETH_ALEN];
00057         struct wpa_ssid *ssid;
00058         int opportunistic;
00059 };
00060 
00061 
00066 struct wpa_sm {
00067         u8 pmk[PMK_LEN];
00068         size_t pmk_len;
00069         struct wpa_ptk ptk, tptk;
00070         int ptk_set, tptk_set;
00071         u8 snonce[WPA_NONCE_LEN];
00072         u8 anonce[WPA_NONCE_LEN]; /* ANonce from the last 1/4 msg */
00073         int renew_snonce;
00074         u8 rx_replay_counter[WPA_REPLAY_COUNTER_LEN];
00075         int rx_replay_counter_set;
00076         u8 request_counter[WPA_REPLAY_COUNTER_LEN];
00077 
00078         struct eapol_sm *eapol; /* EAPOL state machine from upper level code */
00079 
00080         struct rsn_pmksa_cache *pmksa; /* PMKSA cache */
00081         struct rsn_pmksa_cache *cur_pmksa; /* current PMKSA entry */
00082         int pmksa_count; /* number of entries in PMKSA cache */
00083         struct rsn_pmksa_candidate *pmksa_candidates;
00084 
00085         struct l2_packet_data *l2_preauth;
00086         u8 preauth_bssid[ETH_ALEN]; /* current RSN pre-auth peer or
00087                                      * 00:00:00:00:00:00 if no pre-auth is
00088                                      * in progress */
00089         struct eapol_sm *preauth_eapol;
00090 
00091         struct wpa_sm_ctx *ctx;
00092 
00093         void *scard_ctx; /* context for smartcard callbacks */
00094         int fast_reauth; /* whether EAP fast re-authentication is enabled */
00095 
00096         struct wpa_ssid *cur_ssid;
00097 
00098         u8 own_addr[ETH_ALEN];
00099         const char *ifname;
00100         u8 bssid[ETH_ALEN];
00101 
00102         unsigned int dot11RSNAConfigPMKLifetime;
00103         unsigned int dot11RSNAConfigPMKReauthThreshold;
00104         unsigned int dot11RSNAConfigSATimeout;
00105 
00106         unsigned int dot11RSNA4WayHandshakeFailures;
00107 
00108         /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
00109         unsigned int proto;
00110         unsigned int pairwise_cipher;
00111         unsigned int group_cipher;
00112         unsigned int key_mgmt;
00113 
00114         u8 *assoc_wpa_ie; /* Own WPA/RSN IE from (Re)AssocReq */
00115         size_t assoc_wpa_ie_len;
00116         u8 *ap_wpa_ie, *ap_rsn_ie;
00117         size_t ap_wpa_ie_len, ap_rsn_ie_len;
00118 };
00119 
00120 
00121 static inline void wpa_sm_set_state(struct wpa_sm *sm, wpa_states state)
00122 {
00123         sm->ctx->set_state(sm->ctx->ctx, state);
00124 }
00125 
00126 static inline wpa_states wpa_sm_get_state(struct wpa_sm *sm)
00127 {
00128         return sm->ctx->get_state(sm->ctx->ctx);
00129 }
00130 
00131 static inline void wpa_sm_req_scan(struct wpa_sm *sm, int sec, int usec)
00132 {
00133         sm->ctx->req_scan(sm->ctx->ctx, sec, usec);
00134 }
00135 
00136 static inline void wpa_sm_deauthenticate(struct wpa_sm *sm, int reason_code)
00137 {
00138         sm->ctx->deauthenticate(sm->ctx->ctx, reason_code);
00139 }
00140 
00141 static inline void wpa_sm_disassociate(struct wpa_sm *sm, int reason_code)
00142 {
00143         sm->ctx->disassociate(sm->ctx->ctx, reason_code);
00144 }
00145 
00146 static inline int wpa_sm_set_key(struct wpa_sm *sm, wpa_alg alg,
00147                                  const u8 *addr, int key_idx, int set_tx,
00148                                  const u8 *seq, size_t seq_len,
00149                                  const u8 *key, size_t key_len)
00150 {
00151         return sm->ctx->set_key(sm->ctx->ctx, alg, addr, key_idx, set_tx,
00152                                 seq, seq_len, key, key_len);
00153 }
00154 
00155 static inline struct wpa_ssid * wpa_sm_get_ssid(struct wpa_sm *sm)
00156 {
00157         return sm->ctx->get_ssid(sm->ctx->ctx);
00158 }
00159 
00160 static inline int wpa_sm_get_bssid(struct wpa_sm *sm, u8 *bssid)
00161 {
00162         return sm->ctx->get_bssid(sm->ctx->ctx, bssid);
00163 }
00164 
00165 static inline int wpa_sm_ether_send(struct wpa_sm *sm, const u8 *dest,
00166                                     u16 proto, const u8 *buf, size_t len)
00167 {
00168         return sm->ctx->ether_send(sm->ctx->ctx, dest, proto, buf, len);
00169 }
00170 
00171 static inline int wpa_sm_get_beacon_ie(struct wpa_sm *sm)
00172 {
00173         return sm->ctx->get_beacon_ie(sm->ctx->ctx);
00174 }
00175 
00176 static inline void wpa_sm_cancel_auth_timeout(struct wpa_sm *sm)
00177 {
00178         sm->ctx->cancel_auth_timeout(sm->ctx->ctx);
00179 }
00180 
00181 static inline u8 * wpa_sm_alloc_eapol(struct wpa_sm *sm, u8 type,
00182                                       const void *data, u16 data_len,
00183                                       size_t *msg_len, void **data_pos)
00184 {
00185         return sm->ctx->alloc_eapol(sm->ctx->ctx, type, data, data_len,
00186                                     msg_len, data_pos);
00187 }
00188 
00189 static inline int wpa_sm_add_pmkid(struct wpa_sm *sm, const u8 *bssid,
00190                                    const u8 *pmkid)
00191 {
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         return sm->ctx->remove_pmkid(sm->ctx->ctx, bssid, pmkid);
00199 }
00200 
00201 #endif /* WPA_I_H */
00202 

Generated on Sat May 6 21:13:42 2006 for wpa_supplicant by  doxygen 1.4.2