|
1 /* |
|
2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // This is enumeration of EAPOL source code. |
|
20 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
21 #undef EAP_FILE_NUMBER_ENUM |
|
22 #define EAP_FILE_NUMBER_ENUM 134 |
|
23 #undef EAP_FILE_NUMBER_DATE |
|
24 #define EAP_FILE_NUMBER_DATE 1127594498 |
|
25 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
26 |
|
27 |
|
28 |
|
29 #include "tls_peap_types.h" |
|
30 |
|
31 /** @file tls_peap_types.cpp |
|
32 */ |
|
33 |
|
34 //-------------------------------------------------- |
|
35 |
|
36 EAP_FUNC_EXPORT eap_tls_trace_string_c::~eap_tls_trace_string_c() |
|
37 { |
|
38 } |
|
39 |
|
40 EAP_FUNC_EXPORT eap_tls_trace_string_c::eap_tls_trace_string_c() |
|
41 { |
|
42 } |
|
43 |
|
44 |
|
45 #if defined(USE_FAST_EAP_TYPE) |
|
46 |
|
47 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_eap_fast_state_string(const eap_fast_state_e state) |
|
48 { |
|
49 #if defined(USE_EAP_TRACE_STRINGS) |
|
50 EAP_IF_RETURN_STRING(state, eap_fast_state_none) |
|
51 else EAP_IF_RETURN_STRING(state, eap_fast_state_wait_TLVs) |
|
52 else EAP_IF_RETURN_STRING(state, eap_fast_state_wait_crypto_binding_TLV) |
|
53 else EAP_IF_RETURN_STRING(state, eap_fast_state_wait_result_TLV) |
|
54 else EAP_IF_RETURN_STRING(state, eap_fast_state_wait_PAC_TLV) |
|
55 else EAP_IF_RETURN_STRING(state, eap_fast_state_wait_PAC_acknowledge_TLV) |
|
56 else EAP_IF_RETURN_STRING(state, eap_fast_state_wait_PAC_TLV_or_plain_eap_success) |
|
57 else EAP_IF_RETURN_STRING(state, eap_fast_state_success) |
|
58 #else |
|
59 EAP_UNREFERENCED_PARAMETER(state); |
|
60 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
61 { |
|
62 return EAPL("Unknown EAP-FAST state"); |
|
63 } |
|
64 } |
|
65 |
|
66 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
67 |
|
68 |
|
69 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_cipher_suite_string(const tls_cipher_suites_e suite) |
|
70 { |
|
71 |
|
72 #if defined(USE_EAP_TRACE_STRINGS) |
|
73 EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_NULL_WITH_NULL_NULL) |
|
74 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_RSA_WITH_RC4_128_MD5) |
|
75 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_RSA_WITH_RC4_128_SHA) |
|
76 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_RSA_WITH_3DES_EDE_CBC_SHA) |
|
77 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA) |
|
78 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA) |
|
79 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_RSA_WITH_AES_128_CBC_SHA) |
|
80 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_DHE_DSS_WITH_AES_128_CBC_SHA) |
|
81 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_DHE_RSA_WITH_AES_128_CBC_SHA) |
|
82 #if defined(USE_FAST_EAP_TYPE) |
|
83 else EAP_IF_RETURN_STRING(suite, tls_cipher_suites_TLS_DH_anon_WITH_AES_128_CBC_SHA) |
|
84 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
85 else |
|
86 #else |
|
87 EAP_UNREFERENCED_PARAMETER(suite); |
|
88 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
89 { |
|
90 return EAPL("Unknown cipher suite"); |
|
91 } |
|
92 } |
|
93 |
|
94 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_certificate_type_string(const tls_certificate_type_e certificate_type) |
|
95 { |
|
96 |
|
97 #if defined(USE_EAP_TRACE_STRINGS) |
|
98 EAP_IF_RETURN_STRING(certificate_type, tls_certificate_type_rsa_sign) |
|
99 else EAP_IF_RETURN_STRING(certificate_type, tls_certificate_type_dss_sign) |
|
100 else EAP_IF_RETURN_STRING(certificate_type, tls_certificate_type_none) |
|
101 else |
|
102 #else |
|
103 EAP_UNREFERENCED_PARAMETER(certificate_type); |
|
104 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
105 { |
|
106 return EAPL("Unknown certificate type"); |
|
107 } |
|
108 } |
|
109 |
|
110 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_compression_method_string(const tls_compression_method_e compression_method) |
|
111 { |
|
112 |
|
113 #if defined(USE_EAP_TRACE_STRINGS) |
|
114 EAP_IF_RETURN_STRING(compression_method, tls_compression_method_null) |
|
115 else EAP_IF_RETURN_STRING(compression_method, tls_compression_method_none) |
|
116 else |
|
117 #else |
|
118 EAP_UNREFERENCED_PARAMETER(compression_method); |
|
119 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
120 { |
|
121 return EAPL("Unknown compression method"); |
|
122 } |
|
123 } |
|
124 |
|
125 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_state_string(const tls_peap_state_e state) |
|
126 { |
|
127 |
|
128 #if defined(USE_EAP_TRACE_STRINGS) |
|
129 EAP_IF_RETURN_STRING(state, tls_peap_state_none) |
|
130 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_tls_start) |
|
131 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_client_hello) |
|
132 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_server_hello) |
|
133 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_certificate) |
|
134 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_server_key_exchange) |
|
135 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_certificate_request_or_server_hello_done) |
|
136 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_server_hello_done) |
|
137 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_client_key_exchange) |
|
138 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_certificate_verify) |
|
139 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_finished) |
|
140 #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
141 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_handshake_type_new_session_ticket) |
|
142 #endif // #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
143 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_change_cipher_spec) |
|
144 else EAP_IF_RETURN_STRING(state, tls_peap_state_peap_tunnel_ready) |
|
145 else EAP_IF_RETURN_STRING(state, tls_peap_state_full_authentication) |
|
146 else EAP_IF_RETURN_STRING(state, tls_peap_state_original_session_resumption) |
|
147 #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
148 else EAP_IF_RETURN_STRING(state, tls_peap_state_stateless_session_resumption) |
|
149 #endif // #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
150 else EAP_IF_RETURN_STRING(state, tls_peap_state_tppd_peapv1_waits_eap_success_or_tunneled_packet) |
|
151 #if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
|
152 else EAP_IF_RETURN_STRING(state, tls_peap_state_client_send_ttls_plain_ms_chap_v2_empty_ack) |
|
153 else EAP_IF_RETURN_STRING(state, tls_peap_state_server_waits_ttls_plain_ms_chap_v2_empty_ack) |
|
154 #endif //#if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
|
155 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_tunneled_authentication_start) |
|
156 else EAP_IF_RETURN_STRING(state, tls_peap_state_wait_application_data) |
|
157 else EAP_IF_RETURN_STRING(state, tls_peap_state_process_pending_tls_completions) |
|
158 else EAP_IF_RETURN_STRING(state, tls_peap_state_pending_tls_messages_processed) |
|
159 else EAP_IF_RETURN_STRING(state, tls_peap_state_tls_success) |
|
160 else EAP_IF_RETURN_STRING(state, tls_peap_state_failure) |
|
161 else |
|
162 #else |
|
163 EAP_UNREFERENCED_PARAMETER(state); |
|
164 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
165 { |
|
166 return EAPL("Unknown TLS-state"); |
|
167 } |
|
168 } |
|
169 |
|
170 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_peap_version_string(const peap_version_e peap_version) |
|
171 { |
|
172 |
|
173 #if defined(USE_EAP_TRACE_STRINGS) |
|
174 EAP_IF_RETURN_STRING(peap_version, peap_version_none) |
|
175 else EAP_IF_RETURN_STRING(peap_version, peap_version_0_xp) |
|
176 else EAP_IF_RETURN_STRING(peap_version, peap_version_1) |
|
177 else EAP_IF_RETURN_STRING(peap_version, peap_version_2) |
|
178 else |
|
179 #else |
|
180 EAP_UNREFERENCED_PARAMETER(peap_version); |
|
181 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
182 { |
|
183 return EAPL("Unknown TLS-tunnel (PEAP) type"); |
|
184 } |
|
185 } |
|
186 |
|
187 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_alert_level_string(const tls_alert_level_e alert_level) |
|
188 { |
|
189 |
|
190 #if defined(USE_EAP_TRACE_STRINGS) |
|
191 EAP_IF_RETURN_STRING(alert_level, tls_alert_level_warning) |
|
192 else EAP_IF_RETURN_STRING(alert_level, tls_alert_level_fatal) |
|
193 else EAP_IF_RETURN_STRING(alert_level, tls_alert_level_none) |
|
194 else |
|
195 #else |
|
196 EAP_UNREFERENCED_PARAMETER(alert_level); |
|
197 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
198 { |
|
199 return EAPL("Unknown TLS-alert level"); |
|
200 } |
|
201 } |
|
202 |
|
203 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_alert_description_string(const tls_alert_description_e alert_description) |
|
204 { |
|
205 |
|
206 #if defined(USE_EAP_TRACE_STRINGS) |
|
207 EAP_IF_RETURN_STRING(alert_description, tls_alert_description_close_notify) |
|
208 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_unexpected_message) |
|
209 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_bad_record_mac) |
|
210 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_decryption_failed) |
|
211 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_record_overflow) |
|
212 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_decompression_failure) |
|
213 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_handshake_failure) |
|
214 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_bad_certificate) |
|
215 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_unsupported_certificate) |
|
216 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_certificate_revoked) |
|
217 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_certificate_expired) |
|
218 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_certificate_unknown) |
|
219 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_illegal_parameter) |
|
220 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_unknown_ca) |
|
221 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_access_denied) |
|
222 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_decode_error) |
|
223 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_decrypt_error) |
|
224 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_export_restriction) |
|
225 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_protocol_version) |
|
226 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_insufficient_security) |
|
227 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_internal_error) |
|
228 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_user_canceled) |
|
229 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_no_renegotiation) |
|
230 else EAP_IF_RETURN_STRING(alert_description, tls_alert_description_none) |
|
231 else |
|
232 #else |
|
233 EAP_UNREFERENCED_PARAMETER(alert_description); |
|
234 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
235 { |
|
236 return EAPL("Unknown TLS-alert description"); |
|
237 } |
|
238 } |
|
239 |
|
240 |
|
241 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_tls_session_type_string(const tls_session_type_e tls_session_type) |
|
242 { |
|
243 |
|
244 #if defined(USE_EAP_TRACE_STRINGS) |
|
245 EAP_IF_RETURN_STRING(tls_session_type, tls_session_type_none) |
|
246 else EAP_IF_RETURN_STRING(tls_session_type, tls_session_type_full_authentication) |
|
247 else EAP_IF_RETURN_STRING(tls_session_type, tls_session_type_original_session_resumption) |
|
248 else EAP_IF_RETURN_STRING(tls_session_type, tls_session_type_stateless_session_resumption) |
|
249 #if defined(USE_FAST_EAP_TYPE) |
|
250 else EAP_IF_RETURN_STRING(tls_session_type, tls_session_type_eap_fast_pac_session_resumption) |
|
251 else EAP_IF_RETURN_STRING(tls_session_type, tls_session_type_eap_fast_server_unauthenticated_provisioning_mode_ADHP) |
|
252 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
253 else |
|
254 #else |
|
255 EAP_UNREFERENCED_PARAMETER(tls_session_type); |
|
256 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
257 { |
|
258 return EAPL("Unknown TLS-session type"); |
|
259 } |
|
260 } |
|
261 |
|
262 |
|
263 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_ttls_state_string(const eap_ttls_tunneled_message_state_e ttls_state) |
|
264 { |
|
265 |
|
266 #if defined(USE_EAP_TRACE_STRINGS) |
|
267 EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_none) |
|
268 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_identity_response) |
|
269 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_identity_response) |
|
270 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_response) |
|
271 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_change_password_response) |
|
272 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_identity_request) |
|
273 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_identity_request_pending) |
|
274 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_challenge_request) |
|
275 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_success_request) |
|
276 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_complete_success_request) |
|
277 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_process_error_request) |
|
278 else EAP_IF_RETURN_STRING(ttls_state, eap_ttls_tunneled_message_state_complete_error_request) |
|
279 else |
|
280 #else |
|
281 EAP_UNREFERENCED_PARAMETER(ttls_state); |
|
282 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
283 { |
|
284 return EAPL("Unknown TTLS-state"); |
|
285 } |
|
286 } |
|
287 |
|
288 |
|
289 EAP_FUNC_EXPORT eap_const_string eap_tls_trace_string_c::get_tls_identity_privacy_handshake_state_string(const tls_identity_privacy_handshake_state_e privacy_state) |
|
290 { |
|
291 |
|
292 #if defined(USE_EAP_TRACE_STRINGS) |
|
293 EAP_IF_RETURN_STRING(privacy_state, tls_identity_privacy_handshake_state_none) |
|
294 else EAP_IF_RETURN_STRING(privacy_state, tls_identity_privacy_handshake_state_negotiates) |
|
295 else EAP_IF_RETURN_STRING(privacy_state, tls_identity_privacy_handshake_state_runs) |
|
296 else |
|
297 #else |
|
298 EAP_UNREFERENCED_PARAMETER(privacy_state); |
|
299 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
300 { |
|
301 return EAPL("Unknown privacy-state"); |
|
302 } |
|
303 } |
|
304 |
|
305 //-------------------------------------------------- |
|
306 |
|
307 // End. |