eapol/eapol_framework/eapol_common/core/eap_pac_store_client_message_if.cpp
changeset 52 c23bdf5a328a
parent 39 fe6b6762fccd
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: 7 %
    19 * %version: 13 %
    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
    81 		return;
    81 		return;
    82 	}
    82 	}
    83 
    83 
    84 	EAP_TRACE_DEBUG(
    84 	EAP_TRACE_DEBUG(
    85 		m_am_tools, 
    85 		m_am_tools, 
    86 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
    86 		TRACE_FLAGS_DEFAULT, 
    87 		(EAPL("eap_pac_store_client_message_if_c::eap_pac_store_client_message_if_c(): this = 0x%08x.\n"),
    87 		(EAPL("eap_pac_store_client_message_if_c::eap_pac_store_client_message_if_c(): this = 0x%08x.\n"),
    88 		this));
    88 		this));
    89 
    89 
    90 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::eap_pac_store_client_message_if_c()");
    90 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::eap_pac_store_client_message_if_c()");
    91 
    91 
    92 	m_is_valid = true;
    92 	m_is_valid = true;
    93 }
    93 }
    94 
    94 
    95 //--------------------------------------------------
    95 //--------------------------------------------------
   111 // This is documented in abs_eap_stack_interface_c::configure().
   111 // This is documented in abs_eap_stack_interface_c::configure().
   112 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::configure()
   112 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::configure()
   113 {
   113 {
   114 	EAP_TRACE_DEBUG(
   114 	EAP_TRACE_DEBUG(
   115 		m_am_tools, 
   115 		m_am_tools, 
   116 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   116 		TRACE_FLAGS_DEFAULT, 
   117 		(EAPL("eap_pac_store_client_message_if_c::configure(): this = 0x%08x.\n"),
   117 		(EAPL("eap_pac_store_client_message_if_c::configure(): this = 0x%08x.\n"),
   118 		this));
   118 		this));
   119 
   119 
   120 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::configure()");
   120 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::configure()");
   121 
   121 
   122 	eap_status_e status = m_client_if->configure(0);
   122 	eap_status_e status = m_client_if->configure(0);
   123 
   123 
   124 	return EAP_STATUS_RETURN(m_am_tools, status);
   124 	return EAP_STATUS_RETURN(m_am_tools, status);
   125 }
   125 }
   129 // This is documented in abs_eap_stack_interface_c::shutdown().
   129 // This is documented in abs_eap_stack_interface_c::shutdown().
   130 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::shutdown()
   130 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::shutdown()
   131 {
   131 {
   132 	EAP_TRACE_DEBUG(
   132 	EAP_TRACE_DEBUG(
   133 		m_am_tools, 
   133 		m_am_tools, 
   134 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   134 		TRACE_FLAGS_DEFAULT, 
   135 		(EAPL("eap_pac_store_client_message_if_c::shutdown(): this = 0x%08x.\n"),
   135 		(EAPL("eap_pac_store_client_message_if_c::shutdown(): this = 0x%08x.\n"),
   136 		this));
   136 		this));
   137 
   137 
   138 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::shutdown()");
   138 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::shutdown()");
   139 
   139 
   140 	eap_status_e status = m_client_if->shutdown();
   140 	eap_status_e status = m_client_if->shutdown();
   141 
   141 
   142 	return EAP_STATUS_RETURN(m_am_tools, status);
   142 	return EAP_STATUS_RETURN(m_am_tools, status);
   143 }
   143 }
   154 
   154 
   155 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::process_message(eap_process_tlv_message_data_c * const message)
   155 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::process_message(eap_process_tlv_message_data_c * const message)
   156 {
   156 {
   157 	// Sends message data composed of Attribute-Value Pairs.
   157 	// Sends message data composed of Attribute-Value Pairs.
   158 
   158 
   159 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::process_message()");
   159 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::process_message()");
   160 
   160 
   161 	EAP_TRACE_DATA_DEBUG(
   161 	EAP_TRACE_DATA_DEBUG(
   162 		m_am_tools,
   162 		m_am_tools,
   163 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   163 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   164 		(EAPL("eap_pac_store_client_message_if_c::process_message()"),
   164 		(EAPL("eap_pac_store_client_message_if_c::process_message()"),
   182 
   182 
   183 }
   183 }
   184 
   184 
   185 //--------------------------------------------------
   185 //--------------------------------------------------
   186 
   186 
   187 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::open_pac_store(
       
   188 		const eap_status_e /* completion_status */)
       
   189 		{
       
   190 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   191 
       
   192 	eap_status_e status(eap_status_process_general_error);
       
   193 
       
   194 	EAP_TRACE_DEBUG(
       
   195 		m_am_tools, 
       
   196 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   197 		(EAPL("eap_pac_store_client_message_if_c::open_pac_store(): this = 0x%08x.\n"),
       
   198 		this));
       
   199 
       
   200 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::open_pac_store()");
       
   201 
       
   202 // Creates message data composed of Attribute-Value Pairs.
       
   203 
       
   204 	eap_process_tlv_message_data_c message(m_am_tools);
       
   205 
       
   206 	if (message.get_is_valid() == false)
       
   207 	{
       
   208 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   209 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   210 	}
       
   211 
       
   212 	status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_open_pac_store);
       
   213 	if (status != eap_status_ok)
       
   214 	{
       
   215 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   216 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   217 	}
       
   218 
       
   219 	status = process_message(&message);
       
   220 	if (status != eap_status_ok)
       
   221 	{
       
   222 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   223 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   224 	}
       
   225 
       
   226 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   227 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   228 
       
   229 		}
       
   230 
       
   231 //--------------------------------------------------
       
   232 
       
   233 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::destroy_pac_store(
   187 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::destroy_pac_store(
   234 		const eap_status_e /* completion_status */)
   188 		const eap_status_e /* completion_status */)
   235 		{
   189 		{
   236 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   190 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   237 
   191 
   238 	eap_status_e status(eap_status_process_general_error);
   192 	eap_status_e status(eap_status_process_general_error);
   239 
   193 
   240 	EAP_TRACE_DEBUG(
   194 	EAP_TRACE_DEBUG(
   241 		m_am_tools, 
   195 		m_am_tools, 
   242 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   196 		TRACE_FLAGS_DEFAULT, 
   243 		(EAPL("eap_pac_store_client_message_if_c::destroy_pac_store(): this = 0x%08x.\n"),
   197 		(EAPL("eap_pac_store_client_message_if_c::destroy_pac_store(): this = 0x%08x.\n"),
   244 		this));
   198 		this));
   245 
   199 
   246 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::destroy_pac_store()");
   200 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::destroy_pac_store()");
   247 
   201 
   248 // Creates message data composed of Attribute-Value Pairs.
   202 // Creates message data composed of Attribute-Value Pairs.
   249 
   203 
   250 	eap_process_tlv_message_data_c message(m_am_tools);
   204 	eap_process_tlv_message_data_c message(m_am_tools);
   251 
   205 
   271 
   225 
   272 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   226 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   273 	return EAP_STATUS_RETURN(m_am_tools, status);
   227 	return EAP_STATUS_RETURN(m_am_tools, status);
   274 
   228 
   275 		}
   229 		}
   276 //--------------------------------------------------------------------------------------------
   230 
   277 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::create_device_seed(
   231 //--------------------------------------------------
   278 		const eap_status_e /* completion_status */)
   232 
   279 		{
       
   280 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   281 
       
   282 	eap_status_e status(eap_status_process_general_error);
       
   283 
       
   284 	EAP_TRACE_DEBUG(
       
   285 		m_am_tools, 
       
   286 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   287 		(EAPL("eap_pac_store_client_message_if_c::create_device_seed(): this = 0x%08x.\n"),
       
   288 		this));
       
   289 
       
   290 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::create_device_seed()");
       
   291 
       
   292 // Creates message data composed of Attribute-Value Pairs.
       
   293 
       
   294 	eap_process_tlv_message_data_c message(m_am_tools);
       
   295 
       
   296 	if (message.get_is_valid() == false)
       
   297 	{
       
   298 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   299 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   300 	}
       
   301 
       
   302 	status = message.add_parameter_data(eap_tlv_message_type_function_pac_store_create_device_seed);
       
   303 	if (status != eap_status_ok)
       
   304 	{
       
   305 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   306 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   307 	}
       
   308 
       
   309 	status = process_message(&message);
       
   310 	if (status != eap_status_ok)
       
   311 	{
       
   312 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   313 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   314 	}
       
   315 
       
   316 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   317 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   318 			
       
   319 		}
       
   320 
       
   321 //--------------------------------------------------
       
   322 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::is_master_key_present(
   233 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::is_master_key_present(
   323 		const eap_status_e /* completion_status */)
   234 		const eap_status_e /* completion_status */)
   324 		{
   235 		{
   325 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   236 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   326 
   237 
   327 	eap_status_e status(eap_status_process_general_error);
   238 	eap_status_e status(eap_status_process_general_error);
   328 
   239 
   329 	EAP_TRACE_DEBUG(
   240 	EAP_TRACE_DEBUG(
   330 		m_am_tools, 
   241 		m_am_tools, 
   331 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   242 		TRACE_FLAGS_DEFAULT, 
   332 		(EAPL("eap_pac_store_client_message_if_c::is_master_key_present(): this = 0x%08x.\n"),
   243 		(EAPL("eap_pac_store_client_message_if_c::is_master_key_present(): this = 0x%08x.\n"),
   333 		this));
   244 		this));
   334 
   245 
   335 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::is_master_key_present()");
   246 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::is_master_key_present()");
   336 			
   247 			
   337 	eap_process_tlv_message_data_c message(m_am_tools);
   248 	eap_process_tlv_message_data_c message(m_am_tools);
   338 
   249 
   339 	if (message.get_is_valid() == false)
   250 	if (message.get_is_valid() == false)
   340 	{
   251 	{
   359 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   270 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   360 	return EAP_STATUS_RETURN(m_am_tools, status);
   271 	return EAP_STATUS_RETURN(m_am_tools, status);
   361 		}
   272 		}
   362 
   273 
   363 //--------------------------------------------------
   274 //--------------------------------------------------
       
   275 
   364 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::is_master_key_and_password_matching(
   276 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::is_master_key_and_password_matching(
   365 		const eap_variable_data_c * const pac_store_password
   277 		const eap_variable_data_c * const pac_store_password
   366 		,const eap_status_e /* completion_status */)
   278 		,const eap_status_e /* completion_status */)
   367 		{
   279 		{
   368 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   280 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   369 
   281 
   370 	eap_status_e status(eap_status_process_general_error);
   282 	eap_status_e status(eap_status_process_general_error);
   371 
   283 
   372 	EAP_TRACE_DEBUG(
   284 	EAP_TRACE_DEBUG(
   373 		m_am_tools, 
   285 		m_am_tools, 
   374 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   286 		TRACE_FLAGS_DEFAULT, 
   375 		(EAPL("eap_pac_store_client_message_if_c::is_master_key_and_password_matching(): this = 0x%08x.\n"),
   287 		(EAPL("eap_pac_store_client_message_if_c::is_master_key_and_password_matching(): this = 0x%08x.\n"),
   376 		this));
   288 		this));
   377 
   289 
   378 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::is_master_key_and_password_matching()");
   290 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::is_master_key_and_password_matching()");
   379 			
   291 			
   380 // Creates message data composed of Attribute-Value Pairs.
   292 // Creates message data composed of Attribute-Value Pairs.
   381 		eap_process_tlv_message_data_c message(m_am_tools);
   293 		eap_process_tlv_message_data_c message(m_am_tools);
   382 
   294 
   383 		if (message.get_is_valid() == false)
   295 		if (message.get_is_valid() == false)
   411 	return EAP_STATUS_RETURN(m_am_tools, status);
   323 	return EAP_STATUS_RETURN(m_am_tools, status);
   412 
   324 
   413 	}
   325 	}
   414 
   326 
   415 //--------------------------------------------------
   327 //--------------------------------------------------
       
   328 
   416 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::create_and_save_master_key(
   329 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::create_and_save_master_key(
   417 		const eap_variable_data_c * const pac_store_password
   330 		const eap_variable_data_c * const pac_store_password
   418 		,const eap_status_e /* completion_status */)
   331 		,const eap_status_e /* completion_status */)
   419 		{
   332 		{
   420 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   333 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   421 
   334 
   422 	eap_status_e status(eap_status_process_general_error);
   335 	eap_status_e status(eap_status_process_general_error);
   423 
   336 
   424 	EAP_TRACE_DEBUG(
   337 	EAP_TRACE_DEBUG(
   425 		m_am_tools, 
   338 		m_am_tools, 
   426 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   339 		TRACE_FLAGS_DEFAULT, 
   427 		(EAPL("eap_pac_store_client_message_if_c::create_and_save_master_key(): this = 0x%08x.\n"),
   340 		(EAPL("eap_pac_store_client_message_if_c::create_and_save_master_key(): this = 0x%08x.\n"),
   428 		this));
   341 		this));
   429 
   342 
   430 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::create_and_save_master_key()");
   343 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::create_and_save_master_key()");
   431 			
   344 			
   432 // Creates message data composed of Attribute-Value Pairs.
   345 // Creates message data composed of Attribute-Value Pairs.
   433 		eap_process_tlv_message_data_c message(m_am_tools);
   346 		eap_process_tlv_message_data_c message(m_am_tools);
   434 
   347 
   435 		if (message.get_is_valid() == false)
   348 		if (message.get_is_valid() == false)
   463 	return EAP_STATUS_RETURN(m_am_tools, status);
   376 	return EAP_STATUS_RETURN(m_am_tools, status);
   464 
   377 
   465 		}
   378 		}
   466 
   379 
   467 //--------------------------------------------------
   380 //--------------------------------------------------
       
   381 
   468 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::compare_pac_store_password(
   382 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::compare_pac_store_password(
   469 		eap_variable_data_c * pac_store_password)
   383 		eap_variable_data_c * pac_store_password)
   470 		{
   384 		{
   471 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   385 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   472 
   386 
   473 	eap_status_e status(eap_status_process_general_error);
   387 	eap_status_e status(eap_status_process_general_error);
   474 
   388 
   475 	EAP_TRACE_DEBUG(
   389 	EAP_TRACE_DEBUG(
   476 		m_am_tools, 
   390 		m_am_tools, 
   477 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   391 		TRACE_FLAGS_DEFAULT, 
   478 		(EAPL("eap_pac_store_client_message_if_c::compare_pac_store_password(): this = 0x%08x.\n"),
   392 		(EAPL("eap_pac_store_client_message_if_c::compare_pac_store_password(): this = 0x%08x.\n"),
   479 		this));
   393 		this));
   480 
   394 
   481 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::compare_pac_store_password()");
   395 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::compare_pac_store_password()");
   482 
   396 
   483 // Creates message data composed of Attribute-Value Pairs.
   397 // Creates message data composed of Attribute-Value Pairs.
   484 		eap_process_tlv_message_data_c message(m_am_tools);
   398 		eap_process_tlv_message_data_c message(m_am_tools);
   485 
   399 
   486 		if (message.get_is_valid() == false)
   400 		if (message.get_is_valid() == false)
   512 
   426 
   513 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   427 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   514 	return EAP_STATUS_RETURN(m_am_tools, status);
   428 	return EAP_STATUS_RETURN(m_am_tools, status);
   515 			
   429 			
   516 		}
   430 		}
   517 //--------------------------------------------------
   431 
       
   432 //--------------------------------------------------
       
   433 
   518 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::is_pacstore_password_present()
   434 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::is_pacstore_password_present()
   519 		{
   435 		{
   520 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   436 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   521 
   437 
   522 	eap_status_e status(eap_status_process_general_error);
   438 	eap_status_e status(eap_status_process_general_error);
   523 
   439 
   524 	EAP_TRACE_DEBUG(
   440 	EAP_TRACE_DEBUG(
   525 		m_am_tools, 
   441 		m_am_tools, 
   526 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   442 		TRACE_FLAGS_DEFAULT, 
   527 		(EAPL("eap_pac_store_client_message_if_c::is_pacstore_password_present(): this = 0x%08x.\n"),
   443 		(EAPL("eap_pac_store_client_message_if_c::is_pacstore_password_present(): this = 0x%08x.\n"),
   528 		this));
   444 		this));
   529 
   445 
   530 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::is_pacstore_password_present()");
   446 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::is_pacstore_password_present()");
   531 			
   447 			
   532 	eap_process_tlv_message_data_c message(m_am_tools);
   448 	eap_process_tlv_message_data_c message(m_am_tools);
   533 
   449 
   534 	if (message.get_is_valid() == false)
   450 	if (message.get_is_valid() == false)
   535 	{
   451 	{
   553 
   469 
   554 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   470 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   555 	return EAP_STATUS_RETURN(m_am_tools, status);
   471 	return EAP_STATUS_RETURN(m_am_tools, status);
   556 		}
   472 		}
   557 
   473 
   558 
   474 //--------------------------------------------------
   559 //--------------------------------------------------
   475 
   560 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::set_pac_store_password(
   476 EAP_FUNC_EXPORT eap_status_e eap_pac_store_client_message_if_c::set_pac_store_password(
   561 		const eap_variable_data_c * const pac_store_password
   477 		const eap_variable_data_c * const pac_store_password
   562 		,const eap_status_e /* completion_status */)
   478 		,const eap_status_e /* completion_status */)
   563 		{
   479 		{
   564 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   480 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   565 
   481 
   566 	eap_status_e status(eap_status_process_general_error);
   482 	eap_status_e status(eap_status_process_general_error);
   567 
   483 
   568 	EAP_TRACE_DEBUG(
   484 	EAP_TRACE_DEBUG(
   569 		m_am_tools, 
   485 		m_am_tools, 
   570 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   486 		TRACE_FLAGS_DEFAULT, 
   571 		(EAPL("eap_pac_store_client_message_if_c::set_pac_store_password(): this = 0x%08x.\n"),
   487 		(EAPL("eap_pac_store_client_message_if_c::set_pac_store_password(): this = 0x%08x.\n"),
   572 		this));
   488 		this));
   573 
   489 
   574 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::set_pac_store_password()");
   490 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::set_pac_store_password()");
   575 
   491 
   576 // Creates message data composed of Attribute-Value Pairs.
   492 // Creates message data composed of Attribute-Value Pairs.
   577 		eap_process_tlv_message_data_c message(m_am_tools);
   493 		eap_process_tlv_message_data_c message(m_am_tools);
   578 
   494 
   579 		if (message.get_is_valid() == false)
   495 		if (message.get_is_valid() == false)
   607 	return EAP_STATUS_RETURN(m_am_tools, status);
   523 	return EAP_STATUS_RETURN(m_am_tools, status);
   608 			
   524 			
   609 		}
   525 		}
   610 
   526 
   611 //--------------------------------------------------
   527 //--------------------------------------------------
   612 eap_status_e eap_pac_store_client_message_if_c::complete_open_pac_store(
   528 
       
   529 eap_status_e eap_pac_store_client_message_if_c::complete_is_master_key_present(
   613 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
   530 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
   614 {
   531 {
   615 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   532 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   616 
   533 
   617 	eap_status_e status(eap_status_process_general_error);
   534 	eap_status_e status(eap_status_ok);
   618 
   535 
   619 	EAP_TRACE_DEBUG(
   536 	EAP_TRACE_DEBUG(
   620 		m_am_tools, 
   537 		m_am_tools, 
   621 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   538 		TRACE_FLAGS_DEFAULT, 
   622 		(EAPL("eap_pac_store_client_message_if_c::complete_open_pac_store(): this = 0x%08x.\n"),
   539 		(EAPL("eap_pac_store_client_message_if_c::complete_is_master_key_present(): this = 0x%08x.\n"),
   623 		this));
   540 		this));
   624 
   541 
   625 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_open_pac_store()");
   542 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::complete_is_master_key_present()");
   626 
   543 
   627 	u32_t parameter_index(eap_message_payload_index_first_parameter);
   544 	u32_t parameter_index(eap_message_payload_index_first_parameter);
   628 
   545 
   629 	eap_process_tlv_message_data_c message_data(m_am_tools);
   546 	eap_process_tlv_message_data_c message_data(m_am_tools);
   630 
   547 
   631 	if (message_data.get_is_valid() == false)
   548 	if (message_data.get_is_valid() == false)
   632 		{
   549 	{
   633 		status = m_partner->complete_open_pac_store(
   550 	status = m_partner->complete_is_master_key_present(
   634 			eap_status_allocation_error);
   551 		false, eap_status_allocation_error);
   635 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   552 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   636 		}
   553 	}
       
   554 
       
   555   bool is_present = false;
       
   556 	status = message_data.read_parameter_data(parameters, parameter_index, &is_present);
       
   557 	if (status != eap_status_ok)
       
   558 	{
       
   559 	status = m_partner->complete_is_master_key_present(
       
   560 		false, status);
       
   561 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   562 	}
       
   563 
       
   564 	status = m_partner->complete_is_master_key_present(is_present, status);
       
   565 	return status;
       
   566 
       
   567 }
       
   568 
       
   569 //--------------------------------------------------
       
   570 
       
   571 eap_status_e eap_pac_store_client_message_if_c::complete_is_master_key_and_password_matching(
       
   572 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   573 {
       
   574 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   575 
       
   576 	eap_status_e status(eap_status_ok);
       
   577 
       
   578 	EAP_TRACE_DEBUG(
       
   579 		m_am_tools, 
       
   580 		TRACE_FLAGS_DEFAULT, 
       
   581 		(EAPL("eap_pac_store_client_message_if_c::complete_is_master_key_and_password_matching(): this = 0x%08x.\n"),
       
   582 		this));
       
   583 
       
   584 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   585 
       
   586 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   587 
       
   588 	if (message_data.get_is_valid() == false)
       
   589 	{
       
   590 	status = m_partner->complete_is_master_key_and_password_matching(
       
   591 		false, eap_status_allocation_error);
       
   592 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   593 	}
       
   594 
       
   595 	bool is_matching = false;
       
   596 
       
   597 	status = message_data.read_parameter_data(parameters, parameter_index, &is_matching);
       
   598 	if (status != eap_status_ok)
       
   599 	{
       
   600 	status = m_partner->complete_is_master_key_and_password_matching(
       
   601 		false, status);
       
   602 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   603 	}
       
   604 
       
   605 	status = m_partner->complete_is_master_key_and_password_matching(is_matching, status);
       
   606 
       
   607 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::complete_is_master_key_and_password_matching()");
       
   608   return status;
       
   609 }
       
   610 
       
   611 //--------------------------------------------------
       
   612 
       
   613 eap_status_e eap_pac_store_client_message_if_c::complete_create_and_save_master_key(
       
   614 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   615 {
       
   616 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   617 
       
   618 	eap_status_e status(eap_status_process_general_error);
       
   619 
       
   620 	EAP_TRACE_DEBUG(
       
   621 		m_am_tools, 
       
   622 		TRACE_FLAGS_DEFAULT, 
       
   623 		(EAPL("eap_pac_store_client_message_if_c::complete_create_and_save_master_key(): this = 0x%08x.\n"),
       
   624 		this));
       
   625 
       
   626 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::complete_create_and_save_master_key()");
       
   627 
       
   628 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   629 
       
   630 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   631 
       
   632 	if (message_data.get_is_valid() == false)
       
   633 	{
       
   634 	status = m_partner->complete_create_and_save_master_key(
       
   635 		eap_status_allocation_error);
       
   636 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   637 	}
   637 
   638 
   638   eap_status_e return_status;
   639   eap_status_e return_status;
   639 	status = message_data.read_parameter_data(parameters, parameter_index, eap_tlv_message_type_eap_status, &return_status);
   640 	status = message_data.read_parameter_data(parameters, parameter_index, eap_tlv_message_type_eap_status, &return_status);
   640 	if (status != eap_status_ok)
   641 	if (status != eap_status_ok)
   641 		{
   642 	{
   642 		status = m_partner->complete_open_pac_store(
   643 	status = m_partner->complete_create_and_save_master_key(
   643 			status);
   644 		status);
   644 			return EAP_STATUS_RETURN(m_am_tools, status);
   645 		return EAP_STATUS_RETURN(m_am_tools, status);
   645 		}
   646 	}
   646 	
   647 
   647 	status = m_partner->complete_open_pac_store(
   648 	status = m_partner->complete_create_and_save_master_key(return_status);
   648 		return_status);
   649 
   649 		
   650 	return EAP_STATUS_RETURN(m_am_tools, status);
   650 	return status;	
   651 
   651 	
   652 }
   652 
   653 //--------------------------------------------------
   653 }
   654 
   654 
   655 eap_status_e eap_pac_store_client_message_if_c::complete_is_pacstore_password_present(
   655 //--------------------------------------------------
       
   656 
       
   657 eap_status_e eap_pac_store_client_message_if_c::complete_create_device_seed(
       
   658 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
   656 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
   659 {
   657 {
   660 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   658 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   661 
   659 
   662 	eap_status_e status(eap_status_ok);
   660 	eap_status_e status(eap_status_ok);
   663 
   661 
   664 	EAP_TRACE_DEBUG(
   662 	EAP_TRACE_DEBUG(
   665 		m_am_tools, 
   663 		m_am_tools, 
   666 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   664 		TRACE_FLAGS_DEFAULT, 
   667 		(EAPL("eap_pac_store_client_message_if_c::complete_create_device_seed(): this = 0x%08x.\n"),
   665 		(EAPL("eap_pac_store_client_message_if_c::complete_is_pacstore_password_present(): this = 0x%08x.\n"),
   668 		this));
   666 		this));
   669 
   667 
   670 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_create_device_seed()");
   668 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::complete_is_pacstore_password_present()");
   671 
   669 
   672 	u32_t parameter_index(eap_message_payload_index_first_parameter);
   670 	u32_t parameter_index(eap_message_payload_index_first_parameter);
   673 
   671 
   674 	eap_process_tlv_message_data_c message_data(m_am_tools);
   672 	eap_process_tlv_message_data_c message_data(m_am_tools);
   675 
   673 
   676 	if (message_data.get_is_valid() == false)
   674 	if (message_data.get_is_valid() == false)
   677 	{
   675 	{
   678 	status = m_partner->complete_create_device_seed(eap_status_allocation_error);
   676 	status = m_partner->complete_is_pacstore_password_present(
       
   677 		false);
       
   678 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   679 	}
       
   680 
       
   681   bool is_present = false;
       
   682 	status = message_data.read_parameter_data(parameters, parameter_index, &is_present);
       
   683 	if (status != eap_status_ok)
       
   684 	{
       
   685 	status = m_partner->complete_is_pacstore_password_present(
       
   686 		false);
       
   687 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   688 	}
       
   689 
       
   690 	status = m_partner->complete_is_pacstore_password_present(is_present);
       
   691 	return status;
       
   692 
       
   693 }
       
   694 
       
   695 //--------------------------------------------------
       
   696 
       
   697 eap_status_e eap_pac_store_client_message_if_c::complete_compare_pac_store_password(
       
   698 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   699 {
       
   700 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   701 
       
   702 	eap_status_e status(eap_status_ok);
       
   703 
       
   704 	EAP_TRACE_DEBUG(
       
   705 		m_am_tools, 
       
   706 		TRACE_FLAGS_DEFAULT, 
       
   707 		(EAPL("eap_pac_store_client_message_if_c::complete_compare_pac_store_password(): this = 0x%08x.\n"),
       
   708 		this));
       
   709 
       
   710 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   711 
       
   712 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   713 
       
   714 	if (message_data.get_is_valid() == false)
       
   715 	{
       
   716 	status = m_partner->complete_compare_pac_store_password(
       
   717 		false);
       
   718 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   719 	}
       
   720 
       
   721 	bool is_matching = false;
       
   722 
       
   723 	status = message_data.read_parameter_data(parameters, parameter_index, &is_matching);
       
   724 	if (status != eap_status_ok)
       
   725 	{
       
   726 	status = m_partner->complete_compare_pac_store_password(
       
   727 		false);
       
   728 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   729 	}
       
   730 
       
   731 	status = m_partner->complete_compare_pac_store_password(is_matching);
       
   732 
       
   733 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::complete_compare_pac_store_password()");
       
   734   return status;
       
   735 }
       
   736 
       
   737 //--------------------------------------------------
       
   738 
       
   739 eap_status_e eap_pac_store_client_message_if_c::complete_set_pac_store_password(
       
   740 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   741 {
       
   742 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   743 
       
   744 	eap_status_e status(eap_status_process_general_error);
       
   745 
       
   746 	EAP_TRACE_DEBUG(
       
   747 		m_am_tools, 
       
   748 		TRACE_FLAGS_DEFAULT, 
       
   749 		(EAPL("eap_pac_store_client_message_if_c::complete_set_pac_store_password(): this = 0x%08x.\n"),
       
   750 		this));
       
   751 
       
   752 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::complete_set_pac_store_password()");
       
   753 
       
   754 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   755 
       
   756 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   757 
       
   758 	if (message_data.get_is_valid() == false)
       
   759 	{
       
   760 	status = m_partner->complete_set_pac_store_password(
       
   761 		eap_status_allocation_error);
   679 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   762 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   680 	}
   763 	}
   681 
   764 
   682   eap_status_e return_status;
   765   eap_status_e return_status;
   683 	status = message_data.read_parameter_data(parameters, parameter_index, eap_tlv_message_type_eap_status, &return_status);
   766 	status = message_data.read_parameter_data(parameters, parameter_index, eap_tlv_message_type_eap_status, &return_status);
   684 	if (status != eap_status_ok)
   767 	if (status != eap_status_ok)
   685 	{
   768 	{
   686 	status = m_partner->complete_create_device_seed(status);
       
   687 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   688 	}
       
   689 
       
   690 	status = m_partner->complete_create_device_seed(return_status);
       
   691 
       
   692 	return status;
       
   693 }
       
   694 
       
   695 //--------------------------------------------------
       
   696 
       
   697 eap_status_e eap_pac_store_client_message_if_c::complete_is_master_key_present(
       
   698 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   699 {
       
   700 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   701 
       
   702 	eap_status_e status(eap_status_ok);
       
   703 
       
   704 	EAP_TRACE_DEBUG(
       
   705 		m_am_tools, 
       
   706 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   707 		(EAPL("eap_pac_store_client_message_if_c::complete_is_master_key_present(): this = 0x%08x.\n"),
       
   708 		this));
       
   709 
       
   710 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_is_master_key_present()");
       
   711 
       
   712 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   713 
       
   714 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   715 
       
   716 	if (message_data.get_is_valid() == false)
       
   717 	{
       
   718 	status = m_partner->complete_is_master_key_present(
       
   719 		false, eap_status_allocation_error);
       
   720 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   721 	}
       
   722 
       
   723   bool is_present = false;
       
   724 	status = message_data.read_parameter_data(parameters, parameter_index, &is_present);
       
   725 	if (status != eap_status_ok)
       
   726 	{
       
   727 	status = m_partner->complete_is_master_key_present(
       
   728 		false, status);
       
   729 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   730 	}
       
   731 
       
   732 	status = m_partner->complete_is_master_key_present(is_present, status);
       
   733 	return status;
       
   734 
       
   735 }
       
   736 
       
   737 //--------------------------------------------------
       
   738 
       
   739 eap_status_e eap_pac_store_client_message_if_c::complete_is_master_key_and_password_matching(
       
   740 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   741 {
       
   742 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   743 
       
   744 	eap_status_e status(eap_status_ok);
       
   745 
       
   746 	EAP_TRACE_DEBUG(
       
   747 		m_am_tools, 
       
   748 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   749 		(EAPL("eap_pac_store_client_message_if_c::complete_is_master_key_and_password_matching(): this = 0x%08x.\n"),
       
   750 		this));
       
   751 
       
   752 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   753 
       
   754 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   755 
       
   756 	if (message_data.get_is_valid() == false)
       
   757 	{
       
   758 	status = m_partner->complete_is_master_key_and_password_matching(
       
   759 		false, eap_status_allocation_error);
       
   760 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   761 	}
       
   762 
       
   763 	bool is_matching = false;
       
   764 
       
   765 	status = message_data.read_parameter_data(parameters, parameter_index, &is_matching);
       
   766 	if (status != eap_status_ok)
       
   767 	{
       
   768 	status = m_partner->complete_is_master_key_and_password_matching(
       
   769 		false, status);
       
   770 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   771 	}
       
   772 
       
   773 	status = m_partner->complete_is_master_key_and_password_matching(is_matching, status);
       
   774 
       
   775 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_is_master_key_and_password_matching()");
       
   776   return status;
       
   777 }
       
   778 
       
   779 //--------------------------------------------------
       
   780 
       
   781 eap_status_e eap_pac_store_client_message_if_c::complete_create_and_save_master_key(
       
   782 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   783 {
       
   784 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   785 
       
   786 	eap_status_e status(eap_status_process_general_error);
       
   787 
       
   788 	EAP_TRACE_DEBUG(
       
   789 		m_am_tools, 
       
   790 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   791 		(EAPL("eap_pac_store_client_message_if_c::complete_create_and_save_master_key(): this = 0x%08x.\n"),
       
   792 		this));
       
   793 
       
   794 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_create_and_save_master_key()");
       
   795 
       
   796 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   797 
       
   798 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   799 
       
   800 	if (message_data.get_is_valid() == false)
       
   801 	{
       
   802 	status = m_partner->complete_create_and_save_master_key(
       
   803 		eap_status_allocation_error);
       
   804 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   805 	}
       
   806 
       
   807   eap_status_e return_status;
       
   808 	status = message_data.read_parameter_data(parameters, parameter_index, eap_tlv_message_type_eap_status, &return_status);
       
   809 	if (status != eap_status_ok)
       
   810 	{
       
   811 	status = m_partner->complete_create_and_save_master_key(
       
   812 		status);
       
   813 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   814 	}
       
   815 
       
   816 	status = m_partner->complete_create_and_save_master_key(return_status);
       
   817 
       
   818 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   819 
       
   820 }
       
   821 //--------------------------------------------------
       
   822 
       
   823 eap_status_e eap_pac_store_client_message_if_c::complete_is_pacstore_password_present(
       
   824 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   825 {
       
   826 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   827 
       
   828 	eap_status_e status(eap_status_ok);
       
   829 
       
   830 	EAP_TRACE_DEBUG(
       
   831 		m_am_tools, 
       
   832 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   833 		(EAPL("eap_pac_store_client_message_if_c::complete_is_pacstore_password_present(): this = 0x%08x.\n"),
       
   834 		this));
       
   835 
       
   836 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_is_pacstore_password_present()");
       
   837 
       
   838 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   839 
       
   840 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   841 
       
   842 	if (message_data.get_is_valid() == false)
       
   843 	{
       
   844 	status = m_partner->complete_is_pacstore_password_present(
       
   845 		false);
       
   846 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   847 	}
       
   848 
       
   849   bool is_present = false;
       
   850 	status = message_data.read_parameter_data(parameters, parameter_index, &is_present);
       
   851 	if (status != eap_status_ok)
       
   852 	{
       
   853 	status = m_partner->complete_is_pacstore_password_present(
       
   854 		false);
       
   855 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   856 	}
       
   857 
       
   858 	status = m_partner->complete_is_pacstore_password_present(is_present);
       
   859 	return status;
       
   860 
       
   861 }
       
   862 
       
   863 //--------------------------------------------------
       
   864 
       
   865 eap_status_e eap_pac_store_client_message_if_c::complete_compare_pac_store_password(
       
   866 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   867 {
       
   868 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   869 
       
   870 	eap_status_e status(eap_status_ok);
       
   871 
       
   872 	EAP_TRACE_DEBUG(
       
   873 		m_am_tools, 
       
   874 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   875 		(EAPL("eap_pac_store_client_message_if_c::complete_compare_pac_store_password(): this = 0x%08x.\n"),
       
   876 		this));
       
   877 
       
   878 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   879 
       
   880 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   881 
       
   882 	if (message_data.get_is_valid() == false)
       
   883 	{
       
   884 	status = m_partner->complete_compare_pac_store_password(
       
   885 		false);
       
   886 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   887 	}
       
   888 
       
   889 	bool is_matching = false;
       
   890 
       
   891 	status = message_data.read_parameter_data(parameters, parameter_index, &is_matching);
       
   892 	if (status != eap_status_ok)
       
   893 	{
       
   894 	status = m_partner->complete_compare_pac_store_password(
       
   895 		false);
       
   896 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   897 	}
       
   898 
       
   899 	status = m_partner->complete_compare_pac_store_password(is_matching);
       
   900 
       
   901 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_compare_pac_store_password()");
       
   902   return status;
       
   903 }
       
   904 
       
   905 //--------------------------------------------------
       
   906 
       
   907 //--------------------------------------------------
       
   908 /*
       
   909 eap_status_e eap_pac_store_client_message_if_c::complete_get_pac_store_password(
       
   910 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   911 {
       
   912 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   913 
       
   914 	eap_status_e status(eap_status_process_general_error);
       
   915 
       
   916 	EAP_TRACE_DEBUG(
       
   917 		m_am_tools, 
       
   918 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   919 		(EAPL("eap_pac_store_client_message_if_c::complete_get_pac_store_password(): this = 0x%08x.\n"),
       
   920 		this));
       
   921 
       
   922 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_get_pac_store_password()");
       
   923 	
       
   924 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   925 
       
   926 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   927 
       
   928 	if (message_data.get_is_valid() == false)
       
   929 	{
       
   930 	status = m_partner->complete_get_pac_store_password(
       
   931 		NULL);
       
   932 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   933 	}
       
   934 
       
   935 	eap_variable_data_c * const password = new eap_variable_data_c(m_am_tools);
       
   936 	// eap_automatic_variable_c can be used in this block because no functions are leaving here.
       
   937 	eap_automatic_variable_c<eap_variable_data_c> automatic_password_data(m_am_tools, password);
       
   938 
       
   939 	if (password == 0)
       
   940 	{
       
   941 	status = m_partner->complete_get_pac_store_password(
       
   942 		password);
       
   943 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   944 	}
       
   945 
       
   946 	status = message_data.read_parameter_data(parameters, parameter_index, password);
       
   947 	if (status != eap_status_ok)
       
   948 	{
       
   949 	status = m_partner->complete_get_pac_store_password(
       
   950 		password);
       
   951 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   952 	}
       
   953 
       
   954 
       
   955 	status = m_partner->complete_get_pac_store_password(
       
   956 		password);
       
   957 
       
   958 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   959 
       
   960 
       
   961 }
       
   962 */
       
   963 //--------------------------------------------------
       
   964 
       
   965 eap_status_e eap_pac_store_client_message_if_c::complete_set_pac_store_password(
       
   966 		EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   967 {
       
   968 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   969 
       
   970 	eap_status_e status(eap_status_process_general_error);
       
   971 
       
   972 	EAP_TRACE_DEBUG(
       
   973 		m_am_tools, 
       
   974 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   975 		(EAPL("eap_pac_store_client_message_if_c::complete_set_pac_store_password(): this = 0x%08x.\n"),
       
   976 		this));
       
   977 
       
   978 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_set_pac_store_password()");
       
   979 
       
   980 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   981 
       
   982 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   983 
       
   984 	if (message_data.get_is_valid() == false)
       
   985 	{
       
   986 	status = m_partner->complete_set_pac_store_password(
       
   987 		eap_status_allocation_error);
       
   988 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   989 	}
       
   990 
       
   991   eap_status_e return_status;
       
   992 	status = message_data.read_parameter_data(parameters, parameter_index, eap_tlv_message_type_eap_status, &return_status);
       
   993 	if (status != eap_status_ok)
       
   994 	{
       
   995 	status = m_partner->complete_set_pac_store_password(
   769 	status = m_partner->complete_set_pac_store_password(
   996 		status);
   770 		status);
   997 		return EAP_STATUS_RETURN(m_am_tools, status);
   771 		return EAP_STATUS_RETURN(m_am_tools, status);
   998 	}
   772 	}
   999 
   773 
  1011 
   785 
  1012 	eap_status_e status(eap_status_process_general_error);
   786 	eap_status_e status(eap_status_process_general_error);
  1013 
   787 
  1014 	EAP_TRACE_DEBUG(
   788 	EAP_TRACE_DEBUG(
  1015 		m_am_tools, 
   789 		m_am_tools, 
  1016 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   790 		TRACE_FLAGS_DEFAULT, 
  1017 		(EAPL("eap_pac_store_client_message_if_c::complete_destroy_pac_store(): this = 0x%08x.\n"),
   791 		(EAPL("eap_pac_store_client_message_if_c::complete_destroy_pac_store(): this = 0x%08x.\n"),
  1018 		this));
   792 		this));
  1019 
   793 
  1020 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::complete_destroy_pac_store()");
   794 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::complete_destroy_pac_store()");
  1021 
   795 
  1022 	u32_t parameter_index(eap_message_payload_index_first_parameter);
   796 	u32_t parameter_index(eap_message_payload_index_first_parameter);
  1023 
   797 
  1024 	eap_process_tlv_message_data_c message_data(m_am_tools);
   798 	eap_process_tlv_message_data_c message_data(m_am_tools);
  1025 
   799 
  1047 
   821 
  1048 }
   822 }
  1049 
   823 
  1050 //--------------------------------------------------
   824 //--------------------------------------------------
  1051 
   825 
  1052 //--------------------------------------------------
       
  1053 
       
  1054 
       
  1055 //--------------------------------------------------
       
  1056 
       
  1057 
       
  1058 //--------------------------------------------------
       
  1059 
       
  1060 
       
  1061 //--------------------------------------------------
       
  1062 
       
  1063 //--------------------------------------------------
       
  1064 //--------------------------------------------------
       
  1065 
       
  1066 //--------------------------------------------------
       
  1067 
       
  1068 eap_status_e eap_pac_store_client_message_if_c::process_message_type_error(
   826 eap_status_e eap_pac_store_client_message_if_c::process_message_type_error(
  1069 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
   827 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
  1070 {
   828 {
  1071 	eap_status_e status(eap_status_ok);
   829 	eap_status_e status(eap_status_ok);
  1072 
   830 
  1104 {
   862 {
  1105 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   863 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1106 
   864 
  1107 	EAP_TRACE_DEBUG(
   865 	EAP_TRACE_DEBUG(
  1108 		m_am_tools, 
   866 		m_am_tools, 
  1109 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   867 		TRACE_FLAGS_DEFAULT, 
  1110 		(EAPL("eap_pac_store_client_message_if_c::send_data(): this = 0x%08x.\n"),
   868 		(EAPL("eap_pac_store_client_message_if_c::send_data(): this = 0x%08x.\n"),
  1111 		this));
   869 		this));
  1112 
   870 
  1113 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_pac_store_client_message_if_c::send_data()");
   871 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_pac_store_client_message_if_c::send_data()");
  1114 
   872 
  1115 	eap_status_e status(eap_status_process_general_error);
   873 	eap_status_e status(eap_status_process_general_error);
  1116 
   874 
  1117 	// Parses message data composed of Attribute-Value Pairs.
   875 	// Parses message data composed of Attribute-Value Pairs.
  1118 	eap_process_tlv_message_data_c message(m_am_tools);
   876 	eap_process_tlv_message_data_c message(m_am_tools);
  1174 		{
   932 		{
  1175 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   933 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1176 			return EAP_STATUS_RETURN(m_am_tools, status);
   934 			return EAP_STATUS_RETURN(m_am_tools, status);
  1177 		}
   935 		}
  1178 
   936 
       
   937 		EAP_TRACE_DEBUG(
       
   938 			m_am_tools, 
       
   939 			TRACE_FLAGS_DEFAULT, 
       
   940 			(EAPL("eap_pac_store_client_message_if_c::send_data(): this = 0x%08x, message=%d=%s\n"),
       
   941 			this,
       
   942 			function,
       
   943 			eap_process_tlv_message_data_c::get_function_string(function)));
       
   944 
  1179 		switch(function)
   945 		switch(function)
  1180 		{
   946 		{
  1181 		case eap_tlv_message_type_function_pac_store_complete_open_pac_store:
       
  1182 			status = complete_open_pac_store(&parameters);
       
  1183 			break;
       
  1184 		case eap_tlv_message_type_function_pac_store_complete_create_device_seed:
       
  1185 			status = complete_create_device_seed(&parameters);
       
  1186 			break;
       
  1187 		case eap_tlv_message_type_function_pac_store_complete_is_master_key_present:
   947 		case eap_tlv_message_type_function_pac_store_complete_is_master_key_present:
  1188 			status = complete_is_master_key_present(&parameters);
   948 			status = complete_is_master_key_present(&parameters);
  1189 			break;
   949 			break;
  1190 		case eap_tlv_message_type_function_pac_store_complete_is_master_key_and_password_matching:
   950 		case eap_tlv_message_type_function_pac_store_complete_is_master_key_and_password_matching:
  1191 			status = complete_is_master_key_and_password_matching(&parameters);
   951 			status = complete_is_master_key_and_password_matching(&parameters);