1 /* |
1 /* |
2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
49 EAP_TRACE_DEBUG_SYMBIAN( |
49 EAP_TRACE_DEBUG_SYMBIAN( |
50 (_L("CEapFastPacStoreImpl::NewL"))); |
50 (_L("CEapFastPacStoreImpl::NewL"))); |
51 |
51 |
52 CEapFastPacStoreImpl* self = new (ELeave) CEapFastPacStoreImpl(); |
52 CEapFastPacStoreImpl* self = new (ELeave) CEapFastPacStoreImpl(); |
53 |
53 |
54 self->ConstructL(); |
54 CleanupStack::PushL(self); |
55 |
55 |
|
56 self->ConstructL(); |
|
57 |
|
58 CleanupStack::Pop(self); |
|
59 |
56 EAP_TRACE_DEBUG_SYMBIAN( |
60 EAP_TRACE_DEBUG_SYMBIAN( |
57 (_L("CEapFastPacStoreImpl::NewL end"))); |
61 (_L("CEapFastPacStoreImpl::NewL end"))); |
58 return self; |
62 return self; |
59 |
63 |
60 } |
64 } |
191 } |
195 } |
192 } |
196 } |
193 |
197 |
194 // ---------------------------------------------------------- |
198 // ---------------------------------------------------------- |
195 |
199 |
196 void CEapFastPacStoreImpl::OpenPacStoreL() |
|
197 { |
|
198 EAP_TRACE_DEBUG_SYMBIAN( |
|
199 (_L("CEapFastPacStoreImpl::OpenPacStoreL"))); |
|
200 |
|
201 eap_status_e status = iPartner->open_pac_store( |
|
202 iCompletionStatus); |
|
203 |
|
204 if (status != eap_status_ok) |
|
205 { |
|
206 User::Leave(iTools->convert_eapol_error_to_am_error( |
|
207 EAP_STATUS_RETURN(iTools, status))); |
|
208 } |
|
209 |
|
210 iWaitState = eap_fast_pac_store_impl_wait_state_complete_open_pac_store; |
|
211 Activate(); |
|
212 WaitCompletion(); |
|
213 |
|
214 if (iCompletionStatus != eap_status_ok) |
|
215 { |
|
216 User::Leave(iTools->convert_eapol_error_to_am_error( |
|
217 EAP_STATUS_RETURN(iTools, iCompletionStatus))); |
|
218 } |
|
219 |
|
220 EAP_TRACE_DEBUG_SYMBIAN( |
|
221 (_L("CEapFastPacStoreImpl::OpenPacStoreL end"))); |
|
222 |
|
223 } |
|
224 |
|
225 // ---------------------------------------------------------- |
|
226 |
|
227 void CEapFastPacStoreImpl::CreateDeviceSeedL() |
|
228 { |
|
229 EAP_TRACE_DEBUG_SYMBIAN( |
|
230 (_L("CEapFastPacStoreImpl::CreateDeviceSeedL"))); |
|
231 |
|
232 eap_status_e status = iPartner->create_device_seed( |
|
233 iCompletionStatus); |
|
234 |
|
235 if (status != eap_status_ok) |
|
236 { |
|
237 User::Leave(iTools->convert_eapol_error_to_am_error( |
|
238 EAP_STATUS_RETURN(iTools, status))); |
|
239 } |
|
240 |
|
241 iWaitState = eap_fast_pac_store_impl_wait_state_complete_create_device_seed; |
|
242 Activate(); |
|
243 WaitCompletion(); |
|
244 |
|
245 if (iCompletionStatus != eap_status_ok) |
|
246 { |
|
247 User::Leave(iTools->convert_eapol_error_to_am_error( |
|
248 EAP_STATUS_RETURN(iTools, iCompletionStatus))); |
|
249 } |
|
250 |
|
251 EAP_TRACE_DEBUG_SYMBIAN( |
|
252 (_L("CEapFastPacStoreImpl::CreateDeviceSeedL end"))); |
|
253 |
|
254 } |
|
255 |
|
256 // ---------------------------------------------------------- |
|
257 |
|
258 TBool CEapFastPacStoreImpl::IsMasterKeyPresentL() |
200 TBool CEapFastPacStoreImpl::IsMasterKeyPresentL() |
259 { |
201 { |
260 EAP_TRACE_DEBUG_SYMBIAN( |
202 EAP_TRACE_DEBUG_SYMBIAN( |
261 (_L("CEapFastPacStoreImpl::IsMasterKeyPresentL"))); |
203 (_L("CEapFastPacStoreImpl::IsMasterKeyPresentL"))); |
262 |
204 |
355 } |
297 } |
356 |
298 |
357 EAP_TRACE_DEBUG_SYMBIAN( |
299 EAP_TRACE_DEBUG_SYMBIAN( |
358 (_L("CEapFastPacStoreImpl::CreateAndSaveMasterKeyL end"))); |
300 (_L("CEapFastPacStoreImpl::CreateAndSaveMasterKeyL end"))); |
359 |
301 |
360 return iCompletionStatus; |
302 return iTools->convert_eapol_error_to_am_error( |
|
303 EAP_STATUS_RETURN(iTools, iCompletionStatus)); |
361 |
304 |
362 } |
305 } |
363 |
306 |
364 // ---------------------------------------------------------- |
307 // ---------------------------------------------------------- |
365 |
308 |
458 } |
401 } |
459 |
402 |
460 EAP_TRACE_DEBUG_SYMBIAN( |
403 EAP_TRACE_DEBUG_SYMBIAN( |
461 (_L("CEapFastPacStoreImpl::SetPacStorePasswordL end"))); |
404 (_L("CEapFastPacStoreImpl::SetPacStorePasswordL end"))); |
462 |
405 |
463 return iCompletionStatus; |
406 return iTools->convert_eapol_error_to_am_error( |
|
407 EAP_STATUS_RETURN(iTools, iCompletionStatus)); |
464 |
408 |
465 |
409 |
466 } |
410 } |
467 |
411 |
468 // ---------------------------------------------------------- |
412 // ---------------------------------------------------------- |
485 WaitCompletion(); |
429 WaitCompletion(); |
486 |
430 |
487 EAP_TRACE_DEBUG_SYMBIAN( |
431 EAP_TRACE_DEBUG_SYMBIAN( |
488 (_L("CEapFastPacStoreImpl::DestroyPacStore end"))); |
432 (_L("CEapFastPacStoreImpl::DestroyPacStore end"))); |
489 |
433 |
490 return iCompletionStatus; |
434 return iTools->convert_eapol_error_to_am_error( |
491 |
435 EAP_STATUS_RETURN(iTools, iCompletionStatus)); |
492 |
436 |
493 } |
|
494 |
|
495 // ---------------------------------------------------------- |
|
496 |
|
497 eap_status_e CEapFastPacStoreImpl::complete_open_pac_store( |
|
498 const eap_status_e completion_status) |
|
499 { |
|
500 EAP_TRACE_DEBUG( |
|
501 iTools, |
|
502 TRACE_FLAGS_DEFAULT, |
|
503 (EAPL("CEapFastPacStoreImpl::complete_open_pac_store(): this=0x%08x, iWaitState=%d\n"), |
|
504 this, |
|
505 iWaitState)); |
|
506 |
|
507 iCompletionStatus = completion_status; |
|
508 |
|
509 if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_open_pac_store |
|
510 && iCompletionStatus == eap_status_ok) |
|
511 { |
|
512 // ERROR wrong state. |
|
513 iCompletionStatus = eap_status_wrong_eap_type_state; |
|
514 } |
|
515 |
|
516 Complete(); |
|
517 |
|
518 EAP_TRACE_DEBUG_SYMBIAN( |
|
519 (_L("CEapFastPacStoreImpl::complete_open_pac_store end"))); |
|
520 |
|
521 return iCompletionStatus; |
|
522 |
|
523 } |
|
524 |
|
525 // ---------------------------------------------------------- |
|
526 |
|
527 eap_status_e CEapFastPacStoreImpl::complete_create_device_seed( |
|
528 const eap_status_e completion_status) |
|
529 { |
|
530 EAP_TRACE_DEBUG( |
|
531 iTools, |
|
532 TRACE_FLAGS_DEFAULT, |
|
533 (EAPL("CEapFastPacStoreImpl::complete_create_device_seed(): this=0x%08x, iWaitState=%d\n"), |
|
534 this, |
|
535 iWaitState)); |
|
536 |
|
537 iCompletionStatus = completion_status; |
|
538 |
|
539 if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_create_device_seed |
|
540 && iCompletionStatus == eap_status_ok) |
|
541 { |
|
542 // ERROR wrong state. |
|
543 iCompletionStatus = eap_status_wrong_eap_type_state; |
|
544 } |
|
545 |
|
546 Complete(); |
|
547 |
|
548 EAP_TRACE_DEBUG_SYMBIAN( |
|
549 (_L("CEapFastPacStoreImpl::complete_create_device_seed end"))); |
|
550 |
|
551 return iCompletionStatus; |
|
552 |
437 |
553 } |
438 } |
554 |
439 |
555 // ---------------------------------------------------------- |
440 // ---------------------------------------------------------- |
556 |
441 |