diff options
Diffstat (limited to 'lib/minitasn1/int.h')
-rw-r--r-- | lib/minitasn1/int.h | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h index 3163d50d14..d422a79c6b 100644 --- a/lib/minitasn1/int.h +++ b/lib/minitasn1/int.h @@ -43,25 +43,24 @@ /* This structure is also in libtasn1.h, but then contains less fields. You cannot make any modifications to these first fields without breaking ABI. */ -struct asn1_node_st -{ - /* public fields: */ - char name[ASN1_MAX_NAME_SIZE+1]; /* Node name */ - unsigned int name_hash; - unsigned int type; /* Node type */ - unsigned char *value; /* Node value */ - int value_len; - asn1_node down; /* Pointer to the son node */ - asn1_node right; /* Pointer to the brother node */ - asn1_node left; /* Pointer to the next list element */ - /* private fields: */ - unsigned char small_value[ASN1_SMALL_VALUE_SIZE]; /* For small values */ +struct asn1_node_st { + /* public fields: */ + char name[ASN1_MAX_NAME_SIZE + 1]; /* Node name */ + unsigned int name_hash; + unsigned int type; /* Node type */ + unsigned char *value; /* Node value */ + int value_len; + asn1_node down; /* Pointer to the son node */ + asn1_node right; /* Pointer to the brother node */ + asn1_node left; /* Pointer to the next list element */ + /* private fields: */ + unsigned char small_value[ASN1_SMALL_VALUE_SIZE]; /* For small values */ }; typedef struct tag_and_class_st { - unsigned tag; - unsigned class; - const char* desc; + unsigned tag; + unsigned class; + const char *desc; } tag_and_class_st; /* the types that are handled in _asn1_tags */ @@ -158,28 +157,26 @@ extern const tag_and_class_st _asn1_tags[]; /****************************************/ inline static unsigned int type_field(unsigned int ntype) { - return (ntype & 0xff); + return (ntype & 0xff); } /* To convert old types from a static structure */ inline static unsigned int convert_old_type(unsigned int ntype) { -unsigned int type = ntype & 0xff; - if (type == ASN1_ETYPE_TIME) - { - if (ntype & CONST_UTC) - type = ASN1_ETYPE_UTC_TIME; - else - type = ASN1_ETYPE_GENERALIZED_TIME; - - ntype &= ~(CONST_UTC|CONST_GENERALIZED); - ntype &= 0xffffff00; - ntype |= type; - - return ntype; - } - else - return ntype; + unsigned int type = ntype & 0xff; + if (type == ASN1_ETYPE_TIME) { + if (ntype & CONST_UTC) + type = ASN1_ETYPE_UTC_TIME; + else + type = ASN1_ETYPE_GENERALIZED_TIME; + + ntype &= ~(CONST_UTC | CONST_GENERALIZED); + ntype &= 0xffffff00; + ntype |= type; + + return ntype; + } else + return ntype; } -#endif /* INT_H */ +#endif /* INT_H */ |