eapol/eapol_framework/eapol_common/common/asn1_der_type.cpp
changeset 26 9abfd4f00d37
parent 2 1c7bc153c08e
child 34 ad1f037f1ac2
equal deleted inserted replaced
25:e03a3db4489e 26:9abfd4f00d37
    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 
    21 
    22 #include "asn1_der_type.h"
    22 #include "asn1_der_type.h"
    23 #include "eap_automatic_variable.h"
    23 #include "eap_automatic_variable.h"
    24 
    24 
   672 				&data_output[data_output_offset],
   672 				&data_output[data_output_offset],
   673 				max_data_output_length - data_output_offset,
   673 				max_data_output_length - data_output_offset,
   674 				"%02x \0",
   674 				"%02x \0",
   675 				oid_octet);
   675 				oid_octet);
   676 
   676 
   677 			u8_t oid = oid_octet & (~OID_HIGH_BIT);
   677 			u8_t oid = static_cast<u8_t>(oid_octet & (~OID_HIGH_BIT));
   678 
   678 
   679 			if (ind > offset)
   679 			if (ind > offset)
   680 			{
   680 			{
   681 				plain_output_offset += m_am_tools->snprintf(
   681 				plain_output_offset += m_am_tools->snprintf(
   682 					&plain_output[plain_output_offset],
   682 					&plain_output[plain_output_offset],
   924 
   924 
   925 		while (extented_tag < end_byte)
   925 		while (extented_tag < end_byte)
   926 		{
   926 		{
   927 			if ((extented_tag[0] & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   927 			if ((extented_tag[0] & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   928 			{
   928 			{
   929 				return (extented_tag - m_input_data);
   929 				return static_cast<u16_t>(extented_tag - m_input_data);
   930 			}
   930 			}
   931 
   931 
   932 			++extented_tag;
   932 			++extented_tag;
   933 		}
   933 		}
   934 	}
   934 	}
   955 	const u8_t length_octet1 = m_input_data[m_offset_of_length_field];
   955 	const u8_t length_octet1 = m_input_data[m_offset_of_length_field];
   956 
   956 
   957 	if ((length_octet1 & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   957 	if ((length_octet1 & static_cast<u8_t>(asn1_high_bit_mask_tag)) == 0)
   958 	{
   958 	{
   959 		// Short Length field.
   959 		// Short Length field.
   960 		return m_offset_of_length_field + asn1_identifier_const_short_length_size;
   960 		return static_cast<u16_t>(m_offset_of_length_field + asn1_identifier_const_short_length_size);
   961 	}
   961 	}
   962 	else if (m_input_data_length > static_cast<u32_t>(m_offset_of_length_field + asn1_identifier_const_short_length_size))
   962 	else if (m_input_data_length > static_cast<u32_t>(m_offset_of_length_field + asn1_identifier_const_short_length_size))
   963 	{
   963 	{
   964 		const u8_t * extented_length = &(m_input_data[m_offset_of_length_field]);
   964 		const u8_t * extented_length = &(m_input_data[m_offset_of_length_field]);
   965 		if (extented_length == 0)
   965 		if (extented_length == 0)
  1634 				 current_type->get_recursion()));
  1634 				 current_type->get_recursion()));
  1635 
  1635 
  1636 			status = sub_type->initialize(
  1636 			status = sub_type->initialize(
  1637 				current_type->get_unused_data_length(),
  1637 				current_type->get_unused_data_length(),
  1638 				current_type->get_unused_data(),
  1638 				current_type->get_unused_data(),
  1639 				current_type->get_recursion() + 1u,
  1639 				static_cast<u16_t>(current_type->get_recursion() + 1u),
  1640 				current_type->get_count_of_sub_types(),
  1640 				current_type->get_count_of_sub_types(),
  1641 				debug_buffer);
  1641 				debug_buffer);
  1642 			if (status != eap_status_ok)
  1642 			if (status != eap_status_ok)
  1643 			{
  1643 			{
  1644 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1644 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);