make depend
[openssl.git] / crypto / asn1 / tasn_new.c
index 083f88576a8dd8929962563066f054ef2a60f5ad..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.
  */
 /* ====================================================================
@@ -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)