Skip to content
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

vtls/openssl: Support async certificate verification by user callback #11499

Closed
wants to merge 6 commits into from

Conversation

pabusse
Copy link
Contributor

@pabusse pabusse commented Jul 21, 2023

Overview

Update the OpenSSL connect state machine to handle SSL_ERROR_WANT_RETRY_VERIFY. This allows libcurl users to suspend processing while waiting for external I/O during certificate validation.

Intended usage

Clients perform asynchronous certificate verification by installing a X.509 certificate verification function with SSL_CTX_set_cert_verify_callback from the SSL context callback (see CURLOPT_SSL_CTX_FUNCTION).

The verification function calls SSL_set_retry_verify before returning 0 to indicate that the outcome is still pending. Once verification completes, the client calls curl_multi_wakeup to re-enter the SSL_connect state machine and return the final verification outcome from the next call to the verification function.

This mechanism is useful for applications that use OpenSSL for TLS protocol handling and crypto while delegating certificate verification to the platform's native trust store.

@github-actions github-actions bot added the TLS label Jul 21, 2023
@bagder
Copy link
Member

bagder commented Jul 22, 2023

This allows libcurl users to suspend processing while waiting for external I/O during certificate validation

Shouldn't this then also be documented somewhere?

@pabusse
Copy link
Contributor Author

pabusse commented Jul 24, 2023

Shouldn't this then also be documented somewhere?

Added a section on custom certificate verification with OpenSSL. Please take a look.

@jay
Copy link
Member

jay commented Jul 29, 2023

This is highly advanced and too niche to document in SSLCERTS. Instead, I suggest add a concise paragraph above the WARNING paragraphs in CURLOPT_SSL_CTX_FUNCTION: "For OpenSSL, error code SSL_ERROR_WANT_RETRY_VERIFY is supported for custom certificate verification. (Added in 8.3.0)". Anyone who is using a custom CTX function it's up to them to investigate all of the details. There's such a thing as too much documentation.

@jay jay closed this in 11d46bc Aug 1, 2023
@jay
Copy link
Member

jay commented Aug 1, 2023

Thanks

ptitSeb pushed a commit to wasix-org/curl that referenced this pull request Sep 25, 2023
- Update the OpenSSL connect state machine to handle
  SSL_ERROR_WANT_RETRY_VERIFY.

This allows libcurl users that are using custom certificate validation
to suspend processing while waiting for external I/O during certificate
validation.

Closes curl#11499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants