1 /*
2  * EAP method registration
3  * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #include "includes.h"
10 
11 #include "common.h"
12 #include "eap_peer/eap_methods.h"
13 #include "eap_server/eap_methods.h"
14 #include "wpa_supplicant_i.h"
15 
16 
17 /**
18  * eap_register_methods - Register statically linked EAP methods
19  * Returns: 0 on success, -1 or -2 on failure
20  *
21  * This function is called at program initialization to register all EAP
22  * methods that were linked in statically.
23  */
eap_register_methods(void)24 int eap_register_methods(void)
25 {
26 	int ret = 0;
27 
28 #ifdef EAP_MD5
29 	if (ret == 0)
30 		ret = eap_peer_md5_register();
31 #endif /* EAP_MD5 */
32 
33 #ifdef EAP_TLS
34 	if (ret == 0)
35 		ret = eap_peer_tls_register();
36 #endif /* EAP_TLS */
37 
38 #ifdef EAP_UNAUTH_TLS
39 	if (ret == 0)
40 		ret = eap_peer_unauth_tls_register();
41 #endif /* EAP_UNAUTH_TLS */
42 
43 #ifdef EAP_TLS
44 #ifdef CONFIG_HS20
45 	if (ret == 0)
46 		ret = eap_peer_wfa_unauth_tls_register();
47 #endif /* CONFIG_HS20 */
48 #endif /* EAP_TLS */
49 
50 #ifdef EAP_MSCHAPv2
51 	if (ret == 0)
52 		ret = eap_peer_mschapv2_register();
53 #endif /* EAP_MSCHAPv2 */
54 
55 #ifdef EAP_PEAP
56 	if (ret == 0)
57 		ret = eap_peer_peap_register();
58 #endif /* EAP_PEAP */
59 
60 #ifdef EAP_TTLS
61 	if (ret == 0)
62 		ret = eap_peer_ttls_register();
63 #endif /* EAP_TTLS */
64 
65 #ifdef EAP_GTC
66 	if (ret == 0)
67 		ret = eap_peer_gtc_register();
68 #endif /* EAP_GTC */
69 
70 #ifdef EAP_OTP
71 	if (ret == 0)
72 		ret = eap_peer_otp_register();
73 #endif /* EAP_OTP */
74 
75 #ifdef EAP_SIM
76 	if (ret == 0)
77 		ret = eap_peer_sim_register();
78 #endif /* EAP_SIM */
79 
80 #ifdef EAP_LEAP
81 	if (ret == 0)
82 		ret = eap_peer_leap_register();
83 #endif /* EAP_LEAP */
84 
85 #ifdef EAP_PSK
86 	if (ret == 0)
87 		ret = eap_peer_psk_register();
88 #endif /* EAP_PSK */
89 
90 #ifdef EAP_AKA
91 	if (ret == 0)
92 		ret = eap_peer_aka_register();
93 #endif /* EAP_AKA */
94 
95 #ifdef EAP_AKA_PRIME
96 	if (ret == 0)
97 		ret = eap_peer_aka_prime_register();
98 #endif /* EAP_AKA_PRIME */
99 
100 #ifdef EAP_FAST
101 	if (ret == 0)
102 		ret = eap_peer_fast_register();
103 #endif /* EAP_FAST */
104 
105 #ifdef EAP_PAX
106 	if (ret == 0)
107 		ret = eap_peer_pax_register();
108 #endif /* EAP_PAX */
109 
110 #ifdef EAP_SAKE
111 	if (ret == 0)
112 		ret = eap_peer_sake_register();
113 #endif /* EAP_SAKE */
114 
115 #ifdef EAP_GPSK
116 	if (ret == 0)
117 		ret = eap_peer_gpsk_register();
118 #endif /* EAP_GPSK */
119 
120 #ifdef EAP_WSC
121 	if (ret == 0)
122 		ret = eap_peer_wsc_register();
123 #endif /* EAP_WSC */
124 
125 #ifdef EAP_IKEV2
126 	if (ret == 0)
127 		ret = eap_peer_ikev2_register();
128 #endif /* EAP_IKEV2 */
129 
130 #ifdef EAP_VENDOR_TEST
131 	if (ret == 0)
132 		ret = eap_peer_vendor_test_register();
133 #endif /* EAP_VENDOR_TEST */
134 
135 #ifdef EAP_TNC
136 	if (ret == 0)
137 		ret = eap_peer_tnc_register();
138 #endif /* EAP_TNC */
139 
140 #ifdef EAP_PWD
141 	if (ret == 0)
142 		ret = eap_peer_pwd_register();
143 #endif /* EAP_PWD */
144 
145 #ifdef EAP_EKE
146 	if (ret == 0)
147 		ret = eap_peer_eke_register();
148 #endif /* EAP_EKE */
149 
150 #ifdef EAP_SERVER_IDENTITY
151 	if (ret == 0)
152 		ret = eap_server_identity_register();
153 #endif /* EAP_SERVER_IDENTITY */
154 
155 #ifdef EAP_SERVER_MD5
156 	if (ret == 0)
157 		ret = eap_server_md5_register();
158 #endif /* EAP_SERVER_MD5 */
159 
160 #ifdef EAP_SERVER_TLS
161 	if (ret == 0)
162 		ret = eap_server_tls_register();
163 #endif /* EAP_SERVER_TLS */
164 
165 #ifdef EAP_SERVER_UNAUTH_TLS
166 	if (ret == 0)
167 		ret = eap_server_unauth_tls_register();
168 #endif /* EAP_SERVER_UNAUTH_TLS */
169 
170 #ifdef EAP_SERVER_MSCHAPV2
171 	if (ret == 0)
172 		ret = eap_server_mschapv2_register();
173 #endif /* EAP_SERVER_MSCHAPV2 */
174 
175 #ifdef EAP_SERVER_PEAP
176 	if (ret == 0)
177 		ret = eap_server_peap_register();
178 #endif /* EAP_SERVER_PEAP */
179 
180 #ifdef EAP_SERVER_TLV
181 	if (ret == 0)
182 		ret = eap_server_tlv_register();
183 #endif /* EAP_SERVER_TLV */
184 
185 #ifdef EAP_SERVER_GTC
186 	if (ret == 0)
187 		ret = eap_server_gtc_register();
188 #endif /* EAP_SERVER_GTC */
189 
190 #ifdef EAP_SERVER_TTLS
191 	if (ret == 0)
192 		ret = eap_server_ttls_register();
193 #endif /* EAP_SERVER_TTLS */
194 
195 #ifdef EAP_SERVER_SIM
196 	if (ret == 0)
197 		ret = eap_server_sim_register();
198 #endif /* EAP_SERVER_SIM */
199 
200 #ifdef EAP_SERVER_AKA
201 	if (ret == 0)
202 		ret = eap_server_aka_register();
203 #endif /* EAP_SERVER_AKA */
204 
205 #ifdef EAP_SERVER_AKA_PRIME
206 	if (ret == 0)
207 		ret = eap_server_aka_prime_register();
208 #endif /* EAP_SERVER_AKA_PRIME */
209 
210 #ifdef EAP_SERVER_PAX
211 	if (ret == 0)
212 		ret = eap_server_pax_register();
213 #endif /* EAP_SERVER_PAX */
214 
215 #ifdef EAP_SERVER_PSK
216 	if (ret == 0)
217 		ret = eap_server_psk_register();
218 #endif /* EAP_SERVER_PSK */
219 
220 #ifdef EAP_SERVER_SAKE
221 	if (ret == 0)
222 		ret = eap_server_sake_register();
223 #endif /* EAP_SERVER_SAKE */
224 
225 #ifdef EAP_SERVER_GPSK
226 	if (ret == 0)
227 		ret = eap_server_gpsk_register();
228 #endif /* EAP_SERVER_GPSK */
229 
230 #ifdef EAP_SERVER_VENDOR_TEST
231 	if (ret == 0)
232 		ret = eap_server_vendor_test_register();
233 #endif /* EAP_SERVER_VENDOR_TEST */
234 
235 #ifdef EAP_SERVER_FAST
236 	if (ret == 0)
237 		ret = eap_server_fast_register();
238 #endif /* EAP_SERVER_FAST */
239 
240 #ifdef EAP_SERVER_WSC
241 	if (ret == 0)
242 		ret = eap_server_wsc_register();
243 #endif /* EAP_SERVER_WSC */
244 
245 #ifdef EAP_SERVER_IKEV2
246 	if (ret == 0)
247 		ret = eap_server_ikev2_register();
248 #endif /* EAP_SERVER_IKEV2 */
249 
250 #ifdef EAP_SERVER_TNC
251 	if (ret == 0)
252 		ret = eap_server_tnc_register();
253 #endif /* EAP_SERVER_TNC */
254 
255 #ifdef EAP_SERVER_PWD
256 	if (ret == 0)
257 		ret = eap_server_pwd_register();
258 #endif /* EAP_SERVER_PWD */
259 
260 	return ret;
261 }
262