eapol/eapol_framework/eapol_common/core/eapol_core.cpp
branchRCL_3
changeset 10 6d97dea7ee6c
parent 9 aa67149e0134
child 18 bad0cc58d154
equal deleted inserted replaced
9:aa67149e0134 10:6d97dea7ee6c
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 67.1.2.1.1 %
    19 * %version: 67.1.2.1.2 %
    20 */
    20 */
    21 
    21 
    22 // This is enumeration of EAPOL source code.
    22 // This is enumeration of EAPOL source code.
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    24 	#undef EAP_FILE_NUMBER_ENUM
    24 	#undef EAP_FILE_NUMBER_ENUM
   747 			&send_network_id,
   747 			&send_network_id,
   748 			&start_packet,
   748 			&start_packet,
   749 			m_eapol_header_offset,
   749 			m_eapol_header_offset,
   750 			eapol_header_wr_c::get_header_length()+eapol.get_data_length(),
   750 			eapol_header_wr_c::get_header_length()+eapol.get_data_length(),
   751 			buffer_size);
   751 			buffer_size);
       
   752 		if (status != eap_status_ok)
       
   753 		{
       
   754 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   755 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   756 		}
       
   757 
       
   758 		if (m_authentication_type == eapol_key_authentication_type_EAP_authentication_no_encryption)
       
   759 		{
       
   760 			// This is a hack for this security mode. Some APs need broadcast EAPOL-Start-message.
       
   761 
       
   762 			const u8_t BROADCAST_ADDRESS[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
       
   763 
       
   764 			eap_variable_data_c broadcast_destination(
       
   765 				m_am_tools,
       
   766 				BROADCAST_ADDRESS,
       
   767 				sizeof(BROADCAST_ADDRESS),
       
   768 				false,
       
   769 				false);
       
   770 		
       
   771 			if (broadcast_destination.get_is_valid_data() == false)
       
   772 			{
       
   773 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   774 			}
       
   775 
       
   776 			// Here we swap the addresses.
       
   777 			eap_am_network_id_c broadcast_send_network_id(m_am_tools,
       
   778 				receive_network_id->get_destination_id(),
       
   779 				&broadcast_destination,
       
   780 				receive_network_id->get_type());
       
   781 			if (send_network_id.get_is_valid_data() == false)
       
   782 			{
       
   783 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   784 			}
       
   785 
       
   786 			status = m_partner->packet_send(
       
   787 				&broadcast_send_network_id,
       
   788 				&start_packet,
       
   789 				m_eapol_header_offset,
       
   790 				eapol_header_wr_c::get_header_length()+eapol.get_data_length(),
       
   791 				buffer_size);
       
   792 			if (status != eap_status_ok)
       
   793 			{
       
   794 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   795 				return EAP_STATUS_RETURN(m_am_tools, status);
       
   796 			}
       
   797 		}
   752 
   798 
   753 		if (from_timer == false)
   799 		if (from_timer == false)
   754 		{
   800 		{
   755 			// Reset EAPOL-Start counter because this is not a resending.
   801 			// Reset EAPOL-Start counter because this is not a resending.
   756 			m_eapol_starts_sent = 1;
   802 			m_eapol_starts_sent = 1;