make depend
[openssl.git] / crypto / asn1 / tasn_new.c
index 4b046e5e748d40179e75e9d5090f6cb8619e3624..0d9e78cc7cd0f34bd11dfad3ae70160ee0d6aeea 100644 (file)
@@ -1,5 +1,5 @@
 /* tasn_new.c */
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 2000.
  */
 /* ====================================================================
@@ -68,7 +68,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
                                                                int combine);
 static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
 static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
-void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
+static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
 
 ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
        {
@@ -325,6 +325,7 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
 int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
        {
        ASN1_TYPE *typ;
+       ASN1_STRING *str;
        int utype;
 
        if (it && it->funcs)
@@ -345,10 +346,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
                return 1;
 
                case V_ASN1_BOOLEAN:
-               if (it)
-                       *(ASN1_BOOLEAN *)pval = it->size;
-               else
-                       *(ASN1_BOOLEAN *)pval = -1;
+               *(ASN1_BOOLEAN *)pval = it->size;
                return 1;
 
                case V_ASN1_NULL:
@@ -365,7 +363,10 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
                break;
 
                default:
-               *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype);
+               str = ASN1_STRING_type_new(utype);
+               if (it->itype == ASN1_ITYPE_MSTRING && str)
+                       str->flags |= ASN1_STRING_FLAG_MSTRING;
+               *pval = (ASN1_VALUE *)str;
                break;
                }
        if (*pval)
@@ -373,7 +374,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
        return 0;
        }
 
-void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
+static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
        {
        int utype;
        if (it && it->funcs)