ASN1_item_verify needs to initialize ctx before any "goto err" can
[openssl.git] / crypto / asn1 / tasn_enc.c
index 4ab1ea10f53dff967ac17be186beda1e2cea99bb..685401e163e982a777a053aed1e3ee37fbe4bbfa 100644 (file)
@@ -59,6 +59,7 @@
 
 #include <stddef.h>
 #include <string.h>
+#include "cryptlib.h"
 #include <openssl/asn1.h>
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
@@ -617,11 +618,14 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
                tbool = (ASN1_BOOLEAN *)pval;
                if (*tbool == -1)
                        return -1;
-               /* Default handling if value == size field then omit */
-               if (*tbool && (it->size > 0))
-                       return -1;
-               if (!*tbool && !it->size)
-                       return -1;
+               if (it->utype != V_ASN1_ANY)
+                       {
+                       /* Default handling if value == size field then omit */
+                       if (*tbool && (it->size > 0))
+                               return -1;
+                       if (!*tbool && !it->size)
+                               return -1;
+                       }
                c = (unsigned char)*tbool;
                cont = &c;
                len = 1;