|
wpa_supplicant / hostapd 2.0
|
00001 00010 #ifndef EAP_I_H 00011 #define EAP_I_H 00012 00013 #include "wpabuf.h" 00014 #include "eap_peer/eap.h" 00015 #include "eap_common/eap_common.h" 00016 00017 /* RFC 4137 - EAP Peer state machine */ 00018 00019 typedef enum { 00020 DECISION_FAIL, DECISION_COND_SUCC, DECISION_UNCOND_SUCC 00021 } EapDecision; 00022 00023 typedef enum { 00024 METHOD_NONE, METHOD_INIT, METHOD_CONT, METHOD_MAY_CONT, METHOD_DONE 00025 } EapMethodState; 00026 00036 struct eap_method_ret { 00041 Boolean ignore; 00042 00047 EapMethodState methodState; 00048 00053 EapDecision decision; 00054 00059 Boolean allowNotifications; 00060 }; 00061 00062 00070 struct eap_method { 00075 int vendor; 00076 00081 EapType method; 00082 00087 const char *name; 00088 00100 void * (*init)(struct eap_sm *sm); 00101 00110 void (*deinit)(struct eap_sm *sm, void *priv); 00111 00128 struct wpabuf * (*process)(struct eap_sm *sm, void *priv, 00129 struct eap_method_ret *ret, 00130 const struct wpabuf *reqData); 00131 00139 Boolean (*isKeyAvailable)(struct eap_sm *sm, void *priv); 00140 00153 u8 * (*getKey)(struct eap_sm *sm, void *priv, size_t *len); 00154 00170 int (*get_status)(struct eap_sm *sm, void *priv, char *buf, 00171 size_t buflen, int verbose); 00172 00184 Boolean (*has_reauth_data)(struct eap_sm *sm, void *priv); 00185 00198 void (*deinit_for_reauth)(struct eap_sm *sm, void *priv); 00199 00211 void * (*init_for_reauth)(struct eap_sm *sm, void *priv); 00212 00225 const u8 * (*get_identity)(struct eap_sm *sm, void *priv, size_t *len); 00226 00241 void (*free)(struct eap_method *method); 00242 00243 #define EAP_PEER_METHOD_INTERFACE_VERSION 1 00244 00253 int version; 00254 00262 struct eap_method *next; 00263 00264 #ifdef CONFIG_DYNAMIC_EAP_METHODS 00265 00273 void *dl_handle; 00274 #endif /* CONFIG_DYNAMIC_EAP_METHODS */ 00275 00288 u8 * (*get_emsk)(struct eap_sm *sm, void *priv, size_t *len); 00289 }; 00290 00291 00296 struct eap_sm { 00297 enum { 00298 EAP_INITIALIZE, EAP_DISABLED, EAP_IDLE, EAP_RECEIVED, 00299 EAP_GET_METHOD, EAP_METHOD, EAP_SEND_RESPONSE, EAP_DISCARD, 00300 EAP_IDENTITY, EAP_NOTIFICATION, EAP_RETRANSMIT, EAP_SUCCESS, 00301 EAP_FAILURE 00302 } EAP_state; 00303 /* Long-term local variables */ 00304 EapType selectedMethod; 00305 EapMethodState methodState; 00306 int lastId; 00307 struct wpabuf *lastRespData; 00308 EapDecision decision; 00309 /* Short-term local variables */ 00310 Boolean rxReq; 00311 Boolean rxSuccess; 00312 Boolean rxFailure; 00313 int reqId; 00314 EapType reqMethod; 00315 int reqVendor; 00316 u32 reqVendorMethod; 00317 Boolean ignore; 00318 /* Constants */ 00319 int ClientTimeout; 00320 00321 /* Miscellaneous variables */ 00322 Boolean allowNotifications; /* peer state machine <-> methods */ 00323 struct wpabuf *eapRespData; /* peer to lower layer */ 00324 Boolean eapKeyAvailable; /* peer to lower layer */ 00325 u8 *eapKeyData; /* peer to lower layer */ 00326 size_t eapKeyDataLen; /* peer to lower layer */ 00327 const struct eap_method *m; /* selected EAP method */ 00328 /* not defined in RFC 4137 */ 00329 Boolean changed; 00330 void *eapol_ctx; 00331 struct eapol_callbacks *eapol_cb; 00332 void *eap_method_priv; 00333 int init_phase2; 00334 int fast_reauth; 00335 00336 Boolean rxResp /* LEAP only */; 00337 Boolean leap_done; 00338 Boolean peap_done; 00339 u8 req_md5[16]; /* MD5() of the current EAP packet */ 00340 u8 last_md5[16]; /* MD5() of the previously received EAP packet; used 00341 * in duplicate request detection. */ 00342 00343 void *msg_ctx; 00344 void *scard_ctx; 00345 void *ssl_ctx; 00346 void *ssl_ctx2; 00347 00348 unsigned int workaround; 00349 00350 /* Optional challenges generated in Phase 1 (EAP-FAST) */ 00351 u8 *peer_challenge, *auth_challenge; 00352 00353 int num_rounds; 00354 int force_disabled; 00355 00356 struct wps_context *wps; 00357 00358 int prev_failure; 00359 }; 00360 00361 const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len); 00362 const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len); 00363 const u8 * eap_get_config_password2(struct eap_sm *sm, size_t *len, int *hash); 00364 const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len); 00365 const u8 * eap_get_config_otp(struct eap_sm *sm, size_t *len); 00366 void eap_clear_config_otp(struct eap_sm *sm); 00367 const char * eap_get_config_phase1(struct eap_sm *sm); 00368 const char * eap_get_config_phase2(struct eap_sm *sm); 00369 int eap_get_config_fragment_size(struct eap_sm *sm); 00370 struct eap_peer_config * eap_get_config(struct eap_sm *sm); 00371 void eap_set_config_blob(struct eap_sm *sm, struct wpa_config_blob *blob); 00372 const struct wpa_config_blob * 00373 eap_get_config_blob(struct eap_sm *sm, const char *name); 00374 void eap_notify_pending(struct eap_sm *sm); 00375 int eap_allowed_method(struct eap_sm *sm, int vendor, u32 method); 00376 00377 #endif /* EAP_I_H */ 00378
1.7.3