-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Curl will clear the ex data of the X509_STORE in the ossl_connect_step2 with OpenSSL3.0 #11800
Comments
I assume you use In curl v7.88.0 we chose to delay store initialization to a later point in time to have a fast handshake. This means that the store you see in your I think the best way to fix this is to load the "real" store in case an @bagder wdyt? |
I'm trying to understand @guoxinvmware's use case. I don't think we (can) promise that you can pass data with OpenSSL's API like this.
Agreed. |
Yes, you are right. I use it to install my ex data at the store.
|
Just add a PR to make the x509 store fully initialised before an application callback is invoked. Would be nice if you could verify that this fix works for you. |
- refs curl#11800 - we delay loading the x509 store to shorten the handshake time. However an application callback installed via CURLOPT_SSL_CTX_FUNCTION may need to have the store loaded and try to manipulate it. - load the x509 store before invoking the app callback
Verified with https://github.com/curl/curl/pull/11805/commits. This issue is fixed. |
… before - we delay loading the x509 store to shorten the handshake time. However an application callback installed via CURLOPT_SSL_CTX_FUNCTION may need to have the store loaded and try to manipulate it. - load the x509 store before invoking the app callback Fixes curl#11800 Reported-by: guoxinvmware on github Cloes curl#11805
I did this
Steps:
Expected:
4. To obtain the external data.
Actual:
4. the external data is NULL. Curl cleared it before the callback function.
Note:
This issue doesn't occur if I use curl with OpenSSL1.0.2.
My investigation:
Root cause:
In lib/vtls/openssl.c, line 280, the macro HAVE_SSL_X509_STORE_SHARE is only defined in curl when OpenSSL >= 1.1.0.
There is a function named Curl_ssl_setup_x509_store at line 3368, and it will be called in the ossl_connect_step2.
For OpenSSL3.0, it will call the OpenSSL function SSL_CTX_set_cert_store, if there is a cached_store and the cache_criteria_met is true.
The SSL_CTX_set_cert_store will clear the external data we set in the ssl_ctx before.
I expected the following
I expected that curl will not clear the ex data in the ossl_connect_step2 with OpenSSL3.0.
curl/libcurl version
curl 8.2.1
operating system
macOS 13.5.1 (22G90)
The text was updated successfully, but these errors were encountered: