|
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: 9 % |
|
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 48 |
|
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_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
490 |
|
491 EAP_TRACE_DEBUG( |
|
492 m_am_tools, |
|
493 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
494 (EAPL("TIMER: %s: [0x%08x]->eap_pac_store_server_message_if_c::timer_expired(id 0x%02x, data 0x%08x).\n"), |
|
495 (m_is_client == true) ? "client": "server", |
|
496 this, |
|
497 id, |
|
498 data)); |
|
499 |
|
500 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::timer_expired()"); |
|
501 |
|
502 |
|
503 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
504 } |
|
505 |
|
506 //-------------------------------------------------- |
|
507 |
|
508 // |
|
509 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::timer_delete_data( |
|
510 const u32_t id, void *data) |
|
511 { |
|
512 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
513 |
|
514 EAP_TRACE_DEBUG( |
|
515 m_am_tools, |
|
516 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
517 (EAPL("TIMER: %s: [0x%08x]->eap_pac_store_server_message_if_c::timer_delete_data(id 0x%02x, data 0x%08x).\n"), |
|
518 (m_is_client == true) ? "client": "server", |
|
519 this, id, data)); |
|
520 |
|
521 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::timer_delete_data()"); |
|
522 |
|
523 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
524 } |
|
525 |
|
526 //-------------------------------------------------- |
|
527 |
|
528 eap_status_e eap_pac_store_server_message_if_c::open_pac_store( |
|
529 EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters) |
|
530 { |
|
531 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
532 |
|
533 EAP_TRACE_DEBUG( |
|
534 m_am_tools, |
|
535 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
536 (EAPL("%s: eap_pac_store_server_message_if_c::open_pac_store()\n"), |
|
537 (m_is_client == true) ? "client": "server")); |
|
538 |
|
539 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::open_pac_store()"); |
|
540 |
|
541 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
542 |
|
543 eap_status_e status(eap_status_ok); |
|
544 |
|
545 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
546 |
|
547 status = m_am_client->open_pac_store(); |
|
548 |
|
549 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
550 |
|
551 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
552 return EAP_STATUS_RETURN(m_am_tools, status); |
|
553 } |
|
554 |
|
555 //-------------------------------------------------- |
|
556 |
|
557 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) |
|
558 { |
|
559 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
560 |
|
561 eap_status_e status(eap_status_ok); |
|
562 |
|
563 EAP_TRACE_DEBUG( |
|
564 m_am_tools, |
|
565 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
566 (EAPL("eap_pac_store_server_message_if_c::create_device_seed(): this = 0x%08x.\n"), |
|
567 this)); |
|
568 |
|
569 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::create_device_seed()"); |
|
570 |
|
571 status = m_am_client->create_device_seed(); |
|
572 |
|
573 return status; |
|
574 |
|
575 } |
|
576 //-------------------------------------------------- |
|
577 |
|
578 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) |
|
579 { |
|
580 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
581 |
|
582 eap_status_e status(eap_status_ok); |
|
583 |
|
584 EAP_TRACE_DEBUG( |
|
585 m_am_tools, |
|
586 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
587 (EAPL("eap_pac_store_server_message_if_c::is_master_key_present(): this = 0x%08x.\n"), |
|
588 this)); |
|
589 |
|
590 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()"); |
|
591 |
|
592 status = m_am_client->is_master_key_present(); |
|
593 |
|
594 return status; |
|
595 |
|
596 } |
|
597 //-------------------------------------------------- |
|
598 |
|
599 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) |
|
600 { |
|
601 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
602 |
|
603 eap_status_e status(eap_status_ok); |
|
604 |
|
605 EAP_TRACE_DEBUG( |
|
606 m_am_tools, |
|
607 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
608 (EAPL("eap_pac_store_server_message_if_c::is_master_key_and_password_matching(): this = 0x%08x.\n"), |
|
609 this)); |
|
610 |
|
611 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()"); |
|
612 |
|
613 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
614 |
|
615 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
616 |
|
617 if (message_data.get_is_valid() == false) |
|
618 { |
|
619 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
620 return EAP_STATUS_RETURN(m_am_tools, status); |
|
621 } |
|
622 |
|
623 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
624 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
625 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
626 |
|
627 if (password == 0) |
|
628 { |
|
629 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
630 return EAP_STATUS_RETURN(m_am_tools, status); |
|
631 } |
|
632 |
|
633 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
634 if (status != eap_status_ok) |
|
635 { |
|
636 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
637 return EAP_STATUS_RETURN(m_am_tools, status); |
|
638 } |
|
639 status = m_am_client->is_master_key_and_password_matching(password); |
|
640 |
|
641 return status; |
|
642 |
|
643 } |
|
644 //-------------------------------------------------- |
|
645 |
|
646 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) |
|
647 { |
|
648 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
649 |
|
650 eap_status_e status(eap_status_ok); |
|
651 |
|
652 EAP_TRACE_DEBUG( |
|
653 m_am_tools, |
|
654 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
655 (EAPL("eap_pac_store_server_message_if_c::create_and_save_master_key(): this = 0x%08x.\n"), |
|
656 this)); |
|
657 |
|
658 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()"); |
|
659 |
|
660 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
661 |
|
662 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
663 |
|
664 if (message_data.get_is_valid() == false) |
|
665 { |
|
666 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
667 return EAP_STATUS_RETURN(m_am_tools, status); |
|
668 } |
|
669 |
|
670 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
671 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
672 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
673 |
|
674 if (password == 0) |
|
675 { |
|
676 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
677 return EAP_STATUS_RETURN(m_am_tools, status); |
|
678 } |
|
679 |
|
680 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
681 if (status != eap_status_ok) |
|
682 { |
|
683 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
684 return EAP_STATUS_RETURN(m_am_tools, status); |
|
685 } |
|
686 status = m_am_client->create_and_save_master_key(password); |
|
687 |
|
688 return status; |
|
689 |
|
690 } |
|
691 //-------------------------------------------------- |
|
692 |
|
693 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) |
|
694 { |
|
695 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
696 |
|
697 eap_status_e status(eap_status_ok); |
|
698 |
|
699 EAP_TRACE_DEBUG( |
|
700 m_am_tools, |
|
701 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
702 (EAPL("eap_pac_store_server_message_if_c::is_pacstore_password_present(): this = 0x%08x.\n"), |
|
703 this)); |
|
704 |
|
705 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()"); |
|
706 |
|
707 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
708 |
|
709 if (message_data.get_is_valid() == false) |
|
710 { |
|
711 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
712 return EAP_STATUS_RETURN(m_am_tools, status); |
|
713 } |
|
714 |
|
715 status = m_am_client->is_pacstore_password_present(); |
|
716 |
|
717 return status; |
|
718 |
|
719 } |
|
720 //-------------------------------------------------- |
|
721 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) |
|
722 { |
|
723 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
724 |
|
725 eap_status_e status(eap_status_ok); |
|
726 |
|
727 EAP_TRACE_DEBUG( |
|
728 m_am_tools, |
|
729 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
730 (EAPL("eap_pac_store_server_message_if_c::compare_pac_store_password(): this = 0x%08x.\n"), |
|
731 this)); |
|
732 |
|
733 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()"); |
|
734 |
|
735 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
736 |
|
737 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
738 |
|
739 if (message_data.get_is_valid() == false) |
|
740 { |
|
741 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
742 return EAP_STATUS_RETURN(m_am_tools, status); |
|
743 } |
|
744 |
|
745 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
746 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
747 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
748 |
|
749 if (password == 0) |
|
750 { |
|
751 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
752 return EAP_STATUS_RETURN(m_am_tools, status); |
|
753 } |
|
754 |
|
755 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
756 if (status != eap_status_ok) |
|
757 { |
|
758 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
759 return EAP_STATUS_RETURN(m_am_tools, status); |
|
760 } |
|
761 |
|
762 status = m_am_client->compare_pac_store_password(password); |
|
763 |
|
764 return status; |
|
765 |
|
766 } |
|
767 //-------------------------------------------------- |
|
768 |
|
769 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) |
|
770 { |
|
771 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
772 |
|
773 eap_status_e status(eap_status_ok); |
|
774 |
|
775 EAP_TRACE_DEBUG( |
|
776 m_am_tools, |
|
777 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
778 (EAPL("eap_pac_store_server_message_if_c::set_pac_store_password(): this = 0x%08x.\n"), |
|
779 this)); |
|
780 |
|
781 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()"); |
|
782 |
|
783 u32_t parameter_index(eap_message_payload_index_first_parameter); |
|
784 |
|
785 eap_process_tlv_message_data_c message_data(m_am_tools); |
|
786 |
|
787 if (message_data.get_is_valid() == false) |
|
788 { |
|
789 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
790 return EAP_STATUS_RETURN(m_am_tools, status); |
|
791 } |
|
792 |
|
793 eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools); |
|
794 // eap_automatic_variable_c can be used in this block because no functions are leaving here. |
|
795 eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password); |
|
796 |
|
797 if (password == 0) |
|
798 { |
|
799 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
800 return EAP_STATUS_RETURN(m_am_tools, status); |
|
801 } |
|
802 |
|
803 status = message_data.read_parameter_data(parameters, parameter_index, password); |
|
804 if (status != eap_status_ok) |
|
805 { |
|
806 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
807 return EAP_STATUS_RETURN(m_am_tools, status); |
|
808 } |
|
809 status = m_am_client->set_pac_store_password(password); |
|
810 |
|
811 return status; |
|
812 |
|
813 } |
|
814 //-------------------------------------------------- |
|
815 |
|
816 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) |
|
817 { |
|
818 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
819 |
|
820 eap_status_e status(eap_status_ok); |
|
821 |
|
822 EAP_TRACE_DEBUG( |
|
823 m_am_tools, |
|
824 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
825 (EAPL("eap_pac_store_server_message_if_c::destroy_pac_store(): this = 0x%08x.\n"), |
|
826 this)); |
|
827 |
|
828 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_server_message_if_c::destroy_pac_store()"); |
|
829 |
|
830 status = m_am_client->destroy_pac_store(); |
|
831 |
|
832 return status; |
|
833 |
|
834 } |
|
835 //-------------------------------------------------- |
|
836 |
|
837 //-------------------------------------------------- |
|
838 |
|
839 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_open_pac_store(const eap_status_e completion_status) |
|
840 { |
|
841 eap_status_e status(eap_status_process_general_error); |
|
842 |
|
843 EAP_TRACE_DEBUG( |
|
844 m_am_tools, |
|
845 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
846 (EAPL("%s: eap_core_server_message_if_c::complete_open_pac_store()\n"), |
|
847 (m_is_client == true) ? "client": "server")); |
|
848 |
|
849 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_open_pac_store()"); |
|
850 |
|
851 { |
|
852 // Creates message data composed of Attribute-Value Pairs. |
|
853 eap_process_tlv_message_data_c message(m_am_tools); |
|
854 |
|
855 if (message.get_is_valid() == false) |
|
856 { |
|
857 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
858 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
859 } |
|
860 |
|
861 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_open_pac_store); |
|
862 if (status != eap_status_ok) |
|
863 { |
|
864 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
865 return EAP_STATUS_RETURN(m_am_tools, status); |
|
866 } |
|
867 |
|
868 status = message.add_parameter_data(completion_status); |
|
869 if (status != eap_status_ok) |
|
870 { |
|
871 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
872 return EAP_STATUS_RETURN(m_am_tools, status); |
|
873 } |
|
874 |
|
875 status = send_message(&message); |
|
876 if (status != eap_status_ok) |
|
877 { |
|
878 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
879 return EAP_STATUS_RETURN(m_am_tools, status); |
|
880 } |
|
881 } |
|
882 |
|
883 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
884 return EAP_STATUS_RETURN(m_am_tools, status); |
|
885 } |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 //-------------------------------------------------- |
|
892 |
|
893 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_create_device_seed( |
|
894 const eap_status_e completion_status) |
|
895 { |
|
896 eap_status_e status(eap_status_process_general_error); |
|
897 |
|
898 EAP_TRACE_DEBUG( |
|
899 m_am_tools, |
|
900 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
901 (EAPL("%s: eap_core_server_message_if_c::complete_create_device_seed()\n"), |
|
902 (m_is_client == true) ? "client": "server")); |
|
903 |
|
904 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_create_device_seed()"); |
|
905 |
|
906 { |
|
907 // Creates message data composed of Attribute-Value Pairs. |
|
908 eap_process_tlv_message_data_c message(m_am_tools); |
|
909 |
|
910 if (message.get_is_valid() == false) |
|
911 { |
|
912 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
913 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
914 } |
|
915 |
|
916 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_create_device_seed); |
|
917 if (status != eap_status_ok) |
|
918 { |
|
919 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
920 return EAP_STATUS_RETURN(m_am_tools, status); |
|
921 } |
|
922 |
|
923 status = message.add_parameter_data(completion_status); |
|
924 if (status != eap_status_ok) |
|
925 { |
|
926 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
927 return EAP_STATUS_RETURN(m_am_tools, status); |
|
928 } |
|
929 |
|
930 status = send_message(&message); |
|
931 if (status != eap_status_ok) |
|
932 { |
|
933 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
934 return EAP_STATUS_RETURN(m_am_tools, status); |
|
935 } |
|
936 } |
|
937 |
|
938 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
939 return EAP_STATUS_RETURN(m_am_tools, status); |
|
940 |
|
941 } |
|
942 //-------------------------------------------------- |
|
943 |
|
944 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_is_master_key_present( |
|
945 const bool is_present) |
|
946 { |
|
947 eap_status_e status(eap_status_process_general_error); |
|
948 |
|
949 EAP_TRACE_DEBUG( |
|
950 m_am_tools, |
|
951 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
952 (EAPL("%s: eap_core_server_message_if_c::complete_is_master_key_present()\n"), |
|
953 (m_is_client == true) ? "client": "server")); |
|
954 |
|
955 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()"); |
|
956 |
|
957 { |
|
958 // Creates message data composed of Attribute-Value Pairs. |
|
959 eap_process_tlv_message_data_c message(m_am_tools); |
|
960 |
|
961 if (message.get_is_valid() == false) |
|
962 { |
|
963 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
964 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
965 } |
|
966 |
|
967 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_is_master_key_present); |
|
968 if (status != eap_status_ok) |
|
969 { |
|
970 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
971 return EAP_STATUS_RETURN(m_am_tools, status); |
|
972 } |
|
973 |
|
974 status = message.add_parameter_data(is_present); |
|
975 if (status != eap_status_ok) |
|
976 { |
|
977 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
978 return EAP_STATUS_RETURN(m_am_tools, status); |
|
979 } |
|
980 |
|
981 status = send_message(&message); |
|
982 if (status != eap_status_ok) |
|
983 { |
|
984 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
985 return EAP_STATUS_RETURN(m_am_tools, status); |
|
986 } |
|
987 } |
|
988 |
|
989 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
990 return EAP_STATUS_RETURN(m_am_tools, status); |
|
991 |
|
992 } |
|
993 //-------------------------------------------------- |
|
994 |
|
995 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_is_master_key_and_password_matching( |
|
996 const bool is_matching) |
|
997 { |
|
998 eap_status_e status(eap_status_process_general_error); |
|
999 |
|
1000 EAP_TRACE_DEBUG( |
|
1001 m_am_tools, |
|
1002 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1003 (EAPL("%s: eap_core_server_message_if_c::complete_is_master_key_and_password_matching()\n"), |
|
1004 (m_is_client == true) ? "client": "server")); |
|
1005 |
|
1006 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()"); |
|
1007 |
|
1008 { |
|
1009 // Creates message data composed of Attribute-Value Pairs. |
|
1010 eap_process_tlv_message_data_c message(m_am_tools); |
|
1011 |
|
1012 if (message.get_is_valid() == false) |
|
1013 { |
|
1014 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1015 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1016 } |
|
1017 |
|
1018 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_is_master_key_and_password_matching); |
|
1019 if (status != eap_status_ok) |
|
1020 { |
|
1021 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1022 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1023 } |
|
1024 |
|
1025 status = message.add_parameter_data(is_matching); |
|
1026 if (status != eap_status_ok) |
|
1027 { |
|
1028 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1029 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1030 } |
|
1031 |
|
1032 status = send_message(&message); |
|
1033 if (status != eap_status_ok) |
|
1034 { |
|
1035 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1036 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1037 } |
|
1038 } |
|
1039 |
|
1040 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1041 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1042 |
|
1043 } |
|
1044 //-------------------------------------------------- |
|
1045 |
|
1046 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_create_and_save_master_key( |
|
1047 const eap_status_e completion_status) |
|
1048 { |
|
1049 eap_status_e status(eap_status_process_general_error); |
|
1050 |
|
1051 EAP_TRACE_DEBUG( |
|
1052 m_am_tools, |
|
1053 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1054 (EAPL("%s: eap_core_server_message_if_c::complete_create_and_save_master_key()\n"), |
|
1055 (m_is_client == true) ? "client": "server")); |
|
1056 |
|
1057 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()"); |
|
1058 |
|
1059 { |
|
1060 // Creates message data composed of Attribute-Value Pairs. |
|
1061 eap_process_tlv_message_data_c message(m_am_tools); |
|
1062 |
|
1063 if (message.get_is_valid() == false) |
|
1064 { |
|
1065 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1066 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1067 } |
|
1068 |
|
1069 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_create_and_save_master_key); |
|
1070 if (status != eap_status_ok) |
|
1071 { |
|
1072 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1073 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1074 } |
|
1075 |
|
1076 status = message.add_parameter_data(completion_status); |
|
1077 if (status != eap_status_ok) |
|
1078 { |
|
1079 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1080 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1081 } |
|
1082 |
|
1083 status = send_message(&message); |
|
1084 if (status != eap_status_ok) |
|
1085 { |
|
1086 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1087 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1088 } |
|
1089 } |
|
1090 |
|
1091 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1092 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1093 |
|
1094 } |
|
1095 //-------------------------------------------------- |
|
1096 |
|
1097 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_is_pacstore_password_present( |
|
1098 const bool is_present) |
|
1099 { |
|
1100 eap_status_e status(eap_status_process_general_error); |
|
1101 |
|
1102 EAP_TRACE_DEBUG( |
|
1103 m_am_tools, |
|
1104 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1105 (EAPL("%s: eap_core_server_message_if_c::complete_is_pacstore_password_present()\n"), |
|
1106 (m_is_client == true) ? "client": "server")); |
|
1107 |
|
1108 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()"); |
|
1109 |
|
1110 { |
|
1111 // Creates message data composed of Attribute-Value Pairs. |
|
1112 eap_process_tlv_message_data_c message(m_am_tools); |
|
1113 |
|
1114 if (message.get_is_valid() == false) |
|
1115 { |
|
1116 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1117 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1118 } |
|
1119 |
|
1120 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_is_pacstore_password_present); |
|
1121 if (status != eap_status_ok) |
|
1122 { |
|
1123 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1124 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1125 } |
|
1126 |
|
1127 status = message.add_parameter_data(is_present); |
|
1128 if (status != eap_status_ok) |
|
1129 { |
|
1130 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1131 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1132 } |
|
1133 |
|
1134 status = send_message(&message); |
|
1135 if (status != eap_status_ok) |
|
1136 { |
|
1137 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1138 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1139 } |
|
1140 } |
|
1141 |
|
1142 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1143 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1144 |
|
1145 } |
|
1146 //-------------------------------------------------- |
|
1147 |
|
1148 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_compare_pac_store_password( |
|
1149 const bool is_matching) |
|
1150 { |
|
1151 eap_status_e status(eap_status_process_general_error); |
|
1152 |
|
1153 EAP_TRACE_DEBUG( |
|
1154 m_am_tools, |
|
1155 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1156 (EAPL("%s: eap_core_server_message_if_c::complete_compare_pac_store_password()\n"), |
|
1157 (m_is_client == true) ? "client": "server")); |
|
1158 |
|
1159 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()"); |
|
1160 |
|
1161 { |
|
1162 // Creates message data composed of Attribute-Value Pairs. |
|
1163 eap_process_tlv_message_data_c message(m_am_tools); |
|
1164 |
|
1165 if (message.get_is_valid() == false) |
|
1166 { |
|
1167 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1168 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1169 } |
|
1170 |
|
1171 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_compare_pac_store_password); |
|
1172 if (status != eap_status_ok) |
|
1173 { |
|
1174 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1175 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1176 } |
|
1177 |
|
1178 status = message.add_parameter_data(is_matching); |
|
1179 if (status != eap_status_ok) |
|
1180 { |
|
1181 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1182 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1183 } |
|
1184 |
|
1185 status = send_message(&message); |
|
1186 if (status != eap_status_ok) |
|
1187 { |
|
1188 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1189 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1190 } |
|
1191 } |
|
1192 |
|
1193 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1194 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1195 |
|
1196 } |
|
1197 //-------------------------------------------------- |
|
1198 |
|
1199 //-------------------------------------------------- |
|
1200 |
|
1201 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_set_pac_store_password( |
|
1202 const eap_status_e completion_status) |
|
1203 { |
|
1204 eap_status_e status(eap_status_process_general_error); |
|
1205 |
|
1206 EAP_TRACE_DEBUG( |
|
1207 m_am_tools, |
|
1208 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1209 (EAPL("%s: eap_core_server_message_if_c::complete_set_pac_store_password()\n"), |
|
1210 (m_is_client == true) ? "client": "server")); |
|
1211 |
|
1212 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()"); |
|
1213 |
|
1214 { |
|
1215 // Creates message data composed of Attribute-Value Pairs. |
|
1216 eap_process_tlv_message_data_c message(m_am_tools); |
|
1217 |
|
1218 if (message.get_is_valid() == false) |
|
1219 { |
|
1220 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1221 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1222 } |
|
1223 |
|
1224 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_set_pac_store_password); |
|
1225 if (status != eap_status_ok) |
|
1226 { |
|
1227 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1228 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1229 } |
|
1230 |
|
1231 status = message.add_parameter_data(completion_status); |
|
1232 if (status != eap_status_ok) |
|
1233 { |
|
1234 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1235 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1236 } |
|
1237 |
|
1238 status = send_message(&message); |
|
1239 if (status != eap_status_ok) |
|
1240 { |
|
1241 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1242 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1243 } |
|
1244 } |
|
1245 |
|
1246 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1247 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1248 |
|
1249 } |
|
1250 //-------------------------------------------------- |
|
1251 |
|
1252 EAP_FUNC_EXPORT eap_status_e eap_pac_store_server_message_if_c::complete_destroy_pac_store( |
|
1253 const eap_status_e completion_status) |
|
1254 { |
|
1255 eap_status_e status(eap_status_process_general_error); |
|
1256 |
|
1257 EAP_TRACE_DEBUG( |
|
1258 m_am_tools, |
|
1259 EAP_TRACE_FLAGS_MESSAGE_DATA, |
|
1260 (EAPL("%s: eap_core_server_message_if_c::complete_destroy_pac_store()\n"), |
|
1261 (m_is_client == true) ? "client": "server")); |
|
1262 |
|
1263 EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_core_server_message_if_c::complete_destroy_pac_store()"); |
|
1264 |
|
1265 { |
|
1266 // Creates message data composed of Attribute-Value Pairs. |
|
1267 eap_process_tlv_message_data_c message(m_am_tools); |
|
1268 |
|
1269 if (message.get_is_valid() == false) |
|
1270 { |
|
1271 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1272 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1273 } |
|
1274 |
|
1275 status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_complete_destroy_pac_store); |
|
1276 if (status != eap_status_ok) |
|
1277 { |
|
1278 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1279 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1280 } |
|
1281 |
|
1282 status = message.add_parameter_data(completion_status); |
|
1283 if (status != eap_status_ok) |
|
1284 { |
|
1285 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1286 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1287 } |
|
1288 |
|
1289 status = send_message(&message); |
|
1290 if (status != eap_status_ok) |
|
1291 { |
|
1292 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1293 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1294 } |
|
1295 } |
|
1296 |
|
1297 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1298 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1299 |
|
1300 } |
|
1301 //-------------------------------------------------- |
|
1302 |
|
1303 |
|
1304 eap_am_pac_store_c* eap_am_pac_store_symbian_c::new_eap_am_pac_store_symbian_c( |
|
1305 abs_eap_am_tools_c * const tools, |
|
1306 abs_eap_am_pac_store_c * const partner) |
|
1307 { |
|
1308 eap_am_pac_store_c *server = new eap_am_pac_store_symbian_c( |
|
1309 tools, partner); |
|
1310 /* |
|
1311 eap_automatic_variable_c<eap_am_pac_store_c> automatic_server( |
|
1312 tools, |
|
1313 server); |
|
1314 */ |
|
1315 if (server == 0) |
|
1316 { |
|
1317 EAP_TRACE_DEBUG( |
|
1318 tools, |
|
1319 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1320 (EAPL("calls: eap_pac_store_server_message_if_c(): server == 0 !!!:.\n"))); |
|
1321 } |
|
1322 else if (server->get_is_valid() == false) |
|
1323 { |
|
1324 EAP_TRACE_DEBUG( |
|
1325 tools, |
|
1326 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1327 (EAPL("calls: eap_pac_store_server_message_if_c(): server->shutdown():.\n"))); |
|
1328 server->shutdown(); |
|
1329 delete server; |
|
1330 server = 0; |
|
1331 } |
|
1332 |
|
1333 return server; |
|
1334 |
|
1335 } |
|
1336 |
|
1337 |
|
1338 //-------------------------------------------------- |
|
1339 // End. |