00001
00016 #ifndef EAP_I_H
00017 #define EAP_I_H
00018
00019 #include "eap.h"
00020
00021
00022
00023 typedef enum {
00024 DECISION_FAIL, DECISION_COND_SUCC, DECISION_UNCOND_SUCC
00025 } EapDecision;
00026
00027 typedef enum {
00028 METHOD_NONE, METHOD_INIT, METHOD_CONT, METHOD_MAY_CONT, METHOD_DONE
00029 } EapMethodState;
00030
00040 struct eap_method_ret {
00045 Boolean ignore;
00046
00051 EapMethodState methodState;
00052
00057 EapDecision decision;
00058
00063 Boolean allowNotifications;
00064 };
00065
00066
00074 struct eap_method {
00079 int vendor;
00080
00085 EapType method;
00086
00091 const char *name;
00092
00104 void * (*init)(struct eap_sm *sm);
00105
00114 void (*deinit)(struct eap_sm *sm, void *priv);
00115
00134 u8 * (*process)(struct eap_sm *sm, void *priv,
00135 struct eap_method_ret *ret,
00136 const u8 *reqData, size_t reqDataLen,
00137 size_t *respDataLen);
00138
00146 Boolean (*isKeyAvailable)(struct eap_sm *sm, void *priv);
00147
00160 u8 * (*getKey)(struct eap_sm *sm, void *priv, size_t *len);
00161
00177 int (*get_status)(struct eap_sm *sm, void *priv, char *buf,
00178 size_t buflen, int verbose);
00179
00191 Boolean (*has_reauth_data)(struct eap_sm *sm, void *priv);
00192
00205 void (*deinit_for_reauth)(struct eap_sm *sm, void *priv);
00206
00218 void * (*init_for_reauth)(struct eap_sm *sm, void *priv);
00219
00232 const u8 * (*get_identity)(struct eap_sm *sm, void *priv, size_t *len);
00233
00248 void (*free)(struct eap_method *method);
00249
00250 #define EAP_PEER_METHOD_INTERFACE_VERSION 1
00251
00260 int version;
00261
00269 struct eap_method *next;
00270
00271 #ifdef CONFIG_DYNAMIC_EAP_METHODS
00272
00280 void *dl_handle;
00281 #endif
00282
00295 u8 * (*get_emsk)(struct eap_sm *sm, void *priv, size_t *len);
00296 };
00297
00298
00303 struct eap_sm {
00304 enum {
00305 EAP_INITIALIZE, EAP_DISABLED, EAP_IDLE, EAP_RECEIVED,
00306 EAP_GET_METHOD, EAP_METHOD, EAP_SEND_RESPONSE, EAP_DISCARD,
00307 EAP_IDENTITY, EAP_NOTIFICATION, EAP_RETRANSMIT, EAP_SUCCESS,
00308 EAP_FAILURE
00309 } EAP_state;
00310
00311 EapType selectedMethod;
00312 EapMethodState methodState;
00313 int lastId;
00314 u8 *lastRespData;
00315 size_t lastRespDataLen;
00316 EapDecision decision;
00317
00318 Boolean rxReq;
00319 Boolean rxSuccess;
00320 Boolean rxFailure;
00321 int reqId;
00322 EapType reqMethod;
00323 int reqVendor;
00324 u32 reqVendorMethod;
00325 Boolean ignore;
00326
00327 int ClientTimeout;
00328
00329
00330 Boolean allowNotifications;
00331 u8 *eapRespData;
00332 size_t eapRespDataLen;
00333 Boolean eapKeyAvailable;
00334 u8 *eapKeyData;
00335 size_t eapKeyDataLen;
00336 const struct eap_method *m;
00337
00338 Boolean changed;
00339 void *eapol_ctx;
00340 struct eapol_callbacks *eapol_cb;
00341 void *eap_method_priv;
00342 int init_phase2;
00343 int fast_reauth;
00344
00345 Boolean rxResp ;
00346 Boolean leap_done;
00347 Boolean peap_done;
00348 u8 req_md5[16];
00349 u8 last_md5[16];
00350
00351
00352 void *msg_ctx;
00353 void *scard_ctx;
00354 void *ssl_ctx;
00355
00356 unsigned int workaround;
00357
00358
00359 u8 *peer_challenge, *auth_challenge;
00360 int mschapv2_full_key;
00361
00362 int num_rounds;
00363 int force_disabled;
00364 };
00365
00366 const u8 * eap_hdr_validate(int vendor, EapType eap_type,
00367 const u8 *msg, size_t msglen, size_t *plen);
00368 const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len);
00369 const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len);
00370 const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len);
00371 const u8 * eap_get_config_otp(struct eap_sm *sm, size_t *len);
00372 void eap_clear_config_otp(struct eap_sm *sm);
00373 struct wpa_ssid * eap_get_config(struct eap_sm *sm);
00374 void eap_set_config_blob(struct eap_sm *sm, struct wpa_config_blob *blob);
00375 const struct wpa_config_blob *
00376 eap_get_config_blob(struct eap_sm *sm, const char *name);
00377 struct eap_hdr * eap_msg_alloc(int vendor, EapType type, size_t *len,
00378 size_t payload_len, u8 code, u8 identifier,
00379 u8 **payload);
00380 void eap_notify_pending(struct eap_sm *sm);
00381
00382 #endif
00383