Missing declarations, no assembler in PEDANTIC.
[openssl.git] / crypto / x509 / x509name.c
index b4ceb65851cc25f68b7ce30792e238ebcb957e07..27bc4dc9a3e3508db202e8de9897f3c526a3835c 100644 (file)
@@ -195,8 +195,8 @@ int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
        return ret;
 }
 
-int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type,
-                       unsigned char *bytes, int len, int loc, int set)
+int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
+                       const unsigned char *bytes, int len, int loc, int set)
 {
        X509_NAME_ENTRY *ne;
        int ret;
@@ -273,7 +273,7 @@ err:
        }
 
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
-               char *field, int type, unsigned char *bytes, int len)
+               const char *field, int type, const unsigned char *bytes, int len)
        {
        ASN1_OBJECT *obj;
        X509_NAME_ENTRY *nentry;
@@ -283,6 +283,7 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
                {
                X509err(X509_F_X509_NAME_ENTRY_CREATE_BY_TXT,
                                                X509_R_INVALID_FIELD_NAME);
+               ERR_add_error_data(2, "name=", field);
                return(NULL);
                }
        nentry = X509_NAME_ENTRY_create_by_OBJ(ne,obj,type,bytes,len);
@@ -308,7 +309,7 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
        }
 
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
-            ASN1_OBJECT *obj, int type, unsigned char *bytes, int len)
+            ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len)
        {
        X509_NAME_ENTRY *ret;
 
@@ -346,16 +347,16 @@ int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj)
        }
 
 int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
-            unsigned char *bytes, int len)
+            const unsigned char *bytes, int len)
        {
        int i;
 
        if ((ne == NULL) || ((bytes == NULL) && (len != 0))) return(0);
-       if(type & MBSTRING_FLAG
+       if((type > 0) && (type & MBSTRING_FLAG)
                return ASN1_STRING_set_by_NID(&ne->value, bytes,
                                                len, type,
                                        OBJ_obj2nid(ne->object)) ? 1 : 0;
-       if (len < 0) len=strlen((char *)bytes);
+       if (len < 0) len=strlen((const char *)bytes);
        i=ASN1_STRING_set(ne->value,bytes,len);
        if (!i) return(0);
        if (type != V_ASN1_UNDEF)