Skip to content

Offer rustls as an optional TLS engine #341

@sagebind

Description

@sagebind

It would be a large benefit to the Rust community if the curl crate could have an opt-in rustls feature that, when building the bundled libcurl, allows you to use rustls as a TLS backend.

This is possible to do by implementing a compatibility layer between libcurl and rustls by implementing libcurl's internal vtls interface -- rustls does not need to behave like OpenSSL or anything else, it only needs to perform the functions required by the vtls interface.

This compatibility layer could then be exposed as unmangled symbol names for libcurl to reference, which is legal since only one version of the curl crate can exist in a binary per Cargo's linking rules. To actually get libcurl to use the rustls backend, we could either:

  1. Apply a small patch to the libcurl source code that adds the rustls-vtls symbols as an additional (and the selected) backend.
  2. Have the rustls-vtls symbols impersonate a different, existing backend, and don't include the real backend's .c file when we compile.

I've done some investigation and experimentation into this concept myself and it seems feasible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tls-engineBugs or changes related to specific TLS engines.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions