sk_***_new_null() seems to be there to avoid exactly this sort of thing
[openssl.git] / crypto / asn1 / a_print.c
index 4e50f6ec8b98cd874eab802386e9fc3fc2936f97..b7bd2bd18aeb5b05d23000d9f7c8f51dffb40762 100644 (file)
 #include "cryptlib.h"
 #include <openssl/asn1.h>
 
-/* ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_WRONG_PRINTABLE_TYPE);
- * ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_TAG_VALUE_TOO_HIGH);
- */
+ASN1_IA5STRING *ASN1_IA5STRING_new(void)
+{ return M_ASN1_IA5STRING_new();}
+
+void ASN1_IA5STRING_free(ASN1_IA5STRING *x)
+{ M_ASN1_IA5STRING_free(x);}
 
 int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a, unsigned char **pp)
        { return(M_i2d_ASN1_IA5STRING(a,pp)); }
@@ -71,15 +73,30 @@ ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, unsigned char **pp,
             long l)
        { return(M_d2i_ASN1_IA5STRING(a,pp,l)); }
 
+ASN1_T61STRING *ASN1_T61STRING_new(void)
+{ return M_ASN1_T61STRING_new();}
+
+void ASN1_T61STRING_free(ASN1_T61STRING *x)
+{ M_ASN1_T61STRING_free(x);}
+
 ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, unsigned char **pp,
             long l)
        { return(M_d2i_ASN1_T61STRING(a,pp,l)); }
 
+ASN1_PRINTABLESTRING *ASN1_PRINTABLESTRING_new(void)
+{ return M_ASN1_PRINTABLESTRING_new();}
+
+void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *x)
+{ M_ASN1_PRINTABLESTRING_free(x);}
+
 ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
             unsigned char **pp, long l)
        { return(M_d2i_ASN1_PRINTABLESTRING(a,pp,
             l)); }
 
+int i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **pp)
+       { return(M_i2d_ASN1_PRINTABLESTRING(a,pp)); }
+
 int i2d_ASN1_PRINTABLE(ASN1_STRING *a, unsigned char **pp)
        { return(M_i2d_ASN1_PRINTABLE(a,pp)); }
 
@@ -99,6 +116,7 @@ int ASN1_PRINTABLE_type(unsigned char *s, int len)
        while ((*s) && (len-- != 0))
                {
                c= *(s++);
+#ifndef CHARSET_EBCDIC
                if (!(  ((c >= 'a') && (c <= 'z')) ||
                        ((c >= 'A') && (c <= 'Z')) ||
                        (c == ' ') ||
@@ -112,6 +130,13 @@ int ASN1_PRINTABLE_type(unsigned char *s, int len)
                        ia5=1;
                if (c&0x80)
                        t61=1;
+#else
+               if (!isalnum(c) && (c != ' ') &&
+                   strchr("'()+,-./:=?", c) == NULL)
+                       ia5=1;
+               if (os_toascii[c] & 0x80)
+                       t61=1;
+#endif
                }
        if (t61) return(V_ASN1_T61STRING);
        if (ia5) return(V_ASN1_IA5STRING);
@@ -145,6 +170,11 @@ int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
        return(1);
        }
 
+ASN1_STRING *DIRECTORYSTRING_new(void)
+{ return M_DIRECTORYSTRING_new();}
+
+void DIRECTORYSTRING_free(ASN1_STRING *x)
+{ M_DIRECTORYSTRING_free(x);}
 
 int i2d_DIRECTORYSTRING(ASN1_STRING *a, unsigned char **pp)
        { return(M_i2d_DIRECTORYSTRING(a,pp)); }
@@ -153,6 +183,12 @@ ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp,
             long l)
        { return(M_d2i_DIRECTORYSTRING(a,pp,l)); }
 
+ASN1_STRING *DISPLAYTEXT_new(void)
+{ return M_DISPLAYTEXT_new();}
+
+void DISPLAYTEXT_free(ASN1_STRING *x)
+{ M_DISPLAYTEXT_free(x);}
+
 int i2d_DISPLAYTEXT(ASN1_STRING *a, unsigned char **pp)
        { return(M_i2d_DISPLAYTEXT(a,pp)); }