| Index: openssl/crypto/asn1/asn1_gen.c
|
| ===================================================================
|
| --- openssl/crypto/asn1/asn1_gen.c (revision 105093)
|
| +++ openssl/crypto/asn1/asn1_gen.c (working copy)
|
| @@ -247,8 +247,14 @@
|
| /* If IMPLICIT, output tag */
|
|
|
| if (asn1_tags.imp_tag != -1)
|
| + {
|
| + if (asn1_tags.imp_class == V_ASN1_UNIVERSAL
|
| + && (asn1_tags.imp_tag == V_ASN1_SEQUENCE
|
| + || asn1_tags.imp_tag == V_ASN1_SET) )
|
| + hdr_constructed = V_ASN1_CONSTRUCTED;
|
| ASN1_put_object(&p, hdr_constructed, hdr_len,
|
| asn1_tags.imp_tag, asn1_tags.imp_class);
|
| + }
|
|
|
| /* Copy across original encoding */
|
| memcpy(p, cpy_start, cpy_len);
|
| @@ -441,12 +447,12 @@
|
|
|
| static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
| {
|
| - ASN1_TYPE *ret = NULL, *typ = NULL;
|
| + ASN1_TYPE *ret = NULL;
|
| STACK_OF(ASN1_TYPE) *sk = NULL;
|
| STACK_OF(CONF_VALUE) *sect = NULL;
|
| - unsigned char *der = NULL, *p;
|
| + unsigned char *der = NULL;
|
| int derlen;
|
| - int i, is_set;
|
| + int i;
|
| sk = sk_ASN1_TYPE_new_null();
|
| if (!sk)
|
| goto bad;
|
| @@ -459,31 +465,23 @@
|
| goto bad;
|
| for (i = 0; i < sk_CONF_VALUE_num(sect); i++)
|
| {
|
| - typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
|
| + ASN1_TYPE *typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
|
| if (!typ)
|
| goto bad;
|
| if (!sk_ASN1_TYPE_push(sk, typ))
|
| goto bad;
|
| - typ = NULL;
|
| }
|
| }
|
|
|
| /* Now we has a STACK of the components, convert to the correct form */
|
|
|
| if (utype == V_ASN1_SET)
|
| - is_set = 1;
|
| + derlen = i2d_ASN1_SET_ANY(sk, &der);
|
| else
|
| - is_set = 0;
|
| + derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);
|
|
|
| -
|
| - derlen = i2d_ASN1_SET_OF_ASN1_TYPE(sk, NULL, i2d_ASN1_TYPE, utype,
|
| - V_ASN1_UNIVERSAL, is_set);
|
| - der = OPENSSL_malloc(derlen);
|
| - if (!der)
|
| + if (derlen < 0)
|
| goto bad;
|
| - p = der;
|
| - i2d_ASN1_SET_OF_ASN1_TYPE(sk, &p, i2d_ASN1_TYPE, utype,
|
| - V_ASN1_UNIVERSAL, is_set);
|
|
|
| if (!(ret = ASN1_TYPE_new()))
|
| goto bad;
|
| @@ -505,8 +503,6 @@
|
|
|
| if (sk)
|
| sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
|
| - if (typ)
|
| - ASN1_TYPE_free(typ);
|
| if (sect)
|
| X509V3_section_free(cnf, sect);
|
|
|
| @@ -556,7 +552,7 @@
|
| static int asn1_str2tag(const char *tagstr, int len)
|
| {
|
| unsigned int i;
|
| - static struct tag_name_st *tntmp, tnst [] = {
|
| + static const struct tag_name_st *tntmp, tnst [] = {
|
| ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
|
| ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
|
| ASN1_GEN_STR("NULL", V_ASN1_NULL),
|
| @@ -591,6 +587,8 @@
|
| 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),
|
| @@ -736,6 +734,7 @@
|
| 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;
|
|
|