crypto: fix VerifyCallback in case of verify error #2064
Closed
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.
3beb880 has a bug in VerifyCallback when preverify is 1 and the cert chain has an verify error. If the error is UNABLE_TO_GET_ISSUER_CERT_LOCALLY, it leads an assertion error in finding rootCA.
The whitelist check should be made only when the cert chain has no verify error with X509_V_OK.
Fixes: #2061
CI of https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/87/ are green except one failure of test-debug-port-from-cmdline.js on win2012r2. It's not related with this fix.
make test-internet
are fine and the result of a test shown by the issue reporter of #2061 is below.The error code is different because UNABLE_TO_GET_ISSUER_CERT_LOCALLY is overwritten by CERT_HAS_EXPIRED according to the order of verify checks.
R= @bnoordhuis