14 * Description: EAP and WLAN authentication protocols. |
14 * Description: EAP and WLAN authentication protocols. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 /* |
18 /* |
19 * %version: 8 % |
19 * %version: 9 % |
20 */ |
20 */ |
21 |
21 |
22 #if !defined(_GSMSIM_CORE_H_) |
22 #if !defined(_GSMSIM_CORE_H_) |
23 #define _GSMSIM_CORE_H_ |
23 #define _GSMSIM_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_GSMSIM_H) |
|
29 #define EAP_CLASS_VISIBILITY_EAP_TYPE_GSMSIM_H EAP_NONSHARABLE |
|
30 #define EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H |
|
31 #define EAP_C_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H |
|
32 #define EAP_FUNC_EXPORT_EAP_TYPE_GSMSIM_H |
|
33 #define EAP_C_FUNC_EXPORT_EAP_TYPE_GSMSIM_H |
|
34 #elif defined(EAP_EXPORT_EAP_TYPE_GSMSIM_H) |
|
35 #define EAP_CLASS_VISIBILITY_EAP_TYPE_GSMSIM_H EAP_EXPORT |
|
36 #define EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H EAP_FUNC_EXPORT |
|
37 #define EAP_C_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H EAP_C_FUNC_EXPORT |
|
38 #define EAP_FUNC_EXPORT_EAP_TYPE_GSMSIM_H EAP_FUNC_EXPORT |
|
39 #define EAP_C_FUNC_EXPORT_EAP_TYPE_GSMSIM_H EAP_C_FUNC_EXPORT |
|
40 #else |
|
41 #define EAP_CLASS_VISIBILITY_EAP_TYPE_GSMSIM_H EAP_IMPORT |
|
42 #define EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H EAP_FUNC_IMPORT |
|
43 #define EAP_C_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H EAP_C_FUNC_IMPORT |
|
44 #define EAP_FUNC_EXPORT_EAP_TYPE_GSMSIM_H |
|
45 #define EAP_C_FUNC_EXPORT_EAP_TYPE_GSMSIM_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_gsmsim_types.h" |
50 #include "eap_type_gsmsim_types.h" |
30 #include "eap_type_gsmsim_payloads.h" |
51 #include "eap_type_gsmsim_payloads.h" |
31 #include "eap_type_gsmsim_state.h" |
52 #include "eap_type_gsmsim_state.h" |
363 |
384 |
364 /** |
385 /** |
365 * This function checks the received GSMSIM subtype is valid in current state. |
386 * This function checks the received GSMSIM subtype is valid in current state. |
366 * This is used for quick check. |
387 * This is used for quick check. |
367 */ |
388 */ |
368 EAP_FUNC_IMPORT eap_status_e check_valid_state(gsmsim_subtype_e type); |
389 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e check_valid_state(gsmsim_subtype_e type); |
369 |
390 |
370 /** |
391 /** |
371 * This function returns the eap_type_gsmsim_state_variable_parameters_c object of current state. |
392 * This function returns the eap_type_gsmsim_state_variable_parameters_c object of current state. |
372 */ |
393 */ |
373 EAP_FUNC_IMPORT const eap_type_gsmsim_state_variable_parameters_c * get_state_variable(); |
394 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H const eap_type_gsmsim_state_variable_parameters_c * get_state_variable(); |
374 |
395 |
375 #endif //#if !defined(NO_EAP_TYPE_GSMSIM_MESSAGE_STATE_CHECK) |
396 #endif //#if !defined(NO_EAP_TYPE_GSMSIM_MESSAGE_STATE_CHECK) |
376 |
397 |
377 |
398 |
378 /** |
399 /** |
379 * This function saves the current m_state to m_saved_previous_state. |
400 * This function saves the current m_state to m_saved_previous_state. |
380 * The saved state is restored in error case. |
401 * The saved state is restored in error case. |
381 */ |
402 */ |
382 EAP_FUNC_IMPORT void save_current_state(); |
403 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H void save_current_state(); |
383 |
404 |
384 /** |
405 /** |
385 * This function restores the saved state. |
406 * This function restores the saved state. |
386 */ |
407 */ |
387 EAP_FUNC_IMPORT void restore_saved_previous_state(); |
408 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H void restore_saved_previous_state(); |
388 |
409 |
389 /** |
410 /** |
390 * This function stores identity. |
411 * This function stores identity. |
391 */ |
412 */ |
392 EAP_FUNC_IMPORT eap_status_e store_identity( |
413 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e store_identity( |
393 const eap_variable_data_c * const IMSI_or_pseudonym, |
414 const eap_variable_data_c * const IMSI_or_pseudonym, |
394 const bool IMSI_is_used); |
415 const bool IMSI_is_used); |
395 |
416 |
396 #if !defined(NO_EAP_TYPE_GSMSIM_MESSAGE_STATE_CHECK) |
417 #if !defined(NO_EAP_TYPE_GSMSIM_MESSAGE_STATE_CHECK) |
397 /** |
418 /** |
398 * This function initializes the allowed messages within one specific state. |
419 * This function initializes the allowed messages within one specific state. |
399 */ |
420 */ |
400 EAP_FUNC_IMPORT void initialize_state( |
421 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H void initialize_state( |
401 const eap_type_gsmsim_state_variable_e state, |
422 const eap_type_gsmsim_state_variable_e state, |
402 const bool must_be_initiator, |
423 const bool must_be_initiator, |
403 const bool must_be_responder, |
424 const bool must_be_responder, |
404 const gsmsim_subtype_e type0, |
425 const gsmsim_subtype_e type0, |
405 const gsmsim_subtype_e type1, |
426 const gsmsim_subtype_e type1, |
410 /** |
431 /** |
411 * This function expands key and seed data to key_length of expansion. |
432 * This function expands key and seed data to key_length of expansion. |
412 * expansion_0 = prf(key, seed | 0) |
433 * expansion_0 = prf(key, seed | 0) |
413 * expansion_i = prf(key, expansion_i-1 | seed | i), where i = 1, 2... |
434 * expansion_i = prf(key, expansion_i-1 | seed | i), where i = 1, 2... |
414 */ |
435 */ |
415 EAP_FUNC_IMPORT eap_status_e data_exp( |
436 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e data_exp( |
416 const u32_t key_length, |
437 const u32_t key_length, |
417 eap_variable_data_c * const expansion, |
438 eap_variable_data_c * const expansion, |
418 const eap_variable_data_c * const key, |
439 const eap_variable_data_c * const key, |
419 const eap_variable_data_c * const seed); |
440 const eap_variable_data_c * const seed); |
420 |
441 |
421 /** |
442 /** |
422 * This function generates K_encr, K_aut and master_session_key. |
443 * This function generates K_encr, K_aut and master_session_key. |
423 */ |
444 */ |
424 EAP_FUNC_IMPORT eap_status_e generate_shared_secred_keys( |
445 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e generate_shared_secred_keys( |
425 const u32_t key_length, |
446 const u32_t key_length, |
426 const eap_variable_data_c * const n_Kc, |
447 const eap_variable_data_c * const n_Kc, |
427 const eap_variable_data_c * const n_sres, |
448 const eap_variable_data_c * const n_sres, |
428 eap_variable_data_c * const XKEY, |
449 eap_variable_data_c * const XKEY, |
429 eap_variable_data_c * const K_encr, |
450 eap_variable_data_c * const K_encr, |
450 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
471 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
451 |
472 |
452 /** |
473 /** |
453 * This function saves version list from version list payload. |
474 * This function saves version list from version list payload. |
454 */ |
475 */ |
455 EAP_FUNC_IMPORT eap_status_e save_version( |
476 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e save_version( |
456 const u16_t * const payload_version_list, |
477 const u16_t * const payload_version_list, |
457 const u32_t version_count, |
478 const u32_t version_count, |
458 const eap_gsmsim_version selected_version); |
479 const eap_gsmsim_version selected_version); |
459 |
480 |
460 /** |
481 /** |
461 * This function generates a new NAI from domain and IMSI. |
482 * This function generates a new NAI from domain and IMSI. |
462 */ |
483 */ |
463 EAP_FUNC_IMPORT eap_status_e generate_nai( |
484 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e generate_nai( |
464 eap_variable_data_c * const new_nai, ///< This is the new generated NAI. |
485 eap_variable_data_c * const new_nai, ///< This is the new generated NAI. |
465 const bool use_manual_default_realm, ///< When true uses realm parameter, when false generates automatic realm. |
486 const bool use_manual_default_realm, ///< When true uses realm parameter, when false generates automatic realm. |
466 const eap_variable_data_c * const realm, ///< This is the domain part of the NAI. |
487 const eap_variable_data_c * const realm, ///< This is the domain part of the NAI. |
467 const eap_variable_data_c * const id_IMSI_or_pseydonym, ///< This is IMSI or pseudonym. |
488 const eap_variable_data_c * const id_IMSI_or_pseydonym, ///< This is IMSI or pseudonym. |
468 const bool id_is_imsi, ///< This parameter tells whether id_IMSI_or_pseydonym is IMSI (true) or pseudonym (false). |
489 const bool id_is_imsi, ///< This parameter tells whether id_IMSI_or_pseydonym is IMSI (true) or pseudonym (false). |
879 * Payloads are stored to p_gsmsim_payloads. |
900 * Payloads are stored to p_gsmsim_payloads. |
880 * @return If the length of the buffer and sum of the length of all payloads does not match |
901 * @return If the length of the buffer and sum of the length of all payloads does not match |
881 * function returns eap_status_header_corrupted. |
902 * function returns eap_status_header_corrupted. |
882 * Also error is returned when illegal payload attribute is recognised. |
903 * Also error is returned when illegal payload attribute is recognised. |
883 */ |
904 */ |
884 EAP_FUNC_IMPORT eap_status_e parse_gsmsim_payload( |
905 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e parse_gsmsim_payload( |
885 const gsmsim_payload_AT_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload. |
906 const gsmsim_payload_AT_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload. |
886 u32_t * const buffer_length, ///< This is the length of the buffer. This must match with the length of all payloads. |
907 u32_t * const buffer_length, ///< This is the length of the buffer. This must match with the length of all payloads. |
887 gsmsim_payloads_c * const p_gsmsim_payloads, ///< This is pointer to all payloads of the received EAP packet. |
908 gsmsim_payloads_c * const p_gsmsim_payloads, ///< This is pointer to all payloads of the received EAP packet. |
888 const gsmsim_subtype_e subtype |
909 const gsmsim_subtype_e subtype |
889 ); |
910 ); |
890 |
911 |
891 /** |
912 /** |
892 * This function checks the version list payload of the GSMSIM EAP packet is correct. |
913 * This function checks the version list payload of the GSMSIM EAP packet is correct. |
893 */ |
914 */ |
894 EAP_FUNC_IMPORT eap_status_e check_version_list( |
915 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e check_version_list( |
895 const gsmsim_payload_AT_header_c * const payload, |
916 const gsmsim_payload_AT_header_c * const payload, |
896 const u16_t version_list_length, |
917 const u16_t version_list_length, |
897 u8_t * version_list, |
918 u8_t * version_list, |
898 bool * const includes_other_version_than_1); |
919 bool * const includes_other_version_than_1); |
899 |
920 |
900 /** |
921 /** |
901 * This function parses all payloads of the whole GSMSIM EAP packet. |
922 * This function parses all payloads of the whole GSMSIM EAP packet. |
902 * Payloads are stored to p_gsmsim_payloads. |
923 * Payloads are stored to p_gsmsim_payloads. |
903 * @see parse_gsmsim_payload(). |
924 * @see parse_gsmsim_payload(). |
904 */ |
925 */ |
905 EAP_FUNC_IMPORT eap_status_e parse_gsmsim_packet( |
926 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e parse_gsmsim_packet( |
906 gsmsim_header_c * const gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
927 gsmsim_header_c * const gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
907 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
928 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
908 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
929 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
909 ); |
930 ); |
910 |
931 |
911 /** |
932 /** |
912 * This function parses each payload attributes. |
933 * This function parses each payload attributes. |
913 * @return If payload attribute is illegal function returns eap_status_header_corrupted. |
934 * @return If payload attribute is illegal function returns eap_status_header_corrupted. |
914 * If payload attribute is unknown function returns eap_status_unsupported_gsmsim_payload. |
935 * If payload attribute is unknown function returns eap_status_unsupported_gsmsim_payload. |
915 */ |
936 */ |
916 EAP_FUNC_IMPORT eap_status_e parse_generic_payload( |
937 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e parse_generic_payload( |
917 const gsmsim_payload_AT_type_e current_payload, ///< This is the type of current payload attribute. |
938 const gsmsim_payload_AT_type_e current_payload, ///< This is the type of current payload attribute. |
918 const gsmsim_payload_AT_header_c * const payload, ///< This is the current parsed payload. |
939 const gsmsim_payload_AT_header_c * const payload, ///< This is the current parsed payload. |
919 gsmsim_payloads_c * const p_gsmsim_payloads, ///< This is pointer to all payloads of the received EAP packet. |
940 gsmsim_payloads_c * const p_gsmsim_payloads, ///< This is pointer to all payloads of the received EAP packet. |
920 const gsmsim_subtype_e subtype); |
941 const gsmsim_subtype_e subtype); |
921 |
942 |
922 |
943 |
923 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
944 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
924 /** |
945 /** |
925 * This function sends the EAP-Request/SIM/Re-authentication message. |
946 * This function sends the EAP-Request/SIM/Re-authentication message. |
926 */ |
947 */ |
927 EAP_FUNC_IMPORT eap_status_e send_reauthentication_request_message( |
948 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_reauthentication_request_message( |
928 const eap_variable_data_c * const username, |
949 const eap_variable_data_c * const username, |
929 const bool pseudonym_decode_failed, |
950 const bool pseudonym_decode_failed, |
930 const u8_t eap_identifier); |
951 const u8_t eap_identifier); |
931 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
952 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
932 |
953 |
933 |
954 |
934 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
955 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
935 /** |
956 /** |
936 * This function sends the EAP-Request/SIM/Start message. |
957 * This function sends the EAP-Request/SIM/Start message. |
937 */ |
958 */ |
938 EAP_FUNC_IMPORT eap_status_e send_start_request_message( |
959 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_start_request_message( |
939 const bool pseudonym_decode_failed, ///< This identifies whether the pseudonym decode was failed (true). We must send a IMSI request. |
960 const bool pseudonym_decode_failed, ///< This identifies whether the pseudonym decode was failed (true). We must send a IMSI request. |
940 const u8_t eap_identifier ///< This is the EAP-Identifier used with this message. |
961 const u8_t eap_identifier ///< This is the EAP-Identifier used with this message. |
941 ); |
962 ); |
942 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
963 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
943 |
964 |
944 |
965 |
945 /** |
966 /** |
946 * This function sends the EAP-Response/SIM/Start message. |
967 * This function sends the EAP-Response/SIM/Start message. |
947 */ |
968 */ |
948 EAP_FUNC_IMPORT eap_status_e send_start_response_message( |
969 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_start_response_message( |
949 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. NOTE received. |
970 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. NOTE received. |
950 const u8_t received_eap_identifier, ///< This is the EAP-identifier of the received EAP-request message. |
971 const u8_t received_eap_identifier, ///< This is the EAP-identifier of the received EAP-request message. |
951 const eap_gsmsim_version version, ///< This is the selected GSMSIM version. |
972 const eap_gsmsim_version version, ///< This is the selected GSMSIM version. |
952 const gsmsim_payload_AT_type_e include_identity_to_start_response, ///< This is the queried identity type. |
973 const gsmsim_payload_AT_type_e include_identity_to_start_response, ///< This is the queried identity type. |
953 const eap_variable_data_c * const automatic_realm, ///< This could be zero pointer if this is not used. |
974 const eap_variable_data_c * const automatic_realm, ///< This could be zero pointer if this is not used. |
955 ); |
976 ); |
956 |
977 |
957 /** |
978 /** |
958 * This function sends the EAP-Response/SIM/Notification message. |
979 * This function sends the EAP-Response/SIM/Notification message. |
959 */ |
980 */ |
960 EAP_FUNC_IMPORT eap_status_e send_gsmsim_notification_response( |
981 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_gsmsim_notification_response( |
961 const eap_gsmsim_notification_codes_e notification_code, ///< This is the status of the failed triplet query. |
982 const eap_gsmsim_notification_codes_e notification_code, ///< This is the status of the failed triplet query. |
962 const bool add_at_counter_attribute |
983 const bool add_at_counter_attribute |
963 ); |
984 ); |
964 |
985 |
965 /** |
986 /** |
966 * This function sends the EAP-Response/SIM/Client-Error message. |
987 * This function sends the EAP-Response/SIM/Client-Error message. |
967 */ |
988 */ |
968 EAP_FUNC_IMPORT eap_status_e send_gsmsim_client_error_response(); |
989 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_gsmsim_client_error_response(); |
969 |
990 |
970 |
991 |
971 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
992 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
972 /** |
993 /** |
973 * This function sends the EAP-Request/SIM/Challenge message. |
994 * This function sends the EAP-Request/SIM/Challenge message. |
974 */ |
995 */ |
975 EAP_FUNC_IMPORT eap_status_e send_challenge_request_message( |
996 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_challenge_request_message( |
976 const u8_t eap_identifier ///< This is the EAP-Identifier used with this message. |
997 const u8_t eap_identifier ///< This is the EAP-Identifier used with this message. |
977 ); |
998 ); |
978 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
999 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
979 |
1000 |
980 |
1001 |
981 /** |
1002 /** |
982 * This function sends the EAP-Response/SIM/Challenge message. |
1003 * This function sends the EAP-Response/SIM/Challenge message. |
983 */ |
1004 */ |
984 EAP_FUNC_IMPORT eap_status_e send_challenge_response_message( |
1005 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_challenge_response_message( |
985 eap_variable_data_c * const K_aut); |
1006 eap_variable_data_c * const K_aut); |
986 |
1007 |
987 EAP_FUNC_IMPORT eap_status_e send_reauthentication_response_message( |
1008 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_reauthentication_response_message( |
988 const eap_variable_data_c * const orig_XKEY, |
1009 const eap_variable_data_c * const orig_XKEY, |
989 const eap_variable_data_c * const orig_K_aut, |
1010 const eap_variable_data_c * const orig_K_aut, |
990 const eap_variable_data_c * const orig_K_encr, |
1011 const eap_variable_data_c * const orig_K_encr, |
991 const eap_variable_data_c * const reauth_username, |
1012 const eap_variable_data_c * const reauth_username, |
992 const eap_variable_data_c * const reauth_nonce_s, |
1013 const eap_variable_data_c * const reauth_nonce_s, |
998 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1019 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
999 /** |
1020 /** |
1000 * This function sends the EAP-Request/SIM/Notification message. |
1021 * This function sends the EAP-Request/SIM/Notification message. |
1001 * Message includes the localizable notification string. |
1022 * Message includes the localizable notification string. |
1002 */ |
1023 */ |
1003 EAP_FUNC_IMPORT eap_status_e send_gsmsim_notification_request( |
1024 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_gsmsim_notification_request( |
1004 const eap_gsmsim_notification_codes_e notification_code, ///< This is the status of the failed triplet query. |
1025 const eap_gsmsim_notification_codes_e notification_code, ///< This is the status of the failed triplet query. |
1005 const bool add_at_counter_attribute |
1026 const bool add_at_counter_attribute |
1006 ); |
1027 ); |
1007 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1028 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1008 |
1029 |
1009 |
1030 |
1010 /** |
1031 /** |
1011 * This function encrypts the payload. |
1032 * This function encrypts the payload. |
1012 */ |
1033 */ |
1013 EAP_FUNC_IMPORT eap_status_e encrypt_DATA_payload( |
1034 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e encrypt_DATA_payload( |
1014 u8_t * const EAP_data, ///< This is pointer to the begin of the encrypted payload. |
1035 u8_t * const EAP_data, ///< This is pointer to the begin of the encrypted payload. |
1015 const u32_t cbc_aes_data_length, ///< This is the length of the encrypted payload. This must be aligned to AES block length. |
1036 const u32_t cbc_aes_data_length, ///< This is the length of the encrypted payload. This must be aligned to AES block length. |
1016 const eap_variable_data_c * const IV, |
1037 const eap_variable_data_c * const IV, |
1017 const eap_variable_data_c * const encryption_key |
1038 const eap_variable_data_c * const encryption_key |
1018 ); |
1039 ); |
1020 |
1041 |
1021 /** |
1042 /** |
1022 * This function decrypts the payload. |
1043 * This function decrypts the payload. |
1023 * p_gsmsim_payloads->get_ENCR_DATA() points to the decrypted payload. |
1044 * p_gsmsim_payloads->get_ENCR_DATA() points to the decrypted payload. |
1024 */ |
1045 */ |
1025 EAP_FUNC_IMPORT eap_status_e decrypt_DATA_payload( |
1046 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e decrypt_DATA_payload( |
1026 gsmsim_payloads_c * const p_gsmsim_payloads, ///< This is pointer to all payloads of the received EAP packet. |
1047 gsmsim_payloads_c * const p_gsmsim_payloads, ///< This is pointer to all payloads of the received EAP packet. |
1027 const eap_variable_data_c * const encryption_key |
1048 const eap_variable_data_c * const encryption_key |
1028 ); |
1049 ); |
1029 |
1050 |
1030 /** |
1051 /** |
1031 * This function handles the received DATA payload attribute. |
1052 * This function handles the received DATA payload attribute. |
1032 * The received encrypte payload have been decrypted before thiscall. |
1053 * The received encrypte payload have been decrypted before thiscall. |
1033 * p_gsmsim_payloads->get_ENCR_DATA() includes decrypted DATA payload. |
1054 * p_gsmsim_payloads->get_ENCR_DATA() includes decrypted DATA payload. |
1034 */ |
1055 */ |
1035 EAP_FUNC_IMPORT eap_status_e handle_DATA_payload( |
1056 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_DATA_payload( |
1036 const gsmsim_subtype_e subtype, |
1057 const gsmsim_subtype_e subtype, |
1037 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1058 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1038 ); |
1059 ); |
1039 |
1060 |
1040 //-------------------------------------------------- |
1061 //-------------------------------------------------- |
1041 |
1062 |
1042 /** |
1063 /** |
1043 * This function generate a new NONCE of nonce_size octets length. |
1064 * This function generate a new NONCE of nonce_size octets length. |
1044 */ |
1065 */ |
1045 EAP_FUNC_IMPORT eap_status_e generate_nonce( |
1066 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e generate_nonce( |
1046 const u32_t nonce_size, |
1067 const u32_t nonce_size, |
1047 eap_variable_data_c * const nonce); |
1068 eap_variable_data_c * const nonce); |
1048 |
1069 |
1049 /** |
1070 /** |
1050 * This function returns the domain name. |
1071 * This function returns the domain name. |
1051 */ |
1072 */ |
1052 EAP_FUNC_IMPORT eap_variable_data_c * get_nai_realm(); |
1073 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_variable_data_c * get_nai_realm(); |
1053 |
1074 |
1054 /** |
1075 /** |
1055 * This is the situation before the update_buffer_indexes() call. |
1076 * This is the situation before the update_buffer_indexes() call. |
1056 * @code |
1077 * @code |
1057 * |
1078 * |
1159 * @return Immediately comleted asynchronous call returns eap_status_completed_request. |
1180 * @return Immediately comleted asynchronous call returns eap_status_completed_request. |
1160 * AM already called the complete_SIM_IMSI_or_pseudonym_or_reauthentication_id_query(). |
1181 * AM already called the complete_SIM_IMSI_or_pseudonym_or_reauthentication_id_query(). |
1161 * |
1182 * |
1162 * @return Other return values are errors. |
1183 * @return Other return values are errors. |
1163 */ |
1184 */ |
1164 EAP_FUNC_IMPORT eap_status_e query_SIM_IMSI_or_pseudonym_or_reauthentication_id( |
1185 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e query_SIM_IMSI_or_pseudonym_or_reauthentication_id( |
1165 eap_variable_data_c * const IMSI, ///< Pointer to IMSI. Buffer for IMSI is allocated during the call. |
1186 eap_variable_data_c * const IMSI, ///< Pointer to IMSI. Buffer for IMSI is allocated during the call. |
1166 eap_variable_data_c * const pseudonym_identity, ///< Pointer to pseudonym. Buffer for pseudonym is allocated during the call. |
1187 eap_variable_data_c * const pseudonym_identity, ///< Pointer to pseudonym. Buffer for pseudonym is allocated during the call. |
1167 eap_variable_data_c * const reauthentication_identity, ///< Pointer to reauthentication_identity. Buffer for reauthentication_identity is allocated during the call. |
1188 eap_variable_data_c * const reauthentication_identity, ///< Pointer to reauthentication_identity. Buffer for reauthentication_identity is allocated during the call. |
1168 eap_variable_data_c * const automatic_realm, ///< If this is not used, do not add any data to this parameter. |
1189 eap_variable_data_c * const automatic_realm, ///< If this is not used, do not add any data to this parameter. |
1169 u32_t * const length_of_mnc, |
1190 u32_t * const length_of_mnc, |
1227 * Also encrypted payload (l_gsmsim_payloads.get_ENCR_DATA()) is handled here. |
1248 * Also encrypted payload (l_gsmsim_payloads.get_ENCR_DATA()) is handled here. |
1228 * This is the first place where we have the K_encr (handler->get_K_encr()) available. |
1249 * This is the first place where we have the K_encr (handler->get_K_encr()) available. |
1229 * The decrpted DATA payload is handled immediately in handle_DATA_payload() function. |
1250 * The decrpted DATA payload is handled immediately in handle_DATA_payload() function. |
1230 * Then function calculates MAC_SRES and sends EAP-Response/SIM/Challenge. |
1251 * Then function calculates MAC_SRES and sends EAP-Response/SIM/Challenge. |
1231 */ |
1252 */ |
1232 EAP_FUNC_IMPORT eap_status_e process_SIM_kc_sres( |
1253 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e process_SIM_kc_sres( |
1233 const eap_variable_data_c * const n_rand, ///< This includes concatenated n RAND. |
1254 const eap_variable_data_c * const n_rand, ///< This includes concatenated n RAND. |
1234 const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC. |
1255 const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC. |
1235 const eap_variable_data_c * const n_sres ///< This includes concatenated n SRES. |
1256 const eap_variable_data_c * const n_sres ///< This includes concatenated n SRES. |
1236 ); |
1257 ); |
1237 |
1258 |
1238 /** |
1259 /** |
1239 * This function selects whether to use pseudonym or IMSI. |
1260 * This function selects whether to use pseudonym or IMSI. |
1240 * Function creates NAI and EAP-Response/Identity message. |
1261 * Function creates NAI and EAP-Response/Identity message. |
1241 * Message is sent immediately. |
1262 * Message is sent immediately. |
1242 */ |
1263 */ |
1243 EAP_FUNC_IMPORT eap_status_e process_SIM_IMSI( |
1264 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e process_SIM_IMSI( |
1244 const eap_variable_data_c * const IMSI, ///< This is the IMSI. |
1265 const eap_variable_data_c * const IMSI, ///< This is the IMSI. |
1245 const eap_variable_data_c * const pseudonym ///< This is the pseudonym. |
1266 const eap_variable_data_c * const pseudonym ///< This is the pseudonym. |
1246 ); |
1267 ); |
1247 |
1268 |
1248 |
1269 |
1287 |
1308 |
1288 |
1309 |
1289 /** |
1310 /** |
1290 * This function calculates the MAC_SRES. |
1311 * This function calculates the MAC_SRES. |
1291 */ |
1312 */ |
1292 EAP_FUNC_IMPORT eap_status_e calculate_MAC_SRES( |
1313 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e calculate_MAC_SRES( |
1293 eap_variable_data_c * const MAC_SRES, ///< This is the calculated MAC_SRES. |
1314 eap_variable_data_c * const MAC_SRES, ///< This is the calculated MAC_SRES. |
1294 const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC. |
1315 const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC. |
1295 const eap_variable_data_c * const n_sres ///< This includes concatenated n SRES. |
1316 const eap_variable_data_c * const n_sres ///< This includes concatenated n SRES. |
1296 ); |
1317 ); |
1297 |
1318 |
1298 |
1319 |
1299 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1320 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1300 /** |
1321 /** |
1301 * This function reads the identity payload. Identity is stored to handler->get_identity(). |
1322 * This function reads the identity payload. Identity is stored to handler->get_identity(). |
1302 */ |
1323 */ |
1303 EAP_FUNC_IMPORT eap_status_e parse_identity( |
1324 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e parse_identity( |
1304 const u8_t * const identity, ///< This is pointer to received EAP-Identity buffer. |
1325 const u8_t * const identity, ///< This is pointer to received EAP-Identity buffer. |
1305 const u32_t identity_length ///< This is length of received EAP-Identity buffer. |
1326 const u32_t identity_length ///< This is length of received EAP-Identity buffer. |
1306 //const u32_t eap_packet_length ///< This is length of received EAP-Identity buffer. |
1327 //const u32_t eap_packet_length ///< This is length of received EAP-Identity buffer. |
1307 ); |
1328 ); |
1308 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1329 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1309 |
1330 |
1310 |
1331 |
1311 EAP_FUNC_IMPORT eap_status_e handle_eap_identity_query( |
1332 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_eap_identity_query( |
1312 const eap_am_network_id_c * const send_network_id, |
1333 const eap_am_network_id_c * const send_network_id, |
1313 eap_variable_data_c * const identity, |
1334 eap_variable_data_c * const identity, |
1314 const u8_t eap_identifier, |
1335 const u8_t eap_identifier, |
1315 const eap_variable_data_c * const IMSI, |
1336 const eap_variable_data_c * const IMSI, |
1316 const eap_variable_data_c * const pseudonym, |
1337 const eap_variable_data_c * const pseudonym, |
1328 * Function queries the AM (query_imsi_from_username()) whether the pseudonym |
1349 * Function queries the AM (query_imsi_from_username()) whether the pseudonym |
1329 * is known or should it query peer the IMSI. |
1350 * is known or should it query peer the IMSI. |
1330 * Currently the query_imsi_from_username() is synchronous call. |
1351 * Currently the query_imsi_from_username() is synchronous call. |
1331 * The send_start_request_message() function will send the EAP-Request/SIM/Start message. |
1352 * The send_start_request_message() function will send the EAP-Request/SIM/Start message. |
1332 */ |
1353 */ |
1333 EAP_FUNC_IMPORT eap_status_e handle_identity_response_message( |
1354 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_identity_response_message( |
1334 eap_header_rd_c * const eap_header, ///< This is the received EAP-Identity packet, pointer points to the header. |
1355 eap_header_rd_c * const eap_header, ///< This is the received EAP-Identity packet, pointer points to the header. |
1335 const u32_t gsmsim_packet_length ///< This is length of received GSMSIM EAP packet. |
1356 const u32_t gsmsim_packet_length ///< This is length of received GSMSIM EAP packet. |
1336 ); |
1357 ); |
1337 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1358 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1338 |
1359 |
1339 |
1360 |
1340 /** |
1361 /** |
1341 * This function handles the received EAP-Request/SIM/Start message. |
1362 * This function handles the received EAP-Request/SIM/Start message. |
1342 * Function checks the valid payloads and calls send_start_response_message() that sends EAP-Response/SIM/Start message. |
1363 * Function checks the valid payloads and calls send_start_response_message() that sends EAP-Response/SIM/Start message. |
1343 */ |
1364 */ |
1344 EAP_FUNC_IMPORT eap_status_e handle_start_request_message( |
1365 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_start_request_message( |
1345 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1366 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1346 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1367 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1347 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1368 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1348 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1369 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1349 ); |
1370 ); |
1350 |
1371 |
1351 EAP_FUNC_IMPORT eap_status_e handle_gsmsim_notification_request_message_reauthentication( |
1372 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_gsmsim_notification_request_message_reauthentication( |
1352 const eap_am_network_id_c * const receive_network_id, |
1373 const eap_am_network_id_c * const receive_network_id, |
1353 gsmsim_header_c * const received_gsmsim, |
1374 gsmsim_header_c * const received_gsmsim, |
1354 const u32_t gsmsim_packet_length, |
1375 const u32_t gsmsim_packet_length, |
1355 gsmsim_payloads_c * const p_gsmsim_payloads); |
1376 gsmsim_payloads_c * const p_gsmsim_payloads); |
1356 |
1377 |
1357 EAP_FUNC_IMPORT eap_status_e handle_gsmsim_notification_request_message_full_authentication( |
1378 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_gsmsim_notification_request_message_full_authentication( |
1358 const eap_am_network_id_c * const receive_network_id, |
1379 const eap_am_network_id_c * const receive_network_id, |
1359 gsmsim_header_c * const received_gsmsim, |
1380 gsmsim_header_c * const received_gsmsim, |
1360 const u32_t gsmsim_packet_length, |
1381 const u32_t gsmsim_packet_length, |
1361 gsmsim_payloads_c * const p_gsmsim_payloads); |
1382 gsmsim_payloads_c * const p_gsmsim_payloads); |
1362 |
1383 |
1363 /** |
1384 /** |
1364 * This function handles the received EAP-Request/SIM/Notification message. |
1385 * This function handles the received EAP-Request/SIM/Notification message. |
1365 * Function checks the valid payloads and calls send_notification_response_message() that sends EAP-Response/SIM/Notification message. |
1386 * Function checks the valid payloads and calls send_notification_response_message() that sends EAP-Response/SIM/Notification message. |
1366 */ |
1387 */ |
1367 EAP_FUNC_IMPORT eap_status_e handle_gsmsim_notification_request_message( |
1388 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_gsmsim_notification_request_message( |
1368 const eap_am_network_id_c * const receive_network_id, |
1389 const eap_am_network_id_c * const receive_network_id, |
1369 gsmsim_header_c * const received_gsmsim, |
1390 gsmsim_header_c * const received_gsmsim, |
1370 const u32_t gsmsim_packet_length, |
1391 const u32_t gsmsim_packet_length, |
1371 gsmsim_payloads_c * const p_gsmsim_payloads); |
1392 gsmsim_payloads_c * const p_gsmsim_payloads); |
1372 |
1393 |
1395 * after n*Kc and n*SRES is get from SIM. |
1416 * after n*Kc and n*SRES is get from SIM. |
1396 * Function calls query_SIM_kc_sres(). The query_SIM_kc_sres() function |
1417 * Function calls query_SIM_kc_sres(). The query_SIM_kc_sres() function |
1397 * is completed using complete_SIM_kc_sres() function. The complete_SIM_kc_sres() |
1418 * is completed using complete_SIM_kc_sres() function. The complete_SIM_kc_sres() |
1398 * function will call process_SIM_kc_sres(). |
1419 * function will call process_SIM_kc_sres(). |
1399 */ |
1420 */ |
1400 EAP_FUNC_IMPORT eap_status_e handle_reauthentication_request_message( |
1421 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_reauthentication_request_message( |
1401 const eap_am_network_id_c * const receive_network_id, |
1422 const eap_am_network_id_c * const receive_network_id, |
1402 gsmsim_header_c * const received_gsmsim, |
1423 gsmsim_header_c * const received_gsmsim, |
1403 const u32_t gsmsim_packet_length, |
1424 const u32_t gsmsim_packet_length, |
1404 gsmsim_payloads_c * const p_gsmsim_payloads); |
1425 gsmsim_payloads_c * const p_gsmsim_payloads); |
1405 |
1426 |
1406 |
1427 |
1407 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1428 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1408 EAP_FUNC_IMPORT eap_status_e check_challenge_response_message( |
1429 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e check_challenge_response_message( |
1409 const eap_am_network_id_c * const receive_network_id, |
1430 const eap_am_network_id_c * const receive_network_id, |
1410 gsmsim_header_c * const received_gsmsim, |
1431 gsmsim_header_c * const received_gsmsim, |
1411 const u32_t gsmsim_packet_length, |
1432 const u32_t gsmsim_packet_length, |
1412 gsmsim_payloads_c * const p_gsmsim_payloads); |
1433 gsmsim_payloads_c * const p_gsmsim_payloads); |
1413 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1434 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1419 * Function checks the valid payloads. If IMSI is included it is copied to handler->get_IMSI(). |
1440 * Function checks the valid payloads. If IMSI is included it is copied to handler->get_IMSI(). |
1420 * Also the included NONCE_MT is copied to handler->get_NONCE_MT(). |
1441 * Also the included NONCE_MT is copied to handler->get_NONCE_MT(). |
1421 * Function calls the query_SIM_triplets() of AM to get fresh triplets. |
1442 * Function calls the query_SIM_triplets() of AM to get fresh triplets. |
1422 * The query_SIM_triplets() function is completed by AM using complete_SIM_triplets() function. |
1443 * The query_SIM_triplets() function is completed by AM using complete_SIM_triplets() function. |
1423 */ |
1444 */ |
1424 EAP_FUNC_IMPORT eap_status_e handle_start_response_message( |
1445 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_start_response_message( |
1425 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1446 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1426 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1447 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1427 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1448 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1428 ); |
1449 ); |
1429 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1450 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1430 |
1451 |
1431 |
1452 |
1432 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1453 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1433 EAP_FUNC_IMPORT eap_status_e handle_notification_response_message_reauthentication( |
1454 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_notification_response_message_reauthentication( |
1434 const eap_am_network_id_c * const receive_network_id, |
1455 const eap_am_network_id_c * const receive_network_id, |
1435 gsmsim_header_c * const received_gsmsim, |
1456 gsmsim_header_c * const received_gsmsim, |
1436 const u32_t gsmsim_packet_length, |
1457 const u32_t gsmsim_packet_length, |
1437 gsmsim_payloads_c * const p_gsmsim_payloads); |
1458 gsmsim_payloads_c * const p_gsmsim_payloads); |
1438 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1459 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1439 |
1460 |
1440 |
1461 |
1441 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1462 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1442 EAP_FUNC_IMPORT eap_status_e handle_notification_response_message_full_authentication( |
1463 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_notification_response_message_full_authentication( |
1443 const eap_am_network_id_c * const receive_network_id, |
1464 const eap_am_network_id_c * const receive_network_id, |
1444 gsmsim_header_c * const received_gsmsim, |
1465 gsmsim_header_c * const received_gsmsim, |
1445 const u32_t gsmsim_packet_length, |
1466 const u32_t gsmsim_packet_length, |
1446 gsmsim_payloads_c * const p_gsmsim_payloads); |
1467 gsmsim_payloads_c * const p_gsmsim_payloads); |
1447 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1468 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1465 * This function handles the received EAP-Response/SIM/Challenge message. |
1486 * This function handles the received EAP-Response/SIM/Challenge message. |
1466 * Function checks the valid payloads. The analyse_MAC_SRES_payload() function is |
1487 * Function checks the valid payloads. The analyse_MAC_SRES_payload() function is |
1467 * called to check MAC_SRES. If it returns eap_status_success the authentication was succesfull |
1488 * called to check MAC_SRES. If it returns eap_status_success the authentication was succesfull |
1468 * and this function calls the send_eap_success() to send EAP-Success message. |
1489 * and this function calls the send_eap_success() to send EAP-Success message. |
1469 */ |
1490 */ |
1470 EAP_FUNC_IMPORT eap_status_e handle_challenge_response_message( |
1491 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_challenge_response_message( |
1471 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1492 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1472 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1493 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1473 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1494 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1474 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1495 gsmsim_payloads_c * const p_gsmsim_payloads ///< This is pointer to all payloads of the received EAP packet. |
1475 ); |
1496 ); |
1476 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1497 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1477 |
1498 |
1478 |
1499 |
1479 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1500 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1480 EAP_FUNC_IMPORT eap_status_e handle_reauthentication_response_message( |
1501 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_reauthentication_response_message( |
1481 const eap_am_network_id_c * const /* receive_network_id */, |
1502 const eap_am_network_id_c * const /* receive_network_id */, |
1482 gsmsim_header_c * const received_gsmsim, |
1503 gsmsim_header_c * const received_gsmsim, |
1483 const u32_t gsmsim_packet_length, |
1504 const u32_t gsmsim_packet_length, |
1484 gsmsim_payloads_c * const p_gsmsim_payloads); |
1505 gsmsim_payloads_c * const p_gsmsim_payloads); |
1485 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1506 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1486 |
1507 |
1487 |
1508 |
1488 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1509 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1489 EAP_FUNC_IMPORT eap_status_e handle_client_error_response_message( |
1510 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_client_error_response_message( |
1490 const eap_am_network_id_c * const /* receive_network_id */, |
1511 const eap_am_network_id_c * const /* receive_network_id */, |
1491 gsmsim_header_c * const received_gsmsim, |
1512 gsmsim_header_c * const received_gsmsim, |
1492 const u32_t gsmsim_packet_length, |
1513 const u32_t gsmsim_packet_length, |
1493 gsmsim_payloads_c * const p_gsmsim_payloads); |
1514 gsmsim_payloads_c * const p_gsmsim_payloads); |
1494 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1515 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1495 |
1516 |
1496 |
1517 |
1497 /** |
1518 /** |
1498 * This function sends and traces all messages. |
1519 * This function sends and traces all messages. |
1499 */ |
1520 */ |
1500 EAP_FUNC_IMPORT eap_status_e packet_send( |
1521 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e packet_send( |
1501 const eap_am_network_id_c * const network_id, |
1522 const eap_am_network_id_c * const network_id, |
1502 eap_buf_chain_wr_c * const sent_packet, |
1523 eap_buf_chain_wr_c * const sent_packet, |
1503 const u32_t header_offset, |
1524 const u32_t header_offset, |
1504 const u32_t data_length, |
1525 const u32_t data_length, |
1505 const u32_t buffer_length); |
1526 const u32_t buffer_length); |
1507 |
1528 |
1508 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1529 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1509 /** |
1530 /** |
1510 * This function chechs NAI. |
1531 * This function chechs NAI. |
1511 */ |
1532 */ |
1512 EAP_FUNC_IMPORT eap_status_e check_NAI( |
1533 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e check_NAI( |
1513 const u8_t * const identity, |
1534 const u8_t * const identity, |
1514 const u32_t identity_length, |
1535 const u32_t identity_length, |
1515 const u8_t * const at_character); |
1536 const u8_t * const at_character); |
1516 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1537 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1517 |
1538 |
1518 |
1539 |
1519 /** |
1540 /** |
1520 * This function traces the EAP packet. |
1541 * This function traces the EAP packet. |
1521 */ |
1542 */ |
1522 EAP_FUNC_IMPORT void packet_trace( |
1543 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H void packet_trace( |
1523 eap_const_string prefix, |
1544 eap_const_string prefix, |
1524 const eap_am_network_id_c * const receive_network_id, |
1545 const eap_am_network_id_c * const receive_network_id, |
1525 eap_header_wr_c * const received_eap, |
1546 eap_header_wr_c * const received_eap, |
1526 const u32_t eap_packet_length); |
1547 const u32_t eap_packet_length); |
1527 |
1548 |
1540 /** |
1561 /** |
1541 * This function finishes the successfull authentication. |
1562 * This function finishes the successfull authentication. |
1542 * Generated keys are offered to lower layer. |
1563 * Generated keys are offered to lower layer. |
1543 * Connection handle is initialised. |
1564 * Connection handle is initialised. |
1544 */ |
1565 */ |
1545 EAP_FUNC_IMPORT eap_status_e finish_successful_authentication( |
1566 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e finish_successful_authentication( |
1546 const eap_am_network_id_c * const receive_network_id); |
1567 const eap_am_network_id_c * const receive_network_id); |
1547 |
1568 |
1548 /** |
1569 /** |
1549 * This function sends a notification of possible failed authentication |
1570 * This function sends a notification of possible failed authentication |
1550 * to lower layer. |
1571 * to lower layer. |
1551 */ |
1572 */ |
1552 EAP_FUNC_IMPORT eap_status_e send_final_notification(); |
1573 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e send_final_notification(); |
1553 |
1574 |
1554 EAP_FUNC_IMPORT eap_status_e new_handler( |
1575 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e new_handler( |
1555 const eap_am_network_id_c * const receive_network_id, |
1576 const eap_am_network_id_c * const receive_network_id, |
1556 const bool is_client_when_true); |
1577 const bool is_client_when_true); |
1557 |
1578 |
1558 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1579 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1559 EAP_FUNC_IMPORT bool randomly_refuse_eap_identity(); |
1580 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H bool randomly_refuse_eap_identity(); |
1560 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1581 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1561 |
1582 |
1562 EAP_FUNC_IMPORT eap_status_e check_rands( |
1583 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e check_rands( |
1563 const eap_variable_data_c * const n_rands |
1584 const eap_variable_data_c * const n_rands |
1564 ); |
1585 ); |
1565 |
1586 |
1566 /** |
1587 /** |
1567 * This function processes the GSMSIM packets. |
1588 * This function processes the GSMSIM packets. |
1568 */ |
1589 */ |
1569 EAP_FUNC_IMPORT eap_status_e gsmsim_packet_process( |
1590 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e gsmsim_packet_process( |
1570 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1591 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1571 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1592 gsmsim_header_c * const received_gsmsim, ///< This is pointer to EAP header including GSMSIM fields. |
1572 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1593 const u32_t gsmsim_packet_length, ///< This is length of received GSMSIM EAP packet. |
1573 const bool is_client_when_true ///< Indicates whether this is client (true) or server (false). |
1594 const bool is_client_when_true ///< Indicates whether this is client (true) or server (false). |
1574 ); |
1595 ); |
1575 |
1596 |
1576 EAP_FUNC_IMPORT eap_status_e cancel_error_message_delay_timer(); |
1597 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e cancel_error_message_delay_timer(); |
1577 |
1598 |
1578 EAP_FUNC_IMPORT eap_status_e set_error_message_delay_timer(); |
1599 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e set_error_message_delay_timer(); |
1579 |
1600 |
1580 EAP_FUNC_IMPORT eap_status_e handle_error_packet(); |
1601 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_error_packet(); |
1581 |
1602 |
1582 /** |
1603 /** |
1583 * This function initializes the error message. |
1604 * This function initializes the error message. |
1584 */ |
1605 */ |
1585 EAP_FUNC_IMPORT eap_status_e initialize_error_message( |
1606 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e initialize_error_message( |
1586 const eap_status_e error_status |
1607 const eap_status_e error_status |
1587 ); |
1608 ); |
1588 |
1609 |
1589 |
1610 |
1590 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1611 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1591 EAP_FUNC_IMPORT eap_status_e handle_start_response_message_completion( |
1612 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_start_response_message_completion( |
1592 const u8_t next_eap_identifier, |
1613 const u8_t next_eap_identifier, |
1593 const eap_status_e identity_status, |
1614 const eap_status_e identity_status, |
1594 const eap_type_gsmsim_identity_type identity_type, |
1615 const eap_type_gsmsim_identity_type identity_type, |
1595 const bool identity_payload_was_included); |
1616 const bool identity_payload_was_included); |
1596 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1617 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1597 |
1618 |
1598 |
1619 |
1599 EAP_FUNC_IMPORT eap_status_e initialize_notification_message(); |
1620 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e initialize_notification_message(); |
1600 |
1621 |
1601 EAP_FUNC_IMPORT eap_status_e cancel_notification_message_delay_timer(); |
1622 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e cancel_notification_message_delay_timer(); |
1602 |
1623 |
1603 EAP_FUNC_IMPORT eap_status_e set_notification_message_delay_timer(); |
1624 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e set_notification_message_delay_timer(); |
1604 |
1625 |
1605 EAP_FUNC_IMPORT eap_status_e handle_notification_packet(); |
1626 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_notification_packet(); |
1606 |
1627 |
1607 const bool get_gsmsim_notification_code_F_bit(const eap_gsmsim_notification_codes_e notification_code) |
1628 const bool get_gsmsim_notification_code_F_bit(const eap_gsmsim_notification_codes_e notification_code) |
1608 { |
1629 { |
1609 return ((notification_code & gsmsim_notification_code_bit_f) != 0); |
1630 return ((notification_code & gsmsim_notification_code_bit_f) != 0); |
1610 } |
1631 } |
1636 //-------------------------------------------------- |
1657 //-------------------------------------------------- |
1637 |
1658 |
1638 /** |
1659 /** |
1639 * Destructor cancels all timers and deletes member attributes. |
1660 * Destructor cancels all timers and deletes member attributes. |
1640 */ |
1661 */ |
1641 EAP_FUNC_IMPORT virtual ~eap_type_gsmsim_c(); |
1662 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H virtual ~eap_type_gsmsim_c(); |
1642 |
1663 |
1643 /** |
1664 /** |
1644 * Constructor initializes all member attributes. |
1665 * Constructor initializes all member attributes. |
1645 */ |
1666 */ |
1646 EAP_FUNC_IMPORT eap_type_gsmsim_c( |
1667 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_type_gsmsim_c( |
1647 abs_eap_am_tools_c * const tools, ///< This is pointer to the tools AM of current platform. |
1668 abs_eap_am_tools_c * const tools, ///< This is pointer to the tools AM of current platform. |
1648 abs_eap_base_type_c * const partner, ///< This is back pointer to object which created this object. |
1669 abs_eap_base_type_c * const partner, ///< This is back pointer to object which created this object. |
1649 eap_am_type_gsmsim_c * const am_type_gsmsim, ///< This is pointer to adaptation module of GSMSIM EAP type. |
1670 eap_am_type_gsmsim_c * const am_type_gsmsim, ///< This is pointer to adaptation module of GSMSIM EAP type. |
1650 const bool free_am_type_gsmsim, ///< True value means m_am_type_gsmsim is allocated within eap_type_gsmsim_c and m_am_type_gsmsim must be freed in destructor. |
1671 const bool free_am_type_gsmsim, ///< True value means m_am_type_gsmsim is allocated within eap_type_gsmsim_c and m_am_type_gsmsim must be freed in destructor. |
1651 const bool is_client_when_true, ///< Indicates whether this is client (true) or server (false). |
1672 const bool is_client_when_true, ///< Indicates whether this is client (true) or server (false). |
1652 const eap_am_network_id_c * const receive_network_id); |
1673 const eap_am_network_id_c * const receive_network_id); |
1653 |
1674 |
1654 EAP_FUNC_IMPORT static eap_const_string get_identity_string(const eap_type_gsmsim_identity_type identity_type); |
1675 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H static eap_const_string get_identity_string(const eap_type_gsmsim_identity_type identity_type); |
1655 |
1676 |
1656 /** |
1677 /** |
1657 * This function returns string of the state. This is for trace purposes. |
1678 * This function returns string of the state. This is for trace purposes. |
1658 * NOTE this is static member function. |
1679 * NOTE this is static member function. |
1659 */ |
1680 */ |
1660 EAP_FUNC_IMPORT static eap_const_string get_state_string(eap_type_gsmsim_state_variable_e state); |
1681 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H static eap_const_string get_state_string(eap_type_gsmsim_state_variable_e state); |
1661 |
1682 |
1662 /** |
1683 /** |
1663 * This function tells if the object is a client or a server.. |
1684 * This function tells if the object is a client or a server.. |
1664 */ |
1685 */ |
1665 EAP_FUNC_IMPORT bool get_is_client(); |
1686 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H bool get_is_client(); |
1666 |
1687 |
1667 // This is commented in abs_eap_am_type_gsmsim_c::complete_SIM_IMSI_or_pseudonym_or_reauthentication_id_query(). |
1688 // This is commented in abs_eap_am_type_gsmsim_c::complete_SIM_IMSI_or_pseudonym_or_reauthentication_id_query(). |
1668 EAP_FUNC_IMPORT eap_status_e complete_SIM_IMSI_or_pseudonym_or_reauthentication_id_query( |
1689 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e complete_SIM_IMSI_or_pseudonym_or_reauthentication_id_query( |
1669 const eap_variable_data_c * const IMSI, ///< This is the IMSI. |
1690 const eap_variable_data_c * const IMSI, ///< This is the IMSI. |
1670 const eap_variable_data_c * const pseudonym, ///< This is the pseudonym. |
1691 const eap_variable_data_c * const pseudonym, ///< This is the pseudonym. |
1671 const eap_variable_data_c * const reauthentication_identity, ///< This is the re-authentication identity. |
1692 const eap_variable_data_c * const reauthentication_identity, ///< This is the re-authentication identity. |
1672 const eap_variable_data_c * const automatic_realm, ///< This could be zero pointer if this is not used. |
1693 const eap_variable_data_c * const automatic_realm, ///< This could be zero pointer if this is not used. |
1673 const u32_t length_of_mnc, |
1694 const u32_t length_of_mnc, |
1677 ); |
1698 ); |
1678 |
1699 |
1679 |
1700 |
1680 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1701 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1681 // This is commented in abs_eap_am_type_gsmsim_c::complete_SIM_triplets(). |
1702 // This is commented in abs_eap_am_type_gsmsim_c::complete_SIM_triplets(). |
1682 EAP_FUNC_IMPORT eap_status_e complete_SIM_triplets( |
1703 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e complete_SIM_triplets( |
1683 eap_type_sim_triplet_array_c * const triplets, ///< triplets includes all triplets used in this authentication session. |
1704 eap_type_sim_triplet_array_c * const triplets, ///< triplets includes all triplets used in this authentication session. |
1684 const eap_variable_data_c * const IMSI, ///< IMSI may be queried during query_SIM_triplets() function call. It must be copied to state. |
1705 const eap_variable_data_c * const IMSI, ///< IMSI may be queried during query_SIM_triplets() function call. It must be copied to state. |
1685 const eap_gsmsim_triplet_status_e triplet_status, ///< This is the status of the failed triplet query. |
1706 const eap_gsmsim_triplet_status_e triplet_status, ///< This is the status of the failed triplet query. |
1686 const eap_type_gsmsim_identity_type type, ///< This is type of the identity. |
1707 const eap_type_gsmsim_identity_type type, ///< This is type of the identity. |
1687 const eap_status_e completion_status |
1708 const eap_status_e completion_status |
1688 ); |
1709 ); |
1689 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1710 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1690 |
1711 |
1691 |
1712 |
1692 // This is commented in abs_eap_am_type_gsmsim_c::complete_SIM_kc_sres(). |
1713 // This is commented in abs_eap_am_type_gsmsim_c::complete_SIM_kc_sres(). |
1693 EAP_FUNC_IMPORT eap_status_e complete_SIM_kc_sres( |
1714 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e complete_SIM_kc_sres( |
1694 const eap_variable_data_c * const n_rand, ///< This includes concatenated n RAND. |
1715 const eap_variable_data_c * const n_rand, ///< This includes concatenated n RAND. |
1695 const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC. |
1716 const eap_variable_data_c * const n_kc, ///< This includes concatenated n KC. |
1696 const eap_variable_data_c * const n_sres, ///< This includes concatenated n SRES. |
1717 const eap_variable_data_c * const n_sres, ///< This includes concatenated n SRES. |
1697 const eap_status_e completion_status |
1718 const eap_status_e completion_status |
1698 ); |
1719 ); |
1700 |
1721 |
1701 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1722 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1702 /** Client calls this function. |
1723 /** Client calls this function. |
1703 * This function IMSI and username to GSMSIM EAP type. |
1724 * This function IMSI and username to GSMSIM EAP type. |
1704 */ |
1725 */ |
1705 EAP_FUNC_IMPORT eap_status_e handle_imsi_from_username( |
1726 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e handle_imsi_from_username( |
1706 const u8_t next_eap_identifier, |
1727 const u8_t next_eap_identifier, |
1707 const eap_am_network_id_c * const network_id, |
1728 const eap_am_network_id_c * const network_id, |
1708 const eap_variable_data_c * const username, |
1729 const eap_variable_data_c * const username, |
1709 const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter. |
1730 const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter. |
1710 const eap_type_gsmsim_identity_type identity_type); |
1731 const eap_type_gsmsim_identity_type identity_type); |
1711 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1732 #endif //#if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1712 |
1733 |
1713 |
1734 |
1714 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1735 #if defined(USE_EAP_TYPE_SERVER_GSMSIM) |
1715 // This is commented in abs_eap_am_type_gsmsim_c::complete_imsi_from_username(). |
1736 // This is commented in abs_eap_am_type_gsmsim_c::complete_imsi_from_username(). |
1716 EAP_FUNC_IMPORT eap_status_e complete_imsi_from_username( |
1737 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e complete_imsi_from_username( |
1717 const u8_t next_eap_identifier, |
1738 const u8_t next_eap_identifier, |
1718 const eap_am_network_id_c * const network_id, |
1739 const eap_am_network_id_c * const network_id, |
1719 const eap_variable_data_c * const username, |
1740 const eap_variable_data_c * const username, |
1720 const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter. |
1741 const eap_variable_data_c * const imsi, ///< The result is stored to imsi parameter. |
1721 const eap_type_gsmsim_identity_type type, |
1742 const eap_type_gsmsim_identity_type type, |
1726 |
1747 |
1727 /** |
1748 /** |
1728 * The partner class calls this function when EAP/GSMSIM packet is received. |
1749 * The partner class calls this function when EAP/GSMSIM packet is received. |
1729 * see also eap_base_type_c::packet_process(). |
1750 * see also eap_base_type_c::packet_process(). |
1730 */ |
1751 */ |
1731 EAP_FUNC_IMPORT eap_status_e packet_process( |
1752 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e packet_process( |
1732 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1753 const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet. |
1733 eap_header_wr_c * const eap, ///< This is pointer to EAP header and data. |
1754 eap_header_wr_c * const eap, ///< This is pointer to EAP header and data. |
1734 const u32_t eap_packet_length ///< This is length of received EAP packet. |
1755 const u32_t eap_packet_length ///< This is length of received EAP packet. |
1735 ); |
1756 ); |
1736 |
1757 |
1737 /** |
1758 /** |
1738 * This function obtains header offset, MTU and trailer length. |
1759 * This function obtains header offset, MTU and trailer length. |
1739 * See also abs_eap_base_type_c::get_header_offset(). |
1760 * See also abs_eap_base_type_c::get_header_offset(). |
1740 */ |
1761 */ |
1741 EAP_FUNC_IMPORT u32_t get_header_offset( |
1762 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H u32_t get_header_offset( |
1742 u32_t * const MTU, |
1763 u32_t * const MTU, |
1743 u32_t * const trailer_length |
1764 u32_t * const trailer_length |
1744 ); |
1765 ); |
1745 |
1766 |
1746 /** |
1767 /** |
1747 * This function creates a message authentication code (MAC) |
1768 * This function creates a message authentication code (MAC) |
1748 */ |
1769 */ |
1749 EAP_FUNC_IMPORT eap_status_e create_message_authentication_code( |
1770 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e create_message_authentication_code( |
1750 eap_type_gsmsim_MAC_attributes_c *MAC_attributes, ///< This includes required parameters. |
1771 eap_type_gsmsim_MAC_attributes_c *MAC_attributes, ///< This includes required parameters. |
1751 const gsmsim_subtype_e subtype, |
1772 const gsmsim_subtype_e subtype, |
1752 const eap_code_value_e code, |
1773 const eap_code_value_e code, |
1753 const eap_variable_data_c * const authentication_key |
1774 const eap_variable_data_c * const authentication_key |
1754 ); |
1775 ); |
1755 |
1776 |
1756 /** |
1777 /** |
1757 * This function adds addiditional data to MAC calculation. |
1778 * This function adds addiditional data to MAC calculation. |
1758 */ |
1779 */ |
1759 EAP_FUNC_IMPORT eap_status_e extra_message_authentication_code_bytes( |
1780 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e extra_message_authentication_code_bytes( |
1760 const gsmsim_subtype_e subtype, |
1781 const gsmsim_subtype_e subtype, |
1761 const eap_code_value_e code, |
1782 const eap_code_value_e code, |
1762 crypto_hmac_c *hmac_sha1); |
1783 crypto_hmac_c *hmac_sha1); |
1763 |
1784 |
1764 // This is commented in abs_eap_base_timer_c::timer_delete_data(). |
1785 // This is commented in abs_eap_base_timer_c::timer_delete_data(). |
1765 EAP_FUNC_IMPORT eap_status_e timer_expired( |
1786 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e timer_expired( |
1766 const u32_t id, void *data |
1787 const u32_t id, void *data |
1767 ); |
1788 ); |
1768 |
1789 |
1769 // This is commented in abs_eap_base_timer_c::timer_delete_data(). |
1790 // This is commented in abs_eap_base_timer_c::timer_delete_data(). |
1770 EAP_FUNC_IMPORT eap_status_e timer_delete_data( |
1791 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e timer_delete_data( |
1771 const u32_t id, void *data |
1792 const u32_t id, void *data |
1772 ); |
1793 ); |
1773 |
1794 |
1774 // This is commented in eap_base_type_c::set_is_valid(). |
1795 // This is commented in eap_base_type_c::set_is_valid(). |
1775 EAP_FUNC_IMPORT void set_is_valid(); |
1796 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H void set_is_valid(); |
1776 |
1797 |
1777 // This is commented in eap_base_type_c::get_is_valid(). |
1798 // This is commented in eap_base_type_c::get_is_valid(). |
1778 EAP_FUNC_IMPORT bool get_is_valid(); |
1799 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H bool get_is_valid(); |
1779 |
1800 |
1780 // This is commented in eap_base_type_c::configure(). |
1801 // This is commented in eap_base_type_c::configure(). |
1781 /** |
1802 /** |
1782 * EAP-type GSMSIM reads configuration. |
1803 * EAP-type GSMSIM reads configuration. |
1783 */ |
1804 */ |
1784 EAP_FUNC_IMPORT eap_status_e configure(); |
1805 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e configure(); |
1785 |
1806 |
1786 // This is commented in eap_base_type_c::shutdown(). |
1807 // This is commented in eap_base_type_c::shutdown(). |
1787 /** |
1808 /** |
1788 * The shutdown() function is called before the destructor of the |
1809 * The shutdown() function is called before the destructor of the |
1789 * object is executed. During the function call the object |
1810 * object is executed. During the function call the object |
1790 * could shutdown the operations, for example cancel timers. |
1811 * could shutdown the operations, for example cancel timers. |
1791 * Each derived class must define this function. |
1812 * Each derived class must define this function. |
1792 */ |
1813 */ |
1793 EAP_FUNC_IMPORT eap_status_e shutdown(); |
1814 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e shutdown(); |
1794 |
1815 |
1795 /** |
1816 /** |
1796 * The read_configure() function reads the configuration data identified |
1817 * The read_configure() function reads the configuration data identified |
1797 * by the field string of field_length bytes length. Adaptation module must direct |
1818 * by the field string of field_length bytes length. Adaptation module must direct |
1798 * the query to some persistent store. |
1819 * the query to some persistent store. |
1799 * @param field is generic configure string idenfying the required configure data. |
1820 * @param field is generic configure string idenfying the required configure data. |
1800 * @param field_length is length of the field string. |
1821 * @param field_length is length of the field string. |
1801 * @param data is pointer to existing eap_variable_data object. |
1822 * @param data is pointer to existing eap_variable_data object. |
1802 */ |
1823 */ |
1803 EAP_FUNC_IMPORT virtual eap_status_e read_configure( |
1824 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H virtual eap_status_e read_configure( |
1804 const eap_configuration_field_c * const field, |
1825 const eap_configuration_field_c * const field, |
1805 eap_variable_data_c * const data |
1826 eap_variable_data_c * const data |
1806 ); |
1827 ); |
1807 |
1828 |
1808 /** |
1829 /** |
1811 * the action to some persistent store. |
1832 * the action to some persistent store. |
1812 * @param field is generic configure string idenfying the required configure data. |
1833 * @param field is generic configure string idenfying the required configure data. |
1813 * @param field_length is length of the field string. |
1834 * @param field_length is length of the field string. |
1814 * @param data is pointer to existing eap_variable_data object. |
1835 * @param data is pointer to existing eap_variable_data object. |
1815 */ |
1836 */ |
1816 EAP_FUNC_IMPORT virtual eap_status_e write_configure( |
1837 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H virtual eap_status_e write_configure( |
1817 const eap_configuration_field_c * const field, |
1838 const eap_configuration_field_c * const field, |
1818 eap_variable_data_c * const data |
1839 eap_variable_data_c * const data |
1819 ); |
1840 ); |
1820 |
1841 |
1821 // See abs_eap_base_type_c::state_notification(). |
1842 // See abs_eap_base_type_c::state_notification(). |
1822 EAP_FUNC_IMPORT void state_notification( |
1843 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H void state_notification( |
1823 const abs_eap_state_notification_c * const state |
1844 const abs_eap_state_notification_c * const state |
1824 ); |
1845 ); |
1825 |
1846 |
1826 // This is commented in eap_base_type_c::query_eap_identity(). |
1847 // This is commented in eap_base_type_c::query_eap_identity(). |
1827 EAP_FUNC_IMPORT eap_status_e query_eap_identity( |
1848 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e query_eap_identity( |
1828 const bool must_be_synchronous, |
1849 const bool must_be_synchronous, |
1829 eap_variable_data_c * const identity, |
1850 eap_variable_data_c * const identity, |
1830 const eap_am_network_id_c * const receive_network_id, |
1851 const eap_am_network_id_c * const receive_network_id, |
1831 const u8_t eap_identifier); |
1852 const u8_t eap_identifier); |
1832 |
1853 |
1833 // This is commented in eap_base_type_c::query_eap_identity(). |
1854 // This is commented in eap_base_type_c::query_eap_identity(). |
1834 EAP_FUNC_IMPORT eap_status_e set_initial_eap_identifier( |
1855 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e set_initial_eap_identifier( |
1835 const eap_am_network_id_c * const receive_network_id, |
1856 const eap_am_network_id_c * const receive_network_id, |
1836 const u8_t initial_identifier); |
1857 const u8_t initial_identifier); |
1837 |
1858 |
1838 // This is commented in eap_base_type_c::eap_acknowledge(). |
1859 // This is commented in eap_base_type_c::eap_acknowledge(). |
1839 EAP_FUNC_IMPORT eap_status_e eap_acknowledge( |
1860 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e eap_acknowledge( |
1840 const eap_am_network_id_c * const receive_network_id); |
1861 const eap_am_network_id_c * const receive_network_id); |
1841 |
1862 |
1842 /** |
1863 /** |
1843 * This function must reset the state of object to same as |
1864 * This function must reset the state of object to same as |
1844 * state was after the configure() function call. |
1865 * state was after the configure() function call. |
1845 * If object reset succeeds this function must return eap_status_ok. |
1866 * If object reset succeeds this function must return eap_status_ok. |
1846 * If object reset fails this function must return corresponding error status. |
1867 * If object reset fails this function must return corresponding error status. |
1847 * @return This function returns the status of reset operation. |
1868 * @return This function returns the status of reset operation. |
1848 */ |
1869 */ |
1849 EAP_FUNC_IMPORT eap_status_e reset(); |
1870 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e reset(); |
1850 |
1871 |
1851 // |
1872 // |
1852 EAP_FUNC_IMPORT eap_status_e set_timer( |
1873 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e set_timer( |
1853 abs_eap_base_timer_c * const p_initializer, |
1874 abs_eap_base_timer_c * const p_initializer, |
1854 const u32_t p_id, |
1875 const u32_t p_id, |
1855 void * const p_data, |
1876 void * const p_data, |
1856 const u32_t p_time_ms); |
1877 const u32_t p_time_ms); |
1857 |
1878 |
1858 EAP_FUNC_IMPORT eap_status_e cancel_timer( |
1879 EAP_FUNC_VISIBILITY_EAP_TYPE_GSMSIM_H eap_status_e cancel_timer( |
1859 abs_eap_base_timer_c * const p_initializer, |
1880 abs_eap_base_timer_c * const p_initializer, |
1860 const u32_t p_id); |
1881 const u32_t p_id); |
1861 |
1882 |
1862 //-------------------------------------------------- |
1883 //-------------------------------------------------- |
1863 }; // class eap_type_gsmsim_c |
1884 }; // class eap_type_gsmsim_c |