1 /* |
1 /* |
2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-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". |
13 * |
13 * |
14 * Description: State machine for connecting to a WPA network |
14 * Description: State machine for connecting to a WPA network |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 /* |
|
19 * %version: 59 % |
|
20 */ |
18 |
21 |
19 #include "core_sub_operation_wpa_connect.h" |
22 #include "core_sub_operation_wpa_connect.h" |
20 #include "core_sub_operation_connect.h" |
23 #include "core_sub_operation_connect.h" |
21 #include "core_server.h" |
24 #include "core_server.h" |
22 #include "core_tools.h" |
25 #include "core_tools.h" |
57 sent_ie_m( NULL ), |
60 sent_ie_m( NULL ), |
58 auth_algorithm_m( core_authentication_mode_open ), |
61 auth_algorithm_m( core_authentication_mode_open ), |
59 eapol_auth_type_m( wlan_eapol_if_eapol_key_authentication_type_none ), |
62 eapol_auth_type_m( wlan_eapol_if_eapol_key_authentication_type_none ), |
60 assoc_ie_list_m( assoc_ie_list ), |
63 assoc_ie_list_m( assoc_ie_list ), |
61 assoc_resp_m( assoc_resp ), |
64 assoc_resp_m( assoc_resp ), |
62 is_key_caching_used_m( false_t ) |
65 is_key_caching_used_m( false_t ), |
|
66 pairwise_key_m( CIPHER_KEY_NOT_DEFINED ) |
63 { |
67 { |
64 DEBUG( "core_sub_operation_wpa_connect_c::core_sub_operation_wpa_connect_c()" ); |
68 DEBUG( "core_sub_operation_wpa_connect_c::core_sub_operation_wpa_connect_c()" ); |
65 } |
69 } |
66 |
70 |
67 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
378 core_tools_c::cipher_key_type( |
382 core_tools_c::cipher_key_type( |
379 ap_data_m.best_pairwise_cipher() ), |
383 ap_data_m.best_pairwise_cipher() ), |
380 assoc_ie_list_m, |
384 assoc_ie_list_m, |
381 assoc_resp_m, |
385 assoc_resp_m, |
382 is_pairwise_key_invalidated, |
386 is_pairwise_key_invalidated, |
383 true_t ); |
387 true_t, |
|
388 pairwise_key_m.key_length ? &pairwise_key_m : NULL ); |
384 |
389 |
385 return run_sub_operation( operation ); |
390 return run_sub_operation( operation ); |
386 } |
391 } |
387 case core_state_req_connect: |
392 case core_state_req_connect: |
388 { |
393 { |
795 core_tools_c::cipher_key_type( |
800 core_tools_c::cipher_key_type( |
796 key->eapol_key_type, |
801 key->eapol_key_type, |
797 ap_data_m.best_pairwise_cipher(), |
802 ap_data_m.best_pairwise_cipher(), |
798 ap_data_m.best_group_cipher() ); |
803 ap_data_m.best_group_cipher() ); |
799 |
804 |
800 ASSERT( drivers_m ); |
805 /** |
801 drivers_m->add_cipher_key( |
806 * If a pairwise key is supplied before association, we cache it for |
802 type, |
807 * later use instead of immediately setting it. |
803 static_cast<u8_t>( key->key_index ), |
808 */ |
804 static_cast<u16_t>( key->key_length ), |
809 if ( is_cached_sa_used_m && |
805 key->key, |
810 eapol_auth_type_m == wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam && |
806 mac, |
811 key->eapol_key_type == wlan_eapol_if_eapol_key_type_unicast ) |
807 true_t ); |
812 { |
|
813 pairwise_key_m.key_length = static_cast<u16_t>( key->key_length ); |
|
814 pairwise_key_m.key_index = static_cast<u8_t>( key->key_index ); |
|
815 core_tools_c::copy( |
|
816 &pairwise_key_m.key_data[0], |
|
817 key->key, |
|
818 pairwise_key_m.key_length ); |
|
819 } |
|
820 else |
|
821 { |
|
822 ASSERT( drivers_m ); |
|
823 drivers_m->add_cipher_key( |
|
824 type, |
|
825 static_cast<u8_t>( key->key_index ), |
|
826 static_cast<u16_t>( key->key_length ), |
|
827 key->key, |
|
828 mac, |
|
829 true_t ); |
|
830 } |
808 |
831 |
809 return core_error_ok; |
832 return core_error_ok; |
810 } |
833 } |
811 |
834 |
812 // --------------------------------------------------------------------------- |
835 // --------------------------------------------------------------------------- |