Fixes for BOOL handling: produce errors for invalid string for mini-compiler,
[openssl.git] / crypto / asn1 / asn1_gen.c
index 4341e5415a9b21401fb1f12fad73c62dec461f7a..aaa2c7eb3f3529fe6064d502dc984e6ab574ecae 100644 (file)
@@ -88,7 +88,7 @@
 
 struct tag_name_st
        {
-       char *strnam;
+       const char *strnam;
        int len;
        int tag;
        };
@@ -512,13 +512,13 @@ static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons
        /* Can only have IMPLICIT if permitted */
        if ((arg->imp_tag != -1) && !imp_ok)
                {
-               ASN1err(ASN1_F_APPEND_TAG, ASN1_R_ILLEGAL_IMPLICIT_TAG);
+               ASN1err(ASN1_F_APPEND_EXP, ASN1_R_ILLEGAL_IMPLICIT_TAG);
                return 0;
                }
 
        if (arg->exp_count == ASN1_FLAG_EXP_MAX)
                {
-               ASN1err(ASN1_F_APPEND_TAG, ASN1_R_DEPTH_EXCEEDED);
+               ASN1err(ASN1_F_APPEND_EXP, ASN1_R_DEPTH_EXCEEDED);
                return 0;
                }
 
@@ -584,6 +584,8 @@ static int asn1_str2tag(const char *tagstr, int len)
                ASN1_GEN_STR("TELETEXSTRING", V_ASN1_T61STRING),
                ASN1_GEN_STR("GeneralString", V_ASN1_GENERALSTRING),
                ASN1_GEN_STR("GENSTR", V_ASN1_GENERALSTRING),
+               ASN1_GEN_STR("NUMERIC", V_ASN1_NUMERICSTRING),
+               ASN1_GEN_STR("NUMERICSTRING", V_ASN1_NUMERICSTRING),
 
                /* Special cases */
                ASN1_GEN_STR("SEQUENCE", V_ASN1_SEQUENCE),
@@ -658,6 +660,8 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
                        ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_NOT_ASCII_FORMAT);
                        goto bad_form;
                        }
+               vtmp.name = NULL;
+               vtmp.section = NULL;
                vtmp.value = (char *)str;
                if (!X509V3_get_value_bool(&vtmp, &atmp->value.boolean))
                        {
@@ -727,6 +731,7 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
                case V_ASN1_VISIBLESTRING:
                case V_ASN1_UNIVERSALSTRING:
                case V_ASN1_GENERALSTRING:
+               case V_ASN1_NUMERICSTRING:
 
                if (format == ASN1_GEN_FORMAT_ASCII)
                        format = MBSTRING_ASC;