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 * %version: 11 % |
|
20 */ |
|
21 |
|
22 // This is enumeration of EAPOL source code. |
|
23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
24 #undef EAP_FILE_NUMBER_ENUM |
|
25 #define EAP_FILE_NUMBER_ENUM 745 |
|
26 #undef EAP_FILE_NUMBER_DATE |
|
27 #define EAP_FILE_NUMBER_DATE 1127594498 |
|
28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
29 |
|
30 |
|
31 |
|
32 #include "eap_am_memory.h" |
|
33 #include "eap_tools.h" |
|
34 #include "eap_pac_store_server_message_if.h" |
|
35 #include "eap_crypto_api.h" |
|
36 #include "eap_state_notification.h" |
|
37 #include "eap_automatic_variable.h" |
|
38 #include "eap_network_id_selector.h" |
|
39 #include "eap_config.h" |
|
40 #include "eap_am_pac_store.h" |
|
41 #include "eap_am_pac_store_symbian.h" |
|
42 |
|
43 //-------------------------------------------------- |
|
44 |
|
45 // |
|
46 EAP_FUNC_EXPORT eap_pac_store_server_message_if_c::~eap_pac_store_server_message_if_c() |
|
47 { |
|
48 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
49 |
|
50 EAP_TRACE_DEBUG( |
|
51 m_am_tools, |
|
52 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
53 (EAPL("eap_pac_store_server_message_if_c::~eap_pac_store_server_message_if_c(): this = 0x%08x\n"), |
|
54 this)); |
|
55 |
|
56 EAP_ASSERT(m_shutdown_was_called == true); |
|
57 |
|
58 if (m_am_client != 0) |
|
59 { |
|
60 m_am_client->shutdown(); |
|
61 delete m_am_client; |
|
62 } |
|
63 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
64 } |
|
65 |
|
66 //-------------------------------------------------- |
|
67 |
|
68 #if defined(_WIN32) && !defined(__GNUC__) |
|
69 #pragma warning( disable : 4355 ) // 'this' : used in base member initializer list |
|
70 #endif |
|
71 |
|
72 // |
|
73 EAP_FUNC_EXPORT eap_pac_store_server_message_if_c::eap_pac_store_server_message_if_c( |
|
74 abs_eap_am_tools_c * const tools) |
|
75 : m_partner(0) |
|
76 , m_am_client(eap_am_pac_store_symbian_c::new_eap_am_pac_store_symbian_c(tools, this)) |
|
77 , m_am_tools(tools) |
|
78 , m_error_code(eap_status_ok) |
|
79 , m_error_function(eap_tlv_message_type_function_none) |
|
80 , m_is_valid(false) |
|
81 , m_shutdown_was_called(false) |
|
82 { |
|
83 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
84 |
|
85 EAP_TRACE_DEBUG( |
|
86 m_am_tools, |
|
87 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
88 (EAPL("eap_pac_store_server_message_if_c::eap_pac_store_server_message_if_c(): %s, this = 0x%08x => 0x%08x, compiled %s %s.\n"), |
|
89 (m_is_client == true) ? "client": "server", |
|
90 this, |
|
91 dynamic_cast<abs_eap_base_timer_c *>(this), |
|
92 __DATE__, |
|
93 __TIME__)); |
|
94 |
|
95 if (m_am_client != 0 |
|
96 && m_am_client->get_is_valid() == true) |
|
97 { |
|
98 set_is_valid(); |
|
99 } |
|
100 |
|
101 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
102 } |
|
103 |
|
104 //-------------------------------------------------- |
|
105 |
|
106 // |
|
107 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::configure( |
|
108 const eap_variable_data_c * const /* client_configuration */) |
|
109 { |
|
110 EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true); |
|
111 |
|
112 EAP_TRACE_DEBUG( |
|
113 m_am_tools, |
|
114 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
115 (EAPL("%s: eap_pac_store_server_message_if_c::configure()\n"), |
|
116 (m_is_client == true) ? "client": "server")); |
|
117 |
|
118 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::configure()"); |
|
119 |
|
120 eap_status_e status(eap_status_process_general_error); |
|
121 |
|
122 if (m_am_client != 0) |
|
123 { |
|
124 status = m_am_client->configure(); |
|
125 if (status != eap_status_ok) |
|
126 { |
|
127 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
128 return EAP_STATUS_RETURN(m_am_tools, status); |
|
129 } |
|
130 } |
|
131 |
|
132 return EAP_STATUS_RETURN(m_am_tools, status); |
|
133 } |
|
134 |
|
135 //-------------------------------------------------- |
|
136 |
|
137 // |
|
138 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::shutdown() |
|
139 { |
|
140 EAP_TRACE_DEBUG( |
|
141 m_am_tools, |
|
142 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
143 (EAPL("%s: eap_pac_store_server_message_if_c::shutdown(), m_shutdown_was_called=%d\n"), |
|
144 (m_is_client == true) ? "client": "server", |
|
145 m_shutdown_was_called)); |
|
146 |
|
147 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::shutdown()"); |
|
148 |
|
149 EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true); |
|
150 |
|
151 if (m_shutdown_was_called == true) |
|
152 { |
|
153 // Shutdown function was called already. |
|
154 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
155 } |
|
156 m_shutdown_was_called = true; |
|
157 |
|
158 if (m_am_client != 0) |
|
159 { |
|
160 (void) m_am_client->shutdown(); |
|
161 } |
|
162 |
|
163 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
164 } |
|
165 |
|
166 //-------------------------------------------------- |
|
167 |
|
168 // |
|
169 EAP_FUNC_EXPORT void eap_pac_store_server_message_if_c::set_partner(abs_eap_am_message_if_c * const partner) |
|
170 { |
|
171 m_partner = partner; |
|
172 } |
|
173 |
|
174 //-------------------------------------------------- |
|
175 |
|
176 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::send_error_message( |
|
177 const eap_status_e error_code, |
|
178 const eap_tlv_message_type_function_e function) |
|
179 { |
|
180 eap_status_e status(eap_status_ok); |
|
181 |
|
182 { |
|
183 // Creates message data composed of Attribute-Value Pairs. |
|
184 eap_process_tlv_message_data_c message(m_am_tools); |
|
185 |
|
186 if (message.get_is_valid() == false) |
|
187 { |
|
188 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
189 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
190 } |
|
191 |
|
192 status = message.add_parameter_data( |
|
193 eap_tlv_message_type_error, |
|
194 static_cast<u32_t>(error_code)); |
|
195 if (status != eap_status_ok) |
|
196 { |
|
197 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
198 return EAP_STATUS_RETURN(m_am_tools, status); |
|
199 } |
|
200 |
|
201 status = message.add_parameter_data(function); |
|
202 if (status != eap_status_ok) |
|
203 { |
|
204 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
205 return EAP_STATUS_RETURN(m_am_tools, status); |
|
206 } |
|
207 |
|
208 status = send_message(&message); |
|
209 if (status != eap_status_ok) |
|
210 { |
|
211 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
212 return EAP_STATUS_RETURN(m_am_tools, status); |
|
213 } |
|
214 } |
|
215 |
|
216 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
217 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
218 } |
|
219 |
|
220 //-------------------------------------------------- |
|
221 |
|
222 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::send_message(eap_process_tlv_message_data_c * const message) |
|
223 { |
|
224 // Sends message data composed of Attribute-Value Pairs. |
|
225 |
|
226 EAP_TRACE_DATA_DEBUG( |
|
227 m_am_tools, |
|
228 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
229 (EAPL("eap_core_client_message_if_c::send_message()"), |
|
230 message->get_message_data(), |
|
231 message->get_message_data_length())); |
|
232 |
|
233 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_client_message_if_c::send_message()"); |
|
234 |
|
235 |
|
236 { |
|
237 eap_status_e send_status = m_partner->send_data( |
|
238 message->get_message_data(), |
|
239 message->get_message_data_length()); |
|
240 if (send_status != eap_status_ok) |
|
241 { |
|
242 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
243 return EAP_STATUS_RETURN(m_am_tools, send_status); |
|
244 } |
|
245 |
|
246 |
|
247 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
248 return EAP_STATUS_RETURN(m_am_tools, send_status); |
|
249 } |
|
250 |
|
251 } |
|
252 |
|
253 //-------------------------------------------------- |
|
254 |
|
255 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::process_message_type_error( |
|
256 EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters) |
|
257 { |
|
258 eap_status_e status(eap_status_ok); |
|
259 |
|
260 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
261 |
|
262 if (message_data.get_is_valid() == false) |
|
263 { |
|
264 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
265 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
266 } |
|
267 |
|
268 // Error payload is the first in this case. |
|
269 status = message_data.read_parameter_data(parameters, eap_message_payload_index_function, eap_tlv_message_type_error, &m_error_code); |
|
270 if (status != eap_status_ok) |
|
271 { |
|
272 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
273 return EAP_STATUS_RETURN(m_am_tools, status); |
|
274 } |
|
275 |
|
276 // Fuction payload is the second in this case. |
|
277 status = message_data.read_parameter_data(parameters, eap_message_payload_index_first_parameter, &m_error_function); |
|
278 if (status != eap_status_ok) |
|
279 { |
|
280 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
281 return EAP_STATUS_RETURN(m_am_tools, status); |
|
282 } |
|
283 |
|
284 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
285 return EAP_STATUS_RETURN(m_am_tools, status); |
|
286 } |
|
287 |
|
288 //-------------------------------------------------- |
|
289 |
|
290 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::process_message(eap_process_tlv_message_data_c * const message) |
|
291 { |
|
292 // Parses message data composed of Attribute-Value Pairs. |
|
293 |
|
294 EAP_TRACE_DATA_DEBUG( |
|
295 m_am_tools, |
|
296 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
297 (EAPL("eap_pac_store_server_message_if_c::process_message()"), |
|
298 message->get_message_data(), |
|
299 message->get_message_data_length())); |
|
300 |
|
301 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::process_message()"); |
|
302 |
|
303 eap_array_c<eap_tlv_header_c> parameters(m_am_tools); |
|
304 |
|
305 eap_status_e status = message->parse_message_data(¶meters); |
|
306 if (status != eap_status_ok) |
|
307 { |
|
308 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
309 |
|
310 (void) send_error_message( |
|
311 status, |
|
312 eap_tlv_message_type_function_none); |
|
313 |
|
314 return EAP_STATUS_RETURN(m_am_tools, status); |
|
315 } |
|
316 |
|
317 if (parameters.get_object_count() == 0) |
|
318 { |
|
319 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
320 |
|
321 status = eap_status_illegal_parameter; |
|
322 |
|
323 (void) send_error_message( |
|
324 status, |
|
325 eap_tlv_message_type_function_none); |
|
326 |
|
327 return EAP_STATUS_RETURN(m_am_tools, status); |
|
328 } |
|
329 |
|
330 const eap_tlv_header_c * const function_header = parameters.get_object(eap_message_payload_index_function); |
|
331 if (function_header == 0 |
|
332 || (function_header->get_type() != eap_tlv_message_type_error |
|
333 && function_header->get_type() != eap_tlv_message_type_function)) |
|
334 { |
|
335 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
336 |
|
337 status = eap_status_illegal_parameter; |
|
338 |
|
339 (void) send_error_message( |
|
340 status, |
|
341 eap_tlv_message_type_function_none); |
|
342 |
|
343 return EAP_STATUS_RETURN(m_am_tools, status); |
|
344 } |
|
345 |
|
346 if (function_header->get_type() == eap_tlv_message_type_error) |
|
347 { |
|
348 status = process_message_type_error(¶meters); |
|
349 } |
|
350 else // function_header->get_type() == eap_tlv_message_type_function |
|
351 { |
|
352 eap_tlv_message_type_function_e function(eap_tlv_message_type_function_none); |
|
353 |
|
354 status = message->get_parameter_data(function_header, &function); |
|
355 if (status != eap_status_ok) |
|
356 { |
|
357 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
358 |
|
359 (void) send_error_message( |
|
360 status, |
|
361 eap_tlv_message_type_function_none); |
|
362 |
|
363 return EAP_STATUS_RETURN(m_am_tools, status); |
|
364 } |
|
365 |
|
366 switch(function) |
|
367 { |
|
368 case eap_tlv_message_type_function_pac_store_open_pac_store: |
|
369 status = open_pac_store(¶meters); |
|
370 break; |
|
371 case eap_tlv_message_type_function_pac_store_create_device_seed: |
|
372 status = create_device_seed(¶meters); |
|
373 break; |
|
374 case eap_tlv_message_type_function_pac_store_is_master_key_present: |
|
375 status = is_master_key_present(¶meters); |
|
376 break; |
|
377 case eap_tlv_message_type_function_pac_store_is_master_key_and_password_matching: |
|
378 status = is_master_key_and_password_matching(¶meters); |
|
379 break; |
|
380 case eap_tlv_message_type_function_pac_store_create_and_save_master_key: |
|
381 status = create_and_save_master_key(¶meters); |
|
382 break; |
|
383 case eap_tlv_message_type_function_pac_store_compare_pac_store_password: |
|
384 status = compare_pac_store_password(¶meters); |
|
385 break; |
|
386 case eap_tlv_message_type_function_pac_store_is_pacstore_password_present: |
|
387 status = is_pacstore_password_present(¶meters); |
|
388 break; |
|
389 case eap_tlv_message_type_function_pac_store_set_pac_store_password: |
|
390 status = set_pac_store_password(¶meters); |
|
391 break; |
|
392 case eap_tlv_message_type_function_pac_store_destroy_pac_store: |
|
393 status = destroy_pac_store(¶meters); |
|
394 break; |
|
395 default: |
|
396 EAP_TRACE_ERROR( |
|
397 m_am_tools, |
|
398 TRACE_FLAGS_DEFAULT, |
|
399 (EAPL("ERROR: process_data(): unknown function %d.\n"), |
|
400 function)); |
|
401 |
|
402 status = eap_status_illegal_parameter; |
|
403 |
|
404 EAP_ASSERT_ANYWAY_TOOLS(m_am_tools); |
|
405 }; |
|
406 |
|
407 if (status != eap_status_ok |
|
408 && status != eap_status_success |
|
409 && status != eap_status_pending_request |
|
410 && status != eap_status_completed_request |
|
411 && status != eap_status_drop_packet_quietly) |
|
412 { |
|
413 (void) send_error_message( |
|
414 status, |
|
415 function); |
|
416 } |
|
417 } |
|
418 |
|
419 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
420 return EAP_STATUS_RETURN(m_am_tools, status); |
|
421 } |
|
422 |
|
423 //-------------------------------------------------- |
|
424 |
|
425 /// Function receives the data message from lower layer. |
|
426 /// Data is formatted to Attribute-Value Pairs. |
|
427 /// Look at eap_tlv_header_c and eap_tlv_message_data_c. |
|
428 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::process_data(const void * const data, const u32_t length) |
|
429 { |
|
430 eap_status_e status(eap_status_process_general_error); |
|
431 |
|
432 { |
|
433 eap_process_tlv_message_data_c message(m_am_tools); |
|
434 |
|
435 if (message.get_is_valid() == false) |
|
436 { |
|
437 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
438 |
|
439 status = eap_status_allocation_error; |
|
440 |
|
441 (void) send_error_message( |
|
442 status, |
|
443 eap_tlv_message_type_function_none); |
|
444 |
|
445 return EAP_STATUS_RETURN(m_am_tools, status); |
|
446 } |
|
447 |
|
448 status = message.set_message_data(length, data); |
|
449 if (status != eap_status_ok) |
|
450 { |
|
451 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
452 |
|
453 (void) send_error_message( |
|
454 status, |
|
455 eap_tlv_message_type_function_none); |
|
456 |
|
457 return EAP_STATUS_RETURN(m_am_tools, status); |
|
458 } |
|
459 |
|
460 status = process_message(&message); |
|
461 } |
|
462 |
|
463 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
464 return EAP_STATUS_RETURN(m_am_tools, status); |
|
465 } |
|
466 |
|
467 //-------------------------------------------------- |
|
468 |
|
469 // |
|
470 EAP_FUNC_EXPORT void eap_pac_store_server_message_if_c::set_is_valid() |
|
471 { |
|
472 m_is_valid = true; |
|
473 } |
|
474 |
|
475 //-------------------------------------------------- |
|
476 |
|
477 // |
|
478 EAP_FUNC_EXPORT bool eap_pac_store_server_message_if_c::get_is_valid() |
|
479 { |
|
480 return m_is_valid; |
|
481 } |
|
482 |
|
483 //-------------------------------------------------- |
|
484 |
|
485 // |
|
486 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::timer_expired( |
|
487 const u32_t id, void *data) |
|
488 { |
|
489 EAP_UNREFERENCED_PARAMETER(id); |
|
490 EAP_UNREFERENCED_PARAMETER(data); |
|
491 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
492 |
|
493 EAP_TRACE_DEBUG( |
|
494 m_am_tools, |
|
495 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
496 (EAPL("TIMER: %s: [0x%08x]->eap_pac_store_server_message_if_c::timer_expired(id 0x%02x, data 0x%08x).\n"), |
|
497 (m_is_client == true) ? "client": "server", |
|
498 this, |
|
499 id, |
|
500 data)); |
|
501 |
|
502 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::timer_expired()"); |
|
503 |
|
504 |
|
505 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
506 } |
|
507 |
|
508 //-------------------------------------------------- |
|
509 |
|
510 // |
|
511 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::timer_delete_data( |
|
512 const u32_t id, void *data) |
|
513 { |
|
514 EAP_UNREFERENCED_PARAMETER(id); |
|
515 EAP_UNREFERENCED_PARAMETER(data); |
|
516 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
517 |
|
518 EAP_TRACE_DEBUG( |
|
519 m_am_tools, |
|
520 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
521 (EAPL("TIMER: %s: [0x%08x]->eap_pac_store_server_message_if_c::timer_delete_data(id 0x%02x, data 0x%08x).\n"), |
|
522 (m_is_client == true) ? "client": "server", |
|
523 this, id, data)); |
|
524 |
|
525 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::timer_delete_data()"); |
|
526 |
|
527 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
528 } |
|
529 |
|
530 //-------------------------------------------------- |
|
531 |
|
532 eap_status_e eap_pac_store_server_message_if_c::open_pac_store( |
|
533 EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const /* parameters */) |
|
534 { |
|
535 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
536 |
|
537 EAP_TRACE_DEBUG( |
|
538 m_am_tools, |
|
539 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
540 (EAPL("%s: eap_pac_store_server_message_if_c::open_pac_store()\n"), |
|
541 (m_is_client == true) ? "client": "server")); |
|
542 |
|
543 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::open_pac_store()"); |
|
544 |
|
545 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
546 |
|
547 eap_status_e status(eap_status_ok); |
|
548 |
|
549 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
550 |
|
551 status = m_am_client->open_pac_store(); |
|
552 |
|
553 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
554 |
|
555 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
556 return EAP_STATUS_RETURN(m_am_tools, status); |
|
557 } |
|
558 |
|
559 //-------------------------------------------------- |
|
560 |
|
561 eap_status_e eap_pac_store_server_message_if_c::create_device_seed(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const /* parameters */) |
|
562 { |
|
563 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
564 |
|
565 eap_status_e status(eap_status_ok); |
|
566 |
|
567 EAP_TRACE_DEBUG( |
|
568 m_am_tools, |
|
569 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
570 (EAPL("eap_pac_store_server_message_if_c::create_device_seed(): this = 0x%08x.\n"), |
|
571 this)); |
|
572 |
|
573 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::create_device_seed()"); |
|
574 |
|
575 status = m_am_client->create_device_seed(); |
|
576 |
|
577 return status; |
|
578 |
|
579 } |
|
580 //-------------------------------------------------- |
|
581 |
|
582 eap_status_e eap_pac_store_server_message_if_c::is_master_key_present(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const /* parameters */) |
|
583 { |
|
584 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
585 |
|
586 eap_status_e status(eap_status_ok); |
|
587 |
|
588 EAP_TRACE_DEBUG( |
|
589 m_am_tools, |
|
590 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
591 (EAPL("eap_pac_store_server_message_if_c::is_master_key_present(): this = 0x%08x.\n"), |
|
592 this)); |
|
593 |
|
594 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::is_master_key_present()"); |
|
595 |
|
596 status = m_am_client->is_master_key_present(); |
|
597 |
|
598 return status; |
|
599 |
|
600 } |
|
601 //-------------------------------------------------- |
|
602 |
|
603 eap_status_e eap_pac_store_server_message_if_c::is_master_key_and_password_matching(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters) |
|
604 { |
|
605 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
606 |
|
607 eap_status_e status(eap_status_ok); |
|
608 |
|
609 EAP_TRACE_DEBUG( |
|
610 m_am_tools, |
|
611 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
612 (EAPL("eap_pac_store_server_message_if_c::is_master_key_and_password_matching(): this = 0x%08x.\n"), |
|
613 this)); |
|
614 |
|
615 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::is_master_key_and_password_matching()"); |
|
616 |
|
617 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
618 |
|
619 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
620 |
|
621 if (message_data.get_is_valid() == false) |
|
622 { |
|
623 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
624 return EAP_STATUS_RETURN(m_am_tools, status); |
|
625 } |
|
626 |
|
627 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
628 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
629 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
630 |
|
631 if (password == 0) |
|
632 { |
|
633 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
634 return EAP_STATUS_RETURN(m_am_tools, status); |
|
635 } |
|
636 |
|
637 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
638 if (status != eap_status_ok) |
|
639 { |
|
640 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
641 return EAP_STATUS_RETURN(m_am_tools, status); |
|
642 } |
|
643 status = m_am_client->is_master_key_and_password_matching(password); |
|
644 |
|
645 return status; |
|
646 |
|
647 } |
|
648 //-------------------------------------------------- |
|
649 |
|
650 eap_status_e eap_pac_store_server_message_if_c::create_and_save_master_key(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters) |
|
651 { |
|
652 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
653 |
|
654 eap_status_e status(eap_status_ok); |
|
655 |
|
656 EAP_TRACE_DEBUG( |
|
657 m_am_tools, |
|
658 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
659 (EAPL("eap_pac_store_server_message_if_c::create_and_save_master_key(): this = 0x%08x.\n"), |
|
660 this)); |
|
661 |
|
662 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::create_and_save_master_key()"); |
|
663 |
|
664 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
665 |
|
666 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
667 |
|
668 if (message_data.get_is_valid() == false) |
|
669 { |
|
670 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
671 return EAP_STATUS_RETURN(m_am_tools, status); |
|
672 } |
|
673 |
|
674 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
675 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
676 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
677 |
|
678 if (password == 0) |
|
679 { |
|
680 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
681 return EAP_STATUS_RETURN(m_am_tools, status); |
|
682 } |
|
683 |
|
684 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
685 if (status != eap_status_ok) |
|
686 { |
|
687 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
688 return EAP_STATUS_RETURN(m_am_tools, status); |
|
689 } |
|
690 status = m_am_client->create_and_save_master_key(password); |
|
691 |
|
692 return status; |
|
693 |
|
694 } |
|
695 //-------------------------------------------------- |
|
696 |
|
697 eap_status_e eap_pac_store_server_message_if_c::is_pacstore_password_present(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const /* parameters */) |
|
698 { |
|
699 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
700 |
|
701 eap_status_e status(eap_status_ok); |
|
702 |
|
703 EAP_TRACE_DEBUG( |
|
704 m_am_tools, |
|
705 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
706 (EAPL("eap_pac_store_server_message_if_c::is_pacstore_password_present(): this = 0x%08x.\n"), |
|
707 this)); |
|
708 |
|
709 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::is_pacstore_password_present()"); |
|
710 |
|
711 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
712 |
|
713 if (message_data.get_is_valid() == false) |
|
714 { |
|
715 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
716 return EAP_STATUS_RETURN(m_am_tools, status); |
|
717 } |
|
718 |
|
719 status = m_am_client->is_pacstore_password_present(); |
|
720 |
|
721 return status; |
|
722 |
|
723 } |
|
724 //-------------------------------------------------- |
|
725 eap_status_e eap_pac_store_server_message_if_c::compare_pac_store_password(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters) |
|
726 { |
|
727 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
728 |
|
729 eap_status_e status(eap_status_ok); |
|
730 |
|
731 EAP_TRACE_DEBUG( |
|
732 m_am_tools, |
|
733 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
734 (EAPL("eap_pac_store_server_message_if_c::compare_pac_store_password(): this = 0x%08x.\n"), |
|
735 this)); |
|
736 |
|
737 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::compare_pac_store_password()"); |
|
738 |
|
739 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
740 |
|
741 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
742 |
|
743 if (message_data.get_is_valid() == false) |
|
744 { |
|
745 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
746 return EAP_STATUS_RETURN(m_am_tools, status); |
|
747 } |
|
748 |
|
749 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
750 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
751 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
752 |
|
753 if (password == 0) |
|
754 { |
|
755 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
756 return EAP_STATUS_RETURN(m_am_tools, status); |
|
757 } |
|
758 |
|
759 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
760 if (status != eap_status_ok) |
|
761 { |
|
762 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
763 return EAP_STATUS_RETURN(m_am_tools, status); |
|
764 } |
|
765 |
|
766 status = m_am_client->compare_pac_store_password(password); |
|
767 |
|
768 return status; |
|
769 |
|
770 } |
|
771 //-------------------------------------------------- |
|
772 |
|
773 eap_status_e eap_pac_store_server_message_if_c::set_pac_store_password(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters) |
|
774 { |
|
775 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
776 |
|
777 eap_status_e status(eap_status_ok); |
|
778 |
|
779 EAP_TRACE_DEBUG( |
|
780 m_am_tools, |
|
781 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
782 (EAPL("eap_pac_store_server_message_if_c::set_pac_store_password(): this = 0x%08x.\n"), |
|
783 this)); |
|
784 |
|
785 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::set_pac_store_password()"); |
|
786 |
|
787 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
788 |
|
789 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
790 |
|
791 if (message_data.get_is_valid() == false) |
|
792 { |
|
793 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
794 return EAP_STATUS_RETURN(m_am_tools, status); |
|
795 } |
|
796 |
|
797 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
798 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
799 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
800 |
|
801 if (password == 0) |
|
802 { |
|
803 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
804 return EAP_STATUS_RETURN(m_am_tools, status); |
|
805 } |
|
806 |
|
807 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
808 if (status != eap_status_ok) |
|
809 { |
|
810 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
811 return EAP_STATUS_RETURN(m_am_tools, status); |
|
812 } |
|
813 status = m_am_client->set_pac_store_password(password); |
|
814 |
|
815 return status; |
|
816 |
|
817 } |
|
818 //-------------------------------------------------- |
|
819 |
|
820 eap_status_e eap_pac_store_server_message_if_c::destroy_pac_store(EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const /* parameters */) |
|
821 { |
|
822 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
823 |
|
824 eap_status_e status(eap_status_ok); |
|
825 |
|
826 EAP_TRACE_DEBUG( |
|
827 m_am_tools, |
|
828 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
829 (EAPL("eap_pac_store_server_message_if_c::destroy_pac_store(): this = 0x%08x.\n"), |
|
830 this)); |
|
831 |
|
832 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::destroy_pac_store()"); |
|
833 |
|
834 status = m_am_client->destroy_pac_store(); |
|
835 |
|
836 return status; |
|
837 |
|
838 } |
|
839 //-------------------------------------------------- |
|
840 |
|
841 //-------------------------------------------------- |
|
842 |
|
843 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_open_pac_store(const eap_status_e completion_status) |
|
844 { |
|
845 eap_status_e status(eap_status_process_general_error); |
|
846 |
|
847 EAP_TRACE_DEBUG( |
|
848 m_am_tools, |
|
849 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
850 (EAPL("%s: eap_core_server_message_if_c::complete_open_pac_store()\n"), |
|
851 (m_is_client == true) ? "client": "server")); |
|
852 |
|
853 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_open_pac_store()"); |
|
854 |
|
855 { |
|
856 // Creates message data composed of Attribute-Value Pairs. |
|
857 eap_process_tlv_message_data_c message(m_am_tools); |
|
858 |
|
859 if (message.get_is_valid() == false) |
|
860 { |
|
861 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
862 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
863 } |
|
864 |
|
865 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_open_pac_store); |
|
866 if (status != eap_status_ok) |
|
867 { |
|
868 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
869 return EAP_STATUS_RETURN(m_am_tools, status); |
|
870 } |
|
871 |
|
872 status = message.add_parameter_data(completion_status); |
|
873 if (status != eap_status_ok) |
|
874 { |
|
875 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
876 return EAP_STATUS_RETURN(m_am_tools, status); |
|
877 } |
|
878 |
|
879 status = send_message(&message); |
|
880 if (status != eap_status_ok) |
|
881 { |
|
882 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
883 return EAP_STATUS_RETURN(m_am_tools, status); |
|
884 } |
|
885 } |
|
886 |
|
887 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
888 return EAP_STATUS_RETURN(m_am_tools, status); |
|
889 } |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 //-------------------------------------------------- |
|
896 |
|
897 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_create_device_seed( |
|
898 const eap_status_e completion_status) |
|
899 { |
|
900 eap_status_e status(eap_status_process_general_error); |
|
901 |
|
902 EAP_TRACE_DEBUG( |
|
903 m_am_tools, |
|
904 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
905 (EAPL("%s: eap_core_server_message_if_c::complete_create_device_seed()\n"), |
|
906 (m_is_client == true) ? "client": "server")); |
|
907 |
|
908 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_create_device_seed()"); |
|
909 |
|
910 { |
|
911 // Creates message data composed of Attribute-Value Pairs. |
|
912 eap_process_tlv_message_data_c message(m_am_tools); |
|
913 |
|
914 if (message.get_is_valid() == false) |
|
915 { |
|
916 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
917 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
918 } |
|
919 |
|
920 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_create_device_seed); |
|
921 if (status != eap_status_ok) |
|
922 { |
|
923 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
924 return EAP_STATUS_RETURN(m_am_tools, status); |
|
925 } |
|
926 |
|
927 status = message.add_parameter_data(completion_status); |
|
928 if (status != eap_status_ok) |
|
929 { |
|
930 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
931 return EAP_STATUS_RETURN(m_am_tools, status); |
|
932 } |
|
933 |
|
934 status = send_message(&message); |
|
935 if (status != eap_status_ok) |
|
936 { |
|
937 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
938 return EAP_STATUS_RETURN(m_am_tools, status); |
|
939 } |
|
940 } |
|
941 |
|
942 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
943 return EAP_STATUS_RETURN(m_am_tools, status); |
|
944 |
|
945 } |
|
946 //-------------------------------------------------- |
|
947 |
|
948 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_is_master_key_present( |
|
949 const bool is_present) |
|
950 { |
|
951 eap_status_e status(eap_status_process_general_error); |
|
952 |
|
953 EAP_TRACE_DEBUG( |
|
954 m_am_tools, |
|
955 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
956 (EAPL("%s: eap_core_server_message_if_c::complete_is_master_key_present()\n"), |
|
957 (m_is_client == true) ? "client": "server")); |
|
958 |
|
959 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_is_master_key_present()"); |
|
960 |
|
961 { |
|
962 // Creates message data composed of Attribute-Value Pairs. |
|
963 eap_process_tlv_message_data_c message(m_am_tools); |
|
964 |
|
965 if (message.get_is_valid() == false) |
|
966 { |
|
967 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
968 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
969 } |
|
970 |
|
971 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_is_master_key_present); |
|
972 if (status != eap_status_ok) |
|
973 { |
|
974 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
975 return EAP_STATUS_RETURN(m_am_tools, status); |
|
976 } |
|
977 |
|
978 status = message.add_parameter_data(is_present); |
|
979 if (status != eap_status_ok) |
|
980 { |
|
981 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
982 return EAP_STATUS_RETURN(m_am_tools, status); |
|
983 } |
|
984 |
|
985 status = send_message(&message); |
|
986 if (status != eap_status_ok) |
|
987 { |
|
988 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
989 return EAP_STATUS_RETURN(m_am_tools, status); |
|
990 } |
|
991 } |
|
992 |
|
993 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
994 return EAP_STATUS_RETURN(m_am_tools, status); |
|
995 |
|
996 } |
|
997 //-------------------------------------------------- |
|
998 |
|
999 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_is_master_key_and_password_matching( |
|
1000 const bool is_matching) |
|
1001 { |
|
1002 eap_status_e status(eap_status_process_general_error); |
|
1003 |
|
1004 EAP_TRACE_DEBUG( |
|
1005 m_am_tools, |
|
1006 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1007 (EAPL("%s: eap_core_server_message_if_c::complete_is_master_key_and_password_matching()\n"), |
|
1008 (m_is_client == true) ? "client": "server")); |
|
1009 |
|
1010 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_is_master_key_and_password_matching()"); |
|
1011 |
|
1012 { |
|
1013 // Creates message data composed of Attribute-Value Pairs. |
|
1014 eap_process_tlv_message_data_c message(m_am_tools); |
|
1015 |
|
1016 if (message.get_is_valid() == false) |
|
1017 { |
|
1018 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1019 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1020 } |
|
1021 |
|
1022 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_is_master_key_and_password_matching); |
|
1023 if (status != eap_status_ok) |
|
1024 { |
|
1025 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1026 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1027 } |
|
1028 |
|
1029 status = message.add_parameter_data(is_matching); |
|
1030 if (status != eap_status_ok) |
|
1031 { |
|
1032 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1033 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1034 } |
|
1035 |
|
1036 status = send_message(&message); |
|
1037 if (status != eap_status_ok) |
|
1038 { |
|
1039 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1040 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1041 } |
|
1042 } |
|
1043 |
|
1044 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1045 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1046 |
|
1047 } |
|
1048 //-------------------------------------------------- |
|
1049 |
|
1050 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_create_and_save_master_key( |
|
1051 const eap_status_e completion_status) |
|
1052 { |
|
1053 eap_status_e status(eap_status_process_general_error); |
|
1054 |
|
1055 EAP_TRACE_DEBUG( |
|
1056 m_am_tools, |
|
1057 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1058 (EAPL("%s: eap_core_server_message_if_c::complete_create_and_save_master_key()\n"), |
|
1059 (m_is_client == true) ? "client": "server")); |
|
1060 |
|
1061 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_create_and_save_master_key()"); |
|
1062 |
|
1063 { |
|
1064 // Creates message data composed of Attribute-Value Pairs. |
|
1065 eap_process_tlv_message_data_c message(m_am_tools); |
|
1066 |
|
1067 if (message.get_is_valid() == false) |
|
1068 { |
|
1069 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1070 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1071 } |
|
1072 |
|
1073 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_create_and_save_master_key); |
|
1074 if (status != eap_status_ok) |
|
1075 { |
|
1076 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1077 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1078 } |
|
1079 |
|
1080 status = message.add_parameter_data(completion_status); |
|
1081 if (status != eap_status_ok) |
|
1082 { |
|
1083 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1084 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1085 } |
|
1086 |
|
1087 status = send_message(&message); |
|
1088 if (status != eap_status_ok) |
|
1089 { |
|
1090 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1091 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1092 } |
|
1093 } |
|
1094 |
|
1095 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1096 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1097 |
|
1098 } |
|
1099 //-------------------------------------------------- |
|
1100 |
|
1101 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_is_pacstore_password_present( |
|
1102 const bool is_present) |
|
1103 { |
|
1104 eap_status_e status(eap_status_process_general_error); |
|
1105 |
|
1106 EAP_TRACE_DEBUG( |
|
1107 m_am_tools, |
|
1108 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1109 (EAPL("%s: eap_core_server_message_if_c::complete_is_pacstore_password_present()\n"), |
|
1110 (m_is_client == true) ? "client": "server")); |
|
1111 |
|
1112 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_is_pacstore_password_present()"); |
|
1113 |
|
1114 { |
|
1115 // Creates message data composed of Attribute-Value Pairs. |
|
1116 eap_process_tlv_message_data_c message(m_am_tools); |
|
1117 |
|
1118 if (message.get_is_valid() == false) |
|
1119 { |
|
1120 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1121 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1122 } |
|
1123 |
|
1124 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_is_pacstore_password_present); |
|
1125 if (status != eap_status_ok) |
|
1126 { |
|
1127 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1128 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1129 } |
|
1130 |
|
1131 status = message.add_parameter_data(is_present); |
|
1132 if (status != eap_status_ok) |
|
1133 { |
|
1134 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1135 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1136 } |
|
1137 |
|
1138 status = send_message(&message); |
|
1139 if (status != eap_status_ok) |
|
1140 { |
|
1141 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1142 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1143 } |
|
1144 } |
|
1145 |
|
1146 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1147 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1148 |
|
1149 } |
|
1150 //-------------------------------------------------- |
|
1151 |
|
1152 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_compare_pac_store_password( |
|
1153 const bool is_matching) |
|
1154 { |
|
1155 eap_status_e status(eap_status_process_general_error); |
|
1156 |
|
1157 EAP_TRACE_DEBUG( |
|
1158 m_am_tools, |
|
1159 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1160 (EAPL("%s: eap_core_server_message_if_c::complete_compare_pac_store_password()\n"), |
|
1161 (m_is_client == true) ? "client": "server")); |
|
1162 |
|
1163 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_compare_pac_store_password()"); |
|
1164 |
|
1165 { |
|
1166 // Creates message data composed of Attribute-Value Pairs. |
|
1167 eap_process_tlv_message_data_c message(m_am_tools); |
|
1168 |
|
1169 if (message.get_is_valid() == false) |
|
1170 { |
|
1171 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1172 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1173 } |
|
1174 |
|
1175 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_compare_pac_store_password); |
|
1176 if (status != eap_status_ok) |
|
1177 { |
|
1178 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1179 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1180 } |
|
1181 |
|
1182 status = message.add_parameter_data(is_matching); |
|
1183 if (status != eap_status_ok) |
|
1184 { |
|
1185 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1186 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1187 } |
|
1188 |
|
1189 status = send_message(&message); |
|
1190 if (status != eap_status_ok) |
|
1191 { |
|
1192 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1193 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1194 } |
|
1195 } |
|
1196 |
|
1197 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1198 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1199 |
|
1200 } |
|
1201 //-------------------------------------------------- |
|
1202 |
|
1203 //-------------------------------------------------- |
|
1204 |
|
1205 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_set_pac_store_password( |
|
1206 const eap_status_e completion_status) |
|
1207 { |
|
1208 eap_status_e status(eap_status_process_general_error); |
|
1209 |
|
1210 EAP_TRACE_DEBUG( |
|
1211 m_am_tools, |
|
1212 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1213 (EAPL("%s: eap_core_server_message_if_c::complete_set_pac_store_password()\n"), |
|
1214 (m_is_client == true) ? "client": "server")); |
|
1215 |
|
1216 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_set_pac_store_password()"); |
|
1217 |
|
1218 { |
|
1219 // Creates message data composed of Attribute-Value Pairs. |
|
1220 eap_process_tlv_message_data_c message(m_am_tools); |
|
1221 |
|
1222 if (message.get_is_valid() == false) |
|
1223 { |
|
1224 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1225 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1226 } |
|
1227 |
|
1228 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_set_pac_store_password); |
|
1229 if (status != eap_status_ok) |
|
1230 { |
|
1231 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1232 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1233 } |
|
1234 |
|
1235 status = message.add_parameter_data(completion_status); |
|
1236 if (status != eap_status_ok) |
|
1237 { |
|
1238 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1239 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1240 } |
|
1241 |
|
1242 status = send_message(&message); |
|
1243 if (status != eap_status_ok) |
|
1244 { |
|
1245 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1246 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1247 } |
|
1248 } |
|
1249 |
|
1250 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1251 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1252 |
|
1253 } |
|
1254 //-------------------------------------------------- |
|
1255 |
|
1256 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_destroy_pac_store( |
|
1257 const eap_status_e completion_status) |
|
1258 { |
|
1259 eap_status_e status(eap_status_process_general_error); |
|
1260 |
|
1261 EAP_TRACE_DEBUG( |
|
1262 m_am_tools, |
|
1263 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1264 (EAPL("%s: eap_core_server_message_if_c::complete_destroy_pac_store()\n"), |
|
1265 (m_is_client == true) ? "client": "server")); |
|
1266 |
|
1267 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_destroy_pac_store()"); |
|
1268 |
|
1269 { |
|
1270 // Creates message data composed of Attribute-Value Pairs. |
|
1271 eap_process_tlv_message_data_c message(m_am_tools); |
|
1272 |
|
1273 if (message.get_is_valid() == false) |
|
1274 { |
|
1275 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1276 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1277 } |
|
1278 |
|
1279 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_destroy_pac_store); |
|
1280 if (status != eap_status_ok) |
|
1281 { |
|
1282 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1283 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1284 } |
|
1285 |
|
1286 status = message.add_parameter_data(completion_status); |
|
1287 if (status != eap_status_ok) |
|
1288 { |
|
1289 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1290 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1291 } |
|
1292 |
|
1293 status = send_message(&message); |
|
1294 if (status != eap_status_ok) |
|
1295 { |
|
1296 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1297 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1298 } |
|
1299 } |
|
1300 |
|
1301 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1302 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1303 |
|
1304 } |
|
1305 //-------------------------------------------------- |
|
1306 |
|
1307 |
|
1308 eap_am_pac_store_c* eap_am_pac_store_symbian_c::new_eap_am_pac_store_symbian_c( |
|
1309 abs_eap_am_tools_c * const tools, |
|
1310 abs_eap_am_pac_store_c * const partner) |
|
1311 { |
|
1312 eap_am_pac_store_c *server = new eap_am_pac_store_symbian_c( |
|
1313 tools, partner); |
|
1314 /* |
|
1315 eap_automatic_variable_c<eap_am_pac_store_c> automatic_server( |
|
1316 tools, |
|
1317 server); |
|
1318 */ |
|
1319 if (server == 0) |
|
1320 { |
|
1321 EAP_TRACE_DEBUG( |
|
1322 tools, |
|
1323 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1324 (EAPL("calls: eap_pac_store_server_message_if_c(): server == 0 !!!:.\n"))); |
|
1325 } |
|
1326 else if (server->get_is_valid() == false) |
|
1327 { |
|
1328 EAP_TRACE_DEBUG( |
|
1329 tools, |
|
1330 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1331 (EAPL("calls: eap_pac_store_server_message_if_c(): server->shutdown():.\n"))); |
|
1332 server->shutdown(); |
|
1333 delete server; |
|
1334 server = 0; |
|
1335 } |
|
1336 |
|
1337 return server; |
|
1338 |
|
1339 } |
|
1340 |
|
1341 |
|
1342 //-------------------------------------------------- |
|
1343 // End. |
|