Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * hostapd / EAP Full Authenticator state machine (RFC 4137) |
| 3 | * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi> |
| 4 | * |
Dmitry Shmidt | c5ec7f5 | 2012-03-06 16:33:24 -0800 | [diff] [blame] | 5 | * This software may be distributed under the terms of the BSD license. |
| 6 | * See README for more details. |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef EAP_H |
| 10 | #define EAP_H |
| 11 | |
| 12 | #include "common/defs.h" |
| 13 | #include "eap_common/eap_defs.h" |
| 14 | #include "eap_server/eap_methods.h" |
| 15 | #include "wpabuf.h" |
| 16 | |
| 17 | struct eap_sm; |
| 18 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 19 | #define EAP_TTLS_AUTH_PAP 1 |
| 20 | #define EAP_TTLS_AUTH_CHAP 2 |
| 21 | #define EAP_TTLS_AUTH_MSCHAP 4 |
| 22 | #define EAP_TTLS_AUTH_MSCHAPV2 8 |
| 23 | |
| 24 | struct eap_user { |
| 25 | struct { |
| 26 | int vendor; |
| 27 | u32 method; |
| 28 | } methods[EAP_MAX_METHODS]; |
| 29 | u8 *password; |
| 30 | size_t password_len; |
| 31 | int password_hash; /* whether password is hashed with |
| 32 | * nt_password_hash() */ |
| 33 | int phase2; |
| 34 | int force_version; |
Dmitry Shmidt | f21452a | 2014-02-26 10:55:25 -0800 | [diff] [blame^] | 35 | unsigned int remediation:1; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 36 | int ttls_auth; /* bitfield of |
| 37 | * EAP_TTLS_AUTH_{PAP,CHAP,MSCHAP,MSCHAPV2} */ |
| 38 | }; |
| 39 | |
| 40 | struct eap_eapol_interface { |
| 41 | /* Lower layer to full authenticator variables */ |
| 42 | Boolean eapResp; /* shared with EAPOL Backend Authentication */ |
| 43 | struct wpabuf *eapRespData; |
| 44 | Boolean portEnabled; |
| 45 | int retransWhile; |
| 46 | Boolean eapRestart; /* shared with EAPOL Authenticator PAE */ |
| 47 | int eapSRTT; |
| 48 | int eapRTTVAR; |
| 49 | |
| 50 | /* Full authenticator to lower layer variables */ |
| 51 | Boolean eapReq; /* shared with EAPOL Backend Authentication */ |
| 52 | Boolean eapNoReq; /* shared with EAPOL Backend Authentication */ |
| 53 | Boolean eapSuccess; |
| 54 | Boolean eapFail; |
| 55 | Boolean eapTimeout; |
| 56 | struct wpabuf *eapReqData; |
| 57 | u8 *eapKeyData; |
| 58 | size_t eapKeyDataLen; |
| 59 | Boolean eapKeyAvailable; /* called keyAvailable in IEEE 802.1X-2004 */ |
| 60 | |
| 61 | /* AAA interface to full authenticator variables */ |
| 62 | Boolean aaaEapReq; |
| 63 | Boolean aaaEapNoReq; |
| 64 | Boolean aaaSuccess; |
| 65 | Boolean aaaFail; |
| 66 | struct wpabuf *aaaEapReqData; |
| 67 | u8 *aaaEapKeyData; |
| 68 | size_t aaaEapKeyDataLen; |
| 69 | Boolean aaaEapKeyAvailable; |
| 70 | int aaaMethodTimeout; |
| 71 | |
| 72 | /* Full authenticator to AAA interface variables */ |
| 73 | Boolean aaaEapResp; |
| 74 | struct wpabuf *aaaEapRespData; |
| 75 | /* aaaIdentity -> eap_get_identity() */ |
| 76 | Boolean aaaTimeout; |
| 77 | }; |
| 78 | |
| 79 | struct eapol_callbacks { |
| 80 | int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len, |
| 81 | int phase2, struct eap_user *user); |
| 82 | const char * (*get_eap_req_id_text)(void *ctx, size_t *len); |
| 83 | }; |
| 84 | |
| 85 | struct eap_config { |
| 86 | void *ssl_ctx; |
| 87 | void *msg_ctx; |
| 88 | void *eap_sim_db_priv; |
| 89 | Boolean backend_auth; |
| 90 | int eap_server; |
| 91 | u16 pwd_group; |
| 92 | u8 *pac_opaque_encr_key; |
| 93 | u8 *eap_fast_a_id; |
| 94 | size_t eap_fast_a_id_len; |
| 95 | char *eap_fast_a_id_info; |
| 96 | int eap_fast_prov; |
| 97 | int pac_key_lifetime; |
| 98 | int pac_key_refresh_time; |
| 99 | int eap_sim_aka_result_ind; |
| 100 | int tnc; |
| 101 | struct wps_context *wps; |
| 102 | const struct wpabuf *assoc_wps_ie; |
| 103 | const struct wpabuf *assoc_p2p_ie; |
| 104 | const u8 *peer_addr; |
| 105 | int fragment_size; |
Jouni Malinen | 87fd279 | 2011-05-16 18:35:42 +0300 | [diff] [blame] | 106 | |
| 107 | int pbc_in_m1; |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 108 | |
| 109 | const u8 *server_id; |
| 110 | size_t server_id_len; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 111 | }; |
| 112 | |
| 113 | |
| 114 | struct eap_sm * eap_server_sm_init(void *eapol_ctx, |
| 115 | struct eapol_callbacks *eapol_cb, |
| 116 | struct eap_config *eap_conf); |
| 117 | void eap_server_sm_deinit(struct eap_sm *sm); |
| 118 | int eap_server_sm_step(struct eap_sm *sm); |
| 119 | void eap_sm_notify_cached(struct eap_sm *sm); |
| 120 | void eap_sm_pending_cb(struct eap_sm *sm); |
| 121 | int eap_sm_method_pending(struct eap_sm *sm); |
| 122 | const u8 * eap_get_identity(struct eap_sm *sm, size_t *len); |
| 123 | struct eap_eapol_interface * eap_get_interface(struct eap_sm *sm); |
| 124 | void eap_server_clear_identity(struct eap_sm *sm); |
| 125 | |
| 126 | #endif /* EAP_H */ |