wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap.h
Go to the documentation of this file.
1 
5 #ifndef EAP_H
6 #define EAP_H
7 
8 #include "common/defs.h"
9 #include "utils/list.h"
10 #include "eap_common/eap_defs.h"
11 #include "eap_server/eap_methods.h"
12 #include "wpabuf.h"
13 
14 struct eap_sm;
15 
16 #define EAP_TTLS_AUTH_PAP 1
17 #define EAP_TTLS_AUTH_CHAP 2
18 #define EAP_TTLS_AUTH_MSCHAP 4
19 #define EAP_TTLS_AUTH_MSCHAPV2 8
20 
21 struct eap_user {
22  struct {
23  int vendor;
24  u32 method;
25  } methods[EAP_MAX_METHODS];
26  u8 *password;
27  size_t password_len;
28  int password_hash; /* whether password is hashed with
29  * nt_password_hash() */
30  int phase2;
31  int force_version;
32  unsigned int remediation:1;
33  unsigned int macacl:1;
34  int ttls_auth; /* bitfield of
35  * EAP_TTLS_AUTH_{PAP,CHAP,MSCHAP,MSCHAPV2} */
36  struct hostapd_radius_attr *accept_attr;
37 };
38 
40  /* Lower layer to full authenticator variables */
41  Boolean eapResp; /* shared with EAPOL Backend Authentication */
42  struct wpabuf *eapRespData;
43  Boolean portEnabled;
44  int retransWhile;
45  Boolean eapRestart; /* shared with EAPOL Authenticator PAE */
46  int eapSRTT;
47  int eapRTTVAR;
48 
49  /* Full authenticator to lower layer variables */
50  Boolean eapReq; /* shared with EAPOL Backend Authentication */
51  Boolean eapNoReq; /* shared with EAPOL Backend Authentication */
52  Boolean eapSuccess;
53  Boolean eapFail;
54  Boolean eapTimeout;
55  struct wpabuf *eapReqData;
56  u8 *eapKeyData;
57  size_t eapKeyDataLen;
58  u8 *eapSessionId;
59  size_t eapSessionIdLen;
60  Boolean eapKeyAvailable; /* called keyAvailable in IEEE 802.1X-2004 */
61 
62  /* AAA interface to full authenticator variables */
63  Boolean aaaEapReq;
64  Boolean aaaEapNoReq;
65  Boolean aaaSuccess;
66  Boolean aaaFail;
67  struct wpabuf *aaaEapReqData;
68  u8 *aaaEapKeyData;
69  size_t aaaEapKeyDataLen;
70  Boolean aaaEapKeyAvailable;
71  int aaaMethodTimeout;
72 
73  /* Full authenticator to AAA interface variables */
74  Boolean aaaEapResp;
75  struct wpabuf *aaaEapRespData;
76  /* aaaIdentity -> eap_get_identity() */
77  Boolean aaaTimeout;
78 };
79 
81  struct dl_list list;
82  size_t rRK_len;
83  size_t rIK_len;
84  u8 rRK[ERP_MAX_KEY_LEN];
85  u8 rIK[ERP_MAX_KEY_LEN];
86  u32 recv_seq;
87  u8 cryptosuite;
88  char keyname_nai[];
89 };
90 
91 struct eapol_callbacks {
92  int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
93  int phase2, struct eap_user *user);
94  const char * (*get_eap_req_id_text)(void *ctx, size_t *len);
95  void (*log_msg)(void *ctx, const char *msg);
96  int (*get_erp_send_reauth_start)(void *ctx);
97  const char * (*get_erp_domain)(void *ctx);
98  struct eap_server_erp_key * (*erp_get_key)(void *ctx,
99  const char *keyname);
100  int (*erp_add_key)(void *ctx, struct eap_server_erp_key *erp);
101 };
102 
103 struct eap_config {
104  void *ssl_ctx;
105  void *msg_ctx;
106  void *eap_sim_db_priv;
107  Boolean backend_auth;
108  int eap_server;
109  u16 pwd_group;
110  u8 *pac_opaque_encr_key;
111  u8 *eap_fast_a_id;
112  size_t eap_fast_a_id_len;
113  char *eap_fast_a_id_info;
114  int eap_fast_prov;
115  int pac_key_lifetime;
116  int pac_key_refresh_time;
117  int eap_sim_aka_result_ind;
118  int tnc;
119  struct wps_context *wps;
120  const struct wpabuf *assoc_wps_ie;
121  const struct wpabuf *assoc_p2p_ie;
122  const u8 *peer_addr;
123  int fragment_size;
124 
125  int pbc_in_m1;
126 
127  const u8 *server_id;
128  size_t server_id_len;
129  int erp;
130  unsigned int tls_session_lifetime;
131 
132 #ifdef CONFIG_TESTING_OPTIONS
133  u32 tls_test_flags;
134 #endif /* CONFIG_TESTING_OPTIONS */
135 };
136 
137 
138 struct eap_sm * eap_server_sm_init(void *eapol_ctx,
139  const struct eapol_callbacks *eapol_cb,
140  struct eap_config *eap_conf);
141 void eap_server_sm_deinit(struct eap_sm *sm);
142 int eap_server_sm_step(struct eap_sm *sm);
143 void eap_sm_notify_cached(struct eap_sm *sm);
144 void eap_sm_pending_cb(struct eap_sm *sm);
145 int eap_sm_method_pending(struct eap_sm *sm);
146 const u8 * eap_get_identity(struct eap_sm *sm, size_t *len);
147 struct eap_eapol_interface * eap_get_interface(struct eap_sm *sm);
148 void eap_server_clear_identity(struct eap_sm *sm);
149 void eap_server_mschap_rx_callback(struct eap_sm *sm, const char *source,
150  const u8 *username, size_t username_len,
151  const u8 *challenge, const u8 *response);
152 
153 #endif /* EAP_H */
void eap_server_clear_identity(struct eap_sm *sm)
Clear EAP identity information.
Definition: eap_server.c:1986
Definition: ap_config.h:158
WPA Supplicant - Common definitions.
Definition: eap.h:80
Definition: wpabuf.h:16
int eap_sm_method_pending(struct eap_sm *sm)
Query whether EAP method is waiting for pending data.
Definition: eap_server.c:1946
Definition: eap.h:21
Definition: eap.h:39
void eap_server_sm_deinit(struct eap_sm *sm)
Deinitialize and free an EAP server state machine.
Definition: eap_server.c:1883
void eap_sm_notify_cached(struct eap_sm *sm)
Notify EAP state machine of cached PMK.
Definition: eap_server.c:1916
struct eap_sm * eap_server_sm_init(void *eapol_ctx, const struct eapol_callbacks *eapol_cb, struct eap_config *eap_conf)
Allocate and initialize EAP server state machine.
Definition: eap_server.c:1812
Dynamic data buffer.
Doubly-linked list.
Doubly-linked list.
Definition: list.h:12
EAP server/peer: Shared EAP definitions.
Callback functions from EAP to lower layer.
Definition: eap.h:147
EAP server method registration.
const u8 * eap_get_identity(struct eap_sm *sm, size_t *len)
Get the user identity (from EAP-Response/Identity)
Definition: eap_server.c:1960
int eap_server_sm_step(struct eap_sm *sm)
Step EAP server state machine.
Definition: eap_server.c:1780
void eap_sm_pending_cb(struct eap_sm *sm)
EAP state machine callback for a pending EAP request.
Definition: eap_server.c:1931
Global (for all networks) EAPOL state machine context.
Definition: eapol_supp_sm.h:87
Configuration for EAP state machine.
Definition: eap.h:280
struct eap_eapol_interface * eap_get_interface(struct eap_sm *sm)
Get pointer to EAP-EAPOL interface data.
Definition: eap_server.c:1972
EAP state machine data.
Definition: eap_i.h:302
struct wps_context * wps
WPS context data.
Definition: eap.h:317
Long term WPS context data.
Definition: wps.h:623