2 * Copyright (c) 2011, 2015, JANET(UK)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of JANET(UK) nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * Initialisation and finalise functions.
37 #include "gssapiP_eap.h"
39 extern int wpa_debug_level;
42 eapPeerRegisterMethods(OM_uint32 *minor)
48 ret = eap_peer_md5_register();
53 ret = eap_peer_tls_register();
58 ret = eap_peer_mschapv2_register();
59 #endif /* EAP_MSCHAPv2 */
63 ret = eap_peer_peap_register();
68 ret = eap_peer_ttls_register();
73 ret = eap_peer_gtc_register();
78 ret = eap_peer_otp_register();
83 ret = eap_peer_sim_register();
88 ret = eap_peer_leap_register();
93 ret = eap_peer_psk_register();
98 ret = eap_peer_aka_register();
103 ret = eap_peer_aka_prime_register();
104 #endif /* EAP_AKA_PRIME */
108 ret = eap_peer_fast_register();
109 #endif /* EAP_FAST */
113 ret = eap_peer_pax_register();
118 ret = eap_peer_sake_register();
119 #endif /* EAP_SAKE */
123 ret = eap_peer_gpsk_register();
124 #endif /* EAP_GPSK */
128 ret = eap_peer_wsc_register();
133 ret = eap_peer_ikev2_register();
134 #endif /* EAP_IKEV2 */
136 #ifdef EAP_VENDOR_TEST
138 ret = eap_peer_vendor_test_register();
139 #endif /* EAP_VENDOR_TEST */
143 ret = eap_peer_tnc_register();
147 return GSS_S_COMPLETE;
149 *minor = GSSEAP_LIBEAP_INIT_FAILURE;
150 return GSS_S_FAILURE;
154 gssEapInitLibEap(OM_uint32 *minor)
156 char *debug_file = NULL;
157 wpa_debug_level = MSG_ERROR;
158 if ((debug_file = getenv("GSSEAP_TRACE")) != NULL) {
159 wpa_debug_open_file(debug_file);
163 return eapPeerRegisterMethods(minor);
167 gssEapInitLibRadsec(OM_uint32 *minor)
170 *minor = GSSEAP_RADSEC_INIT_FAILURE;
171 return GSS_S_FAILURE;
174 return GSS_S_COMPLETE;
177 void gssEapFinalize(void) GSSEAP_DESTRUCTOR;
180 gssEapInitiatorInit(OM_uint32 *minor)
184 initialize_eapg_error_table();
185 initialize_rse_error_table();
187 major = gssEapInitLibEap(minor);
188 if (GSS_ERROR(major))
191 major = gssEapInitLibRadsec(minor);
192 if (GSS_ERROR(major))
195 #ifdef GSSEAP_ENABLE_REAUTH
196 major = gssEapReauthInitialize(minor);
197 if (GSS_ERROR(major))
202 return GSS_S_COMPLETE;
208 wpa_printf(MSG_INFO, "### gssEapFinalize()");
209 eap_peer_unregister_methods();
212 #ifdef GSSEAP_CONSTRUCTOR
213 static void gssEapInitiatorInitAssert(void) GSSEAP_CONSTRUCTOR;
216 gssEapInitiatorInitAssert(void)
218 OM_uint32 major, minor;
220 major = gssEapInitiatorInit(&minor);
222 GSSEAP_ASSERT(!GSS_ERROR(major));