diff options
| author | beck <> | 2021-08-28 07:49:00 +0000 |
|---|---|---|
| committer | beck <> | 2021-08-28 07:49:00 +0000 |
| commit | 99cb09f81fcfcb0bfc150b5e788033d107fa99a9 (patch) | |
| tree | f04498f61a23f39a6e43a9e84d4a1e9e9c6566d8 | |
| parent | 307723997c5211e804da25ff4cfd81b774204a29 (diff) | |
| download | openbsd-99cb09f81fcfcb0bfc150b5e788033d107fa99a9.tar.gz openbsd-99cb09f81fcfcb0bfc150b5e788033d107fa99a9.tar.bz2 openbsd-99cb09f81fcfcb0bfc150b5e788033d107fa99a9.zip | |
Remove the "dump_chain" flag and code. This was a workaround for a problem where
roots were not checked correctly before intermediates that has since been fixed
and is no longer necessary. It is regress checked by case 2c in
regress/lib/libcrypto/x509/verify.c
ok jsing@ tb@
| -rw-r--r-- | src/lib/libcrypto/x509/x509_internal.h | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/x509_verify.c | 17 |
2 files changed, 4 insertions, 16 deletions
diff --git a/src/lib/libcrypto/x509/x509_internal.h b/src/lib/libcrypto/x509/x509_internal.h index 493bf82ac8..f6ce78346e 100644 --- a/src/lib/libcrypto/x509/x509_internal.h +++ b/src/lib/libcrypto/x509/x509_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_internal.h,v 1.9 2021/08/19 03:44:00 beck Exp $ */ | 1 | /* $OpenBSD: x509_internal.h,v 1.10 2021/08/28 07:49:00 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -69,7 +69,6 @@ struct x509_verify_ctx { | |||
| 69 | int saved_error; | 69 | int saved_error; |
| 70 | int saved_error_depth; | 70 | int saved_error_depth; |
| 71 | size_t chains_count; | 71 | size_t chains_count; |
| 72 | int dump_chain; /* Dump current chain without erroring */ | ||
| 73 | STACK_OF(X509) *roots; /* Trusted roots for this validation */ | 72 | STACK_OF(X509) *roots; /* Trusted roots for this validation */ |
| 74 | STACK_OF(X509) *intermediates; /* Intermediates provided by peer */ | 73 | STACK_OF(X509) *intermediates; /* Intermediates provided by peer */ |
| 75 | time_t *check_time; /* Time for validity checks */ | 74 | time_t *check_time; /* Time for validity checks */ |
diff --git a/src/lib/libcrypto/x509/x509_verify.c b/src/lib/libcrypto/x509/x509_verify.c index 5f3c97abf7..3176e110ba 100644 --- a/src/lib/libcrypto/x509/x509_verify.c +++ b/src/lib/libcrypto/x509/x509_verify.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_verify.c,v 1.42 2021/08/19 03:44:00 beck Exp $ */ | 1 | /* $OpenBSD: x509_verify.c,v 1.43 2021/08/28 07:49:00 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -494,18 +494,8 @@ x509_verify_consider_candidate(struct x509_verify_ctx *ctx, X509 *cert, | |||
| 494 | /* Fail if the certificate is already in the chain */ | 494 | /* Fail if the certificate is already in the chain */ |
| 495 | for (i = 0; i < sk_X509_num(current_chain->certs); i++) { | 495 | for (i = 0; i < sk_X509_num(current_chain->certs); i++) { |
| 496 | if (X509_cmp(sk_X509_value(current_chain->certs, i), | 496 | if (X509_cmp(sk_X509_value(current_chain->certs, i), |
| 497 | candidate) == 0) { | 497 | candidate) == 0) |
| 498 | if (is_root_cert) { | ||
| 499 | /* | ||
| 500 | * Someone made a boo-boo and put their root | ||
| 501 | * in with their intermediates - handle this | ||
| 502 | * gracefully as we'll have already picked | ||
| 503 | * this up as a shorter chain. | ||
| 504 | */ | ||
| 505 | ctx->dump_chain = 1; | ||
| 506 | } | ||
| 507 | return 0; | 498 | return 0; |
| 508 | } | ||
| 509 | } | 499 | } |
| 510 | 500 | ||
| 511 | if (ctx->sig_checks++ > X509_VERIFY_MAX_SIGCHECKS) { | 501 | if (ctx->sig_checks++ > X509_VERIFY_MAX_SIGCHECKS) { |
| @@ -606,7 +596,6 @@ x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert, | |||
| 606 | return; | 596 | return; |
| 607 | 597 | ||
| 608 | count = ctx->chains_count; | 598 | count = ctx->chains_count; |
| 609 | ctx->dump_chain = 0; | ||
| 610 | ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; | 599 | ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; |
| 611 | ctx->error_depth = depth; | 600 | ctx->error_depth = depth; |
| 612 | if (ctx->xsc != NULL) { | 601 | if (ctx->xsc != NULL) { |
| @@ -671,7 +660,7 @@ x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert, | |||
| 671 | ctx->xsc->current_cert = cert; | 660 | ctx->xsc->current_cert = cert; |
| 672 | (void) ctx->xsc->verify_cb(1, ctx->xsc); | 661 | (void) ctx->xsc->verify_cb(1, ctx->xsc); |
| 673 | } | 662 | } |
| 674 | } else if (ctx->error_depth == depth && !ctx->dump_chain) { | 663 | } else if (ctx->error_depth == depth) { |
| 675 | if (!x509_verify_ctx_set_xsc_chain(ctx, current_chain, 0, 0)) | 664 | if (!x509_verify_ctx_set_xsc_chain(ctx, current_chain, 0, 0)) |
| 676 | return; | 665 | return; |
| 677 | (void) x509_verify_cert_error(ctx, cert, depth, | 666 | (void) x509_verify_cert_error(ctx, cert, depth, |
