eapol/eapol_framework/eapol_symbian/am/type/aka/symbian/eap_am_type_aka_symbian.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
equal deleted inserted replaced
17:30e048a7b597 18:bad0cc58d154
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 49 %
    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
    34 #include "eap_am_tools_symbian.h"
    34 #include "eap_am_tools_symbian.h"
    35 #include "eap_state_notification.h"
    35 #include "eap_state_notification.h"
    36 #include "EapAkaDbDefaults.h"
    36 #include "EapAkaDbDefaults.h"
    37 #include "EapAkaDbParameterNames.h"
    37 #include "EapAkaDbParameterNames.h"
    38 #include "EapAkaDbUtils.h"
    38 #include "EapAkaDbUtils.h"
    39 #include "eap_am_trace_symbian.h"
    39 #include "EapTraceSymbian.h"
    40 
    40 
    41 #include <d32dbms.h>	// For DBMS
    41 #include <d32dbms.h>	// For DBMS
    42 #include <s32strm.h> 	// For RReadStream
    42 #include <s32strm.h> 	// For RReadStream
    43 
    43 
    44 #if defined (USE_EAP_TYPE_SERVER_AKA)
    44 #if defined (USE_EAP_TYPE_SERVER_AKA)
   152 , m_AUTN(tools)
   152 , m_AUTN(tools)
   153 , m_max_session_time(0)
   153 , m_max_session_time(0)
   154 {
   154 {
   155 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   155 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   156 
   156 
   157 #ifdef USE_EAP_EXPANDED_TYPES
       
   158 
       
   159 	m_tunneling_vendor_type = m_tunneling_type.get_vendor_type();
       
   160 
       
   161 #else
       
   162 
       
   163 	m_tunneling_vendor_type = static_cast<TUint>(m_tunneling_type);
       
   164 
       
   165 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   166 
       
   167 	if (receive_network_id != 0
   157 	if (receive_network_id != 0
   168 		&& receive_network_id->get_is_valid_data() == true)
   158 		&& receive_network_id->get_is_valid_data() == true)
   169 	{
   159 	{
   170 		eap_status_e status = m_receive_network_id.set_copy_of_network_id(
   160 		eap_status_e status = m_receive_network_id.set_copy_of_network_id(
   171 			receive_network_id);
   161 			receive_network_id);
   203 		m_aka_algorithm = 0;
   193 		m_aka_algorithm = 0;
   204 		return;
   194 		return;
   205 	}
   195 	}
   206 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)	
   196 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)	
   207 
   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 
   208 	// Open/create database
   202 	// Open/create database
   209 	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);	
   210 		
   204 		
   211 	// 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. 
   212 	// 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.
   223 #endif //#if defined (USE_EAP_AKA_INTERFACE)	&& !defined(__WINS__)
   217 #endif //#if defined (USE_EAP_AKA_INTERFACE)	&& !defined(__WINS__)
   224 }
   218 }
   225 
   219 
   226 //--------------------------------------------------
   220 //--------------------------------------------------
   227 
   221 
   228 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(
   229 	abs_eap_am_tools_c * const aTools,
   223 	abs_eap_am_tools_c * const aTools,
   230 	abs_eap_base_type_c * const aPartner,
   224 	abs_eap_base_type_c * const aPartner,
   231 	const TIndexType aIndexType,
   225 	const TIndexType aIndexType,
   232 	const TInt aIndex,
   226 	const TInt aIndex,
   233 	const eap_type_value_e aTunnelingType,
   227 	const eap_type_value_e aTunnelingType,
   312 
   306 
   313 	{
   307 	{
   314 		// Read Maximum Session Validity Time from the config file
   308 		// Read Maximum Session Validity Time from the config file
   315 		eap_variable_data_c sessionTimeFromFile(m_am_tools);
   309 		eap_variable_data_c sessionTimeFromFile(m_am_tools);
   316 		
   310 		
   317 		eap_status_e status = m_partner->read_configure(
   311 		eap_status_e status = type_configure_read(
   318 			cf_str_EAP_AKA_max_session_validity_time.get_field(),
   312 			cf_str_EAP_AKA_max_session_validity_time.get_field(),
   319 			&sessionTimeFromFile);
   313 			&sessionTimeFromFile);
   320 		
   314 		
   321 		if (status == eap_status_ok
   315 		if (status == eap_status_ok
   322 			&& sessionTimeFromFile.get_is_valid_data() == true
   316 			&& sessionTimeFromFile.get_is_valid_data() == true
   335 #if defined (USE_EAP_TYPE_SERVER_AKA)
   329 #if defined (USE_EAP_TYPE_SERVER_AKA)
   336 
   330 
   337 	// 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.
   338 	
   332 	
   339 	{
   333 	{
   340 		eap_status_e status = m_partner->read_configure(
   334 		eap_status_e status = type_configure_read(
   341 			cf_str_EAP_AKA_simulator_aka_k.get_field(),
   335 			cf_str_EAP_AKA_simulator_aka_k.get_field(),
   342 			&m_simulator_aka_K);
   336 			&m_simulator_aka_K);
   343 		if (status == eap_status_ok
   337 		if (status == eap_status_ok
   344 			&& m_simulator_aka_K.get_is_valid_data() == true
   338 			&& m_simulator_aka_K.get_is_valid_data() == true
   345 			&& m_simulator_aka_K.get_data_length() > 0ul
   339 			&& m_simulator_aka_K.get_data_length() > 0ul
   364 			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);
   365 		}
   359 		}
   366 	}
   360 	}
   367 
   361 
   368 	{
   362 	{
   369 		eap_status_e status = m_partner->read_configure(
   363 		eap_status_e status = type_configure_read(
   370 			cf_str_EAP_AKA_simulator_aka_op.get_field(),
   364 			cf_str_EAP_AKA_simulator_aka_op.get_field(),
   371 			&m_simulator_aka_OP);
   365 			&m_simulator_aka_OP);
   372 		if (status == eap_status_ok
   366 		if (status == eap_status_ok
   373 			&& m_simulator_aka_OP.get_is_valid_data() == true
   367 			&& m_simulator_aka_OP.get_is_valid_data() == true
   374 			&& m_simulator_aka_OP.get_data_length() > 0ul
   368 			&& m_simulator_aka_OP.get_data_length() > 0ul
   393 			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);
   394 		}
   388 		}
   395 	}
   389 	}
   396 
   390 
   397 	{
   391 	{
   398 		eap_status_e status = m_partner->read_configure(
   392 		eap_status_e status = type_configure_read(
   399 			cf_str_EAP_AKA_simulator_aka_amf.get_field(),
   393 			cf_str_EAP_AKA_simulator_aka_amf.get_field(),
   400 			&m_simulator_aka_AMF);
   394 			&m_simulator_aka_AMF);
   401 		if (status == eap_status_ok
   395 		if (status == eap_status_ok
   402 			&& m_simulator_aka_AMF.get_is_valid_data() == true
   396 			&& m_simulator_aka_AMF.get_is_valid_data() == true
   403 			&& m_simulator_aka_AMF.get_data_length() == sizeof(u16_t)
   397 			&& m_simulator_aka_AMF.get_data_length() == sizeof(u16_t)
   580 
   574 
   581 	// Form the insertion command
   575 	// Form the insertion command
   582 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   576 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   583 	TPtr sqlStatement = buf->Des();
   577 	TPtr sqlStatement = buf->Des();
   584 
   578 
   585 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
   579 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
   586 	sqlStatement.Format(KSQLInsert, &KPseudonymId, &KAkaTableName, 
   580 	sqlStatement.Format(
   587 		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
   581 		KSQLInsert,
       
   582 		&KPseudonymId,
       
   583 		&KAkaTableName, 
       
   584 		&KServiceType,
       
   585 		m_index_type,
       
   586 		&KServiceIndex,
       
   587 		m_index,
       
   588 		&KTunnelingTypeVendorId,
       
   589 		m_tunneling_type.get_vendor_id(),
       
   590 		&KTunnelingType, 
       
   591 		m_tunneling_type.get_vendor_type());
   588 
   592 
   589 	// Evaluate view
   593 	// Evaluate view
   590 	RDbView view;
   594 	RDbView view;
   591 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
   595 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
   592 	CleanupClosePushL(view);
   596 	CleanupClosePushL(view);
   682 
   686 
   683 	// Form the insertion command
   687 	// Form the insertion command
   684 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   688 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   685 	TPtr sqlStatement = buf->Des();
   689 	TPtr sqlStatement = buf->Des();
   686 
   690 
   687 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
   691 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
   688 	sqlStatement.Format(KSQLInsert, &KReauthId, &KAkaTableName, 
   692 	sqlStatement.Format(
   689 		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
   693 		KSQLInsert,
       
   694 		&KReauthId,
       
   695 		&KAkaTableName, 
       
   696 		&KServiceType,
       
   697 		m_index_type,
       
   698 		&KServiceIndex,
       
   699 		m_index,
       
   700 		&KTunnelingTypeVendorId,
       
   701 		m_tunneling_type.get_vendor_id(),
       
   702 		&KTunnelingType, 
       
   703 		m_tunneling_type.get_vendor_type());
   690 		
   704 		
   691 	// Evaluate view
   705 	// Evaluate view
   692 	RDbView view;
   706 	RDbView view;
   693 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
   707 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
   694 	CleanupClosePushL(view);
   708 	CleanupClosePushL(view);
   810 
   824 
   811 	// Form the insertion command
   825 	// Form the insertion command
   812 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   826 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   813 	TPtr sqlStatement = buf->Des();
   827 	TPtr sqlStatement = buf->Des();
   814 
   828 
   815 	_LIT(KSQLInsert, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
   829 	_LIT(KSQLInsert, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
   816 	sqlStatement.Format(KSQLInsert, &KXKey, &KK_aut, &KK_encr, &KReauthCounter, &KAkaTableName, 
   830 	sqlStatement.Format(
   817 		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
   831 		KSQLInsert,
       
   832 		&KXKey,
       
   833 		&KK_aut,
       
   834 		&KK_encr,
       
   835 		&KReauthCounter,
       
   836 		&KAkaTableName, 
       
   837 		&KServiceType,
       
   838 		m_index_type,
       
   839 		&KServiceIndex,
       
   840 		m_index,
       
   841 		&KTunnelingTypeVendorId,
       
   842 		m_tunneling_type.get_vendor_id(),
       
   843 		&KTunnelingType, 
       
   844 		m_tunneling_type.get_vendor_type());
   818 		
   845 		
   819 	// Evaluate view
   846 	// Evaluate view
   820 	RDbView view;
   847 	RDbView view;
   821 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
   848 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
   822 	CleanupClosePushL(view);
   849 	CleanupClosePushL(view);
   951 
   978 
   952 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   979 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
   953 	TPtr sqlStatement = buf->Des();
   980 	TPtr sqlStatement = buf->Des();
   954 
   981 
   955 	// Form the query
   982 	// Form the query
   956 	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
   983 	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
   957 	sqlStatement.Format(KSQLQuery, &KXKey, &KK_aut, &KK_encr, &KReauthCounter, &KAkaTableName, 
   984 	sqlStatement.Format(
   958 		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
   985 		KSQLQuery,
       
   986 		&KXKey,
       
   987 		&KK_aut,
       
   988 		&KK_encr,
       
   989 		&KReauthCounter,
       
   990 		&KAkaTableName, 
       
   991 		&KServiceType,
       
   992 		m_index_type,
       
   993 		&KServiceIndex,
       
   994 		m_index,
       
   995 		&KTunnelingTypeVendorId,
       
   996 		m_tunneling_type.get_vendor_id(),
       
   997 		&KTunnelingType, 
       
   998 		m_tunneling_type.get_vendor_type());
   959 		
   999 		
   960 	RDbView view;
  1000 	RDbView view;
   961 	// Evaluate view
  1001 	// Evaluate view
   962 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement)));
  1002 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement)));
   963 	CleanupClosePushL(view);
  1003 	CleanupClosePushL(view);
  1062 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1102 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1063 		
  1103 		
  1064 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  1104 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  1065 	TPtr sqlStatement = buf->Des();
  1105 	TPtr sqlStatement = buf->Des();
  1066 
  1106 
  1067 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
  1107 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
  1068 	sqlStatement.Format(KSQLInsert, &KReauthCounter, &KAkaTableName, 
  1108 	sqlStatement.Format(
  1069 		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
  1109 		KSQLInsert,
       
  1110 		&KReauthCounter,
       
  1111 		&KAkaTableName, 
       
  1112 		&KServiceType,
       
  1113 		m_index_type,
       
  1114 		&KServiceIndex,
       
  1115 		m_index,
       
  1116 		&KTunnelingTypeVendorId,
       
  1117 		m_tunneling_type.get_vendor_id(),
       
  1118 		&KTunnelingType, 
       
  1119 		m_tunneling_type.get_vendor_type());
  1070 		
  1120 		
  1071 	// Evaluate view
  1121 	// Evaluate view
  1072 	RDbView view;
  1122 	RDbView view;
  1073 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  1123 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  1074 	CleanupClosePushL(view);
  1124 	CleanupClosePushL(view);
  1177 	automatic_realm->reset();
  1227 	automatic_realm->reset();
  1178 	m_stored_pseudonym.reset();
  1228 	m_stored_pseudonym.reset();
  1179 	m_stored_reauth_id.reset();
  1229 	m_stored_reauth_id.reset();
  1180 	m_previous_imsi.reset();
  1230 	m_previous_imsi.reset();
  1181 
  1231 
  1182 	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
  1232 	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
  1183 	sqlStatement.Format(KSQLQuery, &KReauthId, &KReauthCounter, &KPseudonymId,
  1233 	sqlStatement.Format(
  1184 						&KPreviousIMSI, &KAkaTableName,
  1234 		KSQLQuery,
  1185 						&KServiceType, m_index_type, 
  1235 		&KReauthId,
  1186 						&KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
  1236 		&KReauthCounter,
       
  1237 		&KPseudonymId,
       
  1238 		&KPreviousIMSI,
       
  1239 		&KAkaTableName,
       
  1240 		&KServiceType,
       
  1241 		m_index_type, 
       
  1242 		&KServiceIndex,
       
  1243 		m_index,
       
  1244 		&KTunnelingTypeVendorId,
       
  1245 		m_tunneling_type.get_vendor_id(),
       
  1246 		&KTunnelingType, 
       
  1247 		m_tunneling_type.get_vendor_type());
  1187 
  1248 
  1188 	RDbView view;
  1249 	RDbView view;
  1189 	// Evaluate view
  1250 	// Evaluate view
  1190 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement)));
  1251 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement)));
  1191 	CleanupClosePushL(view);
  1252 	CleanupClosePushL(view);
  1384 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
  1445 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
  1385 }
  1446 }
  1386 
  1447 
  1387 //--------------------------------------------------
  1448 //--------------------------------------------------
  1388 
  1449 
  1389 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(
  1390 	const eap_variable_data_c * const IMSI,
  1451 	const eap_variable_data_c * const IMSI,
  1391 	const eap_status_e completion_status )
  1452 	const eap_status_e completion_status )
  1392 {
  1453 {
  1393 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1454 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1394 	eap_status_e status(eap_status_process_general_error);
  1455 	eap_status_e status(eap_status_process_general_error);
  1542 	
  1603 	
  1543 	// Form the insertion command
  1604 	// Form the insertion command
  1544 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  1605 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  1545 	TPtr sqlStatement = buf->Des();
  1606 	TPtr sqlStatement = buf->Des();
  1546 
  1607 
  1547 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
  1608 	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
  1548 	sqlStatement.Format(KSQLInsert, &KPreviousIMSI, &KAkaTableName, 
  1609 	sqlStatement.Format(
  1549 		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
  1610 		KSQLInsert,
       
  1611 		&KPreviousIMSI,
       
  1612 		&KAkaTableName, 
       
  1613 		&KServiceType,
       
  1614 		m_index_type,
       
  1615 		&KServiceIndex,
       
  1616 		m_index,
       
  1617 		&KTunnelingTypeVendorId,
       
  1618 		m_tunneling_type.get_vendor_id(),
       
  1619 		&KTunnelingType, 
       
  1620 		m_tunneling_type.get_vendor_type());
  1550 		
  1621 		
  1551 	// Evaluate view
  1622 	// Evaluate view
  1552 	RDbView view;
  1623 	RDbView view;
  1553 	
  1624 	
  1554 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  1625 	User::LeaveIfError(view.Prepare(m_database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  1698 	return EAP_STATUS_RETURN(m_am_tools, status);
  1769 	return EAP_STATUS_RETURN(m_am_tools, status);
  1699 }
  1770 }
  1700 
  1771 
  1701 //--------------------------------------------------
  1772 //--------------------------------------------------
  1702 
  1773 
  1703 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(
  1704 	eap_variable_data_c * const aRES, 
  1775 	eap_variable_data_c * const aRES, 
  1705 	eap_variable_data_c * const aCK,
  1776 	eap_variable_data_c * const aCK,
  1706 	eap_variable_data_c * const aIK,
  1777 	eap_variable_data_c * const aIK,
  1707 	eap_variable_data_c * const aAUTS,
  1778 	eap_variable_data_c * const aAUTS,
  1708 	eap_status_e authenticationStatus,
  1779 	eap_status_e authenticationStatus,
  2603 
  2674 
  2604 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)		
  2675 #endif // #if defined (USE_EAP_TYPE_SERVER_AKA)		
  2605 
  2676 
  2606 //--------------------------------------------------
  2677 //--------------------------------------------------
  2607 
  2678 
  2608 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(
  2609 	const eap_am_network_id_c * const send_network_id,
  2680 	const eap_am_network_id_c * const send_network_id,
  2610 	const eap_variable_data_c * const imsi,
  2681 	const eap_variable_data_c * const imsi,
  2611 	eap_variable_data_c * const reauthentication_identity,
  2682 	eap_variable_data_c * const reauthentication_identity,
  2612 	const u32_t maximum_reauthentication_identity_length)
  2683 	const u32_t maximum_reauthentication_identity_length)
  2613 {
  2684 {
  2816 	
  2887 	
  2817 	// Now do the database query
  2888 	// Now do the database query
  2818 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  2889 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  2819 	TPtr sqlStatement = buf->Des();
  2890 	TPtr sqlStatement = buf->Des();
  2820 
  2891 
  2821 	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
  2892 	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
  2822 	sqlStatement.Format(KSQLQueryRow, &unicodeString, &KAkaTableName, 
  2893 	sqlStatement.Format(
  2823 		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
  2894 		KSQLQueryRow,
       
  2895 		&unicodeString,
       
  2896 		&KAkaTableName, 
       
  2897 		&KServiceType,
       
  2898 		m_index_type,
       
  2899 		&KServiceIndex,
       
  2900 		m_index,
       
  2901 		&KTunnelingTypeVendorId,
       
  2902 		m_tunneling_type.get_vendor_id(),
       
  2903 		&KTunnelingType, 
       
  2904 		m_tunneling_type.get_vendor_type());
  2824 	
  2905 	
  2825 	RDbView view;
  2906 	RDbView view;
  2826 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  2907 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  2827 	CleanupClosePushL(view);
  2908 	CleanupClosePushL(view);
  2828 	User::LeaveIfError(view.EvaluateAll());	
  2909 	User::LeaveIfError(view.EvaluateAll());	
  2980 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  3061 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  2981 }
  3062 }
  2982 
  3063 
  2983 //--------------------------------------------------
  3064 //--------------------------------------------------
  2984 
  3065 
  2985 bool eap_am_type_aka_symbian_c::is_session_valid()
  3066 EAP_FUNC_EXPORT bool eap_am_type_aka_symbian_c::is_session_valid()
  2986 {
  3067 {
  2987 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  3068 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2988 	
  3069 	
  2989 	bool sessionValidity(false);
  3070 	bool sessionValidity(false);
  2990 	
  3071 	
  3014 
  3095 
  3015 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  3096 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  3016 	TPtr sqlStatement = buf->Des();
  3097 	TPtr sqlStatement = buf->Des();
  3017 	
  3098 	
  3018 	// Query all the relevant parameters
  3099 	// Query all the relevant parameters
  3019 	_LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
  3100 	_LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
  3020 	sqlStatement.Format(KSQLQuery, &cf_str_EAP_AKA_max_session_validity_time_literal,
  3101 	sqlStatement.Format(
  3021 						&KAKALastFullAuthTime, &KAkaTableName,
  3102 		KSQLQuery,
  3022 						&KServiceType, m_index_type, 
  3103 		&cf_str_EAP_AKA_max_session_validity_time_literal,
  3023 						&KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
  3104 		&KAKALastFullAuthTime,
       
  3105 		&KAkaTableName,
       
  3106 		&KServiceType,
       
  3107 		m_index_type, 
       
  3108 		&KServiceIndex,
       
  3109 		m_index,
       
  3110 		&KTunnelingTypeVendorId,
       
  3111 		m_tunneling_type.get_vendor_id(),
       
  3112 		&KTunnelingType, 
       
  3113 		m_tunneling_type.get_vendor_type());
  3024 
  3114 
  3025 	RDbView view;
  3115 	RDbView view;
  3026 	// Evaluate view
  3116 	// Evaluate view
  3027 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement)));
  3117 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement)));
  3028 	CleanupClosePushL(view);
  3118 	CleanupClosePushL(view);
  3136 
  3226 
  3137 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  3227 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
  3138 	TPtr sqlStatement = buf->Des();
  3228 	TPtr sqlStatement = buf->Des();
  3139 	
  3229 	
  3140 	// Query all the relevant parameters
  3230 	// Query all the relevant parameters
  3141 	_LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
  3231 	_LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
  3142 	sqlStatement.Format(KSQLQuery, &KAKALastFullAuthTime, &KAkaTableName,
  3232 	sqlStatement.Format(
  3143 						&KServiceType, m_index_type, 
  3233 		KSQLQuery,
  3144 						&KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
  3234 		&KAKALastFullAuthTime,
       
  3235 		&KAkaTableName,
       
  3236 		&KServiceType,
       
  3237 		m_index_type, 
       
  3238 		&KServiceIndex,
       
  3239 		m_index,
       
  3240 		&KTunnelingTypeVendorId,
       
  3241 		m_tunneling_type.get_vendor_id(),
       
  3242 		&KTunnelingType, 
       
  3243 		m_tunneling_type.get_vendor_type());
  3145 
  3244 
  3146 	RDbView view;
  3245 	RDbView view;
  3147 	// Evaluate view
  3246 	// Evaluate view
  3148 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  3247 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
  3149 	CleanupClosePushL(view);
  3248 	CleanupClosePushL(view);