[fix] retry matching chain from trust-store and skip expired intermediate certs early #240
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.
The PR represent a very concrete (and "minimalistic") update to try building alternative chain trust chains with cert verification.
The code is inspired by OpenSSL 1.1.1's alt verification logic (namely
(search & S_DOALTERNATE)
) but does not allow arbitrary chain unrolling and retry, thus being somehow less flexible. Instead the retry is hard-coded at the level when the initial chain is built looking up certificates from the trust store.This, and a few extra checks on expiry dates (ported over from OpenSSL 1.1.1), is expected to be sufficient to resolve issues such as #236.
TODO:
(if retry logic is off problematic chains should also veridy with expired CAs removed from the trust store?)
HINT: The #236 work started as a OpenSSL 1.1.1 port #239 but was put to ice due (even after a week) requiring more porting/reviewing of OpenSSL C code.