curl/docs/RUSTLS.md
Viktor Szakats 7e1001bcd6
tidy-up: miscellaneous
- H3 proxy: re-sync code with original source `curl_ngtcp2.c` to reduce
  differences, and to apply missed minor fixes. Also apply clang-format.
  Drop redundant `#undef`s, casts, `#endif` comments, includes, drop
  intermediate variables, sync include and macro order.
  Follow-up to e78b1b3ecc #21153
- INSTALL-CMAKE.md: move `CURL_ENABLE_SMB` to the enable section.
- tests/http/env: rename `tcpdmp` to `tcpdump` to match object variable.
- mbedtls: drop incorrect `mbedTLS 4+` comments.
  (features are also supported by 3+, meaning it's always supported.)
- lib1648: rename a variable to match purpose.
- CIPHERS.md: alpha-sort link list.
- replace rare `X''` hex markup with `0x`.
- `IP v4/6` -> `IPv4/6`.
- 'version X.Y' -> 'vX.Y', where sensible.
- 'VX.Y' -> 'vX.Y', where sensible.
- fix indents, casing, newlines, typos.

Closes #21772
2026-05-27 16:53:57 +02:00

3 KiB

Rustls

Rustls is a TLS backend written in Rust. curl can be built to use it as an alternative to OpenSSL or other TLS backends. We use the rustls-ffi C bindings. This version of curl is compatible with rustls-ffi v0.15.x.

Getting rustls-ffi

To build curl with rustls support you need to have rustls-ffi available first. There are three options for this:

  1. Install it from your package manager, if available.
  2. Download pre-built binaries.
  3. Build it from source.

Installing rustls-ffi from a package manager

See the rustls-ffi README for packaging status. Availability and details for installation differ between distributions.

Once installed, build curl using --with-rustls.

% git clone --depth 1 https://github.com/curl/curl
% cd curl
% autoreconf -fi
% ./configure --with-rustls
% make

Downloading pre-built rustls-ffi binaries

Pre-built binaries are available on the releases page on GitHub for releases since 0.15.0. Download the appropriate archive for your platform and extract it to a directory of your choice (e.g. ${HOME}/rustls-ffi-built).

Once downloaded, build curl using --with-rustls and the path to the extracted binaries.

% git clone --depth 1 https://github.com/curl/curl
% cd curl
% autoreconf -fi
% ./configure --with-rustls=${HOME}/rustls-ffi-built
% make

Building rustls-ffi from source

Building rustls-ffi from source requires both a rust compiler, and the cargo-c cargo plugin.

To install a Rust compiler, use rustup or your package manager to install the 1.73 or newer toolchain.

To install cargo-c, use your package manager, download a pre-built archive, or build it from source with cargo install cargo-c.

Next, check out, build, and install the appropriate version of rustls-ffi using cargo:

% git clone --depth 1 --branch v0.15.3 https://github.com/rustls/rustls-ffi
% cd rustls-ffi
% cargo capi install --release --prefix=${HOME}/rustls-ffi-built

Now configure and build curl using --with-rustls:

% git clone --depth 1 https://github.com/curl/curl
% cd curl
% autoreconf -fi
% ./configure --with-rustls=${HOME}/rustls-ffi-built
% make

See the rustls-ffi README for more information on cryptography providers and their build/platform requirements.