Correct purpose setting for OCSP_request_verify#3089
Merged
samuel40791765 merged 3 commits intoaws:mainfrom Mar 16, 2026
Merged
Correct purpose setting for OCSP_request_verify#3089samuel40791765 merged 3 commits intoaws:mainfrom
samuel40791765 merged 3 commits intoaws:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3089 +/- ##
==========================================
- Coverage 78.19% 78.18% -0.02%
==========================================
Files 689 689
Lines 121814 121822 +8
Branches 16995 16994 -1
==========================================
- Hits 95254 95246 -8
- Misses 25676 25689 +13
- Partials 884 887 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
justsmth
reviewed
Mar 11, 2026
justsmth
reviewed
Mar 12, 2026
5049e8e to
21effe0
Compare
justsmth
previously approved these changes
Mar 13, 2026
justsmth
reviewed
Mar 13, 2026
crypto/ocsp/ocsp_verify.c
Outdated
| // Initialize and set purpose of |ctx| for verification. | ||
| if (!X509_STORE_CTX_init(ctx, store, signer, NULL) && | ||
| if (!X509_STORE_CTX_init(ctx, store, signer, NULL) || | ||
| !X509_STORE_CTX_set_purpose(ctx, X509_PURPOSE_OCSP_HELPER)) { |
Contributor
There was a problem hiding this comment.
NP: We could also make these success values explicit:
if (1 != X509_STORE_CTX_init(ctx, store, signer, NULL) ||
1 != X509_STORE_CTX_set_purpose(ctx, X509_PURPOSE_OCSP_HELPER)) {
932c395 to
b41a023
Compare
b41a023 to
c344b59
Compare
crypto/ocsp/ocsp_verify.c
Outdated
| return 0; | ||
| } | ||
| if (1 != X509_pubkey_digest(cert, dgst, md, NULL)) { | ||
| if (1 == X509_pubkey_digest(cert, dgst, md, NULL)) { |
Contributor
There was a problem hiding this comment.
should we error if this fails?
c344b59 to
cfb9a63
Compare
cfb9a63 to
7a09c49
Compare
7a09c49 to
f369d06
Compare
WillChilds-Klein
approved these changes
Mar 16, 2026
justsmth
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a logic error from
&&→||inOCSP_request_verifywhen initializing the store context and setting its purpose. With&&, aset_purposefailure is silently ignored wheninitsucceeds, soX509_verify_certruns withoutX509_PURPOSE_OCSP_HELPER.OCSP_HELPERis already intentionally permissive (skips leaf EKU checks, uses basic self-signed root trust), and the default path without it behaves nearly the same way. The signature is already validated before this point.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.