gcc 4.2 fixes to avoid use or function pointer casts in OpenSSL.
[openssl.git] / crypto / asn1 / tasn_enc.c
index cef398e0fa8290bb02a657f31000fc3846617f06..ed892e2cb2f58e86653b50d6ce9aaa95cc46688b 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>
@@ -493,7 +494,7 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
                {
                for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk);
                                                        i++, tder++)
-                       sk_ASN1_VALUE_set(sk, i, tder->field);
+                       (void)sk_ASN1_VALUE_set(sk, i, tder->field);
                }
        OPENSSL_free(derlst);
        OPENSSL_free(tmpdat);
@@ -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;