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