diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_att.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_att.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/libcrypto/x509/x509_att.c b/src/lib/libcrypto/x509/x509_att.c index caafde658f..0bae3d32a1 100644 --- a/src/lib/libcrypto/x509/x509_att.c +++ b/src/lib/libcrypto/x509/x509_att.c | |||
@@ -149,8 +149,8 @@ err2: | |||
149 | } | 149 | } |
150 | 150 | ||
151 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, | 151 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, |
152 | ASN1_OBJECT *obj, int type, | 152 | const ASN1_OBJECT *obj, int type, |
153 | unsigned char *bytes, int len) | 153 | const unsigned char *bytes, int len) |
154 | { | 154 | { |
155 | X509_ATTRIBUTE *attr; | 155 | X509_ATTRIBUTE *attr; |
156 | STACK_OF(X509_ATTRIBUTE) *ret; | 156 | STACK_OF(X509_ATTRIBUTE) *ret; |
@@ -163,7 +163,7 @@ STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, | |||
163 | 163 | ||
164 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, | 164 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, |
165 | int nid, int type, | 165 | int nid, int type, |
166 | unsigned char *bytes, int len) | 166 | const unsigned char *bytes, int len) |
167 | { | 167 | { |
168 | X509_ATTRIBUTE *attr; | 168 | X509_ATTRIBUTE *attr; |
169 | STACK_OF(X509_ATTRIBUTE) *ret; | 169 | STACK_OF(X509_ATTRIBUTE) *ret; |
@@ -175,8 +175,8 @@ STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, | |||
175 | } | 175 | } |
176 | 176 | ||
177 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, | 177 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, |
178 | char *attrname, int type, | 178 | const char *attrname, int type, |
179 | unsigned char *bytes, int len) | 179 | const unsigned char *bytes, int len) |
180 | { | 180 | { |
181 | X509_ATTRIBUTE *attr; | 181 | X509_ATTRIBUTE *attr; |
182 | STACK_OF(X509_ATTRIBUTE) *ret; | 182 | STACK_OF(X509_ATTRIBUTE) *ret; |
@@ -188,7 +188,7 @@ STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, | |||
188 | } | 188 | } |
189 | 189 | ||
190 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, | 190 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, |
191 | int atrtype, void *data, int len) | 191 | int atrtype, const void *data, int len) |
192 | { | 192 | { |
193 | ASN1_OBJECT *obj; | 193 | ASN1_OBJECT *obj; |
194 | X509_ATTRIBUTE *ret; | 194 | X509_ATTRIBUTE *ret; |
@@ -205,7 +205,7 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, | |||
205 | } | 205 | } |
206 | 206 | ||
207 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, | 207 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, |
208 | ASN1_OBJECT *obj, int atrtype, void *data, int len) | 208 | const ASN1_OBJECT *obj, int atrtype, const void *data, int len) |
209 | { | 209 | { |
210 | X509_ATTRIBUTE *ret; | 210 | X509_ATTRIBUTE *ret; |
211 | 211 | ||
@@ -234,7 +234,7 @@ err: | |||
234 | } | 234 | } |
235 | 235 | ||
236 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, | 236 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, |
237 | char *atrname, int type, unsigned char *bytes, int len) | 237 | const char *atrname, int type, const unsigned char *bytes, int len) |
238 | { | 238 | { |
239 | ASN1_OBJECT *obj; | 239 | ASN1_OBJECT *obj; |
240 | X509_ATTRIBUTE *nattr; | 240 | X509_ATTRIBUTE *nattr; |
@@ -252,7 +252,7 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, | |||
252 | return nattr; | 252 | return nattr; |
253 | } | 253 | } |
254 | 254 | ||
255 | int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, ASN1_OBJECT *obj) | 255 | int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj) |
256 | { | 256 | { |
257 | if ((attr == NULL) || (obj == NULL)) | 257 | if ((attr == NULL) || (obj == NULL)) |
258 | return(0); | 258 | return(0); |
@@ -261,7 +261,7 @@ int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, ASN1_OBJECT *obj) | |||
261 | return(1); | 261 | return(1); |
262 | } | 262 | } |
263 | 263 | ||
264 | int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, void *data, int len) | 264 | int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len) |
265 | { | 265 | { |
266 | ASN1_TYPE *ttmp; | 266 | ASN1_TYPE *ttmp; |
267 | ASN1_STRING *stmp; | 267 | ASN1_STRING *stmp; |
@@ -283,7 +283,7 @@ int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, void *data, int | |||
283 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; | 283 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; |
284 | if(!(ttmp = ASN1_TYPE_new())) goto err; | 284 | if(!(ttmp = ASN1_TYPE_new())) goto err; |
285 | if(!sk_ASN1_TYPE_push(attr->value.set, ttmp)) goto err; | 285 | if(!sk_ASN1_TYPE_push(attr->value.set, ttmp)) goto err; |
286 | attr->set = 1; | 286 | attr->single = 0; |
287 | ASN1_TYPE_set(ttmp, atype, stmp); | 287 | ASN1_TYPE_set(ttmp, atype, stmp); |
288 | return 1; | 288 | return 1; |
289 | err: | 289 | err: |
@@ -293,7 +293,7 @@ int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, void *data, int | |||
293 | 293 | ||
294 | int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr) | 294 | int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr) |
295 | { | 295 | { |
296 | if(attr->set) return sk_ASN1_TYPE_num(attr->value.set); | 296 | if(!attr->single) return sk_ASN1_TYPE_num(attr->value.set); |
297 | if(attr->value.single) return 1; | 297 | if(attr->value.single) return 1; |
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
@@ -321,6 +321,6 @@ ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx) | |||
321 | { | 321 | { |
322 | if (attr == NULL) return(NULL); | 322 | if (attr == NULL) return(NULL); |
323 | if(idx >= X509_ATTRIBUTE_count(attr)) return NULL; | 323 | if(idx >= X509_ATTRIBUTE_count(attr)) return NULL; |
324 | if(attr->set) return sk_ASN1_TYPE_value(attr->value.set, idx); | 324 | if(!attr->single) return sk_ASN1_TYPE_value(attr->value.set, idx); |
325 | else return attr->value.single; | 325 | else return attr->value.single; |
326 | } | 326 | } |