diff options
Diffstat (limited to 'src/lib/libcrypto/x509')
-rw-r--r-- | src/lib/libcrypto/x509/x509_att.c | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.c | 12 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/lib/libcrypto/x509/x509_att.c b/src/lib/libcrypto/x509/x509_att.c index 511b49d589..98460e8921 100644 --- a/src/lib/libcrypto/x509/x509_att.c +++ b/src/lib/libcrypto/x509/x509_att.c | |||
@@ -245,7 +245,7 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, | |||
245 | goto err; | 245 | goto err; |
246 | if (!X509_ATTRIBUTE_set1_data(ret,atrtype,data,len)) | 246 | if (!X509_ATTRIBUTE_set1_data(ret,atrtype,data,len)) |
247 | goto err; | 247 | goto err; |
248 | 248 | ||
249 | if ((attr != NULL) && (*attr == NULL)) *attr=ret; | 249 | if ((attr != NULL) && (*attr == NULL)) *attr=ret; |
250 | return(ret); | 250 | return(ret); |
251 | err: | 251 | err: |
@@ -302,8 +302,15 @@ int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *dat | |||
302 | atype = attrtype; | 302 | atype = attrtype; |
303 | } | 303 | } |
304 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; | 304 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; |
305 | attr->single = 0; | ||
306 | /* This is a bit naughty because the attribute should really have | ||
307 | * at least one value but some types use and zero length SET and | ||
308 | * require this. | ||
309 | */ | ||
310 | if (attrtype == 0) | ||
311 | return 1; | ||
305 | if(!(ttmp = ASN1_TYPE_new())) goto err; | 312 | if(!(ttmp = ASN1_TYPE_new())) goto err; |
306 | if (len == -1) | 313 | if ((len == -1) && !(attrtype & MBSTRING_FLAG)) |
307 | { | 314 | { |
308 | if (!ASN1_TYPE_set1(ttmp, attrtype, data)) | 315 | if (!ASN1_TYPE_set1(ttmp, attrtype, data)) |
309 | goto err; | 316 | goto err; |
@@ -311,7 +318,6 @@ int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *dat | |||
311 | else | 318 | else |
312 | ASN1_TYPE_set(ttmp, atype, stmp); | 319 | ASN1_TYPE_set(ttmp, atype, stmp); |
313 | if(!sk_ASN1_TYPE_push(attr->value.set, ttmp)) goto err; | 320 | if(!sk_ASN1_TYPE_push(attr->value.set, ttmp)) goto err; |
314 | attr->single = 0; | ||
315 | return 1; | 321 | return 1; |
316 | err: | 322 | err: |
317 | X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE); | 323 | X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index 9a62ebcf67..336c40ddd7 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -394,7 +394,7 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
394 | #ifdef OPENSSL_NO_CHAIN_VERIFY | 394 | #ifdef OPENSSL_NO_CHAIN_VERIFY |
395 | return 1; | 395 | return 1; |
396 | #else | 396 | #else |
397 | int i, ok=0, must_be_ca; | 397 | int i, ok=0, must_be_ca, plen = 0; |
398 | X509 *x; | 398 | X509 *x; |
399 | int (*cb)(int xok,X509_STORE_CTX *xctx); | 399 | int (*cb)(int xok,X509_STORE_CTX *xctx); |
400 | int proxy_path_length = 0; | 400 | int proxy_path_length = 0; |
@@ -495,9 +495,10 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
495 | if (!ok) goto end; | 495 | if (!ok) goto end; |
496 | } | 496 | } |
497 | } | 497 | } |
498 | /* Check pathlen */ | 498 | /* Check pathlen if not self issued */ |
499 | if ((i > 1) && (x->ex_pathlen != -1) | 499 | if ((i > 1) && !(x->ex_flags & EXFLAG_SI) |
500 | && (i > (x->ex_pathlen + proxy_path_length + 1))) | 500 | && (x->ex_pathlen != -1) |
501 | && (plen > (x->ex_pathlen + proxy_path_length + 1))) | ||
501 | { | 502 | { |
502 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; | 503 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; |
503 | ctx->error_depth = i; | 504 | ctx->error_depth = i; |
@@ -505,6 +506,9 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
505 | ok=cb(0,ctx); | 506 | ok=cb(0,ctx); |
506 | if (!ok) goto end; | 507 | if (!ok) goto end; |
507 | } | 508 | } |
509 | /* Increment path length if not self issued */ | ||
510 | if (!(x->ex_flags & EXFLAG_SI)) | ||
511 | plen++; | ||
508 | /* If this certificate is a proxy certificate, the next | 512 | /* If this certificate is a proxy certificate, the next |
509 | certificate must be another proxy certificate or a EE | 513 | certificate must be another proxy certificate or a EE |
510 | certificate. If not, the next certificate must be a | 514 | certificate. If not, the next certificate must be a |