-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
I did this
Steps:
- I used curl 8.2.1 to connect to a website with OpenSSL 3.0.
- I called the OpenSSL function X509_STORE_set_ex_data to set the external data with an X509_STORE.
- Then, I called the OpenSSL function SSL_CTX_set_verify with a callback function.
- In the callback function, I called the X509_STORE_get_ex_data to get the external data.
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)