xref: /freebsd/contrib/wpa/hostapd/eap_register.c (revision c5c3ba6b43cac20dc9432eac15758d41cb2b8b1f)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * EAP method registration
3e28a4053SRui Paulo  * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
7e28a4053SRui Paulo  */
8e28a4053SRui Paulo 
9e28a4053SRui Paulo #include "includes.h"
10e28a4053SRui Paulo 
11e28a4053SRui Paulo #include "common.h"
12e28a4053SRui Paulo #include "eap_server/eap_methods.h"
13e28a4053SRui Paulo #include "eap_register.h"
14e28a4053SRui Paulo 
15e28a4053SRui Paulo 
16e28a4053SRui Paulo /**
17e28a4053SRui Paulo  * eap_server_register_methods - Register statically linked EAP server methods
18e28a4053SRui Paulo  * Returns: 0 on success, -1 or -2 on failure
19e28a4053SRui Paulo  *
20e28a4053SRui Paulo  * This function is called at program initialization to register all EAP
21e28a4053SRui Paulo  * methods that were linked in statically.
22e28a4053SRui Paulo  */
eap_server_register_methods(void)23e28a4053SRui Paulo int eap_server_register_methods(void)
24e28a4053SRui Paulo {
25e28a4053SRui Paulo 	int ret = 0;
26e28a4053SRui Paulo 
27e28a4053SRui Paulo #ifdef EAP_SERVER_IDENTITY
28e28a4053SRui Paulo 	if (ret == 0)
29e28a4053SRui Paulo 		ret = eap_server_identity_register();
30e28a4053SRui Paulo #endif /* EAP_SERVER_IDENTITY */
31e28a4053SRui Paulo 
32e28a4053SRui Paulo #ifdef EAP_SERVER_MD5
33e28a4053SRui Paulo 	if (ret == 0)
34e28a4053SRui Paulo 		ret = eap_server_md5_register();
35e28a4053SRui Paulo #endif /* EAP_SERVER_MD5 */
36e28a4053SRui Paulo 
37e28a4053SRui Paulo #ifdef EAP_SERVER_TLS
38e28a4053SRui Paulo 	if (ret == 0)
39e28a4053SRui Paulo 		ret = eap_server_tls_register();
40e28a4053SRui Paulo #endif /* EAP_SERVER_TLS */
41e28a4053SRui Paulo 
42f05cddf9SRui Paulo #ifdef EAP_SERVER_UNAUTH_TLS
43f05cddf9SRui Paulo 	if (ret == 0)
44f05cddf9SRui Paulo 		ret = eap_server_unauth_tls_register();
45f05cddf9SRui Paulo #endif /* EAP_SERVER_TLS */
46f05cddf9SRui Paulo 
475b9c547cSRui Paulo #ifdef EAP_SERVER_TLS
485b9c547cSRui Paulo #ifdef CONFIG_HS20
495b9c547cSRui Paulo 	if (ret == 0)
505b9c547cSRui Paulo 		ret = eap_server_wfa_unauth_tls_register();
515b9c547cSRui Paulo #endif /* CONFIG_HS20 */
525b9c547cSRui Paulo #endif /* EAP_SERVER_TLS */
535b9c547cSRui Paulo 
54e28a4053SRui Paulo #ifdef EAP_SERVER_MSCHAPV2
55e28a4053SRui Paulo 	if (ret == 0)
56e28a4053SRui Paulo 		ret = eap_server_mschapv2_register();
57e28a4053SRui Paulo #endif /* EAP_SERVER_MSCHAPV2 */
58e28a4053SRui Paulo 
59e28a4053SRui Paulo #ifdef EAP_SERVER_PEAP
60e28a4053SRui Paulo 	if (ret == 0)
61e28a4053SRui Paulo 		ret = eap_server_peap_register();
62e28a4053SRui Paulo #endif /* EAP_SERVER_PEAP */
63e28a4053SRui Paulo 
64e28a4053SRui Paulo #ifdef EAP_SERVER_TLV
65e28a4053SRui Paulo 	if (ret == 0)
66e28a4053SRui Paulo 		ret = eap_server_tlv_register();
67e28a4053SRui Paulo #endif /* EAP_SERVER_TLV */
68e28a4053SRui Paulo 
69e28a4053SRui Paulo #ifdef EAP_SERVER_GTC
70e28a4053SRui Paulo 	if (ret == 0)
71e28a4053SRui Paulo 		ret = eap_server_gtc_register();
72e28a4053SRui Paulo #endif /* EAP_SERVER_GTC */
73e28a4053SRui Paulo 
74e28a4053SRui Paulo #ifdef EAP_SERVER_TTLS
75e28a4053SRui Paulo 	if (ret == 0)
76e28a4053SRui Paulo 		ret = eap_server_ttls_register();
77e28a4053SRui Paulo #endif /* EAP_SERVER_TTLS */
78e28a4053SRui Paulo 
79e28a4053SRui Paulo #ifdef EAP_SERVER_SIM
80e28a4053SRui Paulo 	if (ret == 0)
81e28a4053SRui Paulo 		ret = eap_server_sim_register();
82e28a4053SRui Paulo #endif /* EAP_SERVER_SIM */
83e28a4053SRui Paulo 
84e28a4053SRui Paulo #ifdef EAP_SERVER_AKA
85e28a4053SRui Paulo 	if (ret == 0)
86e28a4053SRui Paulo 		ret = eap_server_aka_register();
87e28a4053SRui Paulo #endif /* EAP_SERVER_AKA */
88e28a4053SRui Paulo 
89e28a4053SRui Paulo #ifdef EAP_SERVER_AKA_PRIME
90e28a4053SRui Paulo 	if (ret == 0)
91e28a4053SRui Paulo 		ret = eap_server_aka_prime_register();
92e28a4053SRui Paulo #endif /* EAP_SERVER_AKA_PRIME */
93e28a4053SRui Paulo 
94e28a4053SRui Paulo #ifdef EAP_SERVER_PAX
95e28a4053SRui Paulo 	if (ret == 0)
96e28a4053SRui Paulo 		ret = eap_server_pax_register();
97e28a4053SRui Paulo #endif /* EAP_SERVER_PAX */
98e28a4053SRui Paulo 
99e28a4053SRui Paulo #ifdef EAP_SERVER_PSK
100e28a4053SRui Paulo 	if (ret == 0)
101e28a4053SRui Paulo 		ret = eap_server_psk_register();
102e28a4053SRui Paulo #endif /* EAP_SERVER_PSK */
103e28a4053SRui Paulo 
104e28a4053SRui Paulo #ifdef EAP_SERVER_SAKE
105e28a4053SRui Paulo 	if (ret == 0)
106e28a4053SRui Paulo 		ret = eap_server_sake_register();
107e28a4053SRui Paulo #endif /* EAP_SERVER_SAKE */
108e28a4053SRui Paulo 
109e28a4053SRui Paulo #ifdef EAP_SERVER_GPSK
110e28a4053SRui Paulo 	if (ret == 0)
111e28a4053SRui Paulo 		ret = eap_server_gpsk_register();
112e28a4053SRui Paulo #endif /* EAP_SERVER_GPSK */
113e28a4053SRui Paulo 
114e28a4053SRui Paulo #ifdef EAP_SERVER_VENDOR_TEST
115e28a4053SRui Paulo 	if (ret == 0)
116e28a4053SRui Paulo 		ret = eap_server_vendor_test_register();
117e28a4053SRui Paulo #endif /* EAP_SERVER_VENDOR_TEST */
118e28a4053SRui Paulo 
119e28a4053SRui Paulo #ifdef EAP_SERVER_FAST
120e28a4053SRui Paulo 	if (ret == 0)
121e28a4053SRui Paulo 		ret = eap_server_fast_register();
122e28a4053SRui Paulo #endif /* EAP_SERVER_FAST */
123e28a4053SRui Paulo 
124*206b73d0SCy Schubert #ifdef EAP_SERVER_TEAP
125*206b73d0SCy Schubert 	if (ret == 0)
126*206b73d0SCy Schubert 		ret = eap_server_teap_register();
127*206b73d0SCy Schubert #endif /* EAP_SERVER_TEAP */
128*206b73d0SCy Schubert 
129e28a4053SRui Paulo #ifdef EAP_SERVER_WSC
130e28a4053SRui Paulo 	if (ret == 0)
131e28a4053SRui Paulo 		ret = eap_server_wsc_register();
132e28a4053SRui Paulo #endif /* EAP_SERVER_WSC */
133e28a4053SRui Paulo 
134e28a4053SRui Paulo #ifdef EAP_SERVER_IKEV2
135e28a4053SRui Paulo 	if (ret == 0)
136e28a4053SRui Paulo 		ret = eap_server_ikev2_register();
137e28a4053SRui Paulo #endif /* EAP_SERVER_IKEV2 */
138e28a4053SRui Paulo 
139e28a4053SRui Paulo #ifdef EAP_SERVER_TNC
140e28a4053SRui Paulo 	if (ret == 0)
141e28a4053SRui Paulo 		ret = eap_server_tnc_register();
142e28a4053SRui Paulo #endif /* EAP_SERVER_TNC */
143e28a4053SRui Paulo 
144f05cddf9SRui Paulo #ifdef EAP_SERVER_PWD
145f05cddf9SRui Paulo 	if (ret == 0)
146f05cddf9SRui Paulo 		ret = eap_server_pwd_register();
147f05cddf9SRui Paulo #endif /* EAP_SERVER_PWD */
148f05cddf9SRui Paulo 
1495b9c547cSRui Paulo #ifdef EAP_SERVER_EKE
1505b9c547cSRui Paulo 	if (ret == 0)
1515b9c547cSRui Paulo 		ret = eap_server_eke_register();
1525b9c547cSRui Paulo #endif /* EAP_SERVER_EKE */
1535b9c547cSRui Paulo 
154e28a4053SRui Paulo 	return ret;
155e28a4053SRui Paulo }
156