eapol/eapol_framework/eapol_common/core/eapol_message_wlan_authentication.cpp
changeset 52 c23bdf5a328a
parent 42 53085837e73a
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 62 %
    19 * %version: 64 %
    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
   180 {
   180 {
   181 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   181 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   182 	
   182 	
   183 	EAP_TRACE_DEBUG(
   183 	EAP_TRACE_DEBUG(
   184 		m_am_tools, 
   184 		m_am_tools, 
   185 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   185 		TRACE_FLAGS_DEFAULT, 
   186 		(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired")
   186 		(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired")
   187 		 EAPL("(id 0x%02x, data 0x%08x).\n"),
   187 		 EAPL("(id 0x%02x, data 0x%08x).\n"),
   188 		 this, id, data));
   188 		 this, id, data));
   189 	
   189 	
   190 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
   190 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
   191 
   191 
   192 	if (id == EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID)
   192 	if (id == EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID)
   193 	{
   193 	{
   194 		EAP_TRACE_DEBUG(
   194 		EAP_TRACE_DEBUG(
   195 			m_am_tools, 
   195 			m_am_tools, 
   196 			EAP_TRACE_FLAGS_MESSAGE_DATA, 
   196 			TRACE_FLAGS_DEFAULT, 
   197 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID")
   197 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID")
   198 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   198 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   199 			 this, id, data));
   199 			 this, id, data));
   200 	
   200 	
   201 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   201 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   208 	}
   208 	}
   209 	else if (id == EAPOL_MESSAGE_TIMER_SEND_DATA_ID)
   209 	else if (id == EAPOL_MESSAGE_TIMER_SEND_DATA_ID)
   210 	{
   210 	{
   211 		EAP_TRACE_DEBUG(
   211 		EAP_TRACE_DEBUG(
   212 			m_am_tools, 
   212 			m_am_tools, 
   213 			EAP_TRACE_FLAGS_MESSAGE_DATA, 
   213 			TRACE_FLAGS_DEFAULT, 
   214 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_SEND_DATA_ID")
   214 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_SEND_DATA_ID")
   215 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   215 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   216 			 this, id, data));
   216 			 this, id, data));
   217 	
   217 	
   218 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   218 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   543 		return EAP_STATUS_RETURN(m_am_tools, eap_status_key_error);
   543 		return EAP_STATUS_RETURN(m_am_tools, eap_status_key_error);
   544 	}
   544 	}
   545 	
   545 	
   546 	EAP_TRACE_DEBUG(
   546 	EAP_TRACE_DEBUG(
   547 		m_am_tools,
   547 		m_am_tools,
   548 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   548 		TRACE_FLAGS_DEFAULT,
   549 		(EAPL("test_eapol_c::packet_data_session_key(): key_type 0x%02x, key_index %d\n"),
   549 		(EAPL("test_eapol_c::packet_data_session_key(): key_type 0x%02x, key_index %d\n"),
   550 		 key->get_key_type(),
   550 		 key->get_key_type(),
   551 		 key->get_key_index()));
   551 		 key->get_key_index()));
   552 	
   552 	
   553 	EAP_TRACE_DATA_DEBUG(
   553 	EAP_TRACE_DATA_DEBUG(
  1104 {
  1104 {
  1105 	// Sends message data composed of Attribute-Value Pairs.
  1105 	// Sends message data composed of Attribute-Value Pairs.
  1106 
  1106 
  1107 	EAP_TRACE_DEBUG(
  1107 	EAP_TRACE_DEBUG(
  1108 		m_am_tools, 
  1108 		m_am_tools, 
  1109 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
  1109 		TRACE_FLAGS_DEFAULT, 
  1110 		(EAPL("TIMER: eapol_message_wlan_authentication_c::send_message()\n")));
  1110 		(EAPL("TIMER: eapol_message_wlan_authentication_c::send_message()\n")));
  1111 
  1111 
  1112 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eapol_message_wlan_authentication_c::send_message()");
  1112 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eapol_message_wlan_authentication_c::send_message()");
  1113 
  1113 
  1114 	EAP_TRACE_DATA_DEBUG(
  1114 	EAP_TRACE_DATA_DEBUG(
  1115 		m_am_tools,
  1115 		m_am_tools,
  1116 		EAP_TRACE_FLAGS_NEVER,
  1116 		EAP_TRACE_FLAGS_NEVER,
  1117 		(EAPL("eapol_message_wlan_authentication_c::send_message()"),
  1117 		(EAPL("eapol_message_wlan_authentication_c::send_message()"),
  1206 {
  1206 {
  1207 	// Parses message data composed of Attribute-Value Pairs.
  1207 	// Parses message data composed of Attribute-Value Pairs.
  1208 
  1208 
  1209 	EAP_TRACE_DEBUG(
  1209 	EAP_TRACE_DEBUG(
  1210 		m_am_tools, 
  1210 		m_am_tools, 
  1211 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
  1211 		TRACE_FLAGS_DEFAULT, 
  1212 		(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data()\n")));
  1212 		(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data()\n")));
  1213 
  1213 
  1214 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eapol_message_wlan_authentication_c::process_data()");
  1214 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eapol_message_wlan_authentication_c::process_data()");
  1215 
  1215 
  1216 	eap_status_e status(eap_status_ok);
  1216 	eap_status_e status(eap_status_ok);
  1217 
  1217 
  1218 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
  1218 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
  1219 
  1219 
  1253 
  1253 
  1254 		automatic_message.do_not_free_variable();
  1254 		automatic_message.do_not_free_variable();
  1255 
  1255 
  1256 		EAP_TRACE_DEBUG(
  1256 		EAP_TRACE_DEBUG(
  1257 			m_am_tools, 
  1257 			m_am_tools, 
  1258 			EAP_TRACE_FLAGS_MESSAGE_DATA, 
  1258 			TRACE_FLAGS_DEFAULT, 
  1259 			(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data(): sets EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID\n")));
  1259 			(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data(): sets EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID\n")));
  1260 	
  1260 	
  1261 		status = m_am_tools->am_set_timer(
  1261 		status = m_am_tools->am_set_timer(
  1262 			this,
  1262 			this,
  1263 			EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID, 
  1263 			EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID, 
  1317 {
  1317 {
  1318 	// Parses message data composed of Attribute-Value Pairs.
  1318 	// Parses message data composed of Attribute-Value Pairs.
  1319 
  1319 
  1320 	EAP_TRACE_DEBUG(
  1320 	EAP_TRACE_DEBUG(
  1321 		m_am_tools, 
  1321 		m_am_tools, 
  1322 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
  1322 		TRACE_FLAGS_DEFAULT, 
  1323 		(EAPL("TIMER: eapol_message_wlan_authentication_c::process_message()\n")));
  1323 		(EAPL("TIMER: eapol_message_wlan_authentication_c::process_message()\n")));
  1324 
  1324 
  1325 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eapol_message_wlan_authentication_c::process_message()");
  1325 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eapol_message_wlan_authentication_c::process_message()");
  1326 
  1326 
  1327 	EAP_TRACE_DATA_DEBUG(
  1327 	EAP_TRACE_DATA_DEBUG(
  1328 		m_am_tools,
  1328 		m_am_tools,
  1329 		EAP_TRACE_FLAGS_NEVER,
  1329 		EAP_TRACE_FLAGS_NEVER,
  1330 		(EAPL("eapol_message_wlan_authentication_c::process_message()"),
  1330 		(EAPL("eapol_message_wlan_authentication_c::process_message()"),
  1391 				status,
  1391 				status,
  1392 				eap_tlv_message_type_function_none);
  1392 				eap_tlv_message_type_function_none);
  1393 
  1393 
  1394 			return EAP_STATUS_RETURN(m_am_tools, status);
  1394 			return EAP_STATUS_RETURN(m_am_tools, status);
  1395 		}
  1395 		}
       
  1396 
       
  1397 		EAP_TRACE_DEBUG(
       
  1398 			m_am_tools, 
       
  1399 			TRACE_FLAGS_DEFAULT, 
       
  1400 			(EAPL("eapol_message_wlan_authentication_c::process_message(): this = 0x%08x, message=%d=%s\n"),
       
  1401 			this,
       
  1402 			function,
       
  1403 			eap_process_tlv_message_data_c::get_function_string(function)));
  1396 
  1404 
  1397 		switch(function)
  1405 		switch(function)
  1398 		{
  1406 		{
  1399 		case eap_tlv_message_type_function_check_pmksa_cache:
  1407 		case eap_tlv_message_type_function_check_pmksa_cache:
  1400 			status = check_pmksa_cache(&parameters);
  1408 			status = check_pmksa_cache(&parameters);