2 * hostapd / EAP Authenticator state machine internal structures (RFC 4137)
3 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
19 #include "eap_server/eap.h"
20 #include "eap_common/eap_common.h"
22 /* RFC 4137 - EAP Standalone Authenticator */
25 * struct eap_method - EAP method interface
26 * This structure defines the EAP method interface. Each method will need to
27 * register its own EAP type, EAP name, and set of function pointers for method
28 * specific operations. This interface is based on section 5.4 of RFC 4137.
35 void * (*init
)(struct eap_sm
*sm
);
36 void * (*initPickUp
)(struct eap_sm
*sm
);
37 void (*reset
)(struct eap_sm
*sm
, void *priv
);
39 struct wpabuf
* (*buildReq
)(struct eap_sm
*sm
, void *priv
, u8 id
);
40 int (*getTimeout
)(struct eap_sm
*sm
, void *priv
);
41 Boolean (*check
)(struct eap_sm
*sm
, void *priv
,
42 struct wpabuf
*respData
);
43 void (*process
)(struct eap_sm
*sm
, void *priv
,
44 struct wpabuf
*respData
);
45 Boolean (*isDone
)(struct eap_sm
*sm
, void *priv
);
46 u8
* (*getKey
)(struct eap_sm
*sm
, void *priv
, size_t *len
);
47 /* isSuccess is not specified in draft-ietf-eap-statemachine-05.txt,
48 * but it is useful in implementing Policy.getDecision() */
49 Boolean (*isSuccess
)(struct eap_sm
*sm
, void *priv
);
52 * free - Free EAP method data
53 * @method: Pointer to the method data registered with
54 * eap_server_method_register().
56 * This function will be called when the EAP method is being
57 * unregistered. If the EAP method allocated resources during
58 * registration (e.g., allocated struct eap_method), they should be
59 * freed in this function. No other method functions will be called
60 * after this call. If this function is not defined (i.e., function
61 * pointer is %NULL), a default handler is used to release the method
62 * data with free(method). This is suitable for most cases.
64 void (*free
)(struct eap_method
*method
);
66 #define EAP_SERVER_METHOD_INTERFACE_VERSION 1
68 * version - Version of the EAP server method interface
70 * The EAP server method implementation should set this variable to
71 * EAP_SERVER_METHOD_INTERFACE_VERSION. This is used to verify that the
72 * EAP method is using supported API version when using dynamically
73 * loadable EAP methods.
78 * next - Pointer to the next EAP method
80 * This variable is used internally in the EAP method registration code
81 * to create a linked list of registered EAP methods.
83 struct eap_method
*next
;
86 * get_emsk - Get EAP method specific keying extended material (EMSK)
87 * @sm: Pointer to EAP state machine allocated with eap_sm_init()
88 * @priv: Pointer to private EAP method data from eap_method::init()
89 * @len: Pointer to a variable to store EMSK length
90 * Returns: EMSK or %NULL if not available
92 * This function can be used to get the extended keying material from
93 * the EAP method. The key may already be stored in the method-specific
94 * private data or this function may derive the key.
96 u8
* (*get_emsk
)(struct eap_sm
*sm
, void *priv
, size_t *len
);
100 * struct eap_sm - EAP server state machine data
104 EAP_DISABLED
, EAP_INITIALIZE
, EAP_IDLE
, EAP_RECEIVED
,
105 EAP_INTEGRITY_CHECK
, EAP_METHOD_RESPONSE
, EAP_METHOD_REQUEST
,
106 EAP_PROPOSE_METHOD
, EAP_SELECT_ACTION
, EAP_SEND_REQUEST
,
107 EAP_DISCARD
, EAP_NAK
, EAP_RETRANSMIT
, EAP_SUCCESS
, EAP_FAILURE
,
108 EAP_TIMEOUT_FAILURE
, EAP_PICK_UP_METHOD
,
109 EAP_INITIALIZE_PASSTHROUGH
, EAP_IDLE2
, EAP_RETRANSMIT2
,
110 EAP_RECEIVED2
, EAP_DISCARD2
, EAP_SEND_REQUEST2
,
111 EAP_AAA_REQUEST
, EAP_AAA_RESPONSE
, EAP_AAA_IDLE
,
112 EAP_TIMEOUT_FAILURE2
, EAP_FAILURE2
, EAP_SUCCESS2
118 struct eap_eapol_interface eap_if
;
120 /* Full authenticator state machine local variables */
122 /* Long-term (maintained betwen packets) */
123 EapType currentMethod
;
126 METHOD_PROPOSED
, METHOD_CONTINUE
, METHOD_END
129 struct wpabuf
*lastReqData
;
132 /* Short-term (not maintained between packets) */
137 u32 respVendorMethod
;
140 DECISION_SUCCESS
, DECISION_FAILURE
, DECISION_CONTINUE
,
144 /* Miscellaneous variables */
145 const struct eap_method
*m
; /* selected EAP method */
146 /* not defined in RFC 4137 */
148 void *eapol_ctx
, *msg_ctx
;
149 struct eapol_callbacks
*eapol_cb
;
150 void *eap_method_priv
;
153 /* Whether Phase 2 method should validate identity match */
154 int require_identity_match
;
155 int lastId
; /* Identifier used in the last EAP-Packet */
156 struct eap_user
*user
;
157 int user_eap_method_index
;
160 void *eap_sim_db_priv
;
161 Boolean backend_auth
;
167 METHOD_PENDING_NONE
, METHOD_PENDING_WAIT
, METHOD_PENDING_CONT
173 u8
*pac_opaque_encr_key
;
175 int eap_sim_aka_result_ind
;
179 int eap_user_get(struct eap_sm
*sm
, const u8
*identity
, size_t identity_len
,
181 void eap_sm_process_nak(struct eap_sm
*sm
, const u8
*nak_list
, size_t len
);