diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-01-20 01:37:17 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-01-20 01:37:17 +0000 |
commit | 6e6bc352b18ae230833580018b246d9a7ce331a6 (patch) | |
tree | 0a4bc7f589e513c956925ca9c3d8650bdd61aa10 /crypto/x509 | |
parent | 77b47b903684020d07d16519b2a74cc58668fb20 (diff) | |
download | openssl-6e6bc352b18ae230833580018b246d9a7ce331a6.tar.gz |
Finish off the X509_ATTRIBUTE string stuff.
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/x509.h | 23 | ||||
-rw-r--r-- | crypto/x509/x509_att.c | 10 | ||||
-rw-r--r-- | crypto/x509/x509_err.c | 4 | ||||
-rw-r--r-- | crypto/x509/x509name.c | 1 |
4 files changed, 27 insertions, 11 deletions
diff --git a/crypto/x509/x509.h b/crypto/x509/x509.h index e68e494c22..1ef305c517 100644 --- a/crypto/x509/x509.h +++ b/crypto/x509/x509.h @@ -905,6 +905,23 @@ STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, int nid); int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); +int X509_REQ_get_attr_count(const X509_REQ *req); +int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, + int lastpos); +int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +int X509_REQ_radd_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +int X509_REQ_radd_attr_by_OBJ(X509_REQ *req, + ASN1_OBJECT *obj, int type, + unsigned char *bytes, int len); +int X509_REQ_radd_attr_by_NID(X509_REQ *req, + int nid, int type, + unsigned char *bytes, int len); +int X509_REQ_radd_attr_by_txt(X509_REQ *req, + char *attrname, int type, + unsigned char *bytes, int len); int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); @@ -968,8 +985,8 @@ 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); -ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); -ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); +ASN1_OBJECT * X509_NAME_ENTRY_iget_object(X509_NAME_ENTRY *ne); +ASN1_STRING * X509_NAME_ENTRY_iget_data(X509_NAME_ENTRY *ne); int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, @@ -1119,7 +1136,7 @@ int X509_TRUST_get_trust(X509_TRUST *xp); #define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 #define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 #define X509_F_X509_ATTRIBUTE_IGET_DATA 139 -#define X509_F_X509_ATTRIBUTE_ISET_DATA 138 +#define X509_F_X509_ATTRIBUTE_RSET_DATA 138 #define X509_F_X509_CHECK_PRIVATE_KEY 128 #define X509_F_X509_EXTENSION_CREATE_BY_NID 108 #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c index e04f77bbcc..da76f9cd4d 100644 --- a/crypto/x509/x509_att.c +++ b/crypto/x509/x509_att.c @@ -123,7 +123,6 @@ STACK_OF(X509_ATTRIBUTE) *X509at_radd_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr) { X509_ATTRIBUTE *new_attr=NULL; - int n; STACK_OF(X509_ATTRIBUTE) *sk=NULL; if ((x != NULL) && (*x == NULL)) @@ -134,8 +133,6 @@ STACK_OF(X509_ATTRIBUTE) *X509at_radd_attr(STACK_OF(X509_ATTRIBUTE) **x, else sk= *x; - n=sk_X509_ATTRIBUTE_num(sk); - if ((new_attr=X509_ATTRIBUTE_dup(attr)) == NULL) goto err2; if (!sk_X509_ATTRIBUTE_push(sk,new_attr)) @@ -247,6 +244,7 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, { X509err(X509_F_X509_ATTRIBUTE_CREATE_BY_TXT, X509_R_INVALID_FIELD_NAME); + ERR_add_error_data(2, "name=", atrname); return(NULL); } nattr = X509_ATTRIBUTE_create_by_OBJ(attr,obj,type,bytes,len); @@ -273,7 +271,7 @@ int X509_ATTRIBUTE_rset_data(X509_ATTRIBUTE *attr, int attrtype, void *data, int stmp = ASN1_STRING_set_by_NID(NULL, data, len, attrtype, OBJ_obj2nid(attr->object)); if(!stmp) { - X509err(X509_F_X509_ATTRIBUTE_ISET_DATA, ERR_R_ASN1_LIB); + X509err(X509_F_X509_ATTRIBUTE_RSET_DATA, ERR_R_ASN1_LIB); return 0; } atype = stmp->type; @@ -286,10 +284,10 @@ int X509_ATTRIBUTE_rset_data(X509_ATTRIBUTE *attr, int attrtype, void *data, int if(!(ttmp = ASN1_TYPE_new())) goto err; if(!sk_ASN1_TYPE_push(attr->value.set, ttmp)) goto err; attr->set = 1; - ASN1_TYPE_set(ttmp, atype, data); + ASN1_TYPE_set(ttmp, atype, stmp); return 1; err: - X509err(X509_F_X509_ATTRIBUTE_ISET_DATA, ERR_R_MALLOC_FAILURE); + X509err(X509_F_X509_ATTRIBUTE_RSET_DATA, ERR_R_MALLOC_FAILURE); return 0; } diff --git a/crypto/x509/x509_err.c b/crypto/x509/x509_err.c index 026a92b6be..a9a81167a7 100644 --- a/crypto/x509/x509_err.c +++ b/crypto/x509/x509_err.c @@ -75,9 +75,9 @@ static ERR_STRING_DATA X509_str_functs[]= {ERR_PACK(0,X509_F_X509_ADD_ATTR,0), "X509_ADD_ATTR"}, {ERR_PACK(0,X509_F_X509_ATTRIBUTE_CREATE_BY_NID,0), "X509_ATTRIBUTE_create_by_NID"}, {ERR_PACK(0,X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ,0), "X509_ATTRIBUTE_create_by_OBJ"}, -{ERR_PACK(0,X509_F_X509_ATTRIBUTE_CREATE_BY_TXT,0), "X509_ATTRIBUTE_CREATE_BY_TXT"}, +{ERR_PACK(0,X509_F_X509_ATTRIBUTE_CREATE_BY_TXT,0), "X509_ATTRIBUTE_create_by_txt"}, {ERR_PACK(0,X509_F_X509_ATTRIBUTE_IGET_DATA,0), "X509_ATTRIBUTE_iget_data"}, -{ERR_PACK(0,X509_F_X509_ATTRIBUTE_ISET_DATA,0), "X509_ATTRIBUTE_ISET_DATA"}, +{ERR_PACK(0,X509_F_X509_ATTRIBUTE_RSET_DATA,0), "X509_ATTRIBUTE_rset_data"}, {ERR_PACK(0,X509_F_X509_CHECK_PRIVATE_KEY,0), "X509_check_private_key"}, {ERR_PACK(0,X509_F_X509_EXTENSION_CREATE_BY_NID,0), "X509_EXTENSION_create_by_NID"}, {ERR_PACK(0,X509_F_X509_EXTENSION_CREATE_BY_OBJ,0), "X509_EXTENSION_create_by_OBJ"}, diff --git a/crypto/x509/x509name.c b/crypto/x509/x509name.c index b4ceb65851..cf2382d42c 100644 --- a/crypto/x509/x509name.c +++ b/crypto/x509/x509name.c @@ -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); |