43 #include "eapol_rc4_key_header.h" |
43 #include "eapol_rc4_key_header.h" |
44 #include "eapol_key_state_string.h" |
44 #include "eapol_key_state_string.h" |
45 |
45 |
46 //-------------------------------------------------- |
46 //-------------------------------------------------- |
47 // |
47 // |
48 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::create_4_way_handshake_message_2( |
48 eap_status_e eapol_key_state_c::create_4_way_handshake_message_2( |
49 eap_buf_chain_wr_c * const sent_packet, |
49 eap_buf_chain_wr_c * const sent_packet, |
50 const u32_t eapol_header_offset, |
50 const u32_t eapol_header_offset, |
51 u32_t * const data_length, |
51 u32_t * const data_length, |
52 u32_t * const buffer_length, |
52 u32_t * const buffer_length, |
53 const u64_t received_key_replay_counter, |
53 const u64_t received_key_replay_counter, |
258 } |
258 } |
259 |
259 |
260 //-------------------------------------------------- |
260 //-------------------------------------------------- |
261 |
261 |
262 // |
262 // |
263 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::create_4_way_handshake_message_4( |
263 eap_status_e eapol_key_state_c::create_4_way_handshake_message_4( |
264 eap_buf_chain_wr_c * const sent_packet, |
264 eap_buf_chain_wr_c * const sent_packet, |
265 const u32_t eapol_header_offset, |
265 const u32_t eapol_header_offset, |
266 u32_t * const data_length, |
266 u32_t * const data_length, |
267 u32_t * const buffer_length, |
267 u32_t * const buffer_length, |
268 const u64_t received_key_replay_counter, |
268 const u64_t received_key_replay_counter, |
409 } |
409 } |
410 |
410 |
411 //-------------------------------------------------- |
411 //-------------------------------------------------- |
412 |
412 |
413 // |
413 // |
414 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::process_4_way_handshake_message_1( |
414 eap_status_e eapol_key_state_c::process_4_way_handshake_message_1( |
415 const eap_am_network_id_c * const receive_network_id, |
415 const eap_am_network_id_c * const receive_network_id, |
416 eapol_RSNA_key_header_c * const eapol_key_message, |
416 eapol_RSNA_key_header_c * const eapol_key_message, |
417 const u32_t /* packet_length */) |
417 const u32_t /* packet_length */) |
418 { |
418 { |
419 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
419 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
420 EAP_UNREFERENCED_PARAMETER(receive_network_id); |
420 EAP_UNREFERENCED_PARAMETER(receive_network_id); |
421 |
421 |
422 eap_status_e status = eap_status_process_general_error; |
422 eap_status_e status = eap_status_process_general_error; |
423 |
423 |
|
424 eapol_key_state_string_c state_string; |
|
425 |
424 EAP_TRACE_DEBUG( |
426 EAP_TRACE_DEBUG( |
425 m_am_tools, |
427 m_am_tools, |
426 TRACE_FLAGS_DEFAULT, |
428 TRACE_FLAGS_DEFAULT, |
427 (EAPL("EAPOL_KEY: %s: eapol_key_state_c::process_4_way_handshake_message_1(): eapol_key_descriptor_type = %s = 0x%02x\n"), |
429 (EAPL("EAPOL_KEY: %s: eapol_key_state_c::process_4_way_handshake_message_1(): eapol_key_descriptor_type = %s = 0x%02x\n"), |
428 (m_is_client == true ? "client": "server"), |
430 (m_is_client == true ? "client": "server"), |
429 eapol_key_state_string_c::get_eapol_key_descriptor_type_string(eapol_key_message->get_key_descriptor_type()), |
431 state_string.get_eapol_key_descriptor_type_string(eapol_key_message->get_key_descriptor_type()), |
430 eapol_key_message->get_key_descriptor_type())); |
432 eapol_key_message->get_key_descriptor_type())); |
431 |
433 |
432 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: eapol_key_state_c::process_4_way_handshake_message_1()"); |
434 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: eapol_key_state_c::process_4_way_handshake_message_1()"); |
433 |
435 |
434 // Only client (supplicant) could receive 4-Way Handshake message 1. |
436 // Only client (supplicant) could receive 4-Way Handshake message 1. |
435 EAP_ASSERT_ALWAYS(m_is_client == true); |
437 EAP_ASSERT_ALWAYS(m_is_client == true); |
436 |
438 |
437 #if 0 |
|
438 if (m_eapol_key_handshake_type == eapol_key_handshake_type_none) |
439 if (m_eapol_key_handshake_type == eapol_key_handshake_type_none) |
439 { |
440 { |
440 // 4-Way Handshake started again. |
441 // 4-Way Handshake started again. |
441 m_eapol_key_handshake_type = eapol_key_handshake_type_4_way_handshake; |
442 m_eapol_key_handshake_type = eapol_key_handshake_type_4_way_handshake; |
442 set_eapol_key_state(eapol_key_state_wait_4_way_handshake_message_1); |
443 set_eapol_key_state(eapol_key_state_wait_4_way_handshake_message_1); |
445 m_am_tools, |
446 m_am_tools, |
446 TRACE_FLAGS_DEFAULT, |
447 TRACE_FLAGS_DEFAULT, |
447 (EAPL("EAPOL_KEY: %s: process_4_way_handshake_message_1(): 4-Way Handshake restarted.\n"), |
448 (EAPL("EAPOL_KEY: %s: process_4_way_handshake_message_1(): 4-Way Handshake restarted.\n"), |
448 (m_is_client == true ? "client": "server"))); |
449 (m_is_client == true ? "client": "server"))); |
449 } |
450 } |
450 #endif |
|
451 |
451 |
452 if (get_eapol_key_state() != eapol_key_state_wait_4_way_handshake_message_1 |
452 if (get_eapol_key_state() != eapol_key_state_wait_4_way_handshake_message_1 |
453 && get_eapol_key_state() != eapol_key_state_wait_4_way_handshake_message_3 |
453 && get_eapol_key_state() != eapol_key_state_wait_4_way_handshake_message_3 |
454 && get_eapol_key_state() != eapol_key_state_4_way_handshake_successfull |
454 && get_eapol_key_state() != eapol_key_state_4_way_handshake_successfull |
455 && get_eapol_key_state() != eapol_key_state_group_key_handshake_successfull |
|
456 && get_eapol_key_state() != eapol_key_state_preauthenticated |
455 && get_eapol_key_state() != eapol_key_state_preauthenticated |
457 #if defined(EAP_USE_WPXM) |
456 #if defined(EAP_USE_WPXM) |
458 && get_eapol_key_state() != eapol_key_state_wpxm_reassociation_finished_successfull |
457 && get_eapol_key_state() != eapol_key_state_wpxm_reassociation_finished_successfull |
459 #endif //#if defined(EAP_USE_WPXM) |
458 #endif //#if defined(EAP_USE_WPXM) |
460 ) |
459 ) |
462 EAP_TRACE_ERROR( |
461 EAP_TRACE_ERROR( |
463 m_am_tools, |
462 m_am_tools, |
464 TRACE_FLAGS_DEFAULT, |
463 TRACE_FLAGS_DEFAULT, |
465 (EAPL("WARNING: EAPOL_KEY: %s: process_4_way_handshake_message_1(): wrong state %s\n"), |
464 (EAPL("WARNING: EAPOL_KEY: %s: process_4_way_handshake_message_1(): wrong state %s\n"), |
466 (m_is_client == true ? "client": "server"), |
465 (m_is_client == true ? "client": "server"), |
467 eapol_key_state_string_c::get_eapol_key_state_string(get_eapol_key_state()))); |
466 state_string.get_eapol_key_state_string(get_eapol_key_state()))); |
468 |
467 |
469 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
468 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
470 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
469 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
471 } |
470 } |
472 |
471 |
768 } |
767 } |
769 |
768 |
770 //-------------------------------------------------- |
769 //-------------------------------------------------- |
771 |
770 |
772 // |
771 // |
773 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::process_4_way_handshake_message_3_payloads_a( |
772 eap_status_e eapol_key_state_c::process_4_way_handshake_message_3_payloads_a( |
774 const eap_am_network_id_c * const receive_network_id, |
773 const eap_am_network_id_c * const receive_network_id, |
775 eapol_RSNA_key_header_c * const eapol_key_message, |
774 eapol_RSNA_key_header_c * const eapol_key_message, |
776 const u32_t packet_length, |
775 const u32_t packet_length, |
777 bool * const group_key_received) |
776 bool * const group_key_received) |
778 { |
777 { |
961 } |
960 } |
962 |
961 |
963 //-------------------------------------------------- |
962 //-------------------------------------------------- |
964 |
963 |
965 // |
964 // |
966 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::process_4_way_handshake_message_3_payloads_b( |
965 eap_status_e eapol_key_state_c::process_4_way_handshake_message_3_payloads_b( |
967 const eap_am_network_id_c * const receive_network_id, |
966 const eap_am_network_id_c * const receive_network_id, |
968 eapol_RSNA_key_header_c * const eapol_key_message, |
967 eapol_RSNA_key_header_c * const eapol_key_message, |
969 const u32_t /* packet_length */, |
968 const u32_t /* packet_length */, |
970 const bool group_key_received) |
969 const bool group_key_received) |
971 { |
970 { |
1119 } |
1118 } |
1120 } |
1119 } |
1121 } |
1120 } |
1122 else |
1121 else |
1123 { |
1122 { |
|
1123 eapol_key_state_string_c state_string; |
|
1124 |
1124 EAP_TRACE_DEBUG( |
1125 EAP_TRACE_DEBUG( |
1125 m_am_tools, |
1126 m_am_tools, |
1126 TRACE_FLAGS_DEFAULT, |
1127 TRACE_FLAGS_DEFAULT, |
1127 (EAPL("WARNING: EAPOL_KEY: eapol_key_state_c::process_4_way_handshake_message_3_payloads_b(): ") |
1128 (EAPL("WARNING: EAPOL_KEY: eapol_key_state_c::process_4_way_handshake_message_3_payloads_b(): ") |
1128 EAPL("No keys are set on state %d=%s.\n"), |
1129 EAPL("No keys are set on state %d=%s.\n"), |
1129 get_eapol_key_state(), |
1130 get_eapol_key_state(), |
1130 eapol_key_state_string_c::get_eapol_key_state_string(get_eapol_key_state()))); |
1131 state_string.get_eapol_key_state_string(get_eapol_key_state()))); |
1131 } |
1132 } |
1132 |
1133 |
1133 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1134 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1134 return EAP_STATUS_RETURN(m_am_tools, status); |
1135 return EAP_STATUS_RETURN(m_am_tools, status); |
1135 } |
1136 } |
1136 |
1137 |
1137 //-------------------------------------------------- |
1138 //-------------------------------------------------- |
1138 |
1139 |
1139 // |
1140 // |
1140 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::process_4_way_handshake_message_3( |
1141 eap_status_e eapol_key_state_c::process_4_way_handshake_message_3( |
1141 const eap_am_network_id_c * const receive_network_id, |
1142 const eap_am_network_id_c * const receive_network_id, |
1142 eapol_RSNA_key_header_c * const eapol_key_message, |
1143 eapol_RSNA_key_header_c * const eapol_key_message, |
1143 const u32_t packet_length) |
1144 const u32_t packet_length) |
1144 { |
1145 { |
1145 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1146 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1146 EAP_UNREFERENCED_PARAMETER(receive_network_id); |
1147 EAP_UNREFERENCED_PARAMETER(receive_network_id); |
1147 |
1148 |
1148 eap_status_e status = eap_status_process_general_error; |
1149 eap_status_e status = eap_status_process_general_error; |
1149 |
1150 |
|
1151 eapol_key_state_string_c state_string; |
|
1152 |
1150 EAP_TRACE_DEBUG( |
1153 EAP_TRACE_DEBUG( |
1151 m_am_tools, |
1154 m_am_tools, |
1152 TRACE_FLAGS_DEFAULT, |
1155 TRACE_FLAGS_DEFAULT, |
1153 (EAPL("EAPOL_KEY: %s: eapol_key_state_c::process_4_way_handshake_message_3(): eapol_key_descriptor_type = %s = 0x%02x\n"), |
1156 (EAPL("EAPOL_KEY: %s: eapol_key_state_c::process_4_way_handshake_message_3(): eapol_key_descriptor_type = %s = 0x%02x\n"), |
1154 (m_is_client == true ? "client": "server"), |
1157 (m_is_client == true ? "client": "server"), |
1155 eapol_key_state_string_c::get_eapol_key_descriptor_type_string(eapol_key_message->get_key_descriptor_type()), |
1158 state_string.get_eapol_key_descriptor_type_string(eapol_key_message->get_key_descriptor_type()), |
1156 eapol_key_message->get_key_descriptor_type())); |
1159 eapol_key_message->get_key_descriptor_type())); |
1157 |
1160 |
1158 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: eapol_key_state_c::process_4_way_handshake_message_3()"); |
1161 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: eapol_key_state_c::process_4_way_handshake_message_3()"); |
1159 |
1162 |
1160 // Only client (supplicant) could receive 4-Way Handshake message 3. |
1163 // Only client (supplicant) could receive 4-Way Handshake message 3. |
1163 // NOTE, this could be re-transmitted message. |
1166 // NOTE, this could be re-transmitted message. |
1164 // Authenticator did not get the 4-Way Handshake message 4. |
1167 // Authenticator did not get the 4-Way Handshake message 4. |
1165 if (m_eapol_key_handshake_type != eapol_key_handshake_type_4_way_handshake |
1168 if (m_eapol_key_handshake_type != eapol_key_handshake_type_4_way_handshake |
1166 && m_eapol_key_handshake_type != eapol_key_handshake_type_group_key_handshake) |
1169 && m_eapol_key_handshake_type != eapol_key_handshake_type_group_key_handshake) |
1167 { |
1170 { |
|
1171 eapol_key_state_string_c state_string; |
1168 EAP_TRACE_ERROR( |
1172 EAP_TRACE_ERROR( |
1169 m_am_tools, |
1173 m_am_tools, |
1170 TRACE_FLAGS_DEFAULT, |
1174 TRACE_FLAGS_DEFAULT, |
1171 (EAPL("WARNING: EAPOL_KEY: %s: process_4_way_handshake_message_3(): wrong handshake type %s\n"), |
1175 (EAPL("WARNING: EAPOL_KEY: %s: process_4_way_handshake_message_3(): wrong handshake type %s\n"), |
1172 (m_is_client == true ? "client": "server"), |
1176 (m_is_client == true ? "client": "server"), |
1173 eapol_key_state_string_c::get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
1177 state_string.get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
1174 |
1178 |
1175 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1179 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1176 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1180 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1177 } |
1181 } |
1178 |
1182 |
1186 EAP_TRACE_ERROR( |
1190 EAP_TRACE_ERROR( |
1187 m_am_tools, |
1191 m_am_tools, |
1188 TRACE_FLAGS_DEFAULT, |
1192 TRACE_FLAGS_DEFAULT, |
1189 (EAPL("WARNING: EAPOL_KEY: %s: process_4_way_handshake_message_3(): wrong state %s\n"), |
1193 (EAPL("WARNING: EAPOL_KEY: %s: process_4_way_handshake_message_3(): wrong state %s\n"), |
1190 (m_is_client == true ? "client": "server"), |
1194 (m_is_client == true ? "client": "server"), |
1191 eapol_key_state_string_c::get_eapol_key_state_string(get_eapol_key_state()))); |
1195 state_string.get_eapol_key_state_string(get_eapol_key_state()))); |
1192 |
1196 |
1193 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1197 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1194 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1198 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1195 } |
1199 } |
1196 |
1200 |
1423 (EAPL("EAPOL_KEY: %s: 4-Way Handshake SUCCESS\n"), |
1427 (EAPL("EAPOL_KEY: %s: 4-Way Handshake SUCCESS\n"), |
1424 (m_is_client == true ? "client": "server"))); |
1428 (m_is_client == true ? "client": "server"))); |
1425 } |
1429 } |
1426 else |
1430 else |
1427 { |
1431 { |
|
1432 eapol_key_state_string_c state_string; |
|
1433 |
1428 EAP_TRACE_DEBUG( |
1434 EAP_TRACE_DEBUG( |
1429 m_am_tools, |
1435 m_am_tools, |
1430 TRACE_FLAGS_DEFAULT, |
1436 TRACE_FLAGS_DEFAULT, |
1431 (EAPL("WARNING: EAPOL_KEY: eapol_key_state_c::process_4_way_handshake_message_3(): ") |
1437 (EAPL("WARNING: EAPOL_KEY: eapol_key_state_c::process_4_way_handshake_message_3(): ") |
1432 EAPL("No keys are set on state %d=%s.\n"), |
1438 EAPL("No keys are set on state %d=%s.\n"), |
1433 get_eapol_key_state(), |
1439 get_eapol_key_state(), |
1434 eapol_key_state_string_c::get_eapol_key_state_string(get_eapol_key_state()))); |
1440 state_string.get_eapol_key_state_string(get_eapol_key_state()))); |
1435 } |
1441 } |
1436 |
1442 |
1437 |
1443 |
1438 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1444 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1439 return EAP_STATUS_RETURN(m_am_tools, status); |
1445 return EAP_STATUS_RETURN(m_am_tools, status); |
1440 } |
1446 } |
1441 |
1447 |
1442 //-------------------------------------------------- |
1448 //-------------------------------------------------- |
1443 |
1449 |
1444 // |
1450 // |
1445 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::create_eapol_key_handshake_message_0( |
1451 eap_status_e eapol_key_state_c::create_eapol_key_handshake_message_0( |
1446 const bool true_when_4_way_handshake, ///< With false initiates Group Key Handshake. |
1452 const bool true_when_4_way_handshake, ///< With false initiates Group Key Handshake. |
1447 eap_buf_chain_wr_c * const sent_packet, |
1453 eap_buf_chain_wr_c * const sent_packet, |
1448 const u32_t eapol_header_offset, |
1454 const u32_t eapol_header_offset, |
1449 u32_t * const data_length, |
1455 u32_t * const data_length, |
1450 u32_t * const buffer_length, |
1456 u32_t * const buffer_length, |
1570 } |
1576 } |
1571 |
1577 |
1572 //-------------------------------------------------- |
1578 //-------------------------------------------------- |
1573 |
1579 |
1574 // |
1580 // |
1575 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::create_group_key_handshake_message_2( |
1581 eap_status_e eapol_key_state_c::create_group_key_handshake_message_2( |
1576 eap_buf_chain_wr_c * const sent_packet, |
1582 eap_buf_chain_wr_c * const sent_packet, |
1577 const u32_t eapol_header_offset, |
1583 const u32_t eapol_header_offset, |
1578 u32_t * const data_length, |
1584 u32_t * const data_length, |
1579 u32_t * const buffer_length, |
1585 u32_t * const buffer_length, |
1580 const u64_t received_key_replay_counter, |
1586 const u64_t received_key_replay_counter, |
1713 } |
1719 } |
1714 |
1720 |
1715 //-------------------------------------------------- |
1721 //-------------------------------------------------- |
1716 |
1722 |
1717 // |
1723 // |
1718 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::process_group_key_handshake_message_1( |
1724 eap_status_e eapol_key_state_c::process_group_key_handshake_message_1( |
1719 const eap_am_network_id_c * const receive_network_id, |
1725 const eap_am_network_id_c * const receive_network_id, |
1720 eapol_RSNA_key_header_c * const eapol_key_message, |
1726 eapol_RSNA_key_header_c * const eapol_key_message, |
1721 const u32_t packet_length) |
1727 const u32_t packet_length) |
1722 { |
1728 { |
1723 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1729 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1746 } |
1752 } |
1747 |
1753 |
1748 if (m_eapol_key_handshake_type != eapol_key_handshake_type_none |
1754 if (m_eapol_key_handshake_type != eapol_key_handshake_type_none |
1749 && m_eapol_key_handshake_type != eapol_key_handshake_type_group_key_handshake) |
1755 && m_eapol_key_handshake_type != eapol_key_handshake_type_group_key_handshake) |
1750 { |
1756 { |
|
1757 eapol_key_state_string_c state_string; |
1751 EAP_TRACE_ERROR( |
1758 EAP_TRACE_ERROR( |
1752 m_am_tools, |
1759 m_am_tools, |
1753 TRACE_FLAGS_DEFAULT, |
1760 TRACE_FLAGS_DEFAULT, |
1754 (EAPL("WARNING: EAPOL_KEY: %s: start_group_key_handshake(): wrong handshake type %s\n"), |
1761 (EAPL("WARNING: EAPOL_KEY: %s: start_group_key_handshake(): wrong handshake type %s\n"), |
1755 (m_is_client == true ? "client": "server"), |
1762 (m_is_client == true ? "client": "server"), |
1756 eapol_key_state_string_c::get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
1763 state_string.get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
1757 |
1764 |
1758 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1765 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1759 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1766 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1760 } |
1767 } |
1761 |
1768 |
1765 #if defined(EAP_USE_WPXM) |
1772 #if defined(EAP_USE_WPXM) |
1766 && get_eapol_key_state() != eapol_key_state_wpxm_reassociation_finished_successfull |
1773 && get_eapol_key_state() != eapol_key_state_wpxm_reassociation_finished_successfull |
1767 #endif //#if defined(EAP_USE_WPXM) |
1774 #endif //#if defined(EAP_USE_WPXM) |
1768 ) |
1775 ) |
1769 { |
1776 { |
|
1777 eapol_key_state_string_c state_string; |
1770 EAP_TRACE_ERROR( |
1778 EAP_TRACE_ERROR( |
1771 m_am_tools, |
1779 m_am_tools, |
1772 TRACE_FLAGS_DEFAULT, |
1780 TRACE_FLAGS_DEFAULT, |
1773 (EAPL("WARNING: EAPOL_KEY: %s: process_group_key_handshake_message_1(): wrong state %s\n"), |
1781 (EAPL("WARNING: EAPOL_KEY: %s: process_group_key_handshake_message_1(): wrong state %s\n"), |
1774 (m_is_client == true ? "client": "server"), |
1782 (m_is_client == true ? "client": "server"), |
1775 eapol_key_state_string_c::get_eapol_key_state_string(get_eapol_key_state()))); |
1783 state_string.get_eapol_key_state_string(get_eapol_key_state()))); |
1776 |
1784 |
1777 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1785 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1778 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1786 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
1779 } |
1787 } |
1780 |
1788 |
2133 (EAPL("EAPOL_KEY: %s: Group Key Handshake SUCCESS\n"), |
2141 (EAPL("EAPOL_KEY: %s: Group Key Handshake SUCCESS\n"), |
2134 (m_is_client == true ? "client": "server"))); |
2142 (m_is_client == true ? "client": "server"))); |
2135 } |
2143 } |
2136 else |
2144 else |
2137 { |
2145 { |
|
2146 eapol_key_state_string_c state_string; |
|
2147 |
2138 EAP_TRACE_DEBUG( |
2148 EAP_TRACE_DEBUG( |
2139 m_am_tools, |
2149 m_am_tools, |
2140 TRACE_FLAGS_DEFAULT, |
2150 TRACE_FLAGS_DEFAULT, |
2141 (EAPL("WARNING: EAPOL_KEY: eapol_key_state_c::process_group_key_handshake_message_1(): ") |
2151 (EAPL("WARNING: EAPOL_KEY: eapol_key_state_c::process_group_key_handshake_message_1(): ") |
2142 EAPL("No keys are set on state %d=%s.\n"), |
2152 EAPL("No keys are set on state %d=%s.\n"), |
2143 get_eapol_key_state(), |
2153 get_eapol_key_state(), |
2144 eapol_key_state_string_c::get_eapol_key_state_string(get_eapol_key_state()))); |
2154 state_string.get_eapol_key_state_string(get_eapol_key_state()))); |
2145 } |
2155 } |
2146 |
2156 |
2147 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2157 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2148 return EAP_STATUS_RETURN(m_am_tools, status); |
2158 return EAP_STATUS_RETURN(m_am_tools, status); |
2149 } |
2159 } |
2150 |
2160 |
2151 //-------------------------------------------------- |
2161 //-------------------------------------------------- |
2152 |
2162 |
2153 // |
2163 // |
2154 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::process_RC4_key_descriptor( |
2164 eap_status_e eapol_key_state_c::process_RC4_key_descriptor( |
2155 const eap_am_network_id_c * const receive_network_id, |
2165 const eap_am_network_id_c * const receive_network_id, |
2156 eap_general_header_base_c * const packet_data, |
2166 eap_general_header_base_c * const packet_data, |
2157 const u32_t packet_length) |
2167 const u32_t packet_length) |
2158 { |
2168 { |
2159 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2169 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2167 return EAP_STATUS_RETURN(m_am_tools, eap_status_too_short_message); |
2177 return EAP_STATUS_RETURN(m_am_tools, eap_status_too_short_message); |
2168 } |
2178 } |
2169 |
2179 |
2170 if (m_eapol_key_handshake_type != eapol_key_handshake_type_dynamic_WEP) |
2180 if (m_eapol_key_handshake_type != eapol_key_handshake_type_dynamic_WEP) |
2171 { |
2181 { |
|
2182 eapol_key_state_string_c state_string; |
2172 EAP_TRACE_ERROR( |
2183 EAP_TRACE_ERROR( |
2173 m_am_tools, |
2184 m_am_tools, |
2174 TRACE_FLAGS_DEFAULT, |
2185 TRACE_FLAGS_DEFAULT, |
2175 (EAPL("ERROR: EAPOL_KEY: %s: process_RC4_key_descriptor(): wrong handshake type %s\n"), |
2186 (EAPL("ERROR: EAPOL_KEY: %s: process_RC4_key_descriptor(): wrong handshake type %s\n"), |
2176 (m_is_client == true ? "client": "server"), |
2187 (m_is_client == true ? "client": "server"), |
2177 eapol_key_state_string_c::get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
2188 state_string.get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
2178 |
2189 |
2179 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2190 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2180 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
2191 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
2181 } |
2192 } |
2182 |
2193 |
2183 if (get_eapol_key_state() != eapol_key_state_wait_rc4_key_message) |
2194 if (get_eapol_key_state() != eapol_key_state_wait_rc4_key_message) |
2184 { |
2195 { |
|
2196 eapol_key_state_string_c state_string; |
2185 EAP_TRACE_ERROR( |
2197 EAP_TRACE_ERROR( |
2186 m_am_tools, |
2198 m_am_tools, |
2187 TRACE_FLAGS_DEFAULT, |
2199 TRACE_FLAGS_DEFAULT, |
2188 (EAPL("WARNING: EAPOL_KEY: %s: process_RC4_key_descriptor(): wrong state %s\n"), |
2200 (EAPL("WARNING: EAPOL_KEY: %s: process_RC4_key_descriptor(): wrong state %s\n"), |
2189 (m_is_client == true ? "client": "server"), |
2201 (m_is_client == true ? "client": "server"), |
2190 eapol_key_state_string_c::get_eapol_key_state_string(get_eapol_key_state()))); |
2202 state_string.get_eapol_key_state_string(get_eapol_key_state()))); |
2191 |
2203 |
2192 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2204 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2193 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
2205 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
2194 } |
2206 } |
2195 |
2207 |
2547 } |
2559 } |
2548 |
2560 |
2549 //-------------------------------------------------- |
2561 //-------------------------------------------------- |
2550 |
2562 |
2551 // |
2563 // |
2552 EAP_FUNC_EXPORT eap_status_e eapol_key_state_c::initialize_4_way_handshake( |
2564 eap_status_e eapol_key_state_c::initialize_4_way_handshake( |
2553 const eap_am_network_id_c * const receive_network_id, |
2565 const eap_am_network_id_c * const receive_network_id, |
2554 const eapol_protocol_version_e used_eapol_version) |
2566 const eapol_protocol_version_e used_eapol_version) |
2555 { |
2567 { |
2556 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2568 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2557 EAP_UNREFERENCED_PARAMETER(receive_network_id); |
2569 EAP_UNREFERENCED_PARAMETER(receive_network_id); |
2562 EAP_ASSERT_ALWAYS(m_is_client == true); |
2574 EAP_ASSERT_ALWAYS(m_is_client == true); |
2563 |
2575 |
2564 EAP_TRACE_DEBUG( |
2576 EAP_TRACE_DEBUG( |
2565 m_am_tools, |
2577 m_am_tools, |
2566 TRACE_FLAGS_DEFAULT, |
2578 TRACE_FLAGS_DEFAULT, |
2567 (EAPL("EAPOL_KEY: %s: eapol_key_state_c::initialize_4_way_handshake(): m_eapol_key_handshake_type=%d=%s, m_eapol_key_state=%d=%s\n"), |
2579 (EAPL("EAPOL_KEY: %s: eapol_key_state_c::initialize_4_way_handshake()\n"), |
2568 (m_is_client == true ? "client": "server"), |
2580 (m_is_client == true ? "client": "server"))); |
2569 m_eapol_key_handshake_type, |
|
2570 eapol_key_state_string_c::get_eapol_key_handshake_type_string(m_eapol_key_handshake_type), |
|
2571 m_eapol_key_state, |
|
2572 eapol_key_state_string_c::get_eapol_key_state_string(m_eapol_key_state))); |
|
2573 |
2581 |
2574 if (m_eapol_key_handshake_type != eapol_key_handshake_type_none |
2582 if (m_eapol_key_handshake_type != eapol_key_handshake_type_none |
2575 && m_eapol_key_handshake_type != eapol_key_handshake_type_authenticated |
|
2576 && m_eapol_key_handshake_type != eapol_key_handshake_type_group_key_handshake |
2583 && m_eapol_key_handshake_type != eapol_key_handshake_type_group_key_handshake |
2577 && m_eapol_key_handshake_type != eapol_key_handshake_type_4_way_handshake) |
2584 && m_eapol_key_handshake_type != eapol_key_handshake_type_4_way_handshake) |
2578 { |
2585 { |
|
2586 eapol_key_state_string_c state_string; |
2579 EAP_TRACE_ERROR( |
2587 EAP_TRACE_ERROR( |
2580 m_am_tools, |
2588 m_am_tools, |
2581 TRACE_FLAGS_DEFAULT, |
2589 TRACE_FLAGS_DEFAULT, |
2582 (EAPL("WARNING: EAPOL_KEY: %s: initialize_4_way_handshake(): wrong handshake type %s\n"), |
2590 (EAPL("WARNING: EAPOL_KEY: %s: initialize_4_way_handshake(): wrong handshake type %s\n"), |
2583 (m_is_client == true ? "client": "server"), |
2591 (m_is_client == true ? "client": "server"), |
2584 eapol_key_state_string_c::get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
2592 state_string.get_eapol_key_handshake_type_string(m_eapol_key_handshake_type))); |
2585 |
2593 |
2586 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2594 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2587 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
2595 return EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state); |
2588 } |
2596 } |
2589 |
2597 |