openssl: Don't add verify locations when verifypeer==0#2290
openssl: Don't add verify locations when verifypeer==0#2290pschlan wants to merge 1 commit intocurl:masterfrom
Conversation
|
Remember |
When peer verification is disabled, calling SSL_CTX_load_verify_locations is not necessary. Only call it when verification is enabled to save resources and increase performance.
681cd08 to
71ee330
Compare
|
Thanks! |
|
I'm not sure if commenting on this closed pull request is the right way to raise this point. This commit has resulted in a regression in our application that uses libcurl. The application code assumes that libcurl (with the OpenSSL backend) will perform the server certificate verification even if verifypeer == 0 and that the verification result will be available using CURLINFO_SSL_VERIFYRESULT. The libcurl code (in vtls/openssl.c) appears to be written to support this use case. Here are a couple of code snippets from vtls/openssl.c in support of that statement Code snippet 1: Code snippet 2: With the change in this commit (to not set the verify location when verifypeer == 0), the CURLINFO_SSL_VERIFYRESULT does not have useful information for the verifypeer == 0 use case. It will always fail with X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY. My suggestion is to revert this commit. The performance optimization to skip the SSL_CTX_load_verify_locations call can still be achieved if the caller does not set ssl_cafile and ssl_capath. Would you like me to create a pull request? |
|
Ouch. It would be great with a new issue or PR for this, yes! |
|
I'll create a pull request shortly. |
|
Thanks for pointing this out. I agree that it should be reverted. |
Please do @pschlan! |
When peer verification is disabled, calling SSL_CTX_load_verify_locations
is not necessary. Only call it when verification is enabled to save
resources and increase performance.