eapol/eapol_framework/eapol_symbian/am/type/aka/symbian/eap_am_type_aka_symbian.cpp
changeset 39 fe6b6762fccd
parent 33 938269283a16
child 49 43351a4f2da3
equal deleted inserted replaced
38:7a0216d033ac 39:fe6b6762fccd
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 46.1.6 %
    19 * %version: 46.1.10 %
    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
   193 		m_aka_algorithm = 0;
   193 		m_aka_algorithm = 0;
   194 		return;
   194 		return;
   195 	}
   195 	}
   196 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)	
   196 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)	
   197 
   197 
       
   198 	TInt error = m_session.Connect();
       
   199 	EAP_TRACE_DEBUG_SYMBIAN((_L("eap_am_type_aka_symbian_c::ConstructL(): - m_session.Connect(), error=%d\n"), error));
       
   200 	User::LeaveIfError(error);
       
   201 
   198 	// Open/create database
   202 	// Open/create database
   199 	EapAkaDbUtils::OpenDatabaseL(m_database, m_session, m_index_type, m_index, m_tunneling_type);	
   203 	EapAkaDbUtils::OpenDatabaseL(m_database, m_session, m_index_type, m_index, m_tunneling_type);	
   200 		
   204 		
   201 	// SIM IMSI, RES, CK, IK and AUTS are queried from SIM using AKA interface. 
   205 	// SIM IMSI, RES, CK, IK and AUTS are queried from SIM using AKA interface. 
   202 	// If this is not used then Nokia test algorithms and test values are used.
   206 	// If this is not used then Nokia test algorithms and test values are used.
   213 #endif //#if defined (USE_EAP_AKA_INTERFACE)	&& !defined(__WINS__)
   217 #endif //#if defined (USE_EAP_AKA_INTERFACE)	&& !defined(__WINS__)
   214 }
   218 }
   215 
   219 
   216 //--------------------------------------------------
   220 //--------------------------------------------------
   217 
   221 
   218 eap_am_type_aka_symbian_c* eap_am_type_aka_symbian_c::NewL(
   222 EAP_FUNC_EXPORT eap_am_type_aka_symbian_c* eap_am_type_aka_symbian_c::NewL(
   219 	abs_eap_am_tools_c * const aTools,
   223 	abs_eap_am_tools_c * const aTools,
   220 	abs_eap_base_type_c * const aPartner,
   224 	abs_eap_base_type_c * const aPartner,
   221 	const TIndexType aIndexType,
   225 	const TIndexType aIndexType,
   222 	const TInt aIndex,
   226 	const TInt aIndex,
   223 	const eap_type_value_e aTunnelingType,
   227 	const eap_type_value_e aTunnelingType,
   302 
   306 
   303 	{
   307 	{
   304 		// Read Maximum Session Validity Time from the config file
   308 		// Read Maximum Session Validity Time from the config file
   305 		eap_variable_data_c sessionTimeFromFile(m_am_tools);
   309 		eap_variable_data_c sessionTimeFromFile(m_am_tools);
   306 		
   310 		
   307 		eap_status_e status = m_partner->read_configure(
   311 		eap_status_e status = type_configure_read(
   308 			cf_str_EAP_AKA_max_session_validity_time.get_field(),
   312 			cf_str_EAP_AKA_max_session_validity_time.get_field(),
   309 			&sessionTimeFromFile);
   313 			&sessionTimeFromFile);
   310 		
   314 		
   311 		if (status == eap_status_ok
   315 		if (status == eap_status_ok
   312 			&& sessionTimeFromFile.get_is_valid_data() == true
   316 			&& sessionTimeFromFile.get_is_valid_data() == true
   325 #if defined (USE_EAP_TYPE_SERVER_AKA)
   329 #if defined (USE_EAP_TYPE_SERVER_AKA)
   326 
   330 
   327 	// We have to set the values for K, OP and AMF in simulator.
   331 	// We have to set the values for K, OP and AMF in simulator.
   328 	
   332 	
   329 	{
   333 	{
   330 		eap_status_e status = m_partner->read_configure(
   334 		eap_status_e status = type_configure_read(
   331 			cf_str_EAP_AKA_simulator_aka_k.get_field(),
   335 			cf_str_EAP_AKA_simulator_aka_k.get_field(),
   332 			&m_simulator_aka_K);
   336 			&m_simulator_aka_K);
   333 		if (status == eap_status_ok
   337 		if (status == eap_status_ok
   334 			&& m_simulator_aka_K.get_is_valid_data() == true
   338 			&& m_simulator_aka_K.get_is_valid_data() == true
   335 			&& m_simulator_aka_K.get_data_length() > 0ul
   339 			&& m_simulator_aka_K.get_data_length() > 0ul
   354 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field);
   358 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field);
   355 		}
   359 		}
   356 	}
   360 	}
   357 
   361 
   358 	{
   362 	{
   359 		eap_status_e status = m_partner->read_configure(
   363 		eap_status_e status = type_configure_read(
   360 			cf_str_EAP_AKA_simulator_aka_op.get_field(),
   364 			cf_str_EAP_AKA_simulator_aka_op.get_field(),
   361 			&m_simulator_aka_OP);
   365 			&m_simulator_aka_OP);
   362 		if (status == eap_status_ok
   366 		if (status == eap_status_ok
   363 			&& m_simulator_aka_OP.get_is_valid_data() == true
   367 			&& m_simulator_aka_OP.get_is_valid_data() == true
   364 			&& m_simulator_aka_OP.get_data_length() > 0ul
   368 			&& m_simulator_aka_OP.get_data_length() > 0ul
   383 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field);
   387 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field);
   384 		}
   388 		}
   385 	}
   389 	}
   386 
   390 
   387 	{
   391 	{
   388 		eap_status_e status = m_partner->read_configure(
   392 		eap_status_e status = type_configure_read(
   389 			cf_str_EAP_AKA_simulator_aka_amf.get_field(),
   393 			cf_str_EAP_AKA_simulator_aka_amf.get_field(),
   390 			&m_simulator_aka_AMF);
   394 			&m_simulator_aka_AMF);
   391 		if (status == eap_status_ok
   395 		if (status == eap_status_ok
   392 			&& m_simulator_aka_AMF.get_is_valid_data() == true
   396 			&& m_simulator_aka_AMF.get_is_valid_data() == true
   393 			&& m_simulator_aka_AMF.get_data_length() == sizeof(u16_t)
   397 			&& m_simulator_aka_AMF.get_data_length() == sizeof(u16_t)
  1441 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
  1445 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
  1442 }
  1446 }
  1443 
  1447 
  1444 //--------------------------------------------------
  1448 //--------------------------------------------------
  1445 
  1449 
  1446 eap_status_e eap_am_type_aka_symbian_c::complete_AKA_imsi_L(
  1450 EAP_FUNC_EXPORT eap_status_e eap_am_type_aka_symbian_c::complete_AKA_imsi_L(
  1447 	const eap_variable_data_c * const IMSI,
  1451 	const eap_variable_data_c * const IMSI,
  1448 	const eap_status_e completion_status )
  1452 	const eap_status_e completion_status )
  1449 {
  1453 {
  1450 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1454 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1451 	eap_status_e status(eap_status_process_general_error);
  1455 	eap_status_e status(eap_status_process_general_error);
  1765 	return EAP_STATUS_RETURN(m_am_tools, status);
  1769 	return EAP_STATUS_RETURN(m_am_tools, status);
  1766 }
  1770 }
  1767 
  1771 
  1768 //--------------------------------------------------
  1772 //--------------------------------------------------
  1769 
  1773 
  1770 eap_status_e eap_am_type_aka_symbian_c::complete_AKA_RES_L(
  1774 EAP_FUNC_EXPORT eap_status_e eap_am_type_aka_symbian_c::complete_AKA_RES_L(
  1771 	eap_variable_data_c * const aRES, 
  1775 	eap_variable_data_c * const aRES, 
  1772 	eap_variable_data_c * const aCK,
  1776 	eap_variable_data_c * const aCK,
  1773 	eap_variable_data_c * const aIK,
  1777 	eap_variable_data_c * const aIK,
  1774 	eap_variable_data_c * const aAUTS,
  1778 	eap_variable_data_c * const aAUTS,
  1775 	eap_status_e authenticationStatus,
  1779 	eap_status_e authenticationStatus,
  2670 
  2674 
  2671 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)		
  2675 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)		
  2672 
  2676 
  2673 //--------------------------------------------------
  2677 //--------------------------------------------------
  2674 
  2678 
  2675 eap_status_e eap_am_type_aka_symbian_c::generate_reauthentication_id(
  2679 EAP_FUNC_EXPORT eap_status_e eap_am_type_aka_symbian_c::generate_reauthentication_id(
  2676 	const eap_am_network_id_c * const send_network_id,
  2680 	const eap_am_network_id_c * const send_network_id,
  2677 	const eap_variable_data_c * const imsi,
  2681 	const eap_variable_data_c * const imsi,
  2678 	eap_variable_data_c * const reauthentication_identity,
  2682 	eap_variable_data_c * const reauthentication_identity,
  2679 	const u32_t maximum_reauthentication_identity_length)
  2683 	const u32_t maximum_reauthentication_identity_length)
  2680 {
  2684 {
  3057 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  3061 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  3058 }
  3062 }
  3059 
  3063 
  3060 //--------------------------------------------------
  3064 //--------------------------------------------------
  3061 
  3065 
  3062 bool eap_am_type_aka_symbian_c::is_session_valid()
  3066 EAP_FUNC_EXPORT bool eap_am_type_aka_symbian_c::is_session_valid()
  3063 {
  3067 {
  3064 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  3068 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  3065 	
  3069 	
  3066 	bool sessionValidity(false);
  3070 	bool sessionValidity(false);
  3067 	
  3071