summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509_att.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-02-11 13:59:33 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-02-11 13:59:33 +0000
commit1ad90a916b4e3295173853d5da7f6a68cbad53f1 (patch)
tree116549f9b3d731de9d70ed66e8914b37ae0115b3 /crypto/x509/x509_att.c
parent8ab9025e316706c0c253dd61fc0f56857f4d24d0 (diff)
Extend attribute setting routines to support non-string types.
Diffstat (limited to 'crypto/x509/x509_att.c')
-rw-r--r--crypto/x509/x509_att.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c
index 65968c4944..2a8cc0c4b0 100644
--- a/crypto/x509/x509_att.c
+++ b/crypto/x509/x509_att.c
@@ -281,16 +281,22 @@ int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *dat
return 0;
}
atype = stmp->type;
- } else {
+ } else if (len != -1){
if(!(stmp = ASN1_STRING_type_new(attrtype))) goto err;
if(!ASN1_STRING_set(stmp, data, len)) goto err;
atype = attrtype;
}
if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err;
if(!(ttmp = ASN1_TYPE_new())) goto err;
+ if (len == -1)
+ {
+ if (!ASN1_TYPE_set1(ttmp, attrtype, data))
+ goto err;
+ }
+ else
+ ASN1_TYPE_set(ttmp, atype, stmp);
if(!sk_ASN1_TYPE_push(attr->value.set, ttmp)) goto err;
attr->single = 0;
- ASN1_TYPE_set(ttmp, atype, stmp);
return 1;
err:
X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE);