RUSTLS.md (2978B)
1 <!-- 2 Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 4 SPDX-License-Identifier: curl 5 --> 6 7 # Rustls 8 9 [Rustls is a TLS backend written in Rust](https://docs.rs/rustls/). curl can 10 be built to use it as an alternative to OpenSSL or other TLS backends. We use 11 the [rustls-ffi C bindings](https://github.com/rustls/rustls-ffi/). This 12 version of curl is compatible with `rustls-ffi` v0.15.x. 13 14 ## Getting rustls-ffi 15 16 To build `curl` with `rustls` support you need to have `rustls-ffi` available first. 17 There are three options for this: 18 19 1. Install it from your package manager, if available. 20 2. Download pre-built binaries. 21 3. Build it from source. 22 23 ### Installing rustls-ffi from a package manager 24 25 See the [rustls-ffi README] for packaging status. Availability and details for installation 26 differ between distributions. 27 28 Once installed, build `curl` using `--with-rustls`. 29 30 % git clone https://github.com/curl/curl 31 % cd curl 32 % autoreconf -fi 33 % ./configure --with-rustls 34 % make 35 36 [rustls-ffi README]: https://github.com/rustls/rustls-ffi?tab=readme-ov-file 37 38 ### Downloading pre-built rustls-ffi binaries 39 40 Pre-built binaries are available on the [releases page] on GitHub for releases since 0.15.0. 41 Download the appropriate archive for your platform and extract it to a directory of your choice 42 (e.g. `${HOME}/rustls-ffi-built`). 43 44 Once downloaded, build `curl` using `--with-rustls` and the path to the extracted binaries. 45 46 % git clone https://github.com/curl/curl 47 % cd curl 48 % autoreconf -fi 49 % ./configure --with-rustls=${HOME}/rustls-ffi-built 50 % make 51 52 [releases page]: https://github.com/rustls/rustls-ffi/releases 53 54 ### Building rustls-ffi from source 55 56 Building `rustls-ffi` from source requires both a rust compiler, and the [cargo-c] cargo plugin. 57 58 To install a Rust compiler, use [rustup] or your package manager to install 59 the **1.73+** or newer toolchain. 60 61 To install `cargo-c`, use your [package manager][cargo-c pkg], download 62 [a pre-built archive][cargo-c prebuilt], or build it from source with `cargo install cargo-c`. 63 64 Next, check out, build, and install the appropriate version of `rustls-ffi` using `cargo`: 65 66 % git clone https://github.com/rustls/rustls-ffi -b v0.15.0 67 % cd rustls-ffi 68 % cargo capi install --release --prefix=${HOME}/rustls-ffi-built 69 70 Now configure and build `curl` using `--with-rustls`: 71 72 % git clone https://github.com/curl/curl 73 % cd curl 74 % autoreconf -fi 75 % ./configure --with-rustls=${HOME}/rustls-ffi-built 76 % make 77 78 See the [rustls-ffi README][cryptography provider] for more information on cryptography providers and 79 their build/platform requirements. 80 81 [cargo-c]: https://github.com/lu-zero/cargo-c 82 [rustup]: https://rustup.rs/ 83 [cargo-c pkg]: https://github.com/lu-zero/cargo-c?tab=readme-ov-file#availability 84 [cargo-c prebuilt]: https://github.com/lu-zero/cargo-c/releases 85 [cryptography provider]: https://github.com/cpu/rustls-ffi?tab=readme-ov-file#cryptography-provider