eapol/eapol_framework/eapol_common/type/aka/include/eap_type_aka.h
changeset 49 43351a4f2da3
parent 34 ad1f037f1ac2
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    22 #if !defined(_AKA_CORE_H_)
    22 #if !defined(_AKA_CORE_H_)
    23 #define _AKA_CORE_H_
    23 #define _AKA_CORE_H_
    24 
    24 
    25 #include "eap_tools.h"
    25 #include "eap_tools.h"
    26 #include "eap_am_export.h"
    26 #include "eap_am_export.h"
       
    27 // Start: added by script change_export_macros.sh.
       
    28 #if defined(EAP_NO_EXPORT_EAP_TYPE_AKA_H)
       
    29 	#define EAP_CLASS_VISIBILITY_EAP_TYPE_AKA_H EAP_NONSHARABLE 
       
    30 	#define EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H 
       
    31 	#define EAP_C_FUNC_VISIBILITY_EAP_TYPE_AKA_H 
       
    32 	#define EAP_FUNC_EXPORT_EAP_TYPE_AKA_H 
       
    33 	#define EAP_C_FUNC_EXPORT_EAP_TYPE_AKA_H 
       
    34 #elif defined(EAP_EXPORT_EAP_TYPE_AKA_H)
       
    35 	#define EAP_CLASS_VISIBILITY_EAP_TYPE_AKA_H EAP_EXPORT 
       
    36 	#define EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H EAP_FUNC_EXPORT 
       
    37 	#define EAP_C_FUNC_VISIBILITY_EAP_TYPE_AKA_H EAP_C_FUNC_EXPORT 
       
    38 	#define EAP_FUNC_EXPORT_EAP_TYPE_AKA_H EAP_FUNC_EXPORT 
       
    39 	#define EAP_C_FUNC_EXPORT_EAP_TYPE_AKA_H EAP_C_FUNC_EXPORT 
       
    40 #else
       
    41 	#define EAP_CLASS_VISIBILITY_EAP_TYPE_AKA_H EAP_IMPORT 
       
    42 	#define EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H EAP_FUNC_IMPORT 
       
    43 	#define EAP_C_FUNC_VISIBILITY_EAP_TYPE_AKA_H EAP_C_FUNC_IMPORT 
       
    44 	#define EAP_FUNC_EXPORT_EAP_TYPE_AKA_H 
       
    45 	#define EAP_C_FUNC_EXPORT_EAP_TYPE_AKA_H 
       
    46 #endif
       
    47 // End: added by script change_export_macros.sh.
    27 #include "eap_base_type.h"
    48 #include "eap_base_type.h"
    28 #include "eap_variable_data.h"
    49 #include "eap_variable_data.h"
    29 #include "eap_type_aka_header.h"
    50 #include "eap_type_aka_header.h"
    30 #include "eap_type_aka_types.h"
    51 #include "eap_type_aka_types.h"
    31 #include "eap_type_aka_payloads.h"
    52 #include "eap_type_aka_payloads.h"
    40 
    61 
    41 //--------------------------------------------------
    62 //--------------------------------------------------
    42 
    63 
    43 
    64 
    44 /// This class is implementation of AKA EAP-type.
    65 /// This class is implementation of AKA EAP-type.
    45 class EAP_EXPORT eap_type_aka_c
    66 class EAP_CLASS_VISIBILITY_EAP_TYPE_AKA_H eap_type_aka_c
    46 : public abs_eap_am_type_aka_c
    67 : public abs_eap_am_type_aka_c
    47 , public abs_eap_base_timer_c
    68 , public abs_eap_base_timer_c
    48 , public eap_base_type_c
    69 , public eap_base_type_c
    49 {
    70 {
    50 private:
    71 private:
   307 	//--------------------------------------------------
   328 	//--------------------------------------------------
   308 
   329 
   309 	/**
   330 	/**
   310 	 * This function initializes the allowed messages within one specific state.
   331 	 * This function initializes the allowed messages within one specific state.
   311 	 */
   332 	 */
   312 	EAP_FUNC_IMPORT void initialize_state(
   333 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H void initialize_state(
   313 				const eap_type_aka_state_variable_e state,
   334 				const eap_type_aka_state_variable_e state,
   314 				const bool must_be_initiator,
   335 				const bool must_be_initiator,
   315 				const bool must_be_responder,
   336 				const bool must_be_responder,
   316 				const aka_subtype_e type0,
   337 				const aka_subtype_e type0,
   317 				const aka_subtype_e type1,
   338 				const aka_subtype_e type1,
   322 	/**
   343 	/**
   323 	 * This function expands key and seed data to key_length of expansion.
   344 	 * This function expands key and seed data to key_length of expansion.
   324 	 *  expansion_0 = prf(key, seed | 0)
   345 	 *  expansion_0 = prf(key, seed | 0)
   325 	 *  expansion_i = prf(key, expansion_i-1 | seed | i), where i = 1, 2...
   346 	 *  expansion_i = prf(key, expansion_i-1 | seed | i), where i = 1, 2...
   326 	 */
   347 	 */
   327 	EAP_FUNC_IMPORT eap_status_e data_exp(
   348 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e data_exp(
   328 		const u32_t key_length,
   349 		const u32_t key_length,
   329 		eap_variable_data_c * const expansion,
   350 		eap_variable_data_c * const expansion,
   330 		const eap_variable_data_c * const key,
   351 		const eap_variable_data_c * const key,
   331 		const eap_variable_data_c * const seed);
   352 		const eap_variable_data_c * const seed);
   332 
   353 
   333 	/**
   354 	/**
   334 	 * This function returns the eap_type_aka_state_variable_parameters_c object of current state.
   355 	 * This function returns the eap_type_aka_state_variable_parameters_c object of current state.
   335 	 */
   356 	 */
   336 	EAP_FUNC_IMPORT const eap_type_aka_state_variable_parameters_c * get_state_variable();
   357 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H const eap_type_aka_state_variable_parameters_c * get_state_variable();
   337 
   358 
   338 
   359 
   339 	//--------------------------------------------------
   360 	//--------------------------------------------------
   340 	//--------------------------------------------------
   361 	//--------------------------------------------------
   341 
   362 
   342 	/**
   363 	/**
   343 	 * This function generates a new NAI from domain and IMSI.
   364 	 * This function generates a new NAI from domain and IMSI.
   344 	 */
   365 	 */
   345 	EAP_FUNC_IMPORT eap_status_e generate_nai(
   366 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e generate_nai(
   346 		eap_variable_data_c * const new_nai, ///< This is the new generated NAI.
   367 		eap_variable_data_c * const new_nai, ///< This is the new generated NAI.
   347 		const bool use_manual_default_realm, ///< When true uses realm parameter, when false generates automatic realm.
   368 		const bool use_manual_default_realm, ///< When true uses realm parameter, when false generates automatic realm.
   348 		const eap_variable_data_c * const realm, ///< This is the domain part of the NAI.
   369 		const eap_variable_data_c * const realm, ///< This is the domain part of the NAI.
   349 		const eap_variable_data_c * const id_IMSI_or_pseydonym, ///< This is IMSI or pseudonym.
   370 		const eap_variable_data_c * const id_IMSI_or_pseydonym, ///< This is IMSI or pseudonym.
   350 		const bool id_is_imsi, ///< This parameter tells whether id_IMSI_or_pseydonym is IMSI (true) or pseudonym (false).
   371 		const bool id_is_imsi, ///< This parameter tells whether id_IMSI_or_pseydonym is IMSI (true) or pseudonym (false).
   377 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   398 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   378 	 * | Any variable length payload                                   |
   399 	 * | Any variable length payload                                   |
   379 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   400 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   380 	 * @endcode
   401 	 * @endcode
   381 	 */
   402 	 */
   382 	EAP_FUNC_IMPORT eap_status_e add_variable_payload(
   403 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_variable_payload(
   383 		aka_header_c * const aka,
   404 		aka_header_c * const aka,
   384 		const u32_t maximum_buffer_size,
   405 		const u32_t maximum_buffer_size,
   385 		const u32_t eap_header_size,
   406 		const u32_t eap_header_size,
   386 		u32_t * const data_offset,
   407 		u32_t * const data_offset,
   387 		u32_t * const data_free,
   408 		u32_t * const data_free,
   414 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   435 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   415 	 * | ... AUTS                                                      |
   436 	 * | ... AUTS                                                      |
   416 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   437 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   417 	 * @endcode
   438 	 * @endcode
   418 	 */
   439 	 */
   419 	EAP_FUNC_IMPORT eap_status_e add_AUTS_payload(
   440 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_AUTS_payload(
   420 		aka_header_c * const aka,
   441 		aka_header_c * const aka,
   421 		const u32_t aka_buffer_length,
   442 		const u32_t aka_buffer_length,
   422 		const u32_t eap_header_size,
   443 		const u32_t eap_header_size,
   423 		u32_t * const aka_data_offset,
   444 		u32_t * const aka_data_offset,
   424 		u32_t * const aka_data_free,
   445 		u32_t * const aka_data_free,
   451 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   472 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   452 	 * |                              RES ...
   473 	 * |                              RES ...
   453 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   474 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   454 	 * @endcode
   475 	 * @endcode
   455 	 */
   476 	 */
   456 	EAP_FUNC_IMPORT eap_status_e add_RES_payload(
   477 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_RES_payload(
   457 		aka_header_c * const aka,
   478 		aka_header_c * const aka,
   458 		const u32_t aka_buffer_length,
   479 		const u32_t aka_buffer_length,
   459 		const u32_t eap_header_size,
   480 		const u32_t eap_header_size,
   460 		u32_t * const aka_data_offset,
   481 		u32_t * const aka_data_offset,
   461 		u32_t * const aka_data_free,
   482 		u32_t * const aka_data_free,
   491 	 * |                                                               |
   512 	 * |                                                               |
   492 	 * |                                                               |
   513 	 * |                                                               |
   493 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   514 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   494 	 * @endcode
   515 	 * @endcode
   495 	 */
   516 	 */
   496 	EAP_FUNC_IMPORT eap_status_e add_pseudonym_or_imsi_payload(
   517 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_pseudonym_or_imsi_payload(
   497 		aka_header_c * const aka,
   518 		aka_header_c * const aka,
   498 		const u32_t maximum_buffer_size,
   519 		const u32_t maximum_buffer_size,
   499 		const u32_t eap_header_size,
   520 		const u32_t eap_header_size,
   500 		u32_t * const data_offset,
   521 		u32_t * const data_offset,
   501 		u32_t * const data_free,
   522 		u32_t * const data_free,
   526 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   547 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   527 	 * |AT_COUNTER     | Length = 1    |      Counter                  |
   548 	 * |AT_COUNTER     | Length = 1    |      Counter                  |
   528 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   549 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   529 	 * @endcode
   550 	 * @endcode
   530 	 */
   551 	 */
   531 	EAP_FUNC_IMPORT eap_status_e add_counter_payload(
   552 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_counter_payload(
   532 		aka_header_c * const aka,
   553 		aka_header_c * const aka,
   533 		const u32_t aka_buffer_length,
   554 		const u32_t aka_buffer_length,
   534 		const u32_t eap_header_size,
   555 		const u32_t eap_header_size,
   535 		u32_t * const aka_data_offset,
   556 		u32_t * const aka_data_offset,
   536 		u32_t * const aka_data_free,
   557 		u32_t * const aka_data_free,
   560 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   581 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   561 	 * |AT_XXX         | Length = 1    |      Reserved                 |
   582 	 * |AT_XXX         | Length = 1    |      Reserved                 |
   562 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   583 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   563 	 * @endcode
   584 	 * @endcode
   564 	 */
   585 	 */
   565 	EAP_FUNC_IMPORT eap_status_e add_simple_payload(
   586 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_simple_payload(
   566 		aka_header_c * const aka,
   587 		aka_header_c * const aka,
   567 		const u32_t aka_buffer_length,
   588 		const u32_t aka_buffer_length,
   568 		const u32_t eap_header_size,
   589 		const u32_t eap_header_size,
   569 		u32_t * const aka_data_offset,
   590 		u32_t * const aka_data_offset,
   570 		u32_t * const aka_data_free,
   591 		u32_t * const aka_data_free,
   592 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   613 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   593 	 * |AT_NOTIFICATION| Length = 1    |      Notification Code        |
   614 	 * |AT_NOTIFICATION| Length = 1    |      Notification Code        |
   594 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   615 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   595 	 * @endcode
   616 	 * @endcode
   596 	 */
   617 	 */
   597 	EAP_FUNC_IMPORT eap_status_e add_notification_payload(
   618 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_notification_payload(
   598 		aka_header_c * const aka,
   619 		aka_header_c * const aka,
   599 		const u32_t aka_buffer_length,
   620 		const u32_t aka_buffer_length,
   600 		const u32_t eap_header_size,
   621 		const u32_t eap_header_size,
   601 		u32_t * const aka_data_offset,
   622 		u32_t * const aka_data_offset,
   602 		u32_t * const aka_data_free,
   623 		u32_t * const aka_data_free,
   625 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   646 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   626 	 * |AT_CLIENT_ERR..| Length = 1    |      Client Error Code        |
   647 	 * |AT_CLIENT_ERR..| Length = 1    |      Client Error Code        |
   627 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   648 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   628 	 * @endcode
   649 	 * @endcode
   629 	 */
   650 	 */
   630 	EAP_FUNC_IMPORT eap_status_e add_client_error_payload(
   651 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_client_error_payload(
   631 		aka_header_c * const aka,
   652 		aka_header_c * const aka,
   632 		const u32_t aka_buffer_length,
   653 		const u32_t aka_buffer_length,
   633 		const u32_t eap_header_size,
   654 		const u32_t eap_header_size,
   634 		u32_t * const aka_data_offset,
   655 		u32_t * const aka_data_offset,
   635 		u32_t * const aka_data_free,
   656 		u32_t * const aka_data_free,
   663 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   684 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   664 	 * | MAC                                                           |
   685 	 * | MAC                                                           |
   665 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   686 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   666 	 * @endcode
   687 	 * @endcode
   667 	 */
   688 	 */
   668 	EAP_FUNC_IMPORT eap_status_e add_mac_payload(
   689 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_mac_payload(
   669 		aka_header_c * const aka,
   690 		aka_header_c * const aka,
   670 		const u32_t maximum_buffer_size,
   691 		const u32_t maximum_buffer_size,
   671 		const u32_t eap_header_size,
   692 		const u32_t eap_header_size,
   672 		u32_t * const data_offset,
   693 		u32_t * const data_offset,
   673 		u32_t * const data_free,
   694 		u32_t * const data_free,
   700 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   721 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   701 	 * | Zero or more padding octets. Padding octet is 0x00.           |
   722 	 * | Zero or more padding octets. Padding octet is 0x00.           |
   702 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   723 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   703 	 * @endcode
   724 	 * @endcode
   704 	 */
   725 	 */
   705 	EAP_FUNC_IMPORT eap_status_e add_padding_payload(
   726 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e add_padding_payload(
   706 		aka_header_c * const aka_packet,
   727 		aka_header_c * const aka_packet,
   707 		const u32_t maximum_buffer_size,
   728 		const u32_t maximum_buffer_size,
   708 		const u32_t eap_header_size,
   729 		const u32_t eap_header_size,
   709 		u32_t * const data_offset,
   730 		u32_t * const data_offset,
   710 		u32_t * const data_free,
   731 		u32_t * const data_free,
   714 
   735 
   715 	/**
   736 	/**
   716 	 * This function verifies the message authentication code (MAC) is correct.
   737 	 * This function verifies the message authentication code (MAC) is correct.
   717 	 * @see add_mac_payload().
   738 	 * @see add_mac_payload().
   718 	 */
   739 	 */
   719 	EAP_FUNC_IMPORT eap_status_e check_message_authentication_code(
   740 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e check_message_authentication_code(
   720 		const eap_variable_data_c * const authentication_key,
   741 		const eap_variable_data_c * const authentication_key,
   721 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   742 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   722 		const aka_header_c * const aka_packet,
   743 		const aka_header_c * const aka_packet,
   723 		const u32_t aka_packet_length);
   744 		const u32_t aka_packet_length);
   724 
   745 
   732 	 * See also parse_aka_packet().
   753 	 * See also parse_aka_packet().
   733 	 *
   754 	 *
   734 	 * Third is analysed the AKA EAP packet. This includes the payload and values of each payload.
   755 	 * Third is analysed the AKA EAP packet. This includes the payload and values of each payload.
   735 	 * See also analyse_aka_packet().
   756 	 * See also analyse_aka_packet().
   736 	 */
   757 	 */
   737 	EAP_FUNC_IMPORT eap_status_e handle_aka_packet(
   758 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_aka_packet(
   738 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
   759 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
   739 		aka_header_c * const aka, ///< This is pointer to EAP header including AKA fields.
   760 		aka_header_c * const aka, ///< This is pointer to EAP header including AKA fields.
   740 		const u32_t aka_length, ///< This is length of received AKA EAP packet.
   761 		const u32_t aka_length, ///< This is length of received AKA EAP packet.
   741 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   762 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   742 		);
   763 		);
   745 	 * This function analyses the received AKA EAP packet.
   766 	 * This function analyses the received AKA EAP packet.
   746 	 * Each sub-type is handled in separate function.
   767 	 * Each sub-type is handled in separate function.
   747 	 * @see Client messages are handled in handle_aka_identity_request_message() and handle_challenge_request_message(). 
   768 	 * @see Client messages are handled in handle_aka_identity_request_message() and handle_challenge_request_message(). 
   748 	 * @see Server messages are handled in handle_aka_identity_response_message() and handle_challenge_response_message(). 
   769 	 * @see Server messages are handled in handle_aka_identity_response_message() and handle_challenge_response_message(). 
   749 	 */
   770 	 */
   750 	EAP_FUNC_IMPORT eap_status_e analyse_aka_packet(
   771 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e analyse_aka_packet(
   751 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
   772 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
   752 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
   773 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
   753 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
   774 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
   754 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   775 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   755 		);
   776 		);
   760 	 * Payloads are stored to p_aka_payloads.
   781 	 * Payloads are stored to p_aka_payloads.
   761 	 * @return If the length of the buffer and sum of the length of all payloads does not match
   782 	 * @return If the length of the buffer and sum of the length of all payloads does not match
   762 	 * function returns eap_status_header_corrupted.
   783 	 * function returns eap_status_header_corrupted.
   763 	 * Also error is returned when illegal payload attribute is recognised.
   784 	 * Also error is returned when illegal payload attribute is recognised.
   764 	 */
   785 	 */
   765 	EAP_FUNC_IMPORT eap_status_e parse_aka_payload(
   786 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e parse_aka_payload(
   766 		const aka_payload_AT_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload.
   787 		const aka_payload_AT_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload.
   767 		u32_t * const buffer_length, ///< This is the length of the buffer. This must match with the length of all payloads.
   788 		u32_t * const buffer_length, ///< This is the length of the buffer. This must match with the length of all payloads.
   768 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   789 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   769 		const aka_subtype_e subtype
   790 		const aka_subtype_e subtype
   770 		);
   791 		);
   772 	/**
   793 	/**
   773 	 * This function parses all payloads of the whole AKA EAP packet.
   794 	 * This function parses all payloads of the whole AKA EAP packet.
   774 	 * Payloads are stored to p_aka_payloads.
   795 	 * Payloads are stored to p_aka_payloads.
   775 	 * @see parse_aka_payload().
   796 	 * @see parse_aka_payload().
   776 	 */
   797 	 */
   777 	EAP_FUNC_IMPORT eap_status_e parse_aka_packet(
   798 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e parse_aka_packet(
   778 		aka_header_c * const aka, ///< This is pointer to EAP header including AKA fields.
   799 		aka_header_c * const aka, ///< This is pointer to EAP header including AKA fields.
   779 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
   800 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
   780 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   801 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   781 		);
   802 		);
   782 
   803 
   783 	/**
   804 	/**
   784 	 * This function parses each payload attributes.
   805 	 * This function parses each payload attributes.
   785 	 * @return If payload attribute is illegal function returns eap_status_header_corrupted.
   806 	 * @return If payload attribute is illegal function returns eap_status_header_corrupted.
   786 	 * If payload attribute is unknown function returns eap_status_unsupported_aka_payload.
   807 	 * If payload attribute is unknown function returns eap_status_unsupported_aka_payload.
   787 	 */
   808 	 */
   788 	EAP_FUNC_IMPORT eap_status_e parse_generic_payload(
   809 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e parse_generic_payload(
   789 		const aka_payload_AT_type_e current_payload, ///< This is the type of current payload attribute.
   810 		const aka_payload_AT_type_e current_payload, ///< This is the type of current payload attribute.
   790 		const aka_payload_AT_header_c * const payload, ///< This is the current parsed payload.
   811 		const aka_payload_AT_header_c * const payload, ///< This is the current parsed payload.
   791 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   812 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   792 		const aka_subtype_e subtype);
   813 		const aka_subtype_e subtype);
   793 
   814 
   794 	/**
   815 	/**
   795 	 * This function sends the EAP-Request/AKA/Re-authentication message.
   816 	 * This function sends the EAP-Request/AKA/Re-authentication message.
   796 	 */
   817 	 */
   797 	EAP_FUNC_IMPORT eap_status_e send_reauthentication_request_message(
   818 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_reauthentication_request_message(
   798 		const eap_variable_data_c * const username,
   819 		const eap_variable_data_c * const username,
   799 		const bool pseudonym_decode_failed,
   820 		const bool pseudonym_decode_failed,
   800 		const u8_t eap_identifier);
   821 		const u8_t eap_identifier);
   801 
   822 
   802 	/**
   823 	/**
   803 	 * This function sends the EAP-Request/AKA/Start message.
   824 	 * This function sends the EAP-Request/AKA/Start message.
   804 	 */
   825 	 */
   805 	EAP_FUNC_IMPORT eap_status_e send_aka_identity_request_message(
   826 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_aka_identity_request_message(
   806 		const bool pseudonym_decode_failed, ///< This identifies whether the pseudonym decode was failed (true). We must send a IMSI request.
   827 		const bool pseudonym_decode_failed, ///< This identifies whether the pseudonym decode was failed (true). We must send a IMSI request.
   807 		const u8_t eap_identifier ///< This is the EAP-Identifier used with this message.
   828 		const u8_t eap_identifier ///< This is the EAP-Identifier used with this message.
   808 		);
   829 		);
   809 
   830 
   810 	/**
   831 	/**
   811 	 * This function sends the EAP-Response/AKA/Start message.
   832 	 * This function sends the EAP-Response/AKA/Start message.
   812 	 */
   833 	 */
   813 	EAP_FUNC_IMPORT eap_status_e send_aka_identity_response_message(
   834 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_aka_identity_response_message(
   814 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. NOTE received.
   835 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. NOTE received.
   815 		const u8_t received_eap_identifier, ///< This is the EAP-identifier of the received EAP-request message.
   836 		const u8_t received_eap_identifier, ///< This is the EAP-identifier of the received EAP-request message.
   816 		const aka_payload_AT_type_e include_identity_to_aka_identity_response, ///< This is the queried identity type.
   837 		const aka_payload_AT_type_e include_identity_to_aka_identity_response, ///< This is the queried identity type.
   817 		const eap_variable_data_c * const automatic_realm
   838 		const eap_variable_data_c * const automatic_realm
   818 		);
   839 		);
   819 
   840 
   820 	/**
   841 	/**
   821 	 * This function sends the EAP-Response/AKA/Notification message.
   842 	 * This function sends the EAP-Response/AKA/Notification message.
   822 	 */
   843 	 */
   823 	EAP_FUNC_IMPORT eap_status_e send_aka_notification_response(
   844 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_aka_notification_response(
   824 		const eap_aka_notification_codes_e notification_code,
   845 		const eap_aka_notification_codes_e notification_code,
   825 		const bool add_at_counter_attribute
   846 		const bool add_at_counter_attribute
   826 		);
   847 		);
   827 
   848 
   828 	/**
   849 	/**
   829 	 * This function sends the EAP-Response/AKA/Client-Error message.
   850 	 * This function sends the EAP-Response/AKA/Client-Error message.
   830 	 */
   851 	 */
   831 	EAP_FUNC_IMPORT eap_status_e send_aka_client_error_response();
   852 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_aka_client_error_response();
   832 
   853 
   833 	/**
   854 	/**
   834 	 * This function sends the EAP-Request/AKA/Challenge message.
   855 	 * This function sends the EAP-Request/AKA/Challenge message.
   835 	 */
   856 	 */
   836 	EAP_FUNC_IMPORT eap_status_e send_challenge_request_message(
   857 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_challenge_request_message(
   837 		const u8_t eap_identifier ///< This is the EAP-Identifier used with this message.
   858 		const u8_t eap_identifier ///< This is the EAP-Identifier used with this message.
   838 		);
   859 		);
   839 
   860 
   840 	/**
   861 	/**
   841 	 * This function sends the EAP-Response/AKA/Challenge message.
   862 	 * This function sends the EAP-Response/AKA/Challenge message.
   842 	 */
   863 	 */
   843 	EAP_FUNC_IMPORT eap_status_e send_challenge_response_message(
   864 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_challenge_response_message(
   844 		eap_variable_data_c * const K_aut);
   865 		eap_variable_data_c * const K_aut);
   845 
   866 
   846 	EAP_FUNC_IMPORT eap_status_e send_reauthentication_response_message(
   867 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_reauthentication_response_message(
   847 		const eap_variable_data_c * const orig_XKEY,
   868 		const eap_variable_data_c * const orig_XKEY,
   848 		const eap_variable_data_c * const orig_K_aut,
   869 		const eap_variable_data_c * const orig_K_aut,
   849 		const eap_variable_data_c * const orig_K_encr,
   870 		const eap_variable_data_c * const orig_K_encr,
   850 		const eap_variable_data_c * const reauth_username,
   871 		const eap_variable_data_c * const reauth_username,
   851 		const eap_variable_data_c * const reauth_nonce_s,
   872 		const eap_variable_data_c * const reauth_nonce_s,
   855 
   876 
   856 	/**
   877 	/**
   857 	 * This function sends the EAP-Request/AKA/Notification message.
   878 	 * This function sends the EAP-Request/AKA/Notification message.
   858 	 * Message includes the localizable notification string.
   879 	 * Message includes the localizable notification string.
   859 	 */
   880 	 */
   860 	EAP_FUNC_IMPORT eap_status_e send_aka_notification_request(
   881 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_aka_notification_request(
   861 		const eap_aka_notification_codes_e notification_code,
   882 		const eap_aka_notification_codes_e notification_code,
   862 		const bool add_at_counter_attribute
   883 		const bool add_at_counter_attribute
   863 		);
   884 		);
   864 
   885 
   865 	EAP_FUNC_IMPORT eap_status_e send_aka_synchronization_failure_response_message(
   886 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_aka_synchronization_failure_response_message(
   866 		const eap_type_aka_authentication_vector_c * const authentication_vector
   887 		const eap_type_aka_authentication_vector_c * const authentication_vector
   867 		);
   888 		);
   868 
   889 
   869 	EAP_FUNC_IMPORT eap_status_e send_aka_authentication_reject_response_message(
   890 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_aka_authentication_reject_response_message(
   870 		const eap_type_aka_authentication_vector_c * const authentication_vector
   891 		const eap_type_aka_authentication_vector_c * const authentication_vector
   871 		);
   892 		);
   872 
   893 
   873 	/**
   894 	/**
   874 	 * This function encrypts the payload.
   895 	 * This function encrypts the payload.
   875 	 */
   896 	 */
   876 	EAP_FUNC_IMPORT eap_status_e encrypt_DATA_payload(
   897 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e encrypt_DATA_payload(
   877 		u8_t * const EAP_data, ///< This is pointer to the begin of the encrypted payload.
   898 		u8_t * const EAP_data, ///< This is pointer to the begin of the encrypted payload.
   878 		const u32_t cbc_aes_data_length, ///< This is the length of the encrypted payload. This must be aligned to AES block length.
   899 		const u32_t cbc_aes_data_length, ///< This is the length of the encrypted payload. This must be aligned to AES block length.
   879 		const eap_variable_data_c * const IV,
   900 		const eap_variable_data_c * const IV,
   880 		const eap_variable_data_c * const encryption_key
   901 		const eap_variable_data_c * const encryption_key
   881 		);
   902 		);
   882 
   903 
   883 	/**
   904 	/**
   884 	 * This function decrypts the payload.
   905 	 * This function decrypts the payload.
   885 	 * p_aka_payloads->get_ENCR_DATA() points to the decrypted payload.
   906 	 * p_aka_payloads->get_ENCR_DATA() points to the decrypted payload.
   886 	 */
   907 	 */
   887 	EAP_FUNC_IMPORT eap_status_e decrypt_DATA_payload(
   908 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e decrypt_DATA_payload(
   888 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   909 		aka_payloads_c * const p_aka_payloads, ///< This is pointer to all payloads of the received EAP packet.
   889 		const eap_variable_data_c * const encryption_key
   910 		const eap_variable_data_c * const encryption_key
   890 		);
   911 		);
   891 
   912 
   892 	/**
   913 	/**
   893 	 * This function handles the received DATA payload attribute.
   914 	 * This function handles the received DATA payload attribute.
   894 	 * The received encrypte payload have been decrypted before thiscall.
   915 	 * The received encrypte payload have been decrypted before thiscall.
   895 	 * p_aka_payloads->get_ENCR_DATA() includes decrypted DATA payload.
   916 	 * p_aka_payloads->get_ENCR_DATA() includes decrypted DATA payload.
   896 	 */
   917 	 */
   897 	EAP_FUNC_IMPORT eap_status_e handle_DATA_payload(
   918 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_DATA_payload(
   898 		const aka_subtype_e subtype,
   919 		const aka_subtype_e subtype,
   899 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   920 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
   900 		);
   921 		);
   901 
   922 
   902 	//--------------------------------------------------
   923 	//--------------------------------------------------
   903 
   924 
   904 	/**
   925 	/**
   905 	 * This function generate a new NONCE of nonce_size octets length.
   926 	 * This function generate a new NONCE of nonce_size octets length.
   906 	 */
   927 	 */
   907 	EAP_FUNC_IMPORT eap_status_e generate_nonce(
   928 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e generate_nonce(
   908 		const u32_t nonce_size,
   929 		const u32_t nonce_size,
   909 		eap_variable_data_c * const nonce);
   930 		eap_variable_data_c * const nonce);
   910 
   931 
   911 	/**
   932 	/**
   912 	 * This function returns the domain name.
   933 	 * This function returns the domain name.
   913 	 */
   934 	 */
   914 	EAP_FUNC_IMPORT eap_variable_data_c * get_nai_realm();
   935 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_variable_data_c * get_nai_realm();
   915 
   936 
   916 	/**
   937 	/**
   917 	 * This is the situation before the update_buffer_indexes() call.
   938 	 * This is the situation before the update_buffer_indexes() call.
   918 	 * @code
   939 	 * @code
   919 	 * 
   940 	 * 
   944 	 *
   965 	 *
   945 	 * @endcode
   966 	 * @endcode
   946 	 *
   967 	 *
   947 	 * Note maximum_buffer_size could be larger than (m_aka_header_offset + m_MTU + m_trailer_length).
   968 	 * Note maximum_buffer_size could be larger than (m_aka_header_offset + m_MTU + m_trailer_length).
   948 	 */
   969 	 */
   949 	EAP_FUNC_IMPORT void update_buffer_indexes(
   970 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H void update_buffer_indexes(
   950 		const u32_t maximum_buffer_size,
   971 		const u32_t maximum_buffer_size,
   951 		const u32_t payload_size,
   972 		const u32_t payload_size,
   952 		u32_t * const buffer_offset,
   973 		u32_t * const buffer_offset,
   953 		u32_t * const buffer_free);
   974 		u32_t * const buffer_free);
   954 
   975 
   991 	 *
  1012 	 *
   992 	 * @endcode
  1013 	 * @endcode
   993 	 *
  1014 	 *
   994 	 * Note maximum_buffer_size could be larger than (m_aka_header_offset + m_MTU + m_trailer_length).
  1015 	 * Note maximum_buffer_size could be larger than (m_aka_header_offset + m_MTU + m_trailer_length).
   995 	 */
  1016 	 */
   996 	EAP_FUNC_IMPORT void update_payload_indexes(
  1017 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H void update_payload_indexes(
   997 		const u32_t maximum_buffer_size,
  1018 		const u32_t maximum_buffer_size,
   998 		const u32_t eap_header_size,
  1019 		const u32_t eap_header_size,
   999 		const u32_t payload_size,
  1020 		const u32_t payload_size,
  1000 		u32_t * const data_offset,
  1021 		u32_t * const data_offset,
  1001 		u32_t * const data_free,
  1022 		u32_t * const data_free,
  1021 	 * @return Immediately comleted asynchronous call returns eap_status_completed_request.
  1042 	 * @return Immediately comleted asynchronous call returns eap_status_completed_request.
  1022 	 * AM already called the complete_AKA_IMSI_or_pseudonym_or_reauthentication_id_query().
  1043 	 * AM already called the complete_AKA_IMSI_or_pseudonym_or_reauthentication_id_query().
  1023 	 *
  1044 	 *
  1024 	 * @return Other return values are errors.
  1045 	 * @return Other return values are errors.
  1025 	 */
  1046 	 */
  1026 	EAP_FUNC_IMPORT eap_status_e query_AKA_IMSI_or_pseudonym_or_reauthentication_id(
  1047 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e query_AKA_IMSI_or_pseudonym_or_reauthentication_id(
  1027 		eap_variable_data_c * const IMSI, ///< Pointer to IMSI. Buffer for IMSI is allocated during the call.
  1048 		eap_variable_data_c * const IMSI, ///< Pointer to IMSI. Buffer for IMSI is allocated during the call.
  1028 		eap_variable_data_c * const pseudonym_identity, ///< Pointer to pseudonym. Buffer for pseudonym is allocated during the call.
  1049 		eap_variable_data_c * const pseudonym_identity, ///< Pointer to pseudonym. Buffer for pseudonym is allocated during the call.
  1029 		eap_variable_data_c * const reauthentication_identity, ///< Pointer to reauthentication_identity. Buffer for reauthentication_identity is allocated during the call.
  1050 		eap_variable_data_c * const reauthentication_identity, ///< Pointer to reauthentication_identity. Buffer for reauthentication_identity is allocated during the call.
  1030 		eap_variable_data_c * const automatic_realm, ///< If this is not used, do not add any data to this parameter.
  1051 		eap_variable_data_c * const automatic_realm, ///< If this is not used, do not add any data to this parameter.
  1031 		u32_t * const length_of_mnc,
  1052 		u32_t * const length_of_mnc,
  1049 	 * @return Immediately comleted asynchronous call returns eap_status_completed_request.
  1070 	 * @return Immediately comleted asynchronous call returns eap_status_completed_request.
  1050 	 * AM already called the complete_AKA_RES_query().
  1071 	 * AM already called the complete_AKA_RES_query().
  1051 	 *
  1072 	 *
  1052 	 * @return Other return values are errors.
  1073 	 * @return Other return values are errors.
  1053 	 */
  1074 	 */
  1054 	EAP_FUNC_IMPORT eap_status_e query_AKA_RES(
  1075 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e query_AKA_RES(
  1055 		eap_type_aka_authentication_vector_c * const authentication_vector
  1076 		eap_type_aka_authentication_vector_c * const authentication_vector
  1056 		);
  1077 		);
  1057 
  1078 
  1058 	/**
  1079 	/**
  1059 	 * This function queries the authentication_vector.
  1080 	 * This function queries the authentication_vector.
  1069 	 * @return Immediately comleted asynchronous call returns eap_status_completed_request.
  1090 	 * @return Immediately comleted asynchronous call returns eap_status_completed_request.
  1070 	 * AM already called the complete_AKA_authentication_vector_query().
  1091 	 * AM already called the complete_AKA_authentication_vector_query().
  1071 	 *
  1092 	 *
  1072 	 * @return Other return values are errors.
  1093 	 * @return Other return values are errors.
  1073 	 */
  1094 	 */
  1074 	EAP_FUNC_IMPORT eap_status_e query_AKA_authentication_vector(
  1095 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e query_AKA_authentication_vector(
  1075 		const u8_t next_eap_identifier,
  1096 		const u8_t next_eap_identifier,
  1076 		eap_type_aka_identity_type * const identity_type
  1097 		eap_type_aka_identity_type * const identity_type
  1077 		);
  1098 		);
  1078 
  1099 
  1079 	/**
  1100 	/**
  1084 	 * Also encrypted payload (l_aka_payloads.get_ENCR_DATA()) is handled here.
  1105 	 * Also encrypted payload (l_aka_payloads.get_ENCR_DATA()) is handled here.
  1085 	 * This is the first place where we have the K_encr (get_K_encr()) available.
  1106 	 * This is the first place where we have the K_encr (get_K_encr()) available.
  1086 	 * The decrpted DATA payload is handled immediately in handle_DATA_payload() function.
  1107 	 * The decrpted DATA payload is handled immediately in handle_DATA_payload() function.
  1087 	 * Then function calculates MAC_SRES and sends EAP-Response/AKA/Challenge.
  1108 	 * Then function calculates MAC_SRES and sends EAP-Response/AKA/Challenge.
  1088 	 */
  1109 	 */
  1089 	EAP_FUNC_IMPORT eap_status_e process_AKA_kc_sres(
  1110 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e process_AKA_kc_sres(
  1090 		const eap_type_aka_authentication_vector_c * const authentication_vector
  1111 		const eap_type_aka_authentication_vector_c * const authentication_vector
  1091 		);
  1112 		);
  1092 
  1113 
  1093 	/**
  1114 	/**
  1094 	 * This function selects whether to use pseudonym or IMSI.
  1115 	 * This function selects whether to use pseudonym or IMSI.
  1095 	 * Function creates NAI and EAP-Response/Identity message.
  1116 	 * Function creates NAI and EAP-Response/Identity message.
  1096 	 * Message is sent immediately.
  1117 	 * Message is sent immediately.
  1097 	 */
  1118 	 */
  1098 	EAP_FUNC_IMPORT eap_status_e process_AKA_IMSI(
  1119 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e process_AKA_IMSI(
  1099 		const eap_variable_data_c * const IMSI, ///< This is the IMSI.
  1120 		const eap_variable_data_c * const IMSI, ///< This is the IMSI.
  1100 		const eap_variable_data_c * const pseudonym ///< This is the pseudonym.
  1121 		const eap_variable_data_c * const pseudonym ///< This is the pseudonym.
  1101 		);
  1122 		);
  1102 
  1123 
  1103 
  1124 
  1104 	/**
  1125 	/**
  1105 	 * This function calculates the MAC_SRES.
  1126 	 * This function calculates the MAC_SRES.
  1106 	 */
  1127 	 */
  1107 	EAP_FUNC_IMPORT eap_status_e calculate_MAC_SRES(
  1128 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e calculate_MAC_SRES(
  1108 		eap_variable_data_c * const MAC_SRES, ///< This is the calculated MAC_SRES.
  1129 		eap_variable_data_c * const MAC_SRES, ///< This is the calculated MAC_SRES.
  1109 		const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC.
  1130 		const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC.
  1110 		const eap_variable_data_c * const n_sres ///< This includes concatenated n SRES.
  1131 		const eap_variable_data_c * const n_sres ///< This includes concatenated n SRES.
  1111 		);
  1132 		);
  1112 
  1133 
  1113 	/**
  1134 	/**
  1114 	 * This function reads the identity payload. Identity is stored to get_identity().
  1135 	 * This function reads the identity payload. Identity is stored to get_identity().
  1115 	 */
  1136 	 */
  1116 	EAP_FUNC_IMPORT eap_status_e parse_identity(
  1137 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e parse_identity(
  1117 		const u8_t * const identity, ///< This is pointer to received EAP-Identity buffer.
  1138 		const u8_t * const identity, ///< This is pointer to received EAP-Identity buffer.
  1118 		const u32_t identity_length ///< This is length of received EAP-Identity buffer.
  1139 		const u32_t identity_length ///< This is length of received EAP-Identity buffer.
  1119 		);
  1140 		);
  1120 
  1141 
  1121 
  1142 
  1122 	EAP_FUNC_IMPORT eap_status_e handle_eap_identity_query(
  1143 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_eap_identity_query(
  1123 		const eap_am_network_id_c * const send_network_id,
  1144 		const eap_am_network_id_c * const send_network_id,
  1124 		eap_variable_data_c * const identity,
  1145 		eap_variable_data_c * const identity,
  1125 		const u8_t eap_identifier,
  1146 		const u8_t eap_identifier,
  1126 		const eap_variable_data_c * const IMSI,
  1147 		const eap_variable_data_c * const IMSI,
  1127 		const eap_variable_data_c * const pseudonym,
  1148 		const eap_variable_data_c * const pseudonym,
  1137 	 * Function queries the AM (query_imsi_from_username()) whether the pseudonym
  1158 	 * Function queries the AM (query_imsi_from_username()) whether the pseudonym
  1138 	 * is known or should it query peer the IMSI.
  1159 	 * is known or should it query peer the IMSI.
  1139 	 * Currently the query_imsi_from_username() is synchronous call.
  1160 	 * Currently the query_imsi_from_username() is synchronous call.
  1140 	 * The send_aka_identity_request_message() function will send the EAP-Request/AKA/Start message.
  1161 	 * The send_aka_identity_request_message() function will send the EAP-Request/AKA/Start message.
  1141 	 */
  1162 	 */
  1142 	EAP_FUNC_IMPORT eap_status_e handle_identity_response_message(
  1163 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_identity_response_message(
  1143 		eap_header_rd_c * const eap_header, ///< This is the received EAP-Identity packet, pointer points to the header.
  1164 		eap_header_rd_c * const eap_header, ///< This is the received EAP-Identity packet, pointer points to the header.
  1144 		const u32_t aka_packet_length ///< This is length of received AKA EAP packet.
  1165 		const u32_t aka_packet_length ///< This is length of received AKA EAP packet.
  1145 		);
  1166 		);
  1146 
  1167 
  1147 	/**
  1168 	/**
  1148 	 * This function handles the received EAP-Request/AKA/Start message.
  1169 	 * This function handles the received EAP-Request/AKA/Start message.
  1149 	 * Function checks the valid payloads and calls send_aka_identity_response_message() that sends EAP-Response/AKA/Start message.
  1170 	 * Function checks the valid payloads and calls send_aka_identity_response_message() that sends EAP-Response/AKA/Start message.
  1150 	 */
  1171 	 */
  1151 	EAP_FUNC_IMPORT eap_status_e handle_aka_identity_request_message(
  1172 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_aka_identity_request_message(
  1152 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1173 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1153 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1174 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1154 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1175 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1155 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1176 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1156 		);
  1177 		);
  1157 
  1178 
  1158 	EAP_FUNC_IMPORT eap_status_e handle_aka_notification_request_message_reauthentication(
  1179 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_aka_notification_request_message_reauthentication(
  1159 		const eap_am_network_id_c * const receive_network_id,
  1180 		const eap_am_network_id_c * const receive_network_id,
  1160 		aka_header_c * const received_aka,
  1181 		aka_header_c * const received_aka,
  1161 		const u32_t aka_packet_length,
  1182 		const u32_t aka_packet_length,
  1162 		aka_payloads_c * const p_aka_payloads);
  1183 		aka_payloads_c * const p_aka_payloads);
  1163 
  1184 
  1164 	EAP_FUNC_IMPORT eap_status_e handle_aka_notification_request_message_full_authentication(
  1185 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_aka_notification_request_message_full_authentication(
  1165 		const eap_am_network_id_c * const receive_network_id,
  1186 		const eap_am_network_id_c * const receive_network_id,
  1166 		aka_header_c * const received_aka,
  1187 		aka_header_c * const received_aka,
  1167 		const u32_t aka_packet_length,
  1188 		const u32_t aka_packet_length,
  1168 		aka_payloads_c * const p_aka_payloads);
  1189 		aka_payloads_c * const p_aka_payloads);
  1169 
  1190 
  1170 	/**
  1191 	/**
  1171 	 * This function handles the received EAP-Request/AKA/Notification message.
  1192 	 * This function handles the received EAP-Request/AKA/Notification message.
  1172 	 * Function checks the valid payloads and calls send_notification_response_message() that sends EAP-Response/AKA/Notification message.
  1193 	 * Function checks the valid payloads and calls send_notification_response_message() that sends EAP-Response/AKA/Notification message.
  1173 	 */
  1194 	 */
  1174 	EAP_FUNC_IMPORT eap_status_e handle_aka_notification_request_message(
  1195 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_aka_notification_request_message(
  1175 		const eap_am_network_id_c * const receive_network_id,
  1196 		const eap_am_network_id_c * const receive_network_id,
  1176 		aka_header_c * const received_aka,
  1197 		aka_header_c * const received_aka,
  1177 		const u32_t aka_packet_length,
  1198 		const u32_t aka_packet_length,
  1178 		aka_payloads_c * const p_aka_payloads);
  1199 		aka_payloads_c * const p_aka_payloads);
  1179 
  1200 
  1185 	 * after n*Kc and n*SRES is get from AKA.
  1206 	 * after n*Kc and n*SRES is get from AKA.
  1186 	 * Function calls query_AKA_RES(). The query_AKA_kc_sres() function
  1207 	 * Function calls query_AKA_RES(). The query_AKA_kc_sres() function
  1187 	 * is completed using complete_AKA_RES_query() function. The complete_AKA_RES_query()
  1208 	 * is completed using complete_AKA_RES_query() function. The complete_AKA_RES_query()
  1188 	 * function will call process_AKA_kc_sres().
  1209 	 * function will call process_AKA_kc_sres().
  1189 	 */
  1210 	 */
  1190 	EAP_FUNC_IMPORT eap_status_e handle_challenge_request_message(
  1211 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_challenge_request_message(
  1191 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1212 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1192 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1213 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1193 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1214 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1194 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1215 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1195 		);
  1216 		);
  1202 	 * after n*Kc and n*SRES is get from AKA.
  1223 	 * after n*Kc and n*SRES is get from AKA.
  1203 	 * Function calls query_AKA_RES(). The query_AKA_RES() function
  1224 	 * Function calls query_AKA_RES(). The query_AKA_RES() function
  1204 	 * is completed using complete_AKA_RES_query() function. The complete_AKA_RES_query()
  1225 	 * is completed using complete_AKA_RES_query() function. The complete_AKA_RES_query()
  1205 	 * function will call process_AKA_kc_sres().
  1226 	 * function will call process_AKA_kc_sres().
  1206 	 */
  1227 	 */
  1207 	EAP_FUNC_IMPORT eap_status_e handle_reauthentication_request_message(
  1228 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_reauthentication_request_message(
  1208 		const eap_am_network_id_c * const receive_network_id,
  1229 		const eap_am_network_id_c * const receive_network_id,
  1209 		aka_header_c * const received_aka,
  1230 		aka_header_c * const received_aka,
  1210 		const u32_t aka_packet_length,
  1231 		const u32_t aka_packet_length,
  1211 		aka_payloads_c * const p_aka_payloads);
  1232 		aka_payloads_c * const p_aka_payloads);
  1212 
  1233 
  1213 	EAP_FUNC_IMPORT eap_status_e check_challenge_response_message(
  1234 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e check_challenge_response_message(
  1214 		const eap_am_network_id_c * const receive_network_id,
  1235 		const eap_am_network_id_c * const receive_network_id,
  1215 		aka_header_c * const received_aka,
  1236 		aka_header_c * const received_aka,
  1216 		const u32_t aka_packet_length,
  1237 		const u32_t aka_packet_length,
  1217 		aka_payloads_c * const p_aka_payloads);
  1238 		aka_payloads_c * const p_aka_payloads);
  1218 
  1239 
  1221 	 * Function checks the valid payloads. If IMSI is included it is copied to get_IMSI().
  1242 	 * Function checks the valid payloads. If IMSI is included it is copied to get_IMSI().
  1222 	 * Also the included NONCE_MT is copied to get_NONCE_MT().
  1243 	 * Also the included NONCE_MT is copied to get_NONCE_MT().
  1223 	 * Function calls the query_AKA_authentication_vector() of AM to get fresh authentication_vector.
  1244 	 * Function calls the query_AKA_authentication_vector() of AM to get fresh authentication_vector.
  1224 	 * The query_AKA_authentication_vector() function is completed by AM using complete_AKA_authentication_vector_query() function.
  1245 	 * The query_AKA_authentication_vector() function is completed by AM using complete_AKA_authentication_vector_query() function.
  1225 	 */
  1246 	 */
  1226 	EAP_FUNC_IMPORT eap_status_e handle_aka_identity_response_message(
  1247 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_aka_identity_response_message(
  1227 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1248 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1228 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1249 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1229 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1250 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1230 		);
  1251 		);
  1231 
  1252 
  1232 	EAP_FUNC_IMPORT eap_status_e handle_notification_response_message_reauthentication(
  1253 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_notification_response_message_reauthentication(
  1233 		const eap_am_network_id_c * const receive_network_id,
  1254 		const eap_am_network_id_c * const receive_network_id,
  1234 		aka_header_c * const received_aka,
  1255 		aka_header_c * const received_aka,
  1235 		const u32_t aka_packet_length,
  1256 		const u32_t aka_packet_length,
  1236 		aka_payloads_c * const p_aka_payloads);
  1257 		aka_payloads_c * const p_aka_payloads);
  1237 
  1258 
  1238 	EAP_FUNC_IMPORT eap_status_e handle_notification_response_message_full_authentication(
  1259 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_notification_response_message_full_authentication(
  1239 		const eap_am_network_id_c * const receive_network_id,
  1260 		const eap_am_network_id_c * const receive_network_id,
  1240 		aka_header_c * const received_aka,
  1261 		aka_header_c * const received_aka,
  1241 		const u32_t aka_packet_length,
  1262 		const u32_t aka_packet_length,
  1242 		aka_payloads_c * const p_aka_payloads);
  1263 		aka_payloads_c * const p_aka_payloads);
  1243 
  1264 
  1244 	/**
  1265 	/**
  1245 	 * This function handles the received EAP-Response/AKA/Notification message.
  1266 	 * This function handles the received EAP-Response/AKA/Notification message.
  1246 	 * Function checks the valid payloads.
  1267 	 * Function checks the valid payloads.
  1247 	 */
  1268 	 */
  1248 	EAP_FUNC_IMPORT eap_status_e handle_notification_response_message(
  1269 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_notification_response_message(
  1249 		const eap_am_network_id_c * const receive_network_id,
  1270 		const eap_am_network_id_c * const receive_network_id,
  1250 		aka_header_c * const received_aka,
  1271 		aka_header_c * const received_aka,
  1251 		const u32_t aka_packet_length,
  1272 		const u32_t aka_packet_length,
  1252 		aka_payloads_c * const p_aka_payloads);
  1273 		aka_payloads_c * const p_aka_payloads);
  1253 
  1274 
  1255 	 * This function handles the received EAP-Response/AKA/Challenge message.
  1276 	 * This function handles the received EAP-Response/AKA/Challenge message.
  1256 	 * Function checks the valid payloads. The analyse_MAC_SRES_payload() function is
  1277 	 * Function checks the valid payloads. The analyse_MAC_SRES_payload() function is
  1257 	 * called to check MAC_SRES. If it returns eap_status_success the authentication was succesfull
  1278 	 * called to check MAC_SRES. If it returns eap_status_success the authentication was succesfull
  1258 	 * and this function calls the send_eap_success() to send EAP-Success message.
  1279 	 * and this function calls the send_eap_success() to send EAP-Success message.
  1259 	 */
  1280 	 */
  1260 	EAP_FUNC_IMPORT eap_status_e handle_challenge_response_message(
  1281 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_challenge_response_message(
  1261 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1282 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1262 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1283 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1263 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1284 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1264 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1285 		aka_payloads_c * const p_aka_payloads ///< This is pointer to all payloads of the received EAP packet.
  1265 		);
  1286 		);
  1266 
  1287 
  1267 	EAP_FUNC_IMPORT eap_status_e handle_reauthentication_response_message(
  1288 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_reauthentication_response_message(
  1268 		const eap_am_network_id_c * const /* receive_network_id */,
  1289 		const eap_am_network_id_c * const /* receive_network_id */,
  1269 		aka_header_c * const received_aka,
  1290 		aka_header_c * const received_aka,
  1270 		const u32_t aka_packet_length,
  1291 		const u32_t aka_packet_length,
  1271 		aka_payloads_c * const p_aka_payloads);
  1292 		aka_payloads_c * const p_aka_payloads);
  1272 
  1293 
  1273 	EAP_FUNC_IMPORT eap_status_e handle_client_error_response_message(
  1294 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_client_error_response_message(
  1274 		const eap_am_network_id_c * const /* receive_network_id */,
  1295 		const eap_am_network_id_c * const /* receive_network_id */,
  1275 		aka_header_c * const received_aka,
  1296 		aka_header_c * const received_aka,
  1276 		const u32_t aka_packet_length,
  1297 		const u32_t aka_packet_length,
  1277 		aka_payloads_c * const p_aka_payloads);
  1298 		aka_payloads_c * const p_aka_payloads);
  1278 
  1299 
  1279 	/**
  1300 	/**
  1280 	 * This function sends and traces all messages.
  1301 	 * This function sends and traces all messages.
  1281 	 */
  1302 	 */
  1282 	EAP_FUNC_IMPORT eap_status_e packet_send(
  1303 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e packet_send(
  1283 		const eap_am_network_id_c * const network_id,
  1304 		const eap_am_network_id_c * const network_id,
  1284 		eap_buf_chain_wr_c * const sent_packet,
  1305 		eap_buf_chain_wr_c * const sent_packet,
  1285 		const u32_t header_offset,
  1306 		const u32_t header_offset,
  1286 		const u32_t data_length,
  1307 		const u32_t data_length,
  1287 		const u32_t buffer_length);
  1308 		const u32_t buffer_length);
  1288 
  1309 
  1289 	/**
  1310 	/**
  1290 	 * This function chechs NAI.
  1311 	 * This function chechs NAI.
  1291 	 */
  1312 	 */
  1292 	EAP_FUNC_IMPORT eap_status_e check_NAI(
  1313 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e check_NAI(
  1293 		const u8_t * const identity,
  1314 		const u8_t * const identity,
  1294 		const u32_t identity_length,
  1315 		const u32_t identity_length,
  1295 		const u8_t * const at_character);
  1316 		const u8_t * const at_character);
  1296 
  1317 
  1297 	/**
  1318 	/**
  1298 	 * This function traces the EAP packet.
  1319 	 * This function traces the EAP packet.
  1299 	 */
  1320 	 */
  1300 	EAP_FUNC_IMPORT void packet_trace(
  1321 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H void packet_trace(
  1301 		eap_const_string prefix,
  1322 		eap_const_string prefix,
  1302 		const eap_am_network_id_c * const receive_network_id,
  1323 		const eap_am_network_id_c * const receive_network_id,
  1303 		eap_header_wr_c * const received_eap,
  1324 		eap_header_wr_c * const received_eap,
  1304 		const u32_t eap_packet_length);
  1325 		const u32_t eap_packet_length);
  1305 
  1326 
  1318 	/**
  1339 	/**
  1319 	 * This function finishes the successfull authentication.
  1340 	 * This function finishes the successfull authentication.
  1320 	 * Generated keys are offered to lower layer.
  1341 	 * Generated keys are offered to lower layer.
  1321 	 * Connection handle is initialised.
  1342 	 * Connection handle is initialised.
  1322 	 */
  1343 	 */
  1323 	EAP_FUNC_IMPORT eap_status_e finish_successful_authentication(
  1344 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e finish_successful_authentication(
  1324 		const eap_am_network_id_c * const receive_network_id);
  1345 		const eap_am_network_id_c * const receive_network_id);
  1325 
  1346 
  1326 	/**
  1347 	/**
  1327 	 * This function sends a notification of possible failed authentication
  1348 	 * This function sends a notification of possible failed authentication
  1328 	 * to lower layer.
  1349 	 * to lower layer.
  1329 	 */
  1350 	 */
  1330 	EAP_FUNC_IMPORT eap_status_e send_final_notification();
  1351 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e send_final_notification();
  1331 
  1352 
  1332 	EAP_FUNC_IMPORT eap_status_e new_handler(
  1353 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e new_handler(
  1333 		const eap_am_network_id_c * const receive_network_id,
  1354 		const eap_am_network_id_c * const receive_network_id,
  1334 		const bool is_client_when_true);
  1355 		const bool is_client_when_true);
  1335 
  1356 
  1336 	EAP_FUNC_IMPORT bool randomly_refuse_eap_identity();
  1357 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H bool randomly_refuse_eap_identity();
  1337 
  1358 
  1338 	/**
  1359 	/**
  1339 	 * This function processes the AKA packets.
  1360 	 * This function processes the AKA packets.
  1340 	 */
  1361 	 */
  1341 	EAP_FUNC_IMPORT eap_status_e aka_packet_process(
  1362 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e aka_packet_process(
  1342 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1363 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1343 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1364 		aka_header_c * const received_aka, ///< This is pointer to EAP header including AKA fields.
  1344 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1365 		const u32_t aka_packet_length, ///< This is length of received AKA EAP packet.
  1345 		const bool is_client_when_true ///< Indicates whether this is client (true) or server (false).
  1366 		const bool is_client_when_true ///< Indicates whether this is client (true) or server (false).
  1346 		);
  1367 		);
  1347 
  1368 
  1348 	EAP_FUNC_IMPORT eap_status_e cancel_error_message_delay_timer();
  1369 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e cancel_error_message_delay_timer();
  1349 
  1370 
  1350 	EAP_FUNC_IMPORT eap_status_e set_error_message_delay_timer();
  1371 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e set_error_message_delay_timer();
  1351 
  1372 
  1352 	EAP_FUNC_IMPORT eap_status_e handle_error_packet();
  1373 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_error_packet();
  1353 
  1374 
  1354 	/**
  1375 	/**
  1355 	 * This function initializes the error message.
  1376 	 * This function initializes the error message.
  1356 	 */
  1377 	 */
  1357 	EAP_FUNC_IMPORT eap_status_e initialize_error_message(
  1378 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e initialize_error_message(
  1358 		const eap_status_e error_status
  1379 		const eap_status_e error_status
  1359 		);
  1380 		);
  1360 
  1381 
  1361 	EAP_FUNC_IMPORT eap_status_e check_synchronization_failure_response_message(
  1382 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e check_synchronization_failure_response_message(
  1362 		const eap_am_network_id_c * const /* receive_network_id */,
  1383 		const eap_am_network_id_c * const /* receive_network_id */,
  1363 		aka_header_c * const received_aka,
  1384 		aka_header_c * const received_aka,
  1364 		const u32_t aka_packet_length,
  1385 		const u32_t aka_packet_length,
  1365 		aka_payloads_c * const p_aka_payloads);
  1386 		aka_payloads_c * const p_aka_payloads);
  1366 
  1387 
  1367 	EAP_FUNC_IMPORT eap_status_e complete_re_syncronization_query(
  1388 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e complete_re_syncronization_query(
  1368 		const u8_t next_eap_identifier,
  1389 		const u8_t next_eap_identifier,
  1369 		const eap_type_aka_authentication_vector_c * const authentication_vector);
  1390 		const eap_type_aka_authentication_vector_c * const authentication_vector);
  1370 
  1391 
  1371 	EAP_FUNC_IMPORT eap_status_e process_re_syncronization(
  1392 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e process_re_syncronization(
  1372 		const u8_t next_eap_identifier,
  1393 		const u8_t next_eap_identifier,
  1373 		const eap_type_aka_authentication_vector_c * const authentication_vector);
  1394 		const eap_type_aka_authentication_vector_c * const authentication_vector);
  1374 
  1395 
  1375 	EAP_FUNC_IMPORT eap_status_e handle_synchronization_failure_response_message(
  1396 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_synchronization_failure_response_message(
  1376 		const eap_am_network_id_c * const /* receive_network_id */,
  1397 		const eap_am_network_id_c * const /* receive_network_id */,
  1377 		aka_header_c * const received_aka,
  1398 		aka_header_c * const received_aka,
  1378 		const u32_t aka_packet_length,
  1399 		const u32_t aka_packet_length,
  1379 		aka_payloads_c * const p_aka_payloads);
  1400 		aka_payloads_c * const p_aka_payloads);
  1380 
  1401 
  1381 	EAP_FUNC_IMPORT eap_status_e handle_aka_identity_response_message_completion(
  1402 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_aka_identity_response_message_completion(
  1382 		const u8_t next_eap_identifier,
  1403 		const u8_t next_eap_identifier,
  1383 		const eap_status_e identity_status,
  1404 		const eap_status_e identity_status,
  1384 		const eap_type_aka_identity_type identity_type,
  1405 		const eap_type_aka_identity_type identity_type,
  1385 		const bool identity_payload_was_included);
  1406 		const bool identity_payload_was_included);
  1386 
  1407 
  1387 	EAP_FUNC_IMPORT eap_status_e initialize_notification_message();
  1408 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e initialize_notification_message();
  1388 
  1409 
  1389 	EAP_FUNC_IMPORT eap_status_e cancel_notification_message_delay_timer();
  1410 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e cancel_notification_message_delay_timer();
  1390 
  1411 
  1391 	EAP_FUNC_IMPORT eap_status_e set_notification_message_delay_timer();
  1412 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e set_notification_message_delay_timer();
  1392 
  1413 
  1393 	EAP_FUNC_IMPORT eap_status_e handle_notification_packet();
  1414 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_notification_packet();
  1394 
  1415 
  1395 	bool get_aka_notification_code_F_bit(const eap_aka_notification_codes_e notification_code);
  1416 	bool get_aka_notification_code_F_bit(const eap_aka_notification_codes_e notification_code);
  1396 
  1417 
  1397 	bool get_aka_notification_code_P_bit(const eap_aka_notification_codes_e notification_code);
  1418 	bool get_aka_notification_code_P_bit(const eap_aka_notification_codes_e notification_code);
  1398 
  1419 
  1399 	EAP_FUNC_IMPORT bool random_selection();
  1420 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H bool random_selection();
  1400 
  1421 
  1401 
  1422 
  1402 	EAP_FUNC_IMPORT eap_status_e checkcode_init();
  1423 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_init();
  1403 
  1424 
  1404 	EAP_FUNC_IMPORT static bool compare_payload_first_is_less(
  1425 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H static bool compare_payload_first_is_less(
  1405 		const aka_payload_AT_type_e * const first,
  1426 		const aka_payload_AT_type_e * const first,
  1406 		const aka_payload_AT_type_e * const second,
  1427 		const aka_payload_AT_type_e * const second,
  1407 		abs_eap_am_tools_c * const m_am_tools);
  1428 		abs_eap_am_tools_c * const m_am_tools);
  1408 
  1429 
  1409 	EAP_FUNC_IMPORT eap_status_e checkcode_verify_payloads(
  1430 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_verify_payloads(
  1410 		aka_payloads_c * const p_aka_payloads);
  1431 		aka_payloads_c * const p_aka_payloads);
  1411 
  1432 
  1412 	EAP_FUNC_IMPORT eap_status_e checkcode_save_message_client(
  1433 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_save_message_client(
  1413 		const void * const data,
  1434 		const void * const data,
  1414 		const u32_t data_length,
  1435 		const u32_t data_length,
  1415 		aka_payloads_c * const p_aka_payloads);
  1436 		aka_payloads_c * const p_aka_payloads);
  1416 
  1437 
  1417 	EAP_FUNC_IMPORT eap_status_e checkcode_save_message_server(
  1438 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_save_message_server(
  1418 		const void * const data,
  1439 		const void * const data,
  1419 		const u32_t data_length);
  1440 		const u32_t data_length);
  1420 
  1441 
  1421 	EAP_FUNC_IMPORT eap_status_e checkcode_update_saved_message();
  1442 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_update_saved_message();
  1422 
  1443 
  1423 	EAP_FUNC_IMPORT eap_status_e checkcode_update(
  1444 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_update(
  1424 		const void * const data,
  1445 		const void * const data,
  1425 		const u32_t data_length);
  1446 		const u32_t data_length);
  1426 
  1447 
  1427 	EAP_FUNC_IMPORT eap_status_e checkcode_final(
  1448 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_final(
  1428 		eap_variable_data_c * const digest);
  1449 		eap_variable_data_c * const digest);
  1429 
  1450 
  1430 	EAP_FUNC_IMPORT eap_status_e checkcode_verify(
  1451 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e checkcode_verify(
  1431 		const eap_variable_data_c * const received_digest);
  1452 		const eap_variable_data_c * const received_digest);
  1432 
  1453 
  1433 	/**
  1454 	/**
  1434 	 * This function stores identity.
  1455 	 * This function stores identity.
  1435 	 */
  1456 	 */
  1436 	EAP_FUNC_IMPORT eap_status_e store_identity(
  1457 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e store_identity(
  1437 		const eap_variable_data_c * const IMSI_or_pseudonym,
  1458 		const eap_variable_data_c * const IMSI_or_pseudonym,
  1438 		const bool IMSI_is_used);
  1459 		const bool IMSI_is_used);
  1439 
  1460 
  1440 	/**
  1461 	/**
  1441 	 * eap_core_map_c class increases reference count each time reference to stored object is get.
  1462 	 * eap_core_map_c class increases reference count each time reference to stored object is get.
  1536 
  1557 
  1537 	/**
  1558 	/**
  1538 	 * This function checks the received AKA subtype is valid in current state.
  1559 	 * This function checks the received AKA subtype is valid in current state.
  1539 	 * This is used for quick check.
  1560 	 * This is used for quick check.
  1540 	 */
  1561 	 */
  1541 	EAP_FUNC_IMPORT eap_status_e check_valid_state(aka_subtype_e type);
  1562 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e check_valid_state(aka_subtype_e type);
  1542 
  1563 
  1543 	/**
  1564 	/**
  1544 	 * This function sets the m_authentication_finished_successfully flag true.
  1565 	 * This function sets the m_authentication_finished_successfully flag true.
  1545 	 */
  1566 	 */
  1546 	void set_authentication_finished_successfully();
  1567 	void set_authentication_finished_successfully();
  1558 	//--------------------------------------------------
  1579 	//--------------------------------------------------
  1559 
  1580 
  1560 	/**
  1581 	/**
  1561 	 * This function generates K_encr, K_aut and master_session_key.
  1582 	 * This function generates K_encr, K_aut and master_session_key.
  1562 	 */
  1583 	 */
  1563 	EAP_FUNC_IMPORT eap_status_e generate_shared_secred_keys(
  1584 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e generate_shared_secred_keys(
  1564 		const u32_t key_length,
  1585 		const u32_t key_length,
  1565 		const eap_variable_data_c * const CK,
  1586 		const eap_variable_data_c * const CK,
  1566 		const eap_variable_data_c * const IK,
  1587 		const eap_variable_data_c * const IK,
  1567 		eap_variable_data_c * const XKEY,
  1588 		eap_variable_data_c * const XKEY,
  1568 		eap_variable_data_c * const K_encr,
  1589 		eap_variable_data_c * const K_encr,
  1573 	//--------------------------------------------------
  1594 	//--------------------------------------------------
  1574 
  1595 
  1575 	/**
  1596 	/**
  1576 	 * This function generates K_encr, K_aut and master_session_key.
  1597 	 * This function generates K_encr, K_aut and master_session_key.
  1577 	 */
  1598 	 */
  1578 	EAP_FUNC_IMPORT eap_status_e generate_reauth_shared_secred_keys(
  1599 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e generate_reauth_shared_secred_keys(
  1579 		const u32_t key_length,
  1600 		const u32_t key_length,
  1580 		const eap_variable_data_c * const orig_XKEY,
  1601 		const eap_variable_data_c * const orig_XKEY,
  1581 		const u32_t reauth_counter,
  1602 		const u32_t reauth_counter,
  1582 		const eap_variable_data_c * const reauth_identity,
  1603 		const eap_variable_data_c * const reauth_identity,
  1583 		const eap_variable_data_c * const reauth_nonce_s,
  1604 		const eap_variable_data_c * const reauth_nonce_s,
  1673 	eap_status_e store_last_encryption_iv(const eap_variable_data_c * const encryption_IV);
  1694 	eap_status_e store_last_encryption_iv(const eap_variable_data_c * const encryption_IV);
  1674 
  1695 
  1675 	/**
  1696 	/**
  1676 	 * Currently this does nothing and this is not called anywhere.
  1697 	 * Currently this does nothing and this is not called anywhere.
  1677 	 */
  1698 	 */
  1678 	EAP_FUNC_IMPORT void delete_unused_keys();
  1699 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H void delete_unused_keys();
  1679 
  1700 
  1680 
  1701 
  1681 	/**
  1702 	/**
  1682 	 * This function returns string of the current state. This is for trace purposes.
  1703 	 * This function returns string of the current state. This is for trace purposes.
  1683 	 */
  1704 	 */
  1684 	EAP_FUNC_IMPORT eap_const_string get_state_string() const;
  1705 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_const_string get_state_string() const;
  1685 
  1706 
  1686 	/**
  1707 	/**
  1687 	 * This function returns string of the current state. This is for trace purposes.
  1708 	 * This function returns string of the current state. This is for trace purposes.
  1688 	 */
  1709 	 */
  1689 	EAP_FUNC_IMPORT eap_const_string get_saved_previous_state_string() const;
  1710 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_const_string get_saved_previous_state_string() const;
  1690 
  1711 
  1691 	/**
  1712 	/**
  1692 	 * This function initializes a timer to sends the EAP-Request/Failure message.
  1713 	 * This function initializes a timer to sends the EAP-Request/Failure message.
  1693 	 */
  1714 	 */
  1694 	EAP_FUNC_IMPORT eap_status_e initialize_eap_failure_timer();
  1715 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e initialize_eap_failure_timer();
  1695 
  1716 
  1696 	/**
  1717 	/**
  1697 	 * This function cancels a timer to sends the EAP-Request/Failure message.
  1718 	 * This function cancels a timer to sends the EAP-Request/Failure message.
  1698 	 */
  1719 	 */
  1699 	EAP_FUNC_IMPORT eap_status_e cancel_eap_failure_timer();
  1720 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e cancel_eap_failure_timer();
  1700 
  1721 
  1701 	/**
  1722 	/**
  1702 	 * This function initializes a timer to sends the EAP-Response/Notification message.
  1723 	 * This function initializes a timer to sends the EAP-Response/Notification message.
  1703 	 */
  1724 	 */
  1704 	EAP_FUNC_IMPORT eap_status_e initialize_eap_notification_timer();
  1725 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e initialize_eap_notification_timer();
  1705 
  1726 
  1706 	/**
  1727 	/**
  1707 	 * This function cancels a timer to sends the EAP-Response/Notification message.
  1728 	 * This function cancels a timer to sends the EAP-Response/Notification message.
  1708 	 */
  1729 	 */
  1709 	EAP_FUNC_IMPORT eap_status_e cancel_eap_notification_timer();
  1730 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e cancel_eap_notification_timer();
  1710 
  1731 
  1711 	/**
  1732 	/**
  1712 	 * This function initializes a timer to sends the EAP-Response/Failure message.
  1733 	 * This function initializes a timer to sends the EAP-Response/Failure message.
  1713 	 */
  1734 	 */
  1714 	EAP_FUNC_IMPORT eap_status_e initialize_failure_message_received_timer();
  1735 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e initialize_failure_message_received_timer();
  1715 
  1736 
  1716 	/**
  1737 	/**
  1717 	 * This function cancels a timer to sends the EAP-Response/Failure message.
  1738 	 * This function cancels a timer to sends the EAP-Response/Failure message.
  1718 	 */
  1739 	 */
  1719 	EAP_FUNC_IMPORT eap_status_e cancel_failure_message_received_timer();
  1740 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e cancel_failure_message_received_timer();
  1720 
  1741 
  1721 	u32_t get_mnc_length(const u32_t mcc);
  1742 	u32_t get_mnc_length(const u32_t mcc);
  1722 
  1743 
  1723 	eap_status_e create_uma_realm(
  1744 	eap_status_e create_uma_realm(
  1724 		eap_variable_data_c * const automatic_realm,
  1745 		eap_variable_data_c * const automatic_realm,
  1736 	//--------------------------------------------------
  1757 	//--------------------------------------------------
  1737 
  1758 
  1738 	/**
  1759 	/**
  1739 	 * Destructor cancels all timers and deletes member attributes.
  1760 	 * Destructor cancels all timers and deletes member attributes.
  1740 	 */
  1761 	 */
  1741 	EAP_FUNC_IMPORT virtual ~eap_type_aka_c();
  1762 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H virtual ~eap_type_aka_c();
  1742 
  1763 
  1743 	/**
  1764 	/**
  1744 	 * Constructor initializes all member attributes.
  1765 	 * Constructor initializes all member attributes.
  1745 	 */
  1766 	 */
  1746 	EAP_FUNC_IMPORT eap_type_aka_c(
  1767 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_type_aka_c(
  1747 		abs_eap_am_tools_c * const tools, ///< This is pointer to the tools AM of current platform.
  1768 		abs_eap_am_tools_c * const tools, ///< This is pointer to the tools AM of current platform.
  1748 		abs_eap_base_type_c * const partner, ///< This is back pointer to object which created this object.
  1769 		abs_eap_base_type_c * const partner, ///< This is back pointer to object which created this object.
  1749 		eap_am_type_aka_c * const am_type_aka, ///< This is pointer to adaptation module of AKA EAP type.
  1770 		eap_am_type_aka_c * const am_type_aka, ///< This is pointer to adaptation module of AKA EAP type.
  1750 		const bool free_am_type_aka, ///< True value means m_am_type_aka is allocated within eap_type_aka_c and m_am_type_aka must be freed in destructor.
  1771 		const bool free_am_type_aka, ///< True value means m_am_type_aka is allocated within eap_type_aka_c and m_am_type_aka must be freed in destructor.
  1751 		const bool is_client_when_true, ///< Indicates whether this is client (true) or server (false).
  1772 		const bool is_client_when_true, ///< Indicates whether this is client (true) or server (false).
  1752 		const eap_am_network_id_c * const receive_network_id);
  1773 		const eap_am_network_id_c * const receive_network_id);
  1753 
  1774 
  1754 	/**
  1775 	/**
  1755 	 * This function tells if the object is a client or a server..
  1776 	 * This function tells if the object is a client or a server..
  1756 	 */
  1777 	 */
  1757 	EAP_FUNC_IMPORT bool get_is_client();
  1778 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H bool get_is_client();
  1758 
  1779 
  1759 	// This is commented in abs_eap_am_type_aka_c::complete_AKA_IMSI_or_pseudonym_or_reauthentication_id_query().
  1780 	// This is commented in abs_eap_am_type_aka_c::complete_AKA_IMSI_or_pseudonym_or_reauthentication_id_query().
  1760 	EAP_FUNC_IMPORT eap_status_e complete_AKA_IMSI_or_pseudonym_or_reauthentication_id_query(
  1781 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e complete_AKA_IMSI_or_pseudonym_or_reauthentication_id_query(
  1761 		const eap_variable_data_c * const IMSI, ///< This is the IMSI.
  1782 		const eap_variable_data_c * const IMSI, ///< This is the IMSI.
  1762 		const eap_variable_data_c * const pseudonym, ///< This is the pseudonym.
  1783 		const eap_variable_data_c * const pseudonym, ///< This is the pseudonym.
  1763 		const eap_variable_data_c * const reauthentication_identity, ///< This is the re-authentication identity.
  1784 		const eap_variable_data_c * const reauthentication_identity, ///< This is the re-authentication identity.
  1764 		const eap_variable_data_c * const automatic_realm,
  1785 		const eap_variable_data_c * const automatic_realm,
  1765 		const u32_t length_of_mnc,
  1786 		const u32_t length_of_mnc,
  1767 		const u8_t received_eap_identifier, ///< This parameter is the EAP-identifier of EAP-request
  1788 		const u8_t received_eap_identifier, ///< This parameter is the EAP-identifier of EAP-request
  1768 		const eap_status_e completion_status
  1789 		const eap_status_e completion_status
  1769 		);
  1790 		);
  1770 
  1791 
  1771 	// This is commented in abs_eap_am_type_aka_c::complete_AKA_authentication_vector_query().
  1792 	// This is commented in abs_eap_am_type_aka_c::complete_AKA_authentication_vector_query().
  1772 	EAP_FUNC_IMPORT eap_status_e complete_AKA_authentication_vector_query(
  1793 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e complete_AKA_authentication_vector_query(
  1773 		eap_type_aka_authentication_vector_c * const authentication_vector, ///< authentication_vector includes all AKA parametrs used in this authentication session.
  1794 		eap_type_aka_authentication_vector_c * const authentication_vector, ///< authentication_vector includes all AKA parametrs used in this authentication session.
  1774 		const eap_variable_data_c * const IMSI, ///< IMSI may be queried during query_AKA_authentication_vector() function call. It must be copied to state.
  1795 		const eap_variable_data_c * const IMSI, ///< IMSI may be queried during query_AKA_authentication_vector() function call. It must be copied to state.
  1775 		const eap_aka_authentication_vector_status_e authentication_vector_status,  ///< This is the status of the failed authentication_vector query.
  1796 		const eap_aka_authentication_vector_status_e authentication_vector_status,  ///< This is the status of the failed authentication_vector query.
  1776 		const eap_type_aka_identity_type type, ///< This is type of the identity.
  1797 		const eap_type_aka_identity_type type, ///< This is type of the identity.
  1777 		const eap_status_e completion_status,
  1798 		const eap_status_e completion_status,
  1778 		const u8_t next_eap_identifier
  1799 		const u8_t next_eap_identifier
  1779 		);
  1800 		);
  1780 
  1801 
  1781 	// This is commented in abs_eap_am_type_aka_c::complete_AKA_RES_query().
  1802 	// This is commented in abs_eap_am_type_aka_c::complete_AKA_RES_query().
  1782 	EAP_FUNC_IMPORT eap_status_e complete_AKA_RES_query(
  1803 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e complete_AKA_RES_query(
  1783 		const eap_type_aka_authentication_vector_c * const authentication_vector,
  1804 		const eap_type_aka_authentication_vector_c * const authentication_vector,
  1784 		const eap_status_e completion_status
  1805 		const eap_status_e completion_status
  1785 		);
  1806 		);
  1786 
  1807 
  1787 	/** Client calls this function.
  1808 	/** Client calls this function.
  1788 	 *  This function IMSI and username to AKA EAP type.
  1809 	 *  This function IMSI and username to AKA EAP type.
  1789 	 */
  1810 	 */
  1790 	EAP_FUNC_IMPORT eap_status_e handle_imsi_from_username(
  1811 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e handle_imsi_from_username(
  1791 		const u8_t next_eap_identifier,
  1812 		const u8_t next_eap_identifier,
  1792 		const eap_am_network_id_c * const network_id,
  1813 		const eap_am_network_id_c * const network_id,
  1793 		const eap_variable_data_c * const username,
  1814 		const eap_variable_data_c * const username,
  1794 		const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter.
  1815 		const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter.
  1795 		const eap_type_aka_identity_type identity_type);
  1816 		const eap_type_aka_identity_type identity_type);
  1796 
  1817 
  1797 	// This is commented in abs_eap_am_type_aka_c::complete_imsi_from_username().
  1818 	// This is commented in abs_eap_am_type_aka_c::complete_imsi_from_username().
  1798 	EAP_FUNC_IMPORT eap_status_e complete_imsi_from_username(
  1819 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e complete_imsi_from_username(
  1799 		const u8_t next_eap_identifier,
  1820 		const u8_t next_eap_identifier,
  1800 		const eap_am_network_id_c * const network_id,
  1821 		const eap_am_network_id_c * const network_id,
  1801 		const eap_variable_data_c * const username,
  1822 		const eap_variable_data_c * const username,
  1802 		const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter.
  1823 		const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter.
  1803 		const eap_type_aka_identity_type type,
  1824 		const eap_type_aka_identity_type type,
  1806 
  1827 
  1807 	/**
  1828 	/**
  1808 	 * The partner class calls this function when EAP/AKA packet is received.
  1829 	 * The partner class calls this function when EAP/AKA packet is received.
  1809 	 * see also eap_base_type_c::packet_process().
  1830 	 * see also eap_base_type_c::packet_process().
  1810 	 */
  1831 	 */
  1811 	EAP_FUNC_IMPORT eap_status_e packet_process(
  1832 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e packet_process(
  1812 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1833 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
  1813 		eap_header_wr_c * const eap, ///< This is pointer to EAP header and data.
  1834 		eap_header_wr_c * const eap, ///< This is pointer to EAP header and data.
  1814 		const u32_t eap_packet_length ///< This is length of received EAP packet.
  1835 		const u32_t eap_packet_length ///< This is length of received EAP packet.
  1815 		);
  1836 		);
  1816 
  1837 
  1817 	/**
  1838 	/**
  1818 	 * This function obtains header offset, MTU and trailer length.
  1839 	 * This function obtains header offset, MTU and trailer length.
  1819 	 * See also abs_eap_base_type_c::get_header_offset().
  1840 	 * See also abs_eap_base_type_c::get_header_offset().
  1820 	 */
  1841 	 */
  1821 	EAP_FUNC_IMPORT u32_t get_header_offset(
  1842 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H u32_t get_header_offset(
  1822 		u32_t * const MTU,
  1843 		u32_t * const MTU,
  1823 		u32_t * const trailer_length
  1844 		u32_t * const trailer_length
  1824 		);
  1845 		);
  1825 
  1846 
  1826 	/**
  1847 	/**
  1827 	 * This function creates a message authentication code (MAC)
  1848 	 * This function creates a message authentication code (MAC)
  1828 	 */
  1849 	 */
  1829 	EAP_FUNC_IMPORT eap_status_e create_message_authentication_code(
  1850 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e create_message_authentication_code(
  1830 		eap_type_aka_MAC_attributes_c *MAC_attributes, ///< This includes required parameters.
  1851 		eap_type_aka_MAC_attributes_c *MAC_attributes, ///< This includes required parameters.
  1831 		const aka_subtype_e subtype,
  1852 		const aka_subtype_e subtype,
  1832 		const eap_code_value_e code,
  1853 		const eap_code_value_e code,
  1833 		const eap_variable_data_c * const authentication_key
  1854 		const eap_variable_data_c * const authentication_key
  1834 		);
  1855 		);
  1835 
  1856 
  1836 	/**
  1857 	/**
  1837 	 * This function adds addiditional data to MAC calculation.
  1858 	 * This function adds addiditional data to MAC calculation.
  1838 	 */
  1859 	 */
  1839 	EAP_FUNC_IMPORT eap_status_e extra_message_authentication_code_bytes(
  1860 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e extra_message_authentication_code_bytes(
  1840 		const aka_subtype_e subtype,
  1861 		const aka_subtype_e subtype,
  1841 		const eap_code_value_e code,
  1862 		const eap_code_value_e code,
  1842 		crypto_hmac_c *hmac_sha1);
  1863 		crypto_hmac_c *hmac_sha1);
  1843 
  1864 
  1844 	// This is commented in abs_eap_base_timer_c::timer_delete_data().
  1865 	// This is commented in abs_eap_base_timer_c::timer_delete_data().
  1845 	EAP_FUNC_IMPORT eap_status_e timer_expired(
  1866 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e timer_expired(
  1846 		const u32_t id, void *data
  1867 		const u32_t id, void *data
  1847 		);
  1868 		);
  1848 
  1869 
  1849 	// This is commented in abs_eap_base_timer_c::timer_delete_data().
  1870 	// This is commented in abs_eap_base_timer_c::timer_delete_data().
  1850 	EAP_FUNC_IMPORT eap_status_e timer_delete_data(
  1871 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e timer_delete_data(
  1851 		const u32_t id, void *data
  1872 		const u32_t id, void *data
  1852 		);
  1873 		);
  1853 
  1874 
  1854 	// This is commented in eap_base_type_c::set_is_valid().
  1875 	// This is commented in eap_base_type_c::set_is_valid().
  1855 	EAP_FUNC_IMPORT void set_is_valid();
  1876 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H void set_is_valid();
  1856 
  1877 
  1857 	// This is commented in eap_base_type_c::get_is_valid().
  1878 	// This is commented in eap_base_type_c::get_is_valid().
  1858 	EAP_FUNC_IMPORT bool get_is_valid();
  1879 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H bool get_is_valid();
  1859 
  1880 
  1860 	// This is commented in eap_base_type_c::configure().
  1881 	// This is commented in eap_base_type_c::configure().
  1861 	/**
  1882 	/**
  1862 	 * EAP-type AKA reads configuration.
  1883 	 * EAP-type AKA reads configuration.
  1863 	 */
  1884 	 */
  1864 	EAP_FUNC_IMPORT eap_status_e configure();
  1885 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e configure();
  1865 
  1886 
  1866 	// This is commented in eap_base_type_c::shutdown().
  1887 	// This is commented in eap_base_type_c::shutdown().
  1867 	/**
  1888 	/**
  1868 	 * The shutdown() function is called before the destructor of the 
  1889 	 * The shutdown() function is called before the destructor of the 
  1869 	 * object is executed. During the function call the object 
  1890 	 * object is executed. During the function call the object 
  1870 	 * could shutdown the operations, for example cancel timers.
  1891 	 * could shutdown the operations, for example cancel timers.
  1871 	 * Each derived class must define this function.
  1892 	 * Each derived class must define this function.
  1872 	 */
  1893 	 */
  1873 	EAP_FUNC_IMPORT eap_status_e shutdown();
  1894 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e shutdown();
  1874 
  1895 
  1875 	/**
  1896 	/**
  1876 	 * The read_configure() function reads the configuration data identified
  1897 	 * The read_configure() function reads the configuration data identified
  1877 	 * by the field string of field_length bytes length. Adaptation module must direct
  1898 	 * by the field string of field_length bytes length. Adaptation module must direct
  1878 	 * the query to some persistent store.
  1899 	 * the query to some persistent store.
  1879 	 * @param field is generic configure string idenfying the required configure data.
  1900 	 * @param field is generic configure string idenfying the required configure data.
  1880 	 * @param data is pointer to existing eap_variable_data object.
  1901 	 * @param data is pointer to existing eap_variable_data object.
  1881 	 */
  1902 	 */
  1882 	EAP_FUNC_IMPORT virtual eap_status_e read_configure(
  1903 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H virtual eap_status_e read_configure(
  1883 		const eap_configuration_field_c * const field,
  1904 		const eap_configuration_field_c * const field,
  1884 		eap_variable_data_c * const data
  1905 		eap_variable_data_c * const data
  1885 		);
  1906 		);
  1886 
  1907 
  1887 	/**
  1908 	/**
  1889 	 * by the field string of field_length bytes length. Adaptation module must direct
  1910 	 * by the field string of field_length bytes length. Adaptation module must direct
  1890 	 * the action to some persistent store.
  1911 	 * the action to some persistent store.
  1891 	 * @param field is generic configure string idenfying the required configure data.
  1912 	 * @param field is generic configure string idenfying the required configure data.
  1892 	 * @param data is pointer to existing eap_variable_data object.
  1913 	 * @param data is pointer to existing eap_variable_data object.
  1893 	 */
  1914 	 */
  1894 	EAP_FUNC_IMPORT virtual eap_status_e write_configure(
  1915 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H virtual eap_status_e write_configure(
  1895 		const eap_configuration_field_c * const field,
  1916 		const eap_configuration_field_c * const field,
  1896 		eap_variable_data_c * const data
  1917 		eap_variable_data_c * const data
  1897 		);
  1918 		);
  1898 
  1919 
  1899 	// See abs_eap_base_type_c::state_notification().
  1920 	// See abs_eap_base_type_c::state_notification().
  1900 	EAP_FUNC_IMPORT void state_notification(
  1921 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H void state_notification(
  1901 		const abs_eap_state_notification_c * const state
  1922 		const abs_eap_state_notification_c * const state
  1902 		);
  1923 		);
  1903 
  1924 
  1904 	// This is commented in eap_base_type_c::query_eap_identity().
  1925 	// This is commented in eap_base_type_c::query_eap_identity().
  1905 	EAP_FUNC_IMPORT eap_status_e query_eap_identity(
  1926 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e query_eap_identity(
  1906 		const bool must_be_synchronous,
  1927 		const bool must_be_synchronous,
  1907 		eap_variable_data_c * const identity,
  1928 		eap_variable_data_c * const identity,
  1908 		const eap_am_network_id_c * const receive_network_id,
  1929 		const eap_am_network_id_c * const receive_network_id,
  1909 		const u8_t eap_identifier);
  1930 		const u8_t eap_identifier);
  1910 
  1931 
  1911 	// This is commented in eap_base_type_c::set_initial_eap_identifier().
  1932 	// This is commented in eap_base_type_c::set_initial_eap_identifier().
  1912 	EAP_FUNC_IMPORT eap_status_e set_initial_eap_identifier(
  1933 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e set_initial_eap_identifier(
  1913 		const eap_am_network_id_c * const receive_network_id,
  1934 		const eap_am_network_id_c * const receive_network_id,
  1914 		const u8_t initial_identifier);
  1935 		const u8_t initial_identifier);
  1915 
  1936 
  1916 	// This is commented in eap_base_type_c::eap_acknowledge().
  1937 	// This is commented in eap_base_type_c::eap_acknowledge().
  1917 	EAP_FUNC_IMPORT eap_status_e eap_acknowledge(
  1938 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e eap_acknowledge(
  1918 		const eap_am_network_id_c * const receive_network_id);
  1939 		const eap_am_network_id_c * const receive_network_id);
  1919 
  1940 
  1920 	/**
  1941 	/**
  1921 	 * This function must reset the state of object to same as 
  1942 	 * This function must reset the state of object to same as 
  1922 	 * state was after the configure() function call.
  1943 	 * state was after the configure() function call.
  1923 	 * If object reset succeeds this function must return eap_status_ok.
  1944 	 * If object reset succeeds this function must return eap_status_ok.
  1924 	 * If object reset fails this function must return corresponding error status.
  1945 	 * If object reset fails this function must return corresponding error status.
  1925 	 * @return This function returns the status of reset operation.
  1946 	 * @return This function returns the status of reset operation.
  1926 	 */
  1947 	 */
  1927 	EAP_FUNC_IMPORT eap_status_e reset();
  1948 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e reset();
  1928 
  1949 
  1929 	//
  1950 	//
  1930 	EAP_FUNC_IMPORT eap_status_e set_timer(
  1951 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e set_timer(
  1931 		abs_eap_base_timer_c * const p_initializer, 
  1952 		abs_eap_base_timer_c * const p_initializer, 
  1932 		const u32_t p_id, 
  1953 		const u32_t p_id, 
  1933 		void * const p_data,
  1954 		void * const p_data,
  1934 		const u32_t p_time_ms);
  1955 		const u32_t p_time_ms);
  1935 
  1956 
  1936 	EAP_FUNC_IMPORT eap_status_e cancel_timer(
  1957 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H eap_status_e cancel_timer(
  1937 		abs_eap_base_timer_c * const p_initializer, 
  1958 		abs_eap_base_timer_c * const p_initializer, 
  1938 		const u32_t p_id);
  1959 		const u32_t p_id);
  1939 
  1960 
  1940 	EAP_FUNC_IMPORT static eap_const_string get_identity_string(const eap_type_aka_identity_type identity_type);
  1961 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H static eap_const_string get_identity_string(const eap_type_aka_identity_type identity_type);
  1941 
  1962 
  1942 	/**
  1963 	/**
  1943 	 * This function returns string of the state. This is for trace purposes.
  1964 	 * This function returns string of the state. This is for trace purposes.
  1944 	 * NOTE this is static member function.
  1965 	 * NOTE this is static member function.
  1945 	 */
  1966 	 */
  1946 	EAP_FUNC_IMPORT static eap_const_string get_state_string(eap_type_aka_state_variable_e state);
  1967 	EAP_FUNC_VISIBILITY_EAP_TYPE_AKA_H static eap_const_string get_state_string(eap_type_aka_state_variable_e state);
  1947 
  1968 
  1948 	//--------------------------------------------------
  1969 	//--------------------------------------------------
  1949 
  1970 
  1950 }; // class eap_type_aka_c
  1971 }; // class eap_type_aka_c
  1951 
  1972