Initial, incomplete support for typesafe macros without using function
[openssl.git] / crypto / asn1 / asn1_gen.c
index e21c05e..a6cd1ad 100644 (file)
@@ -442,9 +442,9 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
        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 (section)
                {
@@ -465,17 +465,9 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
        /* 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_SET_OF_ASN1_TYPE(sk, NULL, i2d_ASN1_TYPE, utype,
-                                          V_ASN1_UNIVERSAL, is_set);
-       der = OPENSSL_malloc(derlen);
-       p = der;
-       i2d_ASN1_SET_OF_ASN1_TYPE(sk, &p, i2d_ASN1_TYPE, utype,
-                                 V_ASN1_UNIVERSAL, is_set);
+               derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);
 
        if (!(ret = ASN1_TYPE_new()))
                goto bad;