eapol/eapol_framework/eapol_common/common/asn1_der_type.cpp
branchRCL_3
changeset 45 bad0cc58d154
parent 2 1c7bc153c08e
child 46 c74b3d9f6b9e
equal deleted inserted replaced
43:30e048a7b597 45:bad0cc58d154
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 34 %
    19 * %version: %
    20 */
    20 */
       
    21 
       
    22 // This is enumeration of EAPOL source code.
       
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    24 	#undef EAP_FILE_NUMBER_ENUM
       
    25 	#define EAP_FILE_NUMBER_ENUM 761 
       
    26 	#undef EAP_FILE_NUMBER_DATE 
       
    27 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    21 
    29 
    22 #include "asn1_der_type.h"
    30 #include "asn1_der_type.h"
    23 #include "eap_automatic_variable.h"
    31 #include "eap_automatic_variable.h"
    24 
    32 
    25 //--------------------------------------------------
    33 //--------------------------------------------------
   672 				&data_output[data_output_offset],
   680 				&data_output[data_output_offset],
   673 				max_data_output_length - data_output_offset,
   681 				max_data_output_length - data_output_offset,
   674 				"%02x \0",
   682 				"%02x \0",
   675 				oid_octet);
   683 				oid_octet);
   676 
   684 
   677 			u8_t oid = oid_octet & (~OID_HIGH_BIT);
   685 			u8_t oid = static_cast<u8_t>(oid_octet & (~OID_HIGH_BIT));
   678 
   686 
   679 			if (ind > offset)
   687 			if (ind > offset)
   680 			{
   688 			{
   681 				plain_output_offset += m_am_tools->snprintf(
   689 				plain_output_offset += m_am_tools->snprintf(
   682 					&plain_output[plain_output_offset],
   690 					&plain_output[plain_output_offset],
   924 
   932 
   925 		while (extented_tag < end_byte)
   933 		while (extented_tag < end_byte)
   926 		{
   934 		{
   927 			if ((extented_tag[0] & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   935 			if ((extented_tag[0] & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   928 			{
   936 			{
   929 				return (extented_tag - m_input_data);
   937 				return static_cast<u16_t>(extented_tag - m_input_data);
   930 			}
   938 			}
   931 
   939 
   932 			++extented_tag;
   940 			++extented_tag;
   933 		}
   941 		}
   934 	}
   942 	}
   955 	const u8_t length_octet1 = m_input_data[m_offset_of_length_field];
   963 	const u8_t length_octet1 = m_input_data[m_offset_of_length_field];
   956 
   964 
   957 	if ((length_octet1 & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   965 	if ((length_octet1 & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   958 	{
   966 	{
   959 		// Short Length field.
   967 		// Short Length field.
   960 		return m_offset_of_length_field + asn1_identifier_const_short_length_size;
   968 		return static_cast<u16_t>(m_offset_of_length_field + asn1_identifier_const_short_length_size);
   961 	}
   969 	}
   962 	else if (m_input_data_length > static_cast<u32_t>(m_offset_of_length_field + asn1_identifier_const_short_length_size))
   970 	else if (m_input_data_length > static_cast<u32_t>(m_offset_of_length_field + asn1_identifier_const_short_length_size))
   963 	{
   971 	{
   964 		const u8_t * extented_length = &(m_input_data[m_offset_of_length_field]);
   972 		const u8_t * extented_length = &(m_input_data[m_offset_of_length_field]);
   965 		if (extented_length == 0)
   973 		if (extented_length == 0)
  1634 				 current_type->get_recursion()));
  1642 				 current_type->get_recursion()));
  1635 
  1643 
  1636 			status = sub_type->initialize(
  1644 			status = sub_type->initialize(
  1637 				current_type->get_unused_data_length(),
  1645 				current_type->get_unused_data_length(),
  1638 				current_type->get_unused_data(),
  1646 				current_type->get_unused_data(),
  1639 				current_type->get_recursion() + 1u,
  1647 				static_cast<u16_t>(current_type->get_recursion() + 1u),
  1640 				current_type->get_count_of_sub_types(),
  1648 				current_type->get_count_of_sub_types(),
  1641 				debug_buffer);
  1649 				debug_buffer);
  1642 			if (status != eap_status_ok)
  1650 			if (status != eap_status_ok)
  1643 			{
  1651 			{
  1644 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1652 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);